Interface Layer
-
- All Superinterfaces:
PropertySupport
- All Known Subinterfaces:
EditableLayer,GeoObjectLayer,HoverableLayer,MVThemeLayer,SelectableLayer,Tool
- All Known Implementing Classes:
AbstractDataSetLayer,BasicLayer,BasicTool,MapNavLayer,NFEAddFeatureElementTool,NFEAddFeatureTool,NFEBoxSelectionTool,NFEEditVertexTool,NFEFeatureElementSelectionTool,NFEFeatureLayerRenderer,NFEFeatureSelectionTool,NFEManipulableFeatureLayerRenderer,NFEManipulateTool,NFENetElementSelectionTool,NFENetworkRenderer,NFEPathRenderer,NFEProgressIndicatorLayer,NFERenderer,NFESelectionTool,NFETool,PointerLocationLayer,ProgressIndicatorLayer,ScaleBarLayer,SimpleBGLayer
public interface Layer extends PropertySupport
A Layer represents a graphics layer that handles the display of and interaction with a particular type of contents. Each layer is responsible for repainting itself and updating its content model as needed. It also listens for and handles various events. Layers are organized and draw in the painter's order. All layers are managed by a LayerManager.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROPERTY_NAMEstatic java.lang.StringPROPERTY_PROVIDERIDstatic java.lang.StringPROPERTY_SRIDstatic java.lang.StringPROPERTY_VISIBLE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadded(java.lang.Object source)The function called when the layer is added to either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)voidclear()Clears all contents of this layer.voidfromXMLElement(org.w3c.dom.Element element)Loads the content from an XML representationMapCanvasgetCanvas()Gets the map canvas that this layer is displayed on.java.awt.geom.Rectangle2DgetDataMBR()Gets the minimum bounding rectangle of all the data in this layer.java.awt.geom.Rectangle2DgetFullExtent()javax.swing.IcongetIcon()java.lang.StringgetName()Gets the name of the layer.java.lang.StringgetProviderID()Returns the provider IDintgetSRID()Gets the SRID of the Layer, 0 if it doesn't have an associated SRIDbooleanhandleEvent(java.util.EventObject evt)The main method that performs event handling for this tool.java.util.List<GeoObject>hitTest(int x, int y, int granularity)Performs a hit test for the given mouse location (x,y).java.util.List<GeoObject>hitTest(java.awt.geom.Rectangle2D box, int granularity)Performs a hit test for the given rectangle.booleanisVisible()Checks whether this layer is currently visible.voidmapRegionChanged(MapRegionEvent e)When the associated canvas's map region is changed, this method is called to notify the layer of the change.voidremoved(java.lang.Object source)The function called when the layer is removed from either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)longrender(java.awt.Graphics2D g)Renders the layer contents to the given Graphics.voidrepaint()Tells the layer to repaint itself immediately.voidsetCanvas(MapCanvas parent)Sets the map canvas on which this layer is displayed.voidsetName(java.lang.String name)Sets the name for this layer.voidsetProviderID(java.lang.String providerID)Sets the provider IDvoidsetSRID(int srid)Sets the SRID of the LayervoidsetVisible(boolean v)Sets the visibility of this layer.org.w3c.dom.ElementtoXMLElement()Returns an XML representation of the layervoidupdate(long elapsedTime)updates the contents data model or structure.-
Methods inherited from interface oracle.spatial.network.nfe.vis.maps.util.PropertySupport
addPropertyChangeListener, addPropertyChangeListener, getProperties, getProperty, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener, setProperty
-
-
-
-
Field Detail
-
PROPERTY_NAME
static final java.lang.String PROPERTY_NAME
- See Also:
- Constant Field Values
-
PROPERTY_VISIBLE
static final java.lang.String PROPERTY_VISIBLE
- See Also:
- Constant Field Values
-
PROPERTY_SRID
static final java.lang.String PROPERTY_SRID
- See Also:
- Constant Field Values
-
PROPERTY_PROVIDERID
static final java.lang.String PROPERTY_PROVIDERID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
Gets the name of the layer.- Returns:
- the name
-
setName
void setName(java.lang.String name)
Sets the name for this layer.- Parameters:
name- the name of the layer
-
isVisible
boolean isVisible()
Checks whether this layer is currently visible.- Returns:
-
setVisible
void setVisible(boolean v)
Sets the visibility of this layer.- Parameters:
v-
-
clear
void clear()
Clears all contents of this layer.
-
handleEvent
boolean handleEvent(java.util.EventObject evt)
The main method that performs event handling for this tool. Returns whether the event should be propagated to other layers down stream (further down the layer stack) after the event has been handled.- Parameters:
evt-
-
update
void update(long elapsedTime)
updates the contents data model or structure.- Parameters:
elapsedTime- The elapsed time since last update.
-
render
long render(java.awt.Graphics2D g)
Renders the layer contents to the given Graphics.- Parameters:
g- the graphics object- Returns:
- the rendering time in milliseconds.
-
hitTest
java.util.List<GeoObject> hitTest(int x, int y, int granularity)
Performs a hit test for the given mouse location (x,y). All the geo-objects that pass the hit test will be returned.- Parameters:
x- mouse location xy- mouse location y- Returns:
- a list of features that pass the hit test; if no feature passes the hit test, the list is empty.
-
hitTest
java.util.List<GeoObject> hitTest(java.awt.geom.Rectangle2D box, int granularity)
Performs a hit test for the given rectangle. All the geo-objects that are either inside or intersect the rectangle will be returned.- Parameters:
box- the test rectangle, in device coordinates- Returns:
- a list of features that pass the box hit test; if no feature passes the hit test, the list is empty.
-
setCanvas
void setCanvas(MapCanvas parent)
Sets the map canvas on which this layer is displayed.
-
getCanvas
MapCanvas getCanvas()
Gets the map canvas that this layer is displayed on.
-
mapRegionChanged
void mapRegionChanged(MapRegionEvent e)
When the associated canvas's map region is changed, this method is called to notify the layer of the change. Note that either a device window change (as a result of resizing the application window) or a data window change can cause this method to be invoked. Query the canvas' MapRegion object to get the changed values. Inside a mapRegionChanged() implementation, the layer typically needs to update its data contents accordingly.
-
repaint
void repaint()
Tells the layer to repaint itself immediately. Typically called when a layer's rendering uses a buffered image, and that image might be in an inconsistent state or should be updated.
-
getIcon
javax.swing.Icon getIcon()
-
getSRID
int getSRID()
Gets the SRID of the Layer, 0 if it doesn't have an associated SRID- Returns:
-
setSRID
void setSRID(int srid)
Sets the SRID of the Layer
-
getDataMBR
java.awt.geom.Rectangle2D getDataMBR()
Gets the minimum bounding rectangle of all the data in this layer.
-
getFullExtent
java.awt.geom.Rectangle2D getFullExtent()
-
added
void added(java.lang.Object source)
The function called when the layer is added to either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)
-
removed
void removed(java.lang.Object source)
The function called when the layer is removed from either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)
-
toXMLElement
org.w3c.dom.Element toXMLElement()
Returns an XML representation of the layer- Returns:
-
fromXMLElement
void fromXMLElement(org.w3c.dom.Element element)
Loads the content from an XML representation- Parameters:
element-
-
getProviderID
java.lang.String getProviderID()
Returns the provider ID- Returns:
-
setProviderID
void setProviderID(java.lang.String providerID)
Sets the provider ID- Parameters:
providerID-
-
-