com.levigo.jadice.document.render
Class BaseRenderSettings

java.lang.Object
  extended by com.levigo.jadice.document.render.AbstractListenableRenderSettings
      extended by com.levigo.jadice.document.render.BaseRenderSettings
All Implemented Interfaces:
ProcessingSettings, RenderSettings, Serializable

public class BaseRenderSettings
extends AbstractListenableRenderSettings

The BaseRenderSettings, as their name implies, control the most fundamental properties of a rendering. in particular, they include geometry, layering and clipping.

See Also:
Serialized Form

Nested Class Summary
static class BaseRenderSettings.Clipping
          An enumeration describing what kind of clipping is applied before rendering a part of the model (which usually starts at the page level).
static class BaseRenderSettings.Rotation
          An enumeration of type safe rotation values.
 
Field Summary
static String ALL_LAYERS_ENABLED
          Identifier key for all-layer enabled state change, used within a RenderSettingsEvent to recognize the kind of change which happen.
static String CLIPPING
          Identifier key for a clipping type change.
static String DEVICE_RESOLUTION
          Identifier key for a change of the device resolution, used within a RenderSettingsEvent to recognize the kind of change which happen.
static String LAYER_ENABLED
          Identifier key for a layer enabled state change, used within a RenderSettingsEvent to recognize the kind of change which happen.
static String ROTATION
          Identifier key for a rotation change, used within a RenderSettingsEvent to recognize the kind of change which happen.
static String ZOOM
          Identifier key for a zoom change, used within a RenderSettingsEvent to recognize the kind of change which happen.
 
Constructor Summary
BaseRenderSettings()
           
 
Method Summary
 double baseToDevice(double value)
          Utility method: convert base units to device units and apply zoom factor
 int baseToDevice(int value)
          Utility method: convert base units to device units and apply zoom factor
 BaseRenderSettings createSnapshot()
          Creates and returns a snapshot copy of this settings instance.
 double deviceToBase(double value)
          Utility method: convert device units to base units and unapply zoom factor
 int deviceToBase(int value)
          Utility method: convert device units to base units and unapply zoom factor
 void disableAllLayers()
          Disables the rendering of all standard layers provided by the DocumentLayer class and explicit enabled layers (defined by a call of setDocumentLayerEnabled(DocumentLayer, boolean) with a true boolean parameter).
 void enableAllLayers()
          Enables the rendering of all standard layers provided by the DocumentLayer class and explicit disabled layers (defined by a call of setDocumentLayerEnabled(DocumentLayer, boolean) with a false boolean parameter).
 boolean equals(Object obj)
           
 AffineTransform getAffineTransform()
          Gets the affine transform for this render context, useful for converting from document to device space.
 AffineTransform getAffineTransform(Dimension2D srcSize)
          Gets the affine transform for this render setting, useful for converting from document to device space.
 BaseRenderSettings.Clipping getClipping()
          Return the clipping type.
 int getDeviceResolution()
          Gets the device resolution.
 AffineTransform getInverseTransform(Dimension2D pageSize)
          Gets the inverse affine transform for this render context, useful for converting from device to document space.
 List<DocumentLayer> getOrderedAndActiveLayers(Collection<DocumentLayer> candidateLayers)
          Returns a collection of candidate layers in an ordering suitable for rendering.
 BaseRenderSettings.Rotation getRotation()
          Gets the rotation angle.
 float getZoom()
          Gets the zoom factor.
 int getZoomFactor()
          Deprecated. Please consider using the getZoom() method instead. Note though, that you will need to multiply its return value by 100 in order to obtain a percent value. This method has been deprecated, because the integer-granularity may introduce rounding-errors which may be unacceptable in certain situations.
 int hashCode()
           
 boolean isDocumentLayerEnabled(DocumentLayer layer)
          Returns whether layer class should be rendered or not.
 void setClipping(BaseRenderSettings.Clipping clipping)
          Set the clipping type.
 void setDeviceResolution(int deviceResolution)
          Sets the device resolution.
 void setDocumentLayerEnabled(DocumentLayer layer, boolean value)
          Sets a flag whether document layer of given class should be rendered or not.
 void setRotation(BaseRenderSettings.Rotation r)
          Sets the rotation angle.
 void setZoom(float zoomFactor)
          Sets the zoom factor.
 void setZoomFactor(int zoomFactor)
          Deprecated. Please consider using the setZoom(float) method instead. Note though, that you will need to divide your argument value by 100. This method has been deprecated, because the integer-granularity may introduce rounding-errors which may be unacceptable in certain situations.
 void update(String propertyName, RenderSettings other, Object... details)
          Updates this instance property specified by given property name with the value provided by the other processing setting.
 
Methods inherited from class com.levigo.jadice.document.render.AbstractListenableRenderSettings
fireChanged, getSettingsChangeHandler, setSettingsChangeHandler
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAYER_ENABLED

public static final String LAYER_ENABLED
Identifier key for a layer enabled state change, used within a RenderSettingsEvent to recognize the kind of change which happen.

