public class NFEBasicModelManipulator extends java.lang.Object implements NFEManipulator
Constructor and Description |
---|
NFEBasicModelManipulator(NFEModel model) |
Modifier and Type | Method and Description |
---|---|
void |
applyFeatureClass(NFEFeature feature, NFEFeatureClass featClass)
Enforces all the attribute constraints defined in the feature class to the given feature
|
NFEFeature |
createFeature(NFEFeatureClass featClass)
Creates an empty Feature (with no Feature Element) of the specified Feature Class
|
NFEFeature |
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 elements
|
java.util.Collection<NFEFeatureElement> |
getAdjacentFeatureElements(NFEFeatureElement featElem, int depth)
Gets all the feature elements connected to the given feature element
|
NFEConnectionManager |
getConnectionManager()
Gets the connection manager used by the current NFEModel
|
NFEInteractionEngine |
getInteractionEngine()
Gets the current interaction engine instance
|
NFERulesEngine |
getRulesEngine()
Gets the rules engine instance that is currently used by the model
|
boolean |
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 element
|
java.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 elements
|
boolean |
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 feature
|
void |
reverseLinkDirection(NFELink link)
Changes the direction of a link by changing the order of its line ordinates
|
void |
setFeatureActive(NFEFeature feature, boolean active)
Sets the feature's active property
|
void |
setFeatureBidirected(NFEFeature feature, boolean bidirected)
Sets whether a feature is bidirected or not
|
void |
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.
|
public NFEBasicModelManipulator(NFEModel model)
public NFEConnectionManager getConnectionManager()
NFEManipulator
getConnectionManager
in interface NFEManipulator
public NFEInteractionEngine getInteractionEngine()
NFEManipulator
getInteractionEngine
in interface NFEManipulator
public boolean isAllowedPoint(java.awt.geom.Point2D point)
NFEManipulator
isAllowedPoint
in interface NFEManipulator
point
- a java point instancepublic boolean isAllowedPoint(double x, double y)
NFEManipulator
isAllowedPoint
in interface NFEManipulator
x
- the point's x ordinatey
- the point's y ordinatepublic boolean isAllowedRectangle(java.awt.geom.Rectangle2D rectangle)
NFEManipulator
isAllowedRectangle
in interface NFEManipulator
rectangle
- a java rectangle instancepublic boolean isAllowedRectangle(double x, double y, double w, double h)
NFEManipulator
isAllowedRectangle
in interface NFEManipulator
x
- the rectangle's lower left corner x ordinatey
- the rectangle's lower left corner y ordinatew
- the rectangle's widthh
- the rectangle's heightpublic boolean isValidPoint(double x, double y)
NFEManipulator
isValidPoint
in interface NFEManipulator
x
- the x of the pointy
- the y of the pointpublic java.util.Collection<NFENetworkElement> removedDanglingNetworkElements(NFENetworkElement fromNetElem)
NFEManipulator
removedDanglingNetworkElements
in interface NFEManipulator
fromNetElem
- the network element from where the search beginspublic void reverseLinkDirection(NFELink link)
NFEManipulator
reverseLinkDirection
in interface NFEManipulator
link
- a link instancepublic void setNetworkElementGeometry(NFENetworkElement netElem, JGeometry newGeom)
setNetworkElementGeometry
in interface NFEManipulator
netElem
-newGeom
-public void setNetworkElementsGeometries(NFENetworkElement[] netElems, JGeometry[] newGeoms, boolean enforceRules, double tolerance)
NFEManipulator
setNetworkElementsGeometries
in interface NFEManipulator
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 enforcedpublic boolean removeFeature(NFEFeature feature)
NFEManipulator
removeFeature
in interface NFEManipulator
feature
- a feature instancepublic boolean removeFeatureElement(NFEFeatureElement featElem)
NFEManipulator
removeFeatureElement
in interface NFEManipulator
featElem
- a feature element instancepublic void applyFeatureClass(NFEFeature feature, NFEFeatureClass featClass)
NFEManipulator
applyFeatureClass
in interface NFEManipulator
feature
- a feature instancefeatClass
- a feature class instancepublic void setFeatureActive(NFEFeature feature, boolean active)
NFEManipulator
setFeatureActive
in interface NFEManipulator
feature
- a feature instanceactive
- the active property valuepublic void setFeatureBidirected(NFEFeature feature, boolean bidirected)
NFEManipulator
setFeatureBidirected
in interface NFEManipulator
feature
- a feature instancebidirected
- true for bidirectedpublic void reverseLineFeatureDirection(NFEFeature lineFeature)
NFEManipulator
reverseLineFeatureDirection
in interface NFEManipulator
lineFeature
- a line feature instancepublic NFEFeatureElement moveFeatureElementToNetworkElement(NFEFeatureElement featElem, NFENetworkElement destNetElem, double destStartPos)
NFEManipulator
moveFeatureElementToNetworkElement
in interface NFEManipulator
featElem
- the feature element to be modifieddestNetElem
- the new underlying network elementdestStartPos
- destination start position (in percent)public void updateLinkGeometry(NFELink link)
updateLinkGeometry
in interface NFEManipulator
link
-public static boolean isFeatureElementCompatibleWithFeatureClass(FeatureElement.FeatureElementType feType, NFEFeatureClass featureClass)
public static boolean isFeatureElementCompatibleWithNetworkElement(FeatureElement.FeatureElementType feType, NFENetworkElement networkElement)
public NFEFeature createFeature(NFEFeatureClass featClass)
NFEManipulator
createFeature
in interface NFEManipulator
featClass
- A Feature Class instance. It is expected to be a well formed instance, containing a reference to the Feature Layer it belongs to.public NFEFeature createPointFeature(NFEFeatureClass featClass, JGeometry pointGeom, boolean enforceRules, double tolerance)
createPointFeature
in interface NFEManipulator
featClass
-pointGeom
-enforceRules
- if true, rules will be executed for this new point featuretolerance
- tolerance used for detecting interactions if rules are enforcedpublic NFEFeature createStandalonePointFeature(NFEFeatureClass featClass, JGeometry pointGeom)
NFEManipulator
createStandalonePointFeature
in interface NFEManipulator
featClass
- a point feature classpointGeom
- a java point instancepublic NFEFeature createLineFeature(NFEFeatureClass featClass, JGeometry lineGeom, boolean enforceRules, double tolerance)
createLineFeature
in interface NFEManipulator
featClass
-lineGeom
-enforceRules
- whether rules must be enforced after creating the featuretolerance
- tolerance used for detecting interactions if rules are enforcedpublic java.util.List<NFEFeature> createPredefinedConnectedPointFeatures(java.util.Collection<NFEPredefinedConnectedPoint> predefConnPoints, JGeometry lineGeom)
createPredefinedConnectedPointFeatures
in interface NFEManipulator
predefConnPoints
-lineGeom
-public java.util.Collection<NFEFeatureElement> getAdjacentFeatureElements(NFEFeatureElement featElem, int depth)
NFEManipulator
getAdjacentFeatureElements
in interface NFEManipulator
featElem
- a feature elementdepth
- for how many levels connected elements must be retrievedpublic NFENode createNode(double[] pointOrds)
NFEManipulator
createNode
in interface NFEManipulator
pointOrds
- a point ordinates.public NFENode createNode(JGeometry geom)
NFEManipulator
createNode
in interface NFEManipulator
geom
- a point geometrypublic NFELink createLink(NFENode startNode, NFENode endNode)
NFEManipulator
createLink
in interface NFEManipulator
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.public NFELink createLink(NFENode startNode, NFENode endNode, JGeometry geom)
NFEManipulator
createLink
in interface NFEManipulator
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 geometrypublic NFEFeatureElement createPONFeatureElement(NFENode node, long featureLayerId, long sequence)
NFEManipulator
createPONFeatureElement
in interface NFEManipulator
node
- the underlying nodefeatureLayerId
- the ID of feature Layer where the feature belongssequence
- the feature element's sequence numberpublic NFEFeatureElement createPOLFeatureElement(NFELink link, double pos, long featureLayerId, long sequence)
NFEManipulator
createPOLFeatureElement
in interface NFEManipulator
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 numberpublic NFEFeatureElement createLineFeatureElement(NFELink link, double startPos, double endPos, long featureLayerId, long sequence)
NFEManipulator
createLineFeatureElement
in interface NFEManipulator
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 numberpublic NFERulesEngine getRulesEngine()
NFEManipulator
getRulesEngine
in interface NFEManipulator
public void enforceRules(java.util.Collection<NFEFeatureElement> featElems, double tolerance)
NFEManipulator
enforceRules
in interface NFEManipulator
featElems
- a collection of feature elementstolerance
- tolerance use for detecting interactions