Class BaseRenderSettings

  • All Implemented Interfaces:
    com.google.gwt.user.client.rpc.IsSerializable, RenderSettings

    public class BaseRenderSettings
    extends AbstractListenableRenderSettings
    Encapsulates the rendering configuration for the whole document.

    Provides PageRenderSettings to override rendering configuration for specific pages.

    • Constructor Detail

      • BaseRenderSettings

        public BaseRenderSettings()
    • Method Detail

      • setDocumentLayerEnabled

        public void setDocumentLayerEnabled​(DocumentLayer layer,
                                            boolean value)
        Sets a flag whether document layer of given class should be rendered or not.
        Parameters:
        layer - Document layer.
        value - Flag
      • isDocumentLayerEnabled

        public boolean isDocumentLayerEnabled​(DocumentLayer layer)
        Returns whether the given layer will be rendered (true if to be rendered, false if not enabled).
        Parameters:
        layer - The document layer to check the enabling state for.
        Returns:
        Indicator whether the layer class should be rendered or not.
      • getOrderedAndActiveLayers

        public List<DocumentLayer> getOrderedAndActiveLayers​(Collection<DocumentLayer> candidateLayers)
        Returns a collection of candidate layers in an ordering suitable for rendering. This entails
        Parameters:
        candidateLayers - The layers to check whether they are active and to return in their predefined order.
        Returns:
        Collection of filtered and ordered layers. It is not guaranteed, that the given candidateLayers collection is changed by this method, but it is also not assured that the returned collection is the same instance as the candidateLayers collection.
      • getZoomFactor

        public float getZoomFactor()
      • setDeviceResolution

        public void setDeviceResolution​(Integer resolution)
        Sets the device deviceResolution.
        Parameters:
        resolution - the deviceResolution to be configured.
      • getDeviceResolution

        public int getDeviceResolution()
        Returns the currently configured device resolution.
        Returns:
        the device resolution that is currently used.
      • setZoom

        public void setZoom​(float zoom)
      • calcBounds

        public Dimension calcBounds​(Page page)
        Calculates the Dimensions of the Page included the Zoomlevel and Rotation
        Parameters:
        page - Page to calc the Bounds
        Returns:
        the Dimensions to draw
      • calcDeviceBounds

        public Dimension calcDeviceBounds​(Page page)
        Calculates the Dimensions of the Page included the Zoomlevel and Rotation and the device ratio
        Parameters:
        page - Page to calc the Bounds
        Returns:
        the Dimensions to draw
      • calcBounds

        public Dimension calcBounds​(int pageWidth,
                                    int pageHeight)
        Calculates the Dimensions of the Page included the Zoomlevel and Rotation
        Parameters:
        pageWidth - real PageWidth
        pageHeight - real PageHeight
        Returns:
        the Dimensions to draw
      • baseToDevice

        public int baseToDevice​(int value)
        Utility method: convert base units to device units and apply zoom factor
        Parameters:
        value - value in base units
        Returns:
        value in device units, zoomed
      • baseToDevice

        public double baseToDevice​(double value)
        Utility method: convert base units to device units and apply zoom factor
        Parameters:
        value - value in base units
        Returns:
        value in device units, zoomed
      • deviceToBase

        public int deviceToBase​(int value)
        Utility method: convert device units to base units and unapply zoom factor
        Parameters:
        value - value in device units
        Returns:
        value in base units, de-zoomed
      • deviceToBase

        public double deviceToBase​(double value)
        Utility method: convert device units to base units and unapply zoom factor
        Parameters:
        value - value in device units
        Returns:
        value in base units, de-zoomed
      • update

        public void update​(String propertyName,
                           RenderSettings other,
                           Object... details)
        Overwrites the current render settings with the given one.
        Parameters:
        propertyName - the name of the property to update. Update supported properties have unique property identifier provided by the specific render settings implementation.
        other - the processing setting which provide the new property value. Therefore the other processing setting have to be of the same type as this instance.
        details - (optional) if some describing details are necessary to do a specific update, the details parameter will transport this information
      • getAffineTransform

        public AffineTransform getAffineTransform()
        Gets the affine transform for this render context, useful for converting from document to device space. Considers zoom factor and rotation. If the transform encompasses a rotational component, the rotation will use the origin as its center. Therefore the target bounding box may occupy any quadrant of the target coordinate system, unless further transformation is applied to the transform returned by this method. WARN: Does not work with rotation!
        Returns:
        AffineTransform
      • getAffineTransform

        public AffineTransform getAffineTransform​(Dimension2D srcSize)
        Gets the affine transform for this render setting, useful for converting from document to device space. Considers zoom factor and rotation. If the transform encompasses a rotational component, the rotation will use an origin calculated from the given source size, so that the result of the rendering lies within the first quadrant (in screen coordinates, i.e. 0/0 at the top/left).
        Parameters:
        srcSize - the size of the object to be rendered in source (document) coordinates.
        Returns:
        AffineTransform
      • getInverseTransform

        public AffineTransform getInverseTransform​(Dimension2D pageSize)
        Gets the inverse affine transform for this render context, useful for converting from device to document space. Considers zoom factor and rotation.
        Parameters:
        pageSize - the pages size in base units
        Returns:
        AffineTransform
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • convertToKey

        public String convertToKey()
        Converts the fields of this class to a String key that can be used to cache tiles in the client side TileCache.
        Returns:
        the key
      • getLayers

        public Set<DocumentLayer> getLayers()
        only for serialization
        Returns:
        the layers
      • getDefaultLayerStateEnabled

        public Boolean getDefaultLayerStateEnabled()
        only for serialization
        Returns:
        whether the default layer state is enabled or not
      • setDefaultLayerStateEnabled

        public void setDefaultLayerStateEnabled​(Boolean defaultLayerStateEnabled)
        only for serialization
        Parameters:
        defaultLayerStateEnabled - whether the default layer state is enabled or not