See Also:
setDocumentLayerEnabled(DocumentLayer, boolean), isDocumentLayerEnabled(DocumentLayer), Constant Field Values

ALL_LAYERS_ENABLED

public static final String ALL_LAYERS_ENABLED
Identifier key for all-layer enabled state change, used within a RenderSettingsEvent to recognize the kind of change which happen.

See Also:
Constant Field Values

ROTATION

public static final String ROTATION
Identifier key for a rotation change, used within a RenderSettingsEvent to recognize the kind of change which happen.

See Also:
setRotation(Rotation), getRotation(), Constant Field Values

ZOOM

public static final String ZOOM
Identifier key for a zoom change, used within a RenderSettingsEvent to recognize the kind of change which happen.

See Also:
setZoom(float), getZoom(), Constant Field Values

CLIPPING

public static final String CLIPPING
Identifier key for a clipping type change.

See Also:
setClipping(Clipping), getClipping(), Constant Field Values

DEVICE_RESOLUTION

public static final String DEVICE_RESOLUTION
Identifier key for a change of the device resolution, used within a RenderSettingsEvent to recognize the kind of change which happen.

See Also:
Constant Field Values
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

enableAllLayers

public void enableAllLayers()
Enables the rendering of all standard layers provided by the DocumentLayer class and explicit disabled layers (defined by a call of setDocumentLayerEnabled(DocumentLayer, boolean) with a false boolean parameter).

Standard layers provided by the DocumentLayer class are:

Other customized layers, will not be enabled by a call of this method. To enable customized layers the usage of setDocumentLayerEnabled(DocumentLayer, boolean) is advised.


disableAllLayers

public void disableAllLayers()
Disables the rendering of all standard layers provided by the DocumentLayer class and explicit enabled layers (defined by a call of setDocumentLayerEnabled(DocumentLayer, boolean) with a true boolean parameter).

Standard layers provided by the DocumentLayer class are:

Other customized layers, will not be disabled by a call of this method. To disable customized layers the usage of setDocumentLayerEnabled(DocumentLayer, boolean) is advised.


isDocumentLayerEnabled

public boolean isDocumentLayerEnabled(DocumentLayer layer)
Returns whether layer class should be rendered or not.

Parameters:
layer -
Returns:
indicator whether 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 -
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.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

createSnapshot

public BaseRenderSettings createSnapshot()
Creates and returns a snapshot copy of this settings instance.

Returns:
snapshot copy

getRotation

public BaseRenderSettings.Rotation getRotation()
Gets the rotation angle.

Returns:
Returns rotation See also BaseRenderSettings.Rotation

setRotation

public void setRotation(BaseRenderSettings.Rotation r)
Sets the rotation angle. Make sure that a valid rotation argument is passed.

Parameters:
r - The rotation angle to set See also BaseRenderSettings.Rotation

getZoomFactor

@Deprecated
public int getZoomFactor()
Deprecated. Please consider using the getZoom() method instead. Note though, that you will need to multiply its return value by 100 in order to obtain a percent value. This method has been deprecated, because the integer-granularity may introduce rounding-errors which may be unacceptable in certain situations.

Gets the zoomFactor in percent.

Returns:
Returns an integer representing the zoom factor in percent.

setZoomFactor

@Deprecated
public void setZoomFactor(int zoomFactor)
Deprecated. Please consider using the setZoom(float) method instead. Note though, that you will need to divide your argument value by 100. This method has been deprecated, because the integer-granularity may introduce rounding-errors which may be unacceptable in certain situations.

Sets the zoomFactor in percent.

Parameters:
zoomFactor - The zoomFactor to set

getZoom

public float getZoom()
Gets the zoom factor. In contrast to getZoomFactor(), this method returns an actual factor, i.e. a value of 1.0f corresponds a 1:1 rendering.

Returns:
Returns a float scaled so that 1.0f corresponds to a 1:1 rendering.

setZoom

public void setZoom(float zoomFactor)
Sets the zoom factor. In contrast to setZoomFactor(int), this method takes an actual factor, i.e. a value of 1.0f corresponds a 1:1 rendering.

Parameters:
zoomFactor - The zoomFactor to set

getDeviceResolution

public int getDeviceResolution()
Gets the device resolution.

Returns:
Returns a device resolution as int

setDeviceResolution

public void setDeviceResolution(int deviceResolution)
Sets the device resolution.

Parameters:
deviceResolution - The device resolution to set

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

getAffineTransform

public AffineTransform getAffineTransform()
Gets the affine transform for this render context, useful for converting from document to device space. Considers only the zoom factor, the 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

update

public void update(String propertyName,
                   RenderSettings other,
                   Object... details)
Description copied from interface: RenderSettings
Updates this instance property specified by given property name with the value provided by the other processing setting. For each update-supported property the render settings type have to provide a unique property name.

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 informations

getClipping

public BaseRenderSettings.Clipping getClipping()
Return the clipping type.

Returns:
the clipping type

setClipping

public void setClipping(BaseRenderSettings.Clipping clipping)
Set the clipping type.

Parameters:
clipping - the clipping type


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.