Package oracle.spatial.network.nfe.model
Class NFEBasicModel
- java.lang.Object
-
- oracle.spatial.network.nfe.model.NFEBasicModel
-
- All Implemented Interfaces:
java.util.EventListener
,NFEModelListener
,NFEModel
public class NFEBasicModel extends java.lang.Object implements NFEModel, NFEModelListener
The default implementation of NFEModel
-
-
Field Summary
-
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 NFEBasicModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFeatureLayer(NFEFeatureLayer featureLayer)
Adds a feature layer to the model.void
addLoadedArea(java.awt.geom.Area area)
Adds an area loaded.void
addModelListener(NFEModelListener listener)
Adds a listener to the model.NFEFeatureLayer
getAnalysisLayer()
Gets a feature layer containing the paths resulting from analysis (if any)NFEEventDispatcher<NFEModelListener>
getDispatcher()
Gets the event dispatcher used by the model.NFEEditionManager
getEditionManager()
Gets the edition manager used by the current modelNFEEditionMode
getEditionMode()
Gets the edition mode of the current model.int
getFeatureElementsCount(NFENetworkElement networkElement)
Gets the number of feature elements associated to a network elementjava.util.Collection<NFEFeatureElement>
getFeatureElementsOnNetworkElement(NFENetworkElement networkElement)
Gets all the feature elements associated to a network elementjava.util.Collection<NFEFeatureElement>
getFeatureElementsOnNetworkElement(NFENetworkElement networkElement, int hierarchyLevel)
Gets all the feature elements with the given hierarchy level associated to a network elementNFEFeatureLayer
getFeatureLayer(long featureLayerId)
Gets a model's feature layer by its id.NFEFeatureLayer
getFeatureLayer(java.lang.String featureLayerName)
Gets a model's feature layer by its namejava.util.Collection<NFEFeatureLayer>
getFeatureLayers()
Gets the feature layers of the current model.java.util.Collection<NFEFeature>
getFeaturesOnNetworkElement(NFENetworkElement networkElement)
Gets all the features containing feature elements associated to the specified network elementNFEGeometryDescriptor
getGeometryDescriptor()
Gets the geometry descriptor of the current model.long
getId()
Gets the ID of the model.NFEIdManager
getIdManager()
Gets the id manager used by the current modeljava.awt.geom.Area
getLoadedArea()
Gets the area currently loaded model's content.NFEManipulator
getManipulator()
Gets the manipulator instance which helps to perform some trivial feature-network operations over the model's contentNFEModelMetadata
getMetadata()
Gets the metadata of the current model.NFEModelObjectFactory
getModelObjectFactory()
Gets the model object factory instance used by the current model.java.lang.String
getName()
Gets the name of the model.NFENetwork
getNetwork()
Gets the current model's networkNFERulesModel
getRulesModel()
Gets the rules model associated to the current model.NFEIOServiceProvider
getServiceProvider()
Gets the service provider used by the model to perform IO operationsNFESpatialModel
getSpatialModel()
Gets the spatial model used by the current model to keep track of the spatial positions of its content (network elements and feature elements)NFEWorkspaceInfo
getWorkspaceInfo()
Gets the workspace manager related data associated to the current modelvoid
modelObjectAdded(NFEModelObjectEvent event)
Invoked when a model object has been addedvoid
modelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)
Invoked when a model object's property has been changedvoid
modelObjectRemoved(NFEModelObjectEvent event)
Invoked when a model object has been removedvoid
modelObjectsAdded(NFEModelObjectsEvent event)
Invoked when one or more model objects have been addedvoid
modelObjectsRemoved(NFEModelObjectsEvent event)
Invoked when one or more model objects have been removedNFEFeatureLayer
removeFeatureLayer(long featureLayerId)
Removes a feature layer with specified from the modelvoid
removeModelListener(NFEModelListener listener)
Removes a listener from the model.void
setAnalysisLayer(NFEFeatureLayer analysisFeatureLayer)
Sets a feature layer which contains paths from analysis.void
setEditionManager(NFEEditionManager em)
Sets the edition managaer to be used by the current model to track changes made to the model's content.void
setEventDispatcher(NFEEventDispatcher<NFEModelListener> eventDispatcher)
Sets the event dispatcher used by the model to fire model events.void
setIdManager(NFEIdManager idManager)
Sets the id manager used by the current model to assign ids to newly created objectsvoid
setMetadata(NFEModelMetadata metadata)
Sets the metadata of the model.void
setModelObjectFactory(NFEModelObjectFactory moFactory)
Sets the model object factory which will be used by the model to create new instances of model objects such as nodes, links, features and all the elements that are associated to the model.void
setNetwork(NFENetwork network)
Sets a network to the current model.void
setServiceProvider(NFEIOServiceProvider serviceProvider)
Sets the service provider to the current model.void
setWorkspaceInfo(NFEWorkspaceInfo workspaceInfo)
Sets the workspace manager configuration used by the model for IO operations
-
-
-
Method Detail
-
setMetadata
public void setMetadata(NFEModelMetadata metadata)
Description copied from interface:NFEModel
Sets the metadata of the model. This is typically set automatically when a model is loaded from the database.- Specified by:
setMetadata
in interfaceNFEModel
- Parameters:
metadata
- The current model's metedata
-
getMetadata
public NFEModelMetadata getMetadata()
Description copied from interface:NFEModel
Gets the metadata of the current model.- Specified by:
getMetadata
in interfaceNFEModel
- Returns:
- The current model's metedata
-
getId
public long getId()
Description copied from interface:NFEModel
Gets the ID of the model. The ID is unique across all the models stored for a user in the database.
-
getName
public java.lang.String getName()
Description copied from interface:NFEModel
Gets the name of the model.
-
getEditionMode
public NFEEditionMode getEditionMode()
Description copied from interface:NFEModel
Gets the edition mode of the current model. The mode can be FromScratch edition mode or ExistingNetwork edition mode.- Specified by:
getEditionMode
in interfaceNFEModel
- Returns:
- The current model's edition mode
-
getGeometryDescriptor
public NFEGeometryDescriptor getGeometryDescriptor()
Description copied from interface:NFEModel
Gets the geometry descriptor of the current model. It contains the SRID used by the model along with dimensions' boundaries.- Specified by:
getGeometryDescriptor
in interfaceNFEModel
- Returns:
- The current model's geometry descriptor
-
setWorkspaceInfo
public void setWorkspaceInfo(NFEWorkspaceInfo workspaceInfo)
Description copied from interface:NFEModel
Sets the workspace manager configuration used by the model for IO operations- Specified by:
setWorkspaceInfo
in interfaceNFEModel
- Parameters:
workspaceInfo
- Workspace Manager data
-
getWorkspaceInfo
public NFEWorkspaceInfo getWorkspaceInfo()
Description copied from interface:NFEModel
Gets the workspace manager related data associated to the current model- Specified by:
getWorkspaceInfo
in interfaceNFEModel
- Returns:
- Workspace Manager data
-
setModelObjectFactory
public void setModelObjectFactory(NFEModelObjectFactory moFactory)
Description copied from interface:NFEModel
Sets the model object factory which will be used by the model to create new instances of model objects such as nodes, links, features and all the elements that are associated to the model. A default instance of model object factory is set automatically when a model is created or loaded.- Specified by:
setModelObjectFactory
in interfaceNFEModel
- Parameters:
moFactory
- A model object factory instance
-
getModelObjectFactory
public NFEModelObjectFactory getModelObjectFactory()
Description copied from interface:NFEModel
Gets the model object factory instance used by the current model.- Specified by:
getModelObjectFactory
in interfaceNFEModel
- Returns:
- a model object factory instance
-
setIdManager
public void setIdManager(NFEIdManager idManager)
Description copied from interface:NFEModel
Sets the id manager used by the current model to assign ids to newly created objects- Specified by:
setIdManager
in interfaceNFEModel
- Parameters:
idManager
- an id manager instance
-
getIdManager
public NFEIdManager getIdManager()
Description copied from interface:NFEModel
Gets the id manager used by the current model- Specified by:
getIdManager
in interfaceNFEModel
- Returns:
- an id manager instance
-
getServiceProvider
public NFEIOServiceProvider getServiceProvider()
Description copied from interface:NFEModel
Gets the service provider used by the model to perform IO operations- Specified by:
getServiceProvider
in interfaceNFEModel
- Returns:
- a service provider instance
-
setServiceProvider
public void setServiceProvider(NFEIOServiceProvider serviceProvider)
Description copied from interface:NFEModel
Sets the service provider to the current model.- Specified by:
setServiceProvider
in interfaceNFEModel
- Parameters:
serviceProvider
- a service provider instance
-
setNetwork
public void setNetwork(NFENetwork network)
Description copied from interface:NFEModel
Sets a network to the current model. Typically a network is automatically set when a model is created or loaded using IOServices through the service provider. The network may not contain nodes or links if the content has not been added or loaded from the database.- Specified by:
setNetwork
in interfaceNFEModel
- Parameters:
network
- a network instance
-
getNetwork
public NFENetwork getNetwork()
Description copied from interface:NFEModel
Gets the current model's network- Specified by:
getNetwork
in interfaceNFEModel
- Returns:
- a not null, possibly empty, network instance
-
addFeatureLayer
public void addFeatureLayer(NFEFeatureLayer featureLayer)
Description copied from interface:NFEModel
Adds a feature layer to the model. A feature layer instance usually is added automatically when it is created using IOServices through the service provider- Specified by:
addFeatureLayer
in interfaceNFEModel
- Parameters:
featureLayer
- a not null, possibly empty, feature layer instance
-
getFeatureLayers
public java.util.Collection<NFEFeatureLayer> getFeatureLayers()
Description copied from interface:NFEModel
Gets the feature layers of the current model. The feature layers may not contain features if content has not be added or loaded from the database.- Specified by:
getFeatureLayers
in interfaceNFEModel
- Returns:
- a collection of feature layers.
-
getFeatureLayer
public NFEFeatureLayer getFeatureLayer(long featureLayerId)
Description copied from interface:NFEModel
Gets a model's feature layer by its id.- Specified by:
getFeatureLayer
in interfaceNFEModel
- Parameters:
featureLayerId
- a feature layer id- Returns:
- a feature layer instance contained in the model. Null otherwise
-
getFeatureLayer
public NFEFeatureLayer getFeatureLayer(java.lang.String featureLayerName)
Description copied from interface:NFEModel
Gets a model's feature layer by its name- Specified by:
getFeatureLayer
in interfaceNFEModel
- Returns:
-
removeFeatureLayer
public NFEFeatureLayer removeFeatureLayer(long featureLayerId)
Description copied from interface:NFEModel
Removes a feature layer with specified from the model- Specified by:
removeFeatureLayer
in interfaceNFEModel
- Parameters:
featureLayerId
- a feature layer id- Returns:
- the removed feature layer instance if it was contained in the model. Null otherwise
-
getLoadedArea
public java.awt.geom.Area getLoadedArea()
Description copied from interface:NFEModel
Gets the area currently loaded model's content. Model's content is all the network elements and features loaded into memory. The model should have loaded at least, the content lying into the loaded area. Additionally, a model could have boundary content loaded and other content loaded an analysis- Specified by:
getLoadedArea
in interfaceNFEModel
- Returns:
- the area of the currently loaded network elements and features
-
addLoadedArea
public void addLoadedArea(java.awt.geom.Area area)
Description copied from interface:NFEModel
Adds an area loaded. Typically it is called by the IOServices when content is loaded.- Specified by:
addLoadedArea
in interfaceNFEModel
- Parameters:
area
- the area of a recently loaded model's content
-
getFeatureElementsOnNetworkElement
public java.util.Collection<NFEFeatureElement> getFeatureElementsOnNetworkElement(NFENetworkElement networkElement)
Description copied from interface:NFEModel
Gets all the feature elements associated to a network element- Specified by:
getFeatureElementsOnNetworkElement
in interfaceNFEModel
- Parameters:
networkElement
- a network element from the model's network- Returns:
- a collection of feature elements associated to the network element. Null or empty collection if the network element does not contain feature elements.
-
getFeatureElementsOnNetworkElement
public java.util.Collection<NFEFeatureElement> getFeatureElementsOnNetworkElement(NFENetworkElement networkElement, int hierarchyLevel)
Description copied from interface:NFEModel
Gets all the feature elements with the given hierarchy level associated to a network element- Specified by:
getFeatureElementsOnNetworkElement
in interfaceNFEModel
- Parameters:
networkElement
- a network element from the model's networkhierarchyLevel
- the hierarchy level of the returned feature elements- Returns:
- a collection of feature elements associated to the network element. Null or empty collection if the network element does not contain feature elements with the given hierarchy level.
-
getFeatureElementsCount
public int getFeatureElementsCount(NFENetworkElement networkElement)
Description copied from interface:NFEModel
Gets the number of feature elements associated to a network element- Specified by:
getFeatureElementsCount
in interfaceNFEModel
- Parameters:
networkElement
- a network element from the model's network- Returns:
- the number of feature elements associated to the network element
-
getFeaturesOnNetworkElement
public java.util.Collection<NFEFeature> getFeaturesOnNetworkElement(NFENetworkElement networkElement)
Description copied from interface:NFEModel
Gets all the features containing feature elements associated to the specified network element- Specified by:
getFeaturesOnNetworkElement
in interfaceNFEModel
- Parameters:
networkElement
- a network element from the model's network- Returns:
- a collection of features. Null or empty collection if the network element does not contain feature elements
-
setEditionManager
public void setEditionManager(NFEEditionManager em)
Description copied from interface:NFEModel
Sets the edition managaer to be used by the current model to track changes made to the model's content. An instance is set by default when the model is created or loaded through the IOServices.- Specified by:
setEditionManager
in interfaceNFEModel
- Parameters:
em
- an edition manager instance
-
getEditionManager
public NFEEditionManager getEditionManager()
Description copied from interface:NFEModel
Gets the edition manager used by the current model- Specified by:
getEditionManager
in interfaceNFEModel
- Returns:
- an edition manager instance
-
setEventDispatcher
public void setEventDispatcher(NFEEventDispatcher<NFEModelListener> eventDispatcher)
Description copied from interface:NFEModel
Sets the event dispatcher used by the model to fire model events. An instance is set by default when the model is created or loaded through the IOServices. If the event dispatcher is set to null, no events will be reported.- Specified by:
setEventDispatcher
in interfaceNFEModel
- Parameters:
eventDispatcher
- an event dispatcher instance
-
getDispatcher
public NFEEventDispatcher<NFEModelListener> getDispatcher()
Description copied from interface:NFEModel
Gets the event dispatcher used by the model.- Specified by:
getDispatcher
in interfaceNFEModel
- Returns:
- an even dispatcher instance or null if it was removed.
-
modelObjectAdded
public void modelObjectAdded(NFEModelObjectEvent event)
Description copied from interface:NFEModelListener
Invoked when a model object has been added- Specified by:
modelObjectAdded
in interfaceNFEModelListener
- Parameters:
event
- contains a reference to the model object that has been added
-
modelObjectsAdded
public void modelObjectsAdded(NFEModelObjectsEvent event)
Description copied from interface:NFEModelListener
Invoked when one or more model objects have been added- Specified by:
modelObjectsAdded
in 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:NFEModelListener
Invoked when a model object has been removed- Specified by:
modelObjectRemoved
in interfaceNFEModelListener
- Parameters:
event
- contains a reference to the model object that has been removed
-
modelObjectsRemoved
public void modelObjectsRemoved(NFEModelObjectsEvent event)
Description copied from interface:NFEModelListener
Invoked when one or more model objects have been removed- Specified by:
modelObjectsRemoved
in 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:NFEModelListener
Invoked when a model object's property has been changed- Specified by:
modelObjectPropertyChanged
in 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
-
getAnalysisLayer
public NFEFeatureLayer getAnalysisLayer()
Description copied from interface:NFEModel
Gets a feature layer containing the paths resulting from analysis (if any)- Specified by:
getAnalysisLayer
in interfaceNFEModel
- Returns:
- a feature layer instance
-
setAnalysisLayer
public void setAnalysisLayer(NFEFeatureLayer analysisFeatureLayer)
Description copied from interface:NFEModel
Sets a feature layer which contains paths from analysis.- Specified by:
setAnalysisLayer
in interfaceNFEModel
- Parameters:
analysisFeatureLayer
- a feature layer instance
-
addModelListener
public void addModelListener(NFEModelListener listener)
Description copied from interface:NFEModel
Adds a listener to the model. The listener will be notified about every event in the model, network and feature layers contained in the model.- Specified by:
addModelListener
in interfaceNFEModel
- Parameters:
listener
- a model listener instance
-
removeModelListener
public void removeModelListener(NFEModelListener listener)
Description copied from interface:NFEModel
Removes a listener from the model. It is also removed from the network and feature layers.- Specified by:
removeModelListener
in interfaceNFEModel
- Parameters:
listener
- a model listener instance
-
getSpatialModel
public NFESpatialModel getSpatialModel()
Description copied from interface:NFEModel
Gets the spatial model used by the current model to keep track of the spatial positions of its content (network elements and feature elements)- Specified by:
getSpatialModel
in interfaceNFEModel
- Returns:
- a spatial model instance
-
getManipulator
public NFEManipulator getManipulator()
Description copied from interface:NFEModel
Gets the manipulator instance which helps to perform some trivial feature-network operations over the model's content- Specified by:
getManipulator
in interfaceNFEModel
- Returns:
- a manipulator instance
-
getRulesModel
public NFERulesModel getRulesModel()
Description copied from interface:NFEModel
Gets the rules model associated to the current model. The rules model contains information of all the rule definitions and rules instances of the current model.- Specified by:
getRulesModel
in interfaceNFEModel
- Returns:
- a rules model instance
-
-