public class NFENetworkRenderer extends NFERenderer<NFENetworkElementGeoObject> implements NFEModelListener, ManipulableLayer, VertexEditableLayer
METHOD_MODEL_OBJECT_ADDED, METHOD_MODEL_OBJECT_REMOVED, METHOD_MODEL_OBJECTS_ADDED, METHOD_MODEL_OBJECTS_REMOVED, METHOD_PROPERTY_CHANGED
TRANS_NONE, TRANS_PULL, TRANS_TRANSLATE
PROPERTY_NAME, PROPERTY_PROVIDERID, PROPERTY_SRID, PROPERTY_VISIBLE
Constructor and Description |
---|
NFENetworkRenderer(MapCanvas canvas, NFEModel model)
Allocates a new network renderer
|
Modifier and Type | Method and Description |
---|---|
void |
addFeatureLayerRenderer(NFEFeatureLayerRenderer flRenderer)
Associates a feature layer renderer
|
boolean |
addVertex(GeoObject geoObj, JGeometrySegmentPoint snapPoint)
Adds a vertex to the given GeoObject at the specified snap point
|
boolean |
canAddVertex(GeoObject geoObj, JGeometrySegmentPoint snapPoint)
Tells whether it is possible to add a new vertex to the GeoObject at the specified snap point
|
void |
cancelManipulation(long manId)
Cancels the given manipulation and releases all the resources related to it
|
boolean |
finishManipulation(long manId, java.awt.geom.Point2D dataPoint)
finishes the manipulation identified by the given id.
|
int |
getApplicableTransformation(GeoObject geoObj, java.util.Collection<GeoObject> manGeoObjGroup, 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 associated
|
double[] |
getHandlePoints(GeoObject geoObj)
Gets the ordinates of the points from which a GeoObject can be manipulated
|
java.util.Collection<GeoObject> |
getManipulableGeoObjects()
Gets the layer's GeoObjects that can be manipulated
|
ManipulationPreview |
getPreview(long manId)
Gets a preview for a manipulation
|
JGeometrySegmentPoint |
getSnapPoint(GeoObject geoObj, java.awt.geom.Point2D dataPoint, double tolerance)
Gets the closer GeoObject's snap point to the given point using the tolerance specified
|
java.util.Collection<GeoObject> |
getVertexEditableGeoObjects()
Gets all the GeoObjects which vertices can be edited
|
double[] |
getVertices(GeoObject geoObj)
Gets all the vertices of the GeoObject
|
boolean |
isHidden()
Tells whether the layer is hidden
|
boolean |
isShowFlow()
Tells whether flow indicators are displayed for links
|
boolean |
manipulate(long manId, java.awt.geom.Point2D dataPoint)
Updates the state of a manipulation with the last point.
|
void |
mapRegionChanged(MapRegionEvent e)
When the associated canvas's map region is changed, this method is called to notify the layer of the change.
|
void |
modelObjectAdded(NFEModelObjectEvent event)
Invoked when a model object has been added
|
void |
modelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)
Invoked when a model object's property has been changed
|
void |
modelObjectRemoved(NFEModelObjectEvent event)
Invoked when a model object has been removed
|
void |
modelObjectsAdded(NFEModelObjectsEvent event)
Invoked when one or more model objects have been added
|
void |
modelObjectsRemoved(NFEModelObjectsEvent event)
Invoked when one or more model objects have been removed
|
void |
refresh()
Refreshes the current data window
|
boolean |
removeFeatureLayerRenderer(NFEFeatureLayerRenderer flRenderer)
Removes the association to a feature layer renderer
|
long |
render(java.awt.Graphics2D graphics)
Renders the layer contents to the given Graphics.
|
void |
setHidden(boolean hidden)
Sets whether the layer is hidden or not
|
void |
setShowFlow(boolean showFlow)
Sets whether flow indicators are displayed for links
|
long |
startManipulation(GeoObject geoObj, java.util.Collection<GeoObject> manGeoObjGroup, JGeometrySegmentPoint snapPoint, int transformation)
Starts a manipulation session.
|
void |
synchronizeWithModel()
Refreshes the current state to refresh the state of the model's network
|
addContextualMenuHandler, addSelectionListener, clear, clearHover, clearSelection, getDataMBR, getFullExtent, getGeoObject, getHover, getImageOpacityAlpha, getObject, getObjects, getSelection, getSelection, getSnapPoint, getTolerance, handleEvent, hitTest, hitTest, isHover, isSelected, numHovered, numSelected, refresh, removeContextualMenuHandler, removeSelectionListener, select, setHover, setImageOpacityAlpha, setSelection, stateChanged, unselect, update
added, addPropertyChangeListener, addPropertyChangeListener, fromXMLElement, getCanvas, getIcon, getName, getProperties, getProperty, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getProviderID, getSRID, isVisible, removed, removePropertyChangeListener, removePropertyChangeListener, repaint, setCanvas, setName, setProperty, setProviderID, setSRID, setVisible, toXMLElement
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
added, fromXMLElement, getCanvas, getIcon, getName, getProviderID, getSRID, isVisible, removed, repaint, setCanvas, setName, setProviderID, setSRID, setVisible, toXMLElement
public void synchronizeWithModel()
public boolean isShowFlow()
public void setShowFlow(boolean showFlow)
showFlow
- true if flow should be shownpublic java.util.List<NFEFeatureLayerRenderer> getFeatureLayerRenderers()
public void addFeatureLayerRenderer(NFEFeatureLayerRenderer flRenderer)
flRenderer
- a feature layer rendererpublic boolean removeFeatureLayerRenderer(NFEFeatureLayerRenderer flRenderer)
flRenderer
- a feature layer rendererpublic boolean isHidden()
public void setHidden(boolean hidden)
hidden
- true if it should be hiddenpublic void refresh()
NFERenderer
refresh
in interface BehavioralLayer
refresh
in class NFERenderer<NFENetworkElementGeoObject>
public void mapRegionChanged(MapRegionEvent e)
Layer
mapRegionChanged
in interface Layer
mapRegionChanged
in class NFERenderer<NFENetworkElementGeoObject>
public long render(java.awt.Graphics2D graphics)
Layer
render
in interface Layer
render
in class NFERenderer<NFENetworkElementGeoObject>
graphics
- the graphics objectpublic void modelObjectAdded(NFEModelObjectEvent event)
NFEModelListener
modelObjectAdded
in interface NFEModelListener
event
- contains a reference to the model object that has been addedpublic void modelObjectsAdded(NFEModelObjectsEvent event)
NFEModelListener
modelObjectsAdded
in interface NFEModelListener
event
- contains a collection of references to the model objects that have been addedpublic void modelObjectRemoved(NFEModelObjectEvent event)
NFEModelListener
modelObjectRemoved
in interface NFEModelListener
event
- contains a reference to the model object that has been removedpublic void modelObjectsRemoved(NFEModelObjectsEvent event)
NFEModelListener
modelObjectsRemoved
in interface NFEModelListener
event
- contains a collection of references to the model objects that have been removedpublic void modelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)
NFEModelListener
modelObjectPropertyChanged
in interface NFEModelListener
event
- contains a reference to the model objects which property has been changed and the name and previous value of the changed propertypublic java.util.Collection<GeoObject> getManipulableGeoObjects()
ManipulableLayer
getManipulableGeoObjects
in interface ManipulableLayer
public double[] getHandlePoints(GeoObject geoObj)
ManipulableLayer
getHandlePoints
in interface ManipulableLayer
geoObj
- a GeoObjectpublic JGeometrySegmentPoint getSnapPoint(GeoObject geoObj, java.awt.geom.Point2D dataPoint, double tolerance)
ManipulableLayer
getSnapPoint
in interface ManipulableLayer
getSnapPoint
in interface VertexEditableLayer
geoObj
- a GeoObjectdataPoint
- a point in model's coordinate systemtolerance
- a tolarence in model's coordinate systempublic int getApplicableTransformation(GeoObject geoObj, java.util.Collection<GeoObject> manGeoObjGroup, JGeometrySegmentPoint snapPoint)
ManipulableLayer
getApplicableTransformation
in interface ManipulableLayer
geoObj
- a GeoObjectmanGeoObjGroup
- a collection containing more GeoObjects to be manipulated. It can be nullsnapPoint
- a segment point relative to the GeoObject's geometrypublic long startManipulation(GeoObject geoObj, java.util.Collection<GeoObject> manGeoObjGroup, JGeometrySegmentPoint snapPoint, int transformation)
ManipulableLayer
startManipulation
in interface ManipulableLayer
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 performedpublic boolean finishManipulation(long manId, java.awt.geom.Point2D dataPoint)
ManipulableLayer
finishManipulation
in interface ManipulableLayer
manId
- the manipulation session iddataPoint
- the last point for the manipulation in model's coordinate systempublic boolean manipulate(long manId, java.awt.geom.Point2D dataPoint)
ManipulableLayer
manipulate
in interface ManipulableLayer
manId
- a manipulation session iddataPoint
- the last user point (it may be a mouse point) in model's coordinate systempublic void cancelManipulation(long manId)
ManipulableLayer
cancelManipulation
in interface ManipulableLayer
manId
- a manipulation session idpublic ManipulationPreview getPreview(long manId)
ManipulableLayer
getPreview
in interface ManipulableLayer
manId
- a manipulation session idpublic java.util.Collection<GeoObject> getVertexEditableGeoObjects()
VertexEditableLayer
getVertexEditableGeoObjects
in interface VertexEditableLayer
public double[] getVertices(GeoObject geoObj)
VertexEditableLayer
getVertices
in interface VertexEditableLayer
geoObj
- a GeoObjectpublic boolean canAddVertex(GeoObject geoObj, JGeometrySegmentPoint snapPoint)
VertexEditableLayer
canAddVertex
in interface VertexEditableLayer
geoObj
- a GeoObjectsnapPoint
- a segment point relative to the GeoObject's geometrypublic boolean addVertex(GeoObject geoObj, JGeometrySegmentPoint snapPoint)
VertexEditableLayer
addVertex
in interface VertexEditableLayer
geoObj
- a GeoObjectsnapPoint
- a segment point relative to the GeoObject's geometry