Class TLfnGXYVectorLayer

java.lang.Object
com.luciad.view.TLcdLayer
com.luciad.view.gxy.TLcdGXYLayer
com.luciad.fusion.client.view.gxy.TLfnGXYVectorLayer
All Implemented Interfaces:
ILcdPropertyChangeSource, ILcdSelection<Object>, ILcdGXYEditableLabelsLayer, ILcdGXYLayer, ILcdLayer, Serializable

public class TLfnGXYVectorLayer extends TLcdGXYLayer
Deprecated.
Since 2017.0 support for coverages of type VECTOR has been superseded with other mechanisms. Please refer to the Fusion migration guide for more information.

An ILcdGXYLayer for the visualization of LuciadFusion vector data in a 2D view.

A layer, ready to be added to the view, can be created as follows;


   ILcdModel model = ...;
   ILcdGXYLayer layer = new TLfnGXYVectorLayer( model, "MyLabel" );
 

The above snippet creates a layer with default visualization setting. If you want to customize this visualization, it is important to understand how the default visualization works, and what hooks are provided to customize this. This is explained in the next sections.

Default visualization

The layer is configured with default painters and label painters. These default painters and label painters will ensure that:

  • The SLD styling is respected when it is available on the coverage (see ALfnCoverageMetadata.getFeatureTypeStyles()).
  • GeoSym styling is used for VPF data, if the Defense Standards component is available (i.e., if it is defined in the license and if the corresponding Java library is found in the classpath). If not available, it will fallback to default styling instead.
  • Default colors and styles are used in other cases.
  • When filters are defined on the coverage, they will be respected by this layer. This means domain objects will only remain visible until the scale is reached for which the filter which accepts that domain object is defined. The domain object will then remain visible when zooming in further.
  • Anti-aliasing is used.

Customize the visualization

It is perfectly possible to customize the visualization of the data on the client side by using the available API of this layer. However, if the custom visualization can be defined in SLD, it is highly recommended to fuse your vector data using an SLD file containing all the styling information. This SLD information will be picked up by this layer automatically. Consult the javadoc of TLfnVectorCoverageMetadata for more information.

To customize the visualization, you can

Working with Fusion vector domain objects

Fusion vector domain objects implement ILcdDataObject and ILcdShapeList. While you can safely access all the ILcdDataObject methods, you should take care when using the ILcdShapeList API. Fusion vector features often have multiple geospatial representations: a same feature may for example be represented by a point at world-scale and a polygon at a more detailed zoom level. The ILcdShapeList interface of these features only provide access to the geometry of the feature at the most detailed level. This most detailed level geometry is typically not loaded yet, and must be retrieved on-demand when you access the ILcdShapeList API.

If you need access to the geometry of a LuciadFusion domain object (for example when writing an ILcdGXYLabelingPathProvider) you must make sure you use the geometry associated with the tiles loaded for the level and bounds associated with the view. This geometry is obtained by calling the getTiledGeometry(Object) method. Failing to do this will load the original untiled geometry, which will have to be retrieved at that moment and may be very costly.

No extra steps need to be taken for painters, label painters and label editors set on this layer. Those will automatically be decorated such that they receive the geometry associated with the tiles loaded for level and bounds associated with the view.

Consult the javadoc of the getTiledGeometry(Object) method for more information about the kind of geometries that will be returned.

