Class BasicLayer
- java.lang.Object
-
- oracle.spatial.network.nfe.vis.maps.layer.BasicLayer
-
- All Implemented Interfaces:
Layer,PropertySupport
- Direct Known Subclasses:
AbstractDataSetLayer,BasicTool,MapNavLayer,NFERenderer,PointerLocationLayer,ProgressIndicatorLayer,ScaleBarLayer,SimpleBGLayer
public class BasicLayer extends java.lang.Object implements Layer
A basic layer that serves as a default implementation of the Layer interface. For simple types of concrete layers, it is easier to extend BasicLayer then override only interface methods that are different from default behavior.
-
-
Field Summary
Fields Modifier and Type Field Description protected MapCanvascanvasprotected PropertySupportObjectproperties-
Fields inherited from interface oracle.spatial.network.nfe.vis.maps.core.Layer
PROPERTY_NAME, PROPERTY_PROVIDERID, PROPERTY_SRID, PROPERTY_VISIBLE
-
-
Constructor Summary
Constructors Constructor Description BasicLayer(MapCanvas canvas)
-
Method Summary
All Methods Instance Methods Concrete 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)voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)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()Always return null here.java.awt.geom.Rectangle2DgetFullExtent()javax.swing.IcongetIcon()java.lang.StringgetName()Gets the name of the layer.java.util.PropertiesgetProperties()java.lang.StringgetProperty(java.lang.String key)java.lang.StringgetProperty(java.lang.String key, java.lang.String defaultValue)java.beans.PropertyChangeListener[]getPropertyChangeListeners()java.beans.PropertyChangeListener[]getPropertyChangeListeners(java.lang.String propertyName)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.protected voidhandleTheEvent(java.util.EventObject evt)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.protected booleanisMyEvent(java.util.EventObject evt)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.protected booleanpropagateEvent(java.util.EventObject evt)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)voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)longrender(java.awt.Graphics2D g)Renders the layer contents to the given Graphics.voidrepaint()Tells the layer to repaint itself immediately.voidsetCanvas(MapCanvas canvas)Sets the map canvas on which this layer is displayed.protected voidsetMyCursor(int x, int y)voidsetName(java.lang.String name)Sets the name for this layer.java.lang.StringsetProperty(java.lang.String key, java.lang.String value)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.
-
-
-
Field Detail
-
canvas
protected MapCanvas canvas
-
properties
protected PropertySupportObject properties
-
-
Constructor Detail
-
BasicLayer
public BasicLayer(MapCanvas canvas)
-
-
Method Detail
-
getProperties
public java.util.Properties getProperties()
- Specified by:
getPropertiesin interfacePropertySupport
-
toXMLElement
public org.w3c.dom.Element toXMLElement()
Description copied from interface:LayerReturns an XML representation of the layer- Specified by:
toXMLElementin interfaceLayer- Returns:
-
fromXMLElement
public void fromXMLElement(org.w3c.dom.Element element)
Description copied from interface:LayerLoads the content from an XML representation- Specified by:
fromXMLElementin interfaceLayer
-
getName
public java.lang.String getName()
Description copied from interface:LayerGets the name of the layer.
-
setName
public void setName(java.lang.String name)
Sets the name for this layer.
-
isVisible
public boolean isVisible()
Description copied from interface:LayerChecks whether this layer is currently visible.
-
setVisible
public void setVisible(boolean v)
Description copied from interface:LayerSets the visibility of this layer.- Specified by:
setVisiblein interfaceLayer
-
getProperty
public java.lang.String getProperty(java.lang.String key)
- Specified by:
getPropertyin interfacePropertySupport
-
getProperty
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)- Specified by:
getPropertyin interfacePropertySupport
-
setProperty
public java.lang.String setProperty(java.lang.String key, java.lang.String value)- Specified by:
setPropertyin interfacePropertySupport
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
- Specified by:
addPropertyChangeListenerin interfacePropertySupport
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)- Specified by:
addPropertyChangeListenerin interfacePropertySupport
-
getPropertyChangeListeners
public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
- Specified by:
getPropertyChangeListenersin interfacePropertySupport
-
getPropertyChangeListeners
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
- Specified by:
getPropertyChangeListenersin interfacePropertySupport
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
- Specified by:
removePropertyChangeListenerin interfacePropertySupport
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)- Specified by:
removePropertyChangeListenerin interfacePropertySupport
-
clear
public void clear()
Description copied from interface:LayerClears all contents of this layer.
-
getCanvas
public MapCanvas getCanvas()
Description copied from interface:LayerGets the map canvas that this layer is displayed on.
-
setCanvas
public void setCanvas(MapCanvas canvas)
Description copied from interface:LayerSets the map canvas on which this layer is displayed.
-
handleEvent
public boolean handleEvent(java.util.EventObject evt)
Description copied from interface:LayerThe 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.- Specified by:
handleEventin interfaceLayer
-
handleTheEvent
protected void handleTheEvent(java.util.EventObject evt)
-
setMyCursor
protected void setMyCursor(int x, int y)
-
isMyEvent
protected boolean isMyEvent(java.util.EventObject evt)
-
propagateEvent
protected boolean propagateEvent(java.util.EventObject evt)
-
hitTest
public java.util.List<GeoObject> hitTest(int x, int y, int granularity)
Description copied from interface:LayerPerforms a hit test for the given mouse location (x,y). All the geo-objects that pass the hit test will be returned.
-
hitTest
public java.util.List<GeoObject> hitTest(java.awt.geom.Rectangle2D box, int granularity)
Description copied from interface:LayerPerforms a hit test for the given rectangle. All the geo-objects that are either inside or intersect the rectangle will be returned.
-
render
public long render(java.awt.Graphics2D g)
Description copied from interface:LayerRenders the layer contents to the given Graphics.
-
mapRegionChanged
public void mapRegionChanged(MapRegionEvent e)
Description copied from interface:LayerWhen 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.- Specified by:
mapRegionChangedin interfaceLayer
-
update
public void update(long elapsedTime)
Description copied from interface:Layerupdates the contents data model or structure.
-
repaint
public void repaint()
Description copied from interface:LayerTells 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.
-
getSRID
public int getSRID()
Description copied from interface:LayerGets the SRID of the Layer, 0 if it doesn't have an associated SRID
-
setSRID
public void setSRID(int srid)
Description copied from interface:LayerSets the SRID of the Layer
-
getDataMBR
public java.awt.geom.Rectangle2D getDataMBR()
Always return null here.- Specified by:
getDataMBRin interfaceLayer
-
getFullExtent
public java.awt.geom.Rectangle2D getFullExtent()
- Specified by:
getFullExtentin interfaceLayer
-
added
public void added(java.lang.Object source)
Description copied from interface:LayerThe function called when the layer is added to either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)
-
removed
public void removed(java.lang.Object source)
Description copied from interface:LayerThe function called when the layer is removed from either a MapCanvas or an EditSession (typically both, MapCanvas first, EditSession later)
-
getProviderID
public java.lang.String getProviderID()
Description copied from interface:LayerReturns the provider ID- Specified by:
getProviderIDin interfaceLayer- Returns:
-
setProviderID
public void setProviderID(java.lang.String providerID)
Description copied from interface:LayerSets the provider ID- Specified by:
setProviderIDin interfaceLayer
-
-