Class NFENetworkRenderer
- java.lang.Object
-
- oracle.spatial.network.nfe.vis.maps.layer.BasicLayer
-
- oracle.spatial.network.nfe.vis.mapcanvas.render.NFERenderer<NFENetworkElementGeoObject>
-
- oracle.spatial.network.nfe.vis.mapcanvas.render.NFENetworkRenderer
-
- All Implemented Interfaces:
java.util.EventListener,javax.swing.event.ChangeListener,NFEModelListener,BehavioralLayer,ManipulableLayer,VertexEditableLayer,GeoObjectLayer,HoverableLayer,Layer,SelectableLayer,PropertySupport
public class NFENetworkRenderer extends NFERenderer<NFENetworkElementGeoObject> implements NFEModelListener, ManipulableLayer, VertexEditableLayer
Layer used for rendering network elements (nodes and links). It is automatically subscribed to the model's network to draw or erase network elements as they are added, modified or removed. Support is provided for manipulating network elements.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class oracle.spatial.network.nfe.vis.mapcanvas.render.NFERenderer
NFERenderer.Tier, NFERenderer.TierRenderingThread
-
-
Field Summary
-
Fields inherited from class oracle.spatial.network.nfe.vis.mapcanvas.render.NFERenderer
animatedStroke, boundaryColor, contextualMenuHandlerList, editable, geoObjects, hoverBorderColor, hoverColor, hoverManager, hoverStroke, imageOpacityAlpha, lastDataWindow, lastViewportTransform, nontargetAnimatedStroke, refreshRegionQueue, selectionManager, simpleStroke, textDefaultColor, textDefaultFont, tiers
-
Fields inherited from class oracle.spatial.network.nfe.vis.maps.layer.BasicLayer
canvas, properties
-
Fields inherited from interface oracle.spatial.network.nfe.vis.maps.core.Layer
PROPERTY_NAME, PROPERTY_PROVIDERID, PROPERTY_SRID, PROPERTY_VISIBLE
-
Fields inherited from interface oracle.spatial.network.nfe.vis.mapcanvas.behavior.manipulate.ManipulableLayer
TRANS_NONE, TRANS_PULL, TRANS_TRANSLATE
-
Fields inherited from interface oracle.spatial.network.nfe.model.event.NFEModelListener
METHOD_MODEL_OBJECT_ADDED, METHOD_MODEL_OBJECT_REMOVED, METHOD_MODEL_OBJECTS_ADDED, METHOD_MODEL_OBJECTS_REMOVED, METHOD_PROPERTY_CHANGED
-
-
Constructor Summary
Constructors Constructor Description NFENetworkRenderer(MapCanvas canvas, NFEModel model)Allocates a new network renderer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFeatureLayerRenderer(NFEFeatureLayerRenderer flRenderer)Associates a feature layer rendererbooleanaddVertex(GeoObject geoObj, oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)Adds a vertex to the given GeoObject at the specified snap pointprotected booleanbelongsToTier(NFENetworkElementGeoObject geoObj, java.lang.String tierName)Tells whether the GeoObject is rendered by the given tierbooleancanAddVertex(GeoObject geoObj, oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)Tells whether it is possible to add a new vertex to the GeoObject at the specified snap pointvoidcancelManipulation(long manId)Cancels the given manipulation and releases all the resources related to itbooleanfinishManipulation(long manId, java.awt.geom.Point2D dataPoint)finishes the manipulation identified by the given id.intgetApplicableTransformation(GeoObject geoObj, java.util.Collection<GeoObject> manGeoObjGroup, oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)Gets manipulation available for the given GeoObject and its current snap point.java.util.List<NFEFeatureLayerRenderer>getFeatureLayerRenderers()Gets all the feature layer renderers associatedprotected java.util.Collection<NFENetworkElementGeoObject>getGeoObjects(java.awt.geom.Area area)Gets all the GeoObjects interacting with the given areaprotected java.util.Collection<NFENetworkElementGeoObject>getGeoObjects(java.awt.geom.Point2D point, int granularity)Gets all the GeoObjects interacting with the given pointprotected java.util.Collection<NFENetworkElementGeoObject>getGeoObjects(java.awt.geom.Rectangle2D rect)Gets all the GeoObjects interacting with the given rectangleprotected oracle.sdovis.style.StylegetGeoObjectStyle(NFENetworkElementGeoObject geoObj)Gets the style used for rendering the GeoObjectdouble[]getHandlePoints(GeoObject geoObj)Gets the ordinates of the points from which a GeoObject can be manipulatedjava.util.Collection<GeoObject>getManipulableGeoObjects()Gets the layer's GeoObjects that can be manipulatedManipulationPreviewgetPreview(long manId)Gets a preview for a manipulationoracle.sdovis.edit.util.JGeometrySegmentPointgetSnapPoint(GeoObject geoObj, java.awt.geom.Point2D dataPoint, double tolerance)Gets the closer GeoObject's snap point to the given point using the tolerance specifiedjava.util.Collection<GeoObject>getVertexEditableGeoObjects()Gets all the GeoObjects which vertices can be editeddouble[]getVertices(GeoObject geoObj)Gets all the vertices of the GeoObjectbooleanisHidden()Tells whether the layer is hiddenbooleanisShowFlow()Tells whether flow indicators are displayed for linksprotected booleanisVisible(NFENetworkElementGeoObject geoObj)Tells whether the GeoObject is visiblebooleanmanipulate(long manId, java.awt.geom.Point2D dataPoint)Updates the state of a manipulation with the last point.voidmapRegionChanged(MapRegionEvent e)When the associated canvas's map region is changed, this method is called to notify the layer of the change.voidmodelObjectAdded(NFEModelObjectEvent event)Invoked when a model object has been addedvoidmodelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)Invoked when a model object's property has been changedvoidmodelObjectRemoved(NFEModelObjectEvent event)Invoked when a model object has been removedvoidmodelObjectsAdded(NFEModelObjectsEvent event)Invoked when one or more model objects have been addedvoidmodelObjectsRemoved(NFEModelObjectsEvent event)Invoked when one or more model objects have been removedvoidrefresh()Refreshes the current data windowbooleanremoveFeatureLayerRenderer(NFEFeatureLayerRenderer flRenderer)Removes the association to a feature layer rendererlongrender(java.awt.Graphics2D graphics)Renders the layer contents to the given Graphics.voidsetHidden(boolean hidden)Sets whether the layer is hidden or notvoidsetShowFlow(boolean showFlow)Sets whether flow indicators are displayed for linkslongstartManipulation(GeoObject geoObj, java.util.Collection<GeoObject> manGeoObjGroup, oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint, int transformation)Starts a manipulation session.voidsynchronizeWithModel()Refreshes the current state to refresh the state of the model's network-
Methods inherited from class oracle.spatial.network.nfe.vis.mapcanvas.render.NFERenderer
addContextualMenuHandler, addSelectionListener, clear, clearHover, clearSelection, containsTag, containsTag, findTier, getDataMBR, getFullExtent, getGeoObject, getHover, getImageOpacityAlpha, getObject, getObjects, getScreenTolerance, getSelection, getSelection, getSnapPoint, getTolerance, handleEvent, hitTest, hitTest, isHover, isSelected, numHovered, numSelected, refresh, refreshAsync, refreshAsync, removeContextualMenuHandler, removeSelectionListener, renderGeoObject, renderGeoObject, renderGeoObjects, renderGeoObjLabel, renderHoveredObject, renderHoveredObjects, renderHoveredPoint, renderHoveredShape, renderSelectedObjects, renderTier, renderTiers, select, setHover, setImageOpacityAlpha, setSelection, sortTiers, stateChanged, unselect, update
-
Methods inherited from class oracle.spatial.network.nfe.vis.maps.layer.BasicLayer
added, addPropertyChangeListener, addPropertyChangeListener, fromXMLElement, getCanvas, getIcon, getName, getProperties, getProperty, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getProviderID, getSRID, handleTheEvent, isMyEvent, isVisible, propagateEvent, removed, removePropertyChangeListener, removePropertyChangeListener, repaint, setCanvas, setMyCursor, setName, setProperty, setProviderID, setSRID, setVisible, toXMLElement
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface oracle.spatial.network.nfe.vis.maps.core.Layer
added, fromXMLElement, getCanvas, getIcon, getName, getProviderID, getSRID, isVisible, removed, repaint, setCanvas, setName, setProviderID, setSRID, setVisible, toXMLElement
-
Methods inherited from interface oracle.spatial.network.nfe.vis.maps.util.PropertySupport
addPropertyChangeListener, addPropertyChangeListener, getProperties, getProperty, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener, setProperty
-
-
-
-
Method Detail
-
synchronizeWithModel
public void synchronizeWithModel()
Refreshes the current state to refresh the state of the model's network
-
isShowFlow
public boolean isShowFlow()
Tells whether flow indicators are displayed for links- Returns:
- true if flow is shown
-
setShowFlow
public void setShowFlow(boolean showFlow)
Sets whether flow indicators are displayed for links- Parameters:
showFlow- true if flow should be shown
-
getFeatureLayerRenderers
public java.util.List<NFEFeatureLayerRenderer> getFeatureLayerRenderers()
Gets all the feature layer renderers associated- Returns:
- a list of feature layer renderers
-
addFeatureLayerRenderer
public void addFeatureLayerRenderer(NFEFeatureLayerRenderer flRenderer)
Associates a feature layer renderer- Parameters:
flRenderer- a feature layer renderer
-
removeFeatureLayerRenderer
public boolean removeFeatureLayerRenderer(NFEFeatureLayerRenderer flRenderer)
Removes the association to a feature layer renderer- Parameters:
flRenderer- a feature layer renderer- Returns:
- true if the association was removed
-
isHidden
public boolean isHidden()
Tells whether the layer is hidden- Returns:
- true if it is hidden
-
setHidden
public void setHidden(boolean hidden)
Sets whether the layer is hidden or not- Parameters:
hidden- true if it should be hidden
-
refresh
public void refresh()
Description copied from class:NFERendererRefreshes the current data window- Specified by:
refreshin interfaceBehavioralLayer- Overrides:
refreshin classNFERenderer<NFENetworkElementGeoObject>
-
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- Overrides:
mapRegionChangedin classNFERenderer<NFENetworkElementGeoObject>
-
render
public long render(java.awt.Graphics2D graphics)
Description copied from interface:LayerRenders the layer contents to the given Graphics.- Specified by:
renderin interfaceLayer- Overrides:
renderin classNFERenderer<NFENetworkElementGeoObject>- Parameters:
graphics- the graphics object- Returns:
- the rendering time in milliseconds.
-
getGeoObjects
protected java.util.Collection<NFENetworkElementGeoObject> getGeoObjects(java.awt.geom.Point2D point, int granularity)
Description copied from class:NFERendererGets all the GeoObjects interacting with the given point- Specified by:
getGeoObjectsin classNFERenderer<NFENetworkElementGeoObject>- Parameters:
point- a spatial point in screen coordinate system- Returns:
- a collection containing all the GeoObjects interacting with the point
-
getGeoObjects
protected java.util.Collection<NFENetworkElementGeoObject> getGeoObjects(java.awt.geom.Rectangle2D rect)
Description copied from class:NFERendererGets all the GeoObjects interacting with the given rectangle- Specified by:
getGeoObjectsin classNFERenderer<NFENetworkElementGeoObject>- Parameters:
rect- a rectangle in screen coordinate system- Returns:
- a collection containing all the GeoObjects interacting with the rectangle
-
getGeoObjects
protected java.util.Collection<NFENetworkElementGeoObject> getGeoObjects(java.awt.geom.Area area)
Description copied from class:NFERendererGets all the GeoObjects interacting with the given area- Specified by:
getGeoObjectsin classNFERenderer<NFENetworkElementGeoObject>- Parameters:
area- an area in screen coordinate system- Returns:
- a collection containing all the GeoObjects interacting with the area
-
getGeoObjectStyle
protected oracle.sdovis.style.Style getGeoObjectStyle(NFENetworkElementGeoObject geoObj)
Description copied from class:NFERendererGets the style used for rendering the GeoObject- Specified by:
getGeoObjectStylein classNFERenderer<NFENetworkElementGeoObject>- Parameters:
geoObj- a GeoObject- Returns:
- the GeoObject's style
-
belongsToTier
protected boolean belongsToTier(NFENetworkElementGeoObject geoObj, java.lang.String tierName)
Description copied from class:NFERendererTells whether the GeoObject is rendered by the given tier- Specified by:
belongsToTierin classNFERenderer<NFENetworkElementGeoObject>- Parameters:
geoObj- a layer's GeoObjecttierName- a tier name- Returns:
- true if the GeoObject is rendered by (belongs to) the given tier
-
isVisible
protected boolean isVisible(NFENetworkElementGeoObject geoObj)
Description copied from class:NFERendererTells whether the GeoObject is visible- Specified by:
isVisiblein classNFERenderer<NFENetworkElementGeoObject>- Parameters:
geoObj- a layer's GeoObject- Returns:
- true if the GeoObject is visible
-
modelObjectAdded
public void modelObjectAdded(NFEModelObjectEvent event)
Description copied from interface:NFEModelListenerInvoked when a model object has been added- Specified by:
modelObjectAddedin interfaceNFEModelListener- Parameters:
event- contains a reference to the model object that has been added
-
modelObjectsAdded
public void modelObjectsAdded(NFEModelObjectsEvent event)
Description copied from interface:NFEModelListenerInvoked when one or more model objects have been added- Specified by:
modelObjectsAddedin interfaceNFEModelListener- Parameters:
event- contains a collection of references to the model objects that have been added
-
modelObjectRemoved
public void modelObjectRemoved(NFEModelObjectEvent event)
Description copied from interface:NFEModelListenerInvoked when a model object has been removed- Specified by:
modelObjectRemovedin interfaceNFEModelListener- Parameters:
event- contains a reference to the model object that has been removed
-
modelObjectsRemoved
public void modelObjectsRemoved(NFEModelObjectsEvent event)
Description copied from interface:NFEModelListenerInvoked when one or more model objects have been removed- Specified by:
modelObjectsRemovedin interfaceNFEModelListener- Parameters:
event- contains a collection of references to the model objects that have been removed
-
modelObjectPropertyChanged
public void modelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)
Description copied from interface:NFEModelListenerInvoked when a model object's property has been changed- Specified by:
modelObjectPropertyChangedin interfaceNFEModelListener- Parameters:
event- contains a reference to the model objects which property has been changed and the name and previous value of the changed property
-
getManipulableGeoObjects
public java.util.Collection<GeoObject> getManipulableGeoObjects()
Description copied from interface:ManipulableLayerGets the layer's GeoObjects that can be manipulated- Specified by:
getManipulableGeoObjectsin interfaceManipulableLayer- Returns:
- a collection of GeoObjects
-
getHandlePoints
public double[] getHandlePoints(GeoObject geoObj)
Description copied from interface:ManipulableLayerGets the ordinates of the points from which a GeoObject can be manipulated- Specified by:
getHandlePointsin interfaceManipulableLayer- Parameters:
geoObj- a GeoObject- Returns:
- an array of ordinates in model's coordinate system
-
getSnapPoint
public oracle.sdovis.edit.util.JGeometrySegmentPoint getSnapPoint(GeoObject geoObj, java.awt.geom.Point2D dataPoint, double tolerance)
Description copied from interface:ManipulableLayerGets the closer GeoObject's snap point to the given point using the tolerance specified- Specified by:
getSnapPointin interfaceManipulableLayer- Specified by:
getSnapPointin interfaceVertexEditableLayer- Parameters:
geoObj- a GeoObjectdataPoint- a point in model's coordinate systemtolerance- a tolarence in model's coordinate system- Returns:
- a segment point relative to the GeoObject's geometry
-
getApplicableTransformation
public int getApplicableTransformation(GeoObject geoObj, java.util.Collection<GeoObject> manGeoObjGroup, oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)
Description copied from interface:ManipulableLayerGets manipulation available for the given GeoObject and its current snap point. It is also specified all the GeoObjects that need to be manipulated along with the first GeoObject passed.- Specified by:
getApplicableTransformationin interfaceManipulableLayer- Parameters:
geoObj- a GeoObjectmanGeoObjGroup- a collection containing more GeoObjects to be manipulated. It can be nullsnapPoint- a segment point relative to the GeoObject's geometry- Returns:
- a manipulation code
-
startManipulation
public long startManipulation(GeoObject geoObj, java.util.Collection<GeoObject> manGeoObjGroup, oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint, int transformation)
Description copied from interface:ManipulableLayerStarts a manipulation session. The manipulation will be performed over the give GeoObject and the GeoObject group passed.- Specified by:
startManipulationin interfaceManipulableLayer- Parameters:
geoObj- the target GeoObject to be manipulatedmanGeoObjGroup- a group of GeoObjects to be manipulatedsnapPoint- a segment point relative to the GeoObject's geometrytransformation- the type of manipulation to be performed- Returns:
- a manipulation session id
-
finishManipulation
public boolean finishManipulation(long manId, java.awt.geom.Point2D dataPoint)Description copied from interface:ManipulableLayerfinishes the manipulation identified by the given id. The last mouse point is specified.- Specified by:
finishManipulationin interfaceManipulableLayer- Parameters:
manId- the manipulation session iddataPoint- the last point for the manipulation in model's coordinate system- Returns:
- true if the manipulation was performed successfully
-
manipulate
public boolean manipulate(long manId, java.awt.geom.Point2D dataPoint)Description copied from interface:ManipulableLayerUpdates the state of a manipulation with the last point. It is useful if a live preview has to be shown.- Specified by:
manipulatein interfaceManipulableLayer- Parameters:
manId- a manipulation session iddataPoint- the last user point (it may be a mouse point) in model's coordinate system- Returns:
- true if the manipulation state was updated successfully
-
cancelManipulation
public void cancelManipulation(long manId)
Description copied from interface:ManipulableLayerCancels the given manipulation and releases all the resources related to it- Specified by:
cancelManipulationin interfaceManipulableLayer- Parameters:
manId- a manipulation session id
-
getPreview
public ManipulationPreview getPreview(long manId)
Description copied from interface:ManipulableLayerGets a preview for a manipulation- Specified by:
getPreviewin interfaceManipulableLayer- Parameters:
manId- a manipulation session id- Returns:
- a manipulation preview object
-
getVertexEditableGeoObjects
public java.util.Collection<GeoObject> getVertexEditableGeoObjects()
Description copied from interface:VertexEditableLayerGets all the GeoObjects which vertices can be edited- Specified by:
getVertexEditableGeoObjectsin interfaceVertexEditableLayer- Returns:
- a collection of GeoObjects
-
getVertices
public double[] getVertices(GeoObject geoObj)
Description copied from interface:VertexEditableLayerGets all the vertices of the GeoObject- Specified by:
getVerticesin interfaceVertexEditableLayer- Parameters:
geoObj- a GeoObject- Returns:
- an array containing the ordinates of the GeoObject's vertices
-
canAddVertex
public boolean canAddVertex(GeoObject geoObj, oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)
Description copied from interface:VertexEditableLayerTells whether it is possible to add a new vertex to the GeoObject at the specified snap point- Specified by:
canAddVertexin interfaceVertexEditableLayer- Parameters:
geoObj- a GeoObjectsnapPoint- a segment point relative to the GeoObject's geometry- Returns:
- true if it is possible to add a new vertex
-
addVertex
public boolean addVertex(GeoObject geoObj, oracle.sdovis.edit.util.JGeometrySegmentPoint snapPoint)
Description copied from interface:VertexEditableLayerAdds a vertex to the given GeoObject at the specified snap point- Specified by:
addVertexin interfaceVertexEditableLayer- Parameters:
geoObj- a GeoObjectsnapPoint- a segment point relative to the GeoObject's geometry- Returns:
- true if the vertex was successfully added
-
-