Class NFEBasicModelManipulator
- java.lang.Object
-
- oracle.spatial.network.nfe.model.edit.NFEBasicModelManipulator
-
- All Implemented Interfaces:
NFEManipulator
public class NFEBasicModelManipulator extends java.lang.Object implements NFEManipulator
The default implementation of NFEModelManipulator
-
-
Constructor Summary
Constructors Constructor Description NFEBasicModelManipulator(NFEModel model)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyFeatureClass(NFEFeature feature, NFEFeatureClass featClass)
Enforces all the attribute constraints defined in the feature class to the given featureNFEFeature
createFeature(NFEFeatureClass featClass)
Creates an empty Feature (with no Feature Element) of the specified Feature ClassNFEFeature
createLineFeature(NFEFeatureClass featClass, JGeometry lineGeom, boolean enforceRules, double tolerance)
Creates a new line feature and its corresponding feature element(s) and network elements.NFEFeatureElement
createLineFeatureElement(NFELink link, double startPos, double endPos, long featureLayerId, long sequence)
Creates a new feature containing one line feature element.NFELink
createLink(NFENode startNode, NFENode endNode)
Creates a new link.NFELink
createLink(NFENode startNode, NFENode endNode, JGeometry geom)
Creates a new link.NFENode
createNode(double[] pointOrds)
Creates a new node.NFENode
createNode(JGeometry geom)
Creates a new node.NFEFeature
createPointFeature(NFEFeatureClass featClass, JGeometry pointGeom, boolean enforceRules, double tolerance)
Creates a new feature of the given feature class, containing only a PON feature element and its corresponding node.NFEFeatureElement
createPOLFeatureElement(NFELink link, double pos, long featureLayerId, long sequence)
Creates a new feature containing one PointOnLink feature element.NFEFeatureElement
createPONFeatureElement(NFENode node, long featureLayerId, long sequence)
Creates a new feature containing one PointOnNode feature element.java.util.List<NFEFeature>
createPredefinedConnectedPointFeatures(java.util.Collection<NFEPredefinedConnectedPoint> predefConnPoints, JGeometry lineGeom)
Creates the predefined points defined in the line feature class along a line geometry using the predefined points position percentages.NFEFeature
createStandalonePointFeature(NFEFeatureClass featClass, JGeometry pointGeom)
Creates a new feature of the given feature class, containing only a PON feature element and its corresponding node.void
enforceRules(java.util.Collection<NFEFeatureElement> featElems, double tolerance)
Detect interactions and enforces rules if needed for the given feature elementsjava.util.Collection<NFEFeatureElement>
getAdjacentFeatureElements(NFEFeatureElement featElem, int depth)
Gets all the feature elements connected to the given feature elementNFEConnectionManager
getConnectionManager()
Gets the connection manager used by the current NFEModelNFEInteractionEngine
getInteractionEngine()
Gets the current interaction engine instanceNFERulesEngine
getRulesEngine()
Gets the rules engine instance that is currently used by the modelboolean
isAllowedPoint(double x, double y)
Tells whether a point is inside the boundaries defined by the model.boolean
isAllowedPoint(java.awt.geom.Point2D point)
Tells whether a point is inside the boundaries defined by the model.boolean
isAllowedRectangle(double x, double y, double w, double h)
Tells whether a rectangle is inside the boundaries defined by the model.boolean
isAllowedRectangle(java.awt.geom.Rectangle2D rectangle)
Tells whether a rectangle is inside the boundaries defined by the model.static boolean
isFeatureElementCompatibleWithFeatureClass(FeatureElement.FeatureElementType feType, NFEFeatureClass featureClass)
static boolean
isFeatureElementCompatibleWithNetworkElement(FeatureElement.FeatureElementType feType, NFENetworkElement networkElement)
boolean
isValidPoint(double x, double y)
Returns true if the point location is valid, false otherwise.NFEFeatureElement
moveFeatureElementToNetworkElement(NFEFeatureElement featElem, NFENetworkElement destNetElem, double destStartPos)
Changes a feature element's underlying network elementjava.util.Collection<NFENetworkElement>
removedDanglingNetworkElements(NFENetworkElement fromNetElem)
Removes any dangling network element connected to the given network element (including the passed network element if it is itself a dangling element).boolean
removeFeature(NFEFeature feature)
Removes a feature from the model along with its feature elements and network elementsboolean
removeFeatureElement(NFEFeatureElement featElem)
Removes a feature element from its feature along with the network element where the feature element is placed.void
reverseLineFeatureDirection(NFEFeature lineFeature)
Reverse the direction of all the links containing feature elements of the given featurevoid
reverseLinkDirection(NFELink link)
Changes the direction of a link by changing the order of its line ordinatesvoid
setFeatureActive(NFEFeature feature, boolean active)
Sets the feature's active propertyvoid
setFeatureBidirected(NFEFeature feature, boolean bidirected)
Sets whether a feature is bidirected or notvoid
setNetworkElementGeometry(NFENetworkElement netElem, JGeometry newGeom)
Sets a new geometry to the specified network element.void
setNetworkElementsGeometries(NFENetworkElement[] netElems, JGeometry[] newGeoms, boolean enforceRules, double tolerance)
Changes geometries to a group of network elements.void
updateLinkGeometry(NFELink link)
Updates the link's geometry so reflect the position of its start and end points.
-
-
-
Constructor Detail
-
NFEBasicModelManipulator
public NFEBasicModelManipulator(NFEModel model)
-
-
Method Detail
-
getConnectionManager
public NFEConnectionManager getConnectionManager()
Description copied from interface:NFEManipulator
Gets the connection manager used by the current NFEModel- Specified by:
getConnectionManager
in interfaceNFEManipulator
- Returns:
- a connection manager instance
-
getInteractionEngine
public NFEInteractionEngine getInteractionEngine()
Description copied from interface:NFEManipulator
Gets the current interaction engine instance- Specified by:
getInteractionEngine
in interfaceNFEManipulator
- Returns:
- an interaction engine instance
-
isAllowedPoint
public boolean isAllowedPoint(java.awt.geom.Point2D point)
Description copied from interface:NFEManipulator
Tells whether a point is inside the boundaries defined by the model. The boundaries are defined at the geometry descriptor when the model is created.- Specified by:
isAllowedPoint
in interfaceNFEManipulator
- Parameters:
point
- a java point instance- Returns:
- true if the point is inside the model boundaries
-
isAllowedPoint
public boolean isAllowedPoint(double x, double y)
Description copied from interface:NFEManipulator
Tells whether a point is inside the boundaries defined by the model. The boundaries are defined at the geometry descriptor when the model is created.- Specified by:
isAllowedPoint
in interfaceNFEManipulator
- Parameters:
x
- the point's x ordinatey
- the point's y ordinate- Returns:
- true if the point is inside the model boundaries
-
isAllowedRectangle
public boolean isAllowedRectangle(java.awt.geom.Rectangle2D rectangle)
Description copied from interface:NFEManipulator
Tells whether a rectangle is inside the boundaries defined by the model. The boundaries are defined at the geometry descriptor when the model is created.- Specified by:
isAllowedRectangle
in interfaceNFEManipulator
- Parameters:
rectangle
- a java rectangle instance- Returns:
- true if the rectangle is inside the model boundaries
-
isAllowedRectangle
public boolean isAllowedRectangle(double x, double y, double w, double h)
Description copied from interface:NFEManipulator
Tells whether a rectangle is inside the boundaries defined by the model. The boundaries are defined at the geometry descriptor when the model is created.- Specified by:
isAllowedRectangle
in interfaceNFEManipulator
- Parameters:
x
- the rectangle's lower left corner x ordinatey
- the rectangle's lower left corner y ordinatew
- the rectangle's widthh
- the rectangle's height- Returns:
-
isValidPoint
public boolean isValidPoint(double x, double y)
Description copied from interface:NFEManipulator
Returns true if the point location is valid, false otherwise. A point location is consider invalid if the location is outside the model boundaries.- Specified by:
isValidPoint
in interfaceNFEManipulator
- Parameters:
x
- the x of the pointy
- the y of the point- Returns:
- true if the point location is valid, false otherwise
-
removedDanglingNetworkElements
public java.util.Collection<NFENetworkElement> removedDanglingNetworkElements(NFENetworkElement fromNetElem)
Description copied from interface:NFEManipulator
Removes any dangling network element connected to the given network element (including the passed network element if it is itself a dangling element). In FromScratch mode, a network element is considered a dangling element if it is a link without features or an unconnected node without features.- Specified by:
removedDanglingNetworkElements
in interfaceNFEManipulator
- Parameters:
fromNetElem
- the network element from where the search begins- Returns:
- a collection containing all the removed dangling points
-
reverseLinkDirection
public void reverseLinkDirection(NFELink link)
Description copied from interface:NFEManipulator
Changes the direction of a link by changing the order of its line ordinates- Specified by:
reverseLinkDirection
in interfaceNFEManipulator
- Parameters:
link
- a link instance
-
setNetworkElementGeometry
public void setNetworkElementGeometry(NFENetworkElement netElem, JGeometry newGeom)
Sets a new geometry to the specified network element. All the connected network elements' geometries are updated accordingly.- Specified by:
setNetworkElementGeometry
in interfaceNFEManipulator
- Parameters:
netElem
-newGeom
-
-
setNetworkElementsGeometries
public void setNetworkElementsGeometries(NFENetworkElement[] netElems, JGeometry[] newGeoms, boolean enforceRules, double tolerance)
Description copied from interface:NFEManipulator
Changes geometries to a group of network elements. Optionally enforces rules. Tolerance is only required is enforce rules is true.- Specified by:
setNetworkElementsGeometries
in interfaceNFEManipulator
- Parameters:
netElems
- An array of network elements which geometries will be changednewGeoms
- An array of new geometries. The length of this array must be equal than the netElems array.enforceRules
- if true, rules will be executed for the changed elementstolerance
- tolerance used for detecting interactions if rules are enforced
-
removeFeature
public boolean removeFeature(NFEFeature feature)
Description copied from interface:NFEManipulator
Removes a feature from the model along with its feature elements and network elements- Specified by:
removeFeature
in interfaceNFEManipulator
- Parameters:
feature
- a feature instance- Returns:
- true if the feature was removed successfully
-
removeFeatureElement
public boolean removeFeatureElement(NFEFeatureElement featElem)
Description copied from interface:NFEManipulator
Removes a feature element from its feature along with the network element where the feature element is placed.- Specified by:
removeFeatureElement
in interfaceNFEManipulator
- Parameters:
featElem
- a feature element instance- Returns:
- true if the feature element was removed successfully
-
applyFeatureClass
public void applyFeatureClass(NFEFeature feature, NFEFeatureClass featClass)
Description copied from interface:NFEManipulator
Enforces all the attribute constraints defined in the feature class to the given feature- Specified by:
applyFeatureClass
in interfaceNFEManipulator
- Parameters:
feature
- a feature instancefeatClass
- a feature class instance
-
setFeatureActive
public void setFeatureActive(NFEFeature feature, boolean active)
Description copied from interface:NFEManipulator
Sets the feature's active property- Specified by:
setFeatureActive
in interfaceNFEManipulator
- Parameters:
feature
- a feature instanceactive
- the active property value
-
setFeatureBidirected
public void setFeatureBidirected(NFEFeature feature, boolean bidirected)
Description copied from interface:NFEManipulator
Sets whether a feature is bidirected or not- Specified by:
setFeatureBidirected
in interfaceNFEManipulator
- Parameters:
feature
- a feature instancebidirected
- true for bidirected
-
reverseLineFeatureDirection
public void reverseLineFeatureDirection(NFEFeature lineFeature)
Description copied from interface:NFEManipulator
Reverse the direction of all the links containing feature elements of the given feature- Specified by:
reverseLineFeatureDirection
in interfaceNFEManipulator
- Parameters:
lineFeature
- a line feature instance
-
moveFeatureElementToNetworkElement
public NFEFeatureElement moveFeatureElementToNetworkElement(NFEFeatureElement featElem, NFENetworkElement destNetElem, double destStartPos)
Description copied from interface:NFEManipulator
Changes a feature element's underlying network element- Specified by:
moveFeatureElementToNetworkElement
in interfaceNFEManipulator
- Parameters:
featElem
- the feature element to be modifieddestNetElem
- the new underlying network elementdestStartPos
- destination start position (in percent)- Returns:
- moved feature element
-
updateLinkGeometry
public void updateLinkGeometry(NFELink link)
Updates the link's geometry so reflect the position of its start and end points. If the link's geometry has not been set (it's null), it creates a straight line from the start to the end node.- Specified by:
updateLinkGeometry
in interfaceNFEManipulator
- Parameters:
link
-
-
isFeatureElementCompatibleWithFeatureClass
public static boolean isFeatureElementCompatibleWithFeatureClass(FeatureElement.FeatureElementType feType, NFEFeatureClass featureClass)
-
isFeatureElementCompatibleWithNetworkElement
public static boolean isFeatureElementCompatibleWithNetworkElement(FeatureElement.FeatureElementType feType, NFENetworkElement networkElement)
-
createFeature
public NFEFeature createFeature(NFEFeatureClass featClass)
Description copied from interface:NFEManipulator
Creates an empty Feature (with no Feature Element) of the specified Feature Class- Specified by:
createFeature
in interfaceNFEManipulator
- Parameters:
featClass
- A Feature Class instance. It is expected to be a well formed instance, containing a reference to the Feature Layer it belongs to.- Returns:
- a new empty feature instance
-
createPointFeature
public NFEFeature createPointFeature(NFEFeatureClass featClass, JGeometry pointGeom, boolean enforceRules, double tolerance)
Creates a new feature of the given feature class, containing only a PON feature element and its corresponding node.- Specified by:
createPointFeature
in interfaceNFEManipulator
- Parameters:
featClass
-pointGeom
-enforceRules
- if true, rules will be executed for this new point featuretolerance
- tolerance used for detecting interactions if rules are enforced- Returns:
-
createStandalonePointFeature
public NFEFeature createStandalonePointFeature(NFEFeatureClass featClass, JGeometry pointGeom)
Description copied from interface:NFEManipulator
Creates a new feature of the given feature class, containing only a PON feature element and its corresponding node. Neither, the feature or the network element are added to a feature layer nor the network- Specified by:
createStandalonePointFeature
in interfaceNFEManipulator
- Parameters:
featClass
- a point feature classpointGeom
- a java point instance- Returns:
-
createLineFeature
public NFEFeature createLineFeature(NFEFeatureClass featClass, JGeometry lineGeom, boolean enforceRules, double tolerance)
Creates a new line feature and its corresponding feature element(s) and network elements. If the feature class contains predefined point features they are created too. Feature elements are created accordingly.- Specified by:
createLineFeature
in interfaceNFEManipulator
- Parameters:
featClass
-lineGeom
-enforceRules
- whether rules must be enforced after creating the featuretolerance
- tolerance used for detecting interactions if rules are enforced- Returns:
-
createPredefinedConnectedPointFeatures
public java.util.List<NFEFeature> createPredefinedConnectedPointFeatures(java.util.Collection<NFEPredefinedConnectedPoint> predefConnPoints, JGeometry lineGeom)
Creates the predefined points defined in the line feature class along a line geometry using the predefined points position percentages.- Specified by:
createPredefinedConnectedPointFeatures
in interfaceNFEManipulator
- Parameters:
predefConnPoints
-lineGeom
-- Returns:
-
getAdjacentFeatureElements
public java.util.Collection<NFEFeatureElement> getAdjacentFeatureElements(NFEFeatureElement featElem, int depth)
Description copied from interface:NFEManipulator
Gets all the feature elements connected to the given feature element- Specified by:
getAdjacentFeatureElements
in interfaceNFEManipulator
- Parameters:
featElem
- a feature elementdepth
- for how many levels connected elements must be retrieved- Returns:
- a collection of connected feature elements
-
createNode
public NFENode createNode(double[] pointOrds)
Description copied from interface:NFEManipulator
Creates a new node. The node is added automatically to the network- Specified by:
createNode
in interfaceNFEManipulator
- Parameters:
pointOrds
- a point ordinates.- Returns:
- a new node instance
-
createNode
public NFENode createNode(JGeometry geom)
Description copied from interface:NFEManipulator
Creates a new node. The node is added automatically to the network- Specified by:
createNode
in interfaceNFEManipulator
- Parameters:
geom
- a point geometry- Returns:
- a new node instance
-
createLink
public NFELink createLink(NFENode startNode, NFENode endNode)
Description copied from interface:NFEManipulator
Creates a new link. The links geometry will be a straight line from startNode to endNode. The link is added automatically to the network.- Specified by:
createLink
in interfaceNFEManipulator
- Parameters:
startNode
- the link's start node. The node must exist in the network.endNode
- the link's end node. The node must exist in the network.- Returns:
- a new link instance
-
createLink
public NFELink createLink(NFENode startNode, NFENode endNode, JGeometry geom)
Description copied from interface:NFEManipulator
Creates a new link. The link is added automatically to the network.- Specified by:
createLink
in interfaceNFEManipulator
- Parameters:
startNode
- the link's start node. The node must exist in the network.endNode
- the link's end node. The node must exist in the network.geom
- a line string geometry- Returns:
- a new link instance
-
createPONFeatureElement
public NFEFeatureElement createPONFeatureElement(NFENode node, long featureLayerId, long sequence)
Description copied from interface:NFEManipulator
Creates a new feature containing one PointOnNode feature element. The feature is added automatically to its feature layer.- Specified by:
createPONFeatureElement
in interfaceNFEManipulator
- Parameters:
node
- the underlying nodefeatureLayerId
- the ID of feature Layer where the feature belongssequence
- the feature element's sequence number- Returns:
- a new feature element instance
-
createPOLFeatureElement
public NFEFeatureElement createPOLFeatureElement(NFELink link, double pos, long featureLayerId, long sequence)
Description copied from interface:NFEManipulator
Creates a new feature containing one PointOnLink feature element. The feature is added automatically to its feature layer.- Specified by:
createPOLFeatureElement
in interfaceNFEManipulator
- Parameters:
link
- the underlying linkpos
- position of the POL feature element. Relative to the link's lengthfeatureLayerId
- the ID of feature Layer where the feature belongssequence
- the feature element's sequence number- Returns:
- a new feature element instance
-
createLineFeatureElement
public NFEFeatureElement createLineFeatureElement(NFELink link, double startPos, double endPos, long featureLayerId, long sequence)
Description copied from interface:NFEManipulator
Creates a new feature containing one line feature element. The feature is added automatically to its feature layer.- Specified by:
createLineFeatureElement
in interfaceNFEManipulator
- Parameters:
link
- the underlying linkstartPos
- start position of the line feature element. Relative to the link's lengthendPos
- end position of the line feature element. Relative to the link's lengthfeatureLayerId
- the ID of the feature layer the feature belongssequence
- the feature element's sequence number- Returns:
- a new feature element instance
-
getRulesEngine
public NFERulesEngine getRulesEngine()
Description copied from interface:NFEManipulator
Gets the rules engine instance that is currently used by the model- Specified by:
getRulesEngine
in interfaceNFEManipulator
- Returns:
- a rules engine instance
-
enforceRules
public void enforceRules(java.util.Collection<NFEFeatureElement> featElems, double tolerance)
Description copied from interface:NFEManipulator
Detect interactions and enforces rules if needed for the given feature elements- Specified by:
enforceRules
in interfaceNFEManipulator
- Parameters:
featElems
- a collection of feature elementstolerance
- tolerance use for detecting interactions
-
-