Since:
11.0
See Also:
  • Constructor Details

    • TLfnGXYVectorLayer

      public TLfnGXYVectorLayer(ILcdModel aModel, String aLabel)
      Deprecated.

      Creates a new GXY layer for fusion vector data with default styling.

      This method delegates to TLfnGXYVectorLayer(com.luciad.model.ILcdModel, String, ILfnVectorGXYStyleProviderFactory...) with an empty array of ILfnVectorGXYStyleProviderFactory instances. The styling for a layer created with this constructor follows the same rules as explained there.

      Parameters:
      aModel - The model
      aLabel - The label
      See Also:
    • TLfnGXYVectorLayer

      public TLfnGXYVectorLayer(ILcdModel aModel, String aLabel, ILfnVectorGXYStyleProviderFactory... aStyleProviderFactories)
      Deprecated.

      Creates a new GXY layer for fusion vector data.

      The default styling of the layer is done using the following rules:

      1. When the vector coverage for which this layer is created contains SLD style information, this style information will be used for the visualization.
      2. When the vector coverage for which this layer is created contains VPF data, the default styling is GeoSym.
      3. When no SLD info is available and the coverage does not contain VPF data, the aStyleProviderFactories will be asked to create a style provider. The first style provider which can be created will be used.
      4. If none of the ILfnVectorGXYStyleProviderFactory instances passed to this constructor can create a style provider, a default style will be used.

      By default, a label painter will be set when the datamodel contains string properties.

      If you want to have more control over the styling, you can replace the (label) painter provider instances by calling the corresponding setter on this layer.

      Parameters:
      aModel - The model
      aLabel - The label
      aStyleProviderFactories - The style provider factories.
  • Method Details

    • setUseCoverageScalesAsLevelScales

      public void setUseCoverageScalesAsLevelScales(boolean aUseCoverageScalesAsLevelScales)
      Deprecated.
      It is recommended to fuse the data using SLD for filtering, and rely on the styling information in SLD for visualization. Doing this will ensure that all features appear at the scales exactly as defined in the SLD, both in GXY as in Lightspeed.
      Configures whether to use the scales from the coverage metadata as level scales. If true the coverage metadata scales will be used to choose the right level for a given precision. The scale at index i will be used as the minimum scale for displaying level i in the tile pyramid. If false, the layer will use its own logic to determine the most appropriate level.

      The default value is false.

      Parameters:
      aUseCoverageScalesAsLevelScales - boolean indicating whether to use the coverage metadata scales as level scales.
    • isUseCoverageScalesAsLevelScales

      public boolean isUseCoverageScalesAsLevelScales()
      Deprecated.
      It is recommended to fuse the data using SLD for filtering, and rely on the styling information in SLD for visualization. Doing this will ensure that all features appear at the scales exactly as defined in the SLD, both in GXY as in Lightspeed.
      Returns whether to use the scales from the coverage metadata as level scales.
      Returns:
      true if the coverage metadata scales are used as level scales, false otherwise.
    • setModel

      public void setModel(ILcdModel aModel)
      Deprecated.
      Description copied from class: TLcdLayer
      Sets the ILcdModel to this ILcdLayer.
      Overrides:
      setModel in class TLcdGXYLayer
      Parameters:
      aModel - the model that contains the objects that should be displayed in this layer.
    • getTiledGeometry

      public Object getTiledGeometry(Object aObject)
      Deprecated.

      Extract the geometry associated with the element at the current level for the tiles that are currently available.

      Returned shapes

      An ILcdShapeList containing a shape for each visible element of the feature: The top-level object will also implement ILcdDataObject.

      Restrictions

      • It is possible that you only get a part of the original geometry: if not all tiles geometry were visible, or if some tiles have not yet been loaded.
      • It is possible that the geometry is presented in separate parts, e.g. if a tile in the middle is not yet loaded.
      • Parts of adjacent tiles will always be merged together into one part.
      • It is possible that extra points will be present that were not present in the original geometry. These points are interpolated points and will not be visible.
      Parameters:
      aObject - A domain object as received from an applyOnInteract(com.luciad.util.ILcdFunction, java.awt.Rectangle, boolean, com.luciad.view.gxy.ILcdGXYView) call.
      Returns:
      An object that contains the available tiled geometry.
    • isAsynchronousTileRequestAllowed

      public boolean isAsynchronousTileRequestAllowed()
      Deprecated.
      Returns whether the tiles can be requested asynchronously. When allowed, tiles may be requested asynchronously to improve performance but this is not guaranteed. When not allowed, it is guaranteed that no tiles will be requested asynchronously. This can result in lower performance but guarantees that all visible data is painted.
      Returns:
      true if the tiles can be requested asynchronously, false otherwise
    • setAsynchronousTileRequestAllowed

      public void setAsynchronousTileRequestAllowed(boolean aAsynchronousTileRequestAllowed)
      Deprecated.
      Sets whether the tiles can be requested asynchronously.
      Parameters:
      aAsynchronousTileRequestAllowed - whether the tiles can be requested asynchronously
      See Also:
    • isRepaintViewWhenTileAvailable

      public boolean isRepaintViewWhenTileAvailable()
      Deprecated.
      Indicates if the view is repainted when a tile becomes available.
      Returns:
      whether the view is repainted when a tile becomes available
    • setRepaintViewWhenTileAvailable

      public void setRepaintViewWhenTileAvailable(boolean aRepaintViewWhenTileAvailable)
      Deprecated.
      Sets whether the view is repainted when a tile becomes available.
      Parameters:
      aRepaintViewWhenTileAvailable - whether the view should repainted when a tile becomes available
    • getBounds

      public ILcdBounds getBounds(int aMode, ILcdGXYView aGXYView) throws TLcdNoBoundsException
      Deprecated.
      Description copied from class: TLcdGXYLayer
      Returns the view bounds of this ILcdGXYLayer content, the bounds of all the drawings (for the supplied mode) that represent the Objects contained in the ILcdModel of this ILcdGXYLayer. For this operation, this ILcdGXYLayer is to be considered as part of aGXYView.

      Outside of the layers bounds no interaction with any object of the layer via its representation is possible. Note that these bounds do not necessarily encompass the representation of all objects in the model, only the objects for which there is a representation in the view.

      Specified by:
      getBounds in interface ILcdGXYLayer
      Overrides:
      getBounds in class TLcdGXYLayer
      Parameters:
      aMode - a bitwise combination of ALL or SELECTION and one or more of BODIES and HANDLES. The ILcdGXYLayer.LABELS mode is not supported.
      aGXYView - the view in which the layer could be placed. This enables taking into account the views settings, for example the scale.
      Returns:
      a bounds (in view coordinates, pixels) that encompasses the representation of all objects that are rendered in a view.
      Throws:
      TLcdNoBoundsException - if the layer doesn't have any valid bounds, for example when none of the elements have a representation for the views current settings.
    • applyOnInteract

      public int applyOnInteract(ILcdFunction aFunction, Rectangle aBounds, boolean aStrictInteract, ILcdGXYView aGXYView)
      Deprecated.
      Description copied from class: TLcdGXYLayer
      Applies the function to (at the least) all objects that are contained (partially or completely) in the bounds of the view.

      The function shall be applied successively to all objects in the bounds as long as the function returns true for an object. This allows developers to indicate a stop condition. Note that the order in which the objects are passed to the function is not specified.

      When strict interaction is required, only objects whose representation lies within the given bounds, completely or partially, are candidates to be passed to the function. An object whose representation does not interact with the bounds should not be passed to the function. Applying non strict interaction can be useful to avoid heavy computations to determine whether an objects representation lies within the bounds.

      This method behaves similar to the paint method, and as such is allowed to omit small or invisible objects for performance reasons.

      Objects smaller than the set minimum object size may be omitted.

      Specified by:
      applyOnInteract in interface ILcdGXYLayer
      Overrides:
      applyOnInteract in class TLcdGXYLayer
      Parameters:
      aFunction - the function to apply. When the function returns false, no more objects should be passed to the function.
      aBounds - all objects who lie partially or completely in this area in the view are candidates to be passed to the function.
      aStrictInteract - if true, the ILcdFunction shall be applied only to the objects interacting with the given bounds. When false is passed, other objects may be taken into account too. When applying the function to an object consumes less time than checking whether an objects representation interacts with the bounds, non-strict interaction is generally faster.
      aGXYView - the view in whose bounds the objects representations should be in order to be passed to the function.
      Returns:
      the number of objects the function was applied on.
    • paint

      public void paint(Graphics aGraphics, int aMode, ILcdGXYView aGXYView)
      Deprecated.
      Description copied from class: TLcdGXYLayer
      Paints the combined representation of the layer's objects for a view, taking into account the mode.

      The mode indicates what objects of the model should be taken into account and what representation should be provided. The objects to be taken into account shall be one of:

      • ALL: all the objects in the layer's model, or
      • SELECTION: all the objects in the layer's selection.

      Note that the combined representation may contain less than the representation of all objects that were taken into account, as some objects may be disregarded for various reasons (filters, scale, ... ). When the views scale is outside the scale range (BODIES or HANDLES mode) or the label scale range (LABELS mode) nothing shall be painted.

      The representations provided shall be one or more of:

      • BODIES: the combination of geometric representations of the objects,
      • HANDLES: the handles for the objects. These are the parts of the objects representation on which user interaction can be applied. For example, for a circle this can be the center point, allowing to move the circle.
      • LABELS: the combination of the textual representations of the objects.

      The mode supplied shall be a bitwise or combination of a constant of the first group and one or more of the second group. When painting in BODIES or HANDLES mode, painting of an object shall be delegated to the painter for that object, when the LABELS mode is passed, painting shall be delegated to the labelpainter for that object.

      The view is passed to provide contextual information: some of the objects may have a different representation depending on the view, or depending on a property of the view, for example, the scale of the view.

      The combined representation of the objects has to be painted on the Graphics supplied, as these may be different from the Graphics provided by the view (due to double buffering, for example).

      When stopPainting is called, the current painting operation should be aborted.

      If this layer is asked to paint its labels, it must inform its ALcdLabelLocations instance as to which labels have been painted and which haven't been.

      The paint mode may contain ILcdGXYEditableLabelsLayer.PLACED_LABELS. This is a paint mode to indicate that only labels that are already placed should be painted. The already placed labels can be retrieved from the ALcdLabelLocations retrieved using ILcdGXYEditableLabelsLayer.getLabelLocations().

      This implementation calls paintFromOverlaps or paintFromModel, depending on whether TLcdGXYLayer.isPaintFromOverlaps() returns true or false.

      This method also calls TLcdGXYLayer.applyOnInteract(com.luciad.util.ILcdFunction, java.awt.Graphics, int, ILcdGXYView) and TLcdGXYLayer.applyOnInteractLabels(com.luciad.util.ILcdFunction, java.awt.Graphics, int, ILcdGXYView) to determine which objects or labels should be painted. Customizing these methods will also customize the painting behavior.

      Objects smaller than the set minimum object size may be omitted.

      Specified by:
      paint in interface ILcdGXYEditableLabelsLayer
      Specified by:
      paint in interface ILcdGXYLayer
      Overrides:
      paint in class TLcdGXYLayer
      Parameters:
      aGraphics - the Graphics to paint on.
      aMode - indicates what should be painted and how it should be painted.
      aGXYView - the view to paint for.
      See Also:
    • applyOnInteract

      public int applyOnInteract(ILcdFunction aFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView)
      Deprecated.
      Description copied from interface: ILcdGXYEditableLabelsLayer
      Applies the function to (at the least) all objects that are contained (partially or completely) in the bounds of the view. This method behaves similar to the paint method, and as such is allowed to omit small or invisible objects for performance reasons. For example, it can disregard objects that are outside the scale range.

      The function shall be applied successively to all objects in the bounds as long as the function returns true for an object. This allows developers to indicate a stop condition. Note that the order in which the objects are passed to the function is not specified.

      The mode indicates what objects of the model should be taken into account. The objects to be taken into account shall be one of:

      • ALL: all the objects in the layer's model, or
      • SELECTION: all the objects in the layer's selection.

      The representations provided shall be a combination of one or more of:

      • BODIES: the combination of geometric representations of the objects,
      • HANDLES: the handles for the objects,
      • LABELS: the combination of the textual representations of the objects.

      The mode supplied shall be a bitwise 'or' combination of a constant of the first group and a combination of constants of the second group.

      Specified by:
      applyOnInteract in interface ILcdGXYEditableLabelsLayer
      Overrides:
      applyOnInteract in class TLcdGXYLayer
      Parameters:
      aFunction - the function to apply. When the function returns false, no more objects should be passed to the function.
      aGraphics - the graphics
      aPaintMode - the paint mode.
      aGXYView - the view in whose bounds the objects representations should be in order to be passed to the function. Note that for efficiency reasons (e.g. to avoid expensive bounds calculations) objects may be passed that are not inside the view bounds.
      Returns:
      the number of objects the function was applied on.
    • applyOnInteractLabels

      public int applyOnInteractLabels(ILcdFunction aLabelFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView)
      Deprecated.
      Description copied from interface: ILcdGXYEditableLabelsLayer
      Applies the function to (at the least) all labels that are contained (partially or completely) in the bounds of the view. This method behaves similar to the paint method, and as such is allowed to omit labels for small or invisible objects for performance reasons. For example, it can disregard labels for objects outside the scale range, or labels outside the label scale range.

      The function shall be applied successively to all labels in the bounds as long as the function returns true for a label. This allows developers to indicate a stop condition. Note that the order in which the labels are passed to the function is not specified.

      The mode indicates what labels should be taken into account. The labels to be taken into account shall be one of:

      • ALL: all the labels in the layer's model, or
      • SELECTION: all the labels in the layer's selection.

      The representations provided shall be a combination of one or more of:

      • BODIES: the combination of label representations of the objects,
      • HANDLES: the handles for the labeled objects,
      • LABELS: the combination of the textual labels representations of the objects.

      The mode supplied shall be a bitwise 'or' combination of a constant of the first group and a combination of constants of the second group.

      Specified by:
      applyOnInteractLabels in interface ILcdGXYEditableLabelsLayer
      Overrides:
      applyOnInteractLabels in class TLcdGXYLayer
      Parameters:
      aLabelFunction - the function to apply. When the function returns false, no more labels should be passed to the function. The Object passed to this function is always a TLcdLabelIdentifier.
      aGraphics - the graphics
      aPaintMode - the paint mode.
      aGXYView - the view in whose bounds the objects representations should be in order passed to the function. Note that for efficiency reasons (e.g. to avoid expensive bounds calculations) objects may be passed that are not inside the view bounds.
      Returns:
      the number of objects the function was applied on.
    • applyOnInteract

      protected int applyOnInteract(ILcdFunction aFunction, Graphics aGraphics, int aPaintMode, ILcdModel aModel, ILcdGXYView aGXYView)
      Deprecated.
      Description copied from class: TLcdGXYLayer
      Applies the function to (at the least) all objects from the given model that are contained (partially or completely) in the bounds of the view. This method behaves similar to the paint method, and as such is allowed to omit small or invisible objects for performance reasons. For example, it can disregard objects that are outside the scale range.

      For more information on this method, see the javadoc of applyOnInteract.

      This method is called by

      So it is possible to customise these methods by overriding this method. This can be used to e.g. customize the model content for painting of customise the model content for label placement.
      Overrides:
      applyOnInteract in class TLcdGXYLayer
      Parameters:
      aFunction - the function to apply. When the function returns false, no more objects should be passed to the function.
      aGraphics - the graphics
      aPaintMode - the paint mode.
      aModel - the model for whose objects the given function is applied.
      aGXYView - the view in whose bounds the objects representations should be in order to be passed to the function. Note that for efficiency reasons (e.g. to avoid expensive bounds calculations) objects may be passed that are not inside the view bounds.
      Returns:
      the number of objects the function was applied on.
    • setGXYEditorProvider

      public void setGXYEditorProvider(ILcdGXYEditorProvider aGXYEditorProvider)
      Deprecated.
      Sets an ILcdGXYEditorProvider to this TLcdGXYLayer. This allows an eternal entity (for example, an ILcdGXYController to edit the domain objects of this layer by retrieving an editor for it. Editing of objects in the model through the layer is only possible for objects for which the editor provider returns an ILcdGXYEditor. By default the editor provider is null and no editing is possible.

      Note that no property change listeners can be added to the editor provider, so the layer is not automatically notified when a property on the editor provider has changed. To notify the layer and its listeners, a property change event has to be fired, using the method TLcdLayer.firePropertyChangeEvent(java.beans.PropertyChangeEvent).

      Warning: editing fusion vector data is not supported. Calling this method will throw an exception.

      Overrides:
      setGXYEditorProvider in class TLcdGXYLayer
      Parameters:
      aGXYEditorProvider - the new editor provider
      See Also:
    • setGXYPainterProvider

      public void setGXYPainterProvider(ILcdGXYPainterProvider aGXYPainterProvider)
      Deprecated.
      Sets an ILcdGXYPainterProvider to this TLcdGXYLayer. During painting, the provider will be queried to return a painter for the relevant domain objects. If no painter provider is set to this layer, nothing will be rendered.

      This call overwrites the painter provider array with a new one containing the given provider.

      Note that no property change listeners can be added to the painter provider, so the layer is not automatically notified when a property on the painter provider has changed. To notify the layer and its listeners, a property change event has to be fired, using the method TLcdLayer.firePropertyChangeEvent(java.beans.PropertyChangeEvent).

      aGXYPainterProvider will be decorated to ensure that it receives the geometry associated with the tiles loaded for level and bounds associated with the view. Consult getTiledGeometry(Object) for more information.

      Warning: calling this method will replace the default styling. As a result, the ILfnVectorGXYStyleProviderFactory instances passed in the constructor will no longer be used.

      Overrides:
      setGXYPainterProvider in class TLcdGXYLayer
      Parameters:
      aGXYPainterProvider - the new painter provider
      See Also:
    • setGXYPainterProviderArray

      public void setGXYPainterProviderArray(ILcdGXYPainterProvider[] aGXYPainterProviderArray)
      Deprecated.
      Like, TLcdGXYLayer.setGXYPainterProvider(com.luciad.view.gxy.ILcdGXYPainterProvider), but sets an array of ILcdGXYPainterProvider to this TLcdGXYLayer. Painting is done for each of the providers (in the order of the array), each time for the whole set of elements. This can be useful to perform multiple painting passes.

      All the painter providers in aGXYPainterProviderArray will be decorated to ensure that they receive the geometry associated with the tiles loaded for level and bounds associated with the view. Consult getTiledGeometry(Object) for more information.

      Warning: calling this method will replace the default styling. As a result, the ILfnVectorGXYStyleProviderFactory instances passed in the constructor will no longer be used.

      Overrides:
      setGXYPainterProviderArray in class TLcdGXYLayer
      Parameters:
      aGXYPainterProviderArray - a sequence of painter providers
      See Also:
    • setGXYLabelPainterProvider

      public void setGXYLabelPainterProvider(ILcdGXYLabelPainterProvider aGXYLabelPainterProvider)
      Deprecated.
      Sets an ILcdGXYLabelPainterProvider to this TLcdGXYLayer. During painting, the provider will be queried to return a label painter for the relevant domain objects. If no label painter provider is set to this layer, no labels will be rendered.

      Note that no property change listeners can be added to the label painter provider, so the layer is not automatically notified when a property on the label painter provider has changed. To notify the layer and its listeners, a property change event has to be fired, using the method TLcdLayer.firePropertyChangeEvent(java.beans.PropertyChangeEvent).

      aGXYLabelPainterProvider will be decorated to ensure that it receives the geometry associated with the tiles loaded for level and bounds associated with the view. Consult getTiledGeometry(Object) for more information.

      Overrides:
      setGXYLabelPainterProvider in class TLcdGXYLayer
      Parameters:
      aGXYLabelPainterProvider - the new label painter provider
      See Also:
    • setGXYLabelEditorProvider

      public void setGXYLabelEditorProvider(ILcdGXYLabelEditorProvider aGXYLabelEditorProvider)
      Deprecated.
      Sets an ILcdGXYLabelEditorProvider to this TLcdGXYLayer. This allows an eternal entity (for example, an ILcdGXYController to edit the labels of domain objects of this layer by retrieving a label editor for it. If no label editor provider is set, no labels can be edited for any object in the model. The default value is null.

      Note that no property change listeners can be added to the label editor provider, so the layer is not automatically notified when a property on the label editor provider has changed. To notify the layer and its listeners, a property change event has to be fired, using the method TLcdLayer.firePropertyChangeEvent(java.beans.PropertyChangeEvent).

      aGXYLabelEditorProvider will be decorated to ensure that it receives the geometry associated with the tiles loaded for level and bounds associated with the view. Consult getTiledGeometry(Object) for more information.

      Overrides:
      setGXYLabelEditorProvider in class TLcdGXYLayer
      Parameters:
      aGXYLabelEditorProvider - the new label editor provider
      See Also: