public class TopoMap
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BATCH_SIZE |
static int |
NOID |
static int |
UNIVERSE_FACE |
Constructor and Description |
---|
TopoMap(java.sql.Connection con, java.lang.String topoName, int numberOfEdges, int numberOfNodes, int numberOfFaces)
Constructs a TopoMap object with a database Connection object and topology name.
|
TopoMap(java.sql.Connection con, java.lang.String topoName, int numberOfEdges, int numberOfNodes, int numberOfFaces, TopoPreprocess tp)
Constructs a TopoMap object with a database Connection object and topology name, and an object which implements the TopoPreprocess interface for preprocessing on invocation of addXXXX methods
|
Modifier and Type | Method and Description |
---|---|
int |
addEdge(int node1, int node2, Point2DD[] coords)
Adds an Edge to the topology, making all necessary adjustments to the surrounding topological context.
|
int |
addIsolatedNode(int faceID, Point2DD p)
Adds an isolated node inside of a face when the face ID is known.
|
int |
addIsolatedNode(Point2DD p)
Adds an isolated node inside of a face when the face ID is not known.
|
int[] |
addLinearGeometry(JGeometry geom)
Adds a linear (line string) geometry to the topology, inserting edges and nodes as necessary based on the full intersection of the geometry with the edges and nodes in the topology graph.
|
int[] |
addLinearGeometry(Point2DD[] coords)
Adds a linear (line string) geometry to the topology, inserting edges and nodes as necessary based on the full intersection of the geometry with the edges and nodes in the topology graph.
|
int |
addLoop(int nodeID, Point2DD[] coords)
Adds an edge that loops and connects to the same node.
|
int |
addNode(int edgeID, Point2DD p, int coordIndex, boolean isNewShapePoint)
Adds a node to an edge, splitting the edge in the process.
|
int |
addPointGeometry(JGeometry geom)
Adds a point geometry to the topology.
|
int |
addPointGeometry(Point2DD coord)
Adds a point to the topology.
|
int[] |
addPolygonGeometry(JGeometry geom)
Adds a polygon geometry to the topology, inserting edges and nodes as necessary based on the full intersection of the geometry with the edges and nodes in the topology graph.
|
int[] |
addPolygonGeometry(Point2DD[] coords)
Adds a single polygon geometry to the topology, inserting edges and nodes as necessary based on the full intersection of the polygon with the edges and nodes in the topology graph.
|
void |
changeEdgeCoords(int edge, Point2DD[] coords)
Replaces the coordinate string for an edge without changing the topological context of the edge.
|
void |
changeEdgeCoords(int edge, Point2DD[] coords, java.util.ArrayList<java.lang.Integer> movedIsoNodes, java.util.ArrayList<java.lang.Integer> movedIsoEdges, boolean allowIsoMoves)
Replaces the coordinate string for an edge without changing the topological context of the edge.
|
void |
clearCache()
Clears all entities from the object cache.
|
void |
clearCacheForNLW()
Clears all entities from the object cache such that another loadWindow can be loaded witout doing a commit/rollback.
|
void |
clearPreprocess()
Clears the preprocessing listener for addXXXX methods
|
void |
closeStmt()
Closes the statement cursor.
|
void |
commitDB()
Commits any updates to the database and clears any row locks.
|
void |
createEdgeIndex()
Builds a ram-resident R-tree index for the edge cache.
|
void |
createFaceIndex()
Builds a ram-resident R-tree index for the face cache.
|
void |
dispose() |
boolean |
fixFaceMBRs()
Adjusts the MBRs of any faces in the cache whose instance MBR does not match MBR computed from the edges in the outer boundary of the face.
|
Point2DD[] |
getCacheBounds()
Determines the bounds of the data contained in the cache, using the index in the cache; useful for determining plot bounds, for example.
|
int |
getCacheEdgeCount()
Returns the number of edges in the cache.
|
int |
getCacheFaceCount()
Returns the number of faces in the cache.
|
int |
getCacheNodeCount()
Returns the number of nodes in the cache.
|
static java.sql.Connection |
getConnection(java.lang.String connectString, java.lang.String userID, java.lang.String passwd)
Static method to build a JDBC Connection object from a connection string, user ID, and password.
|
int |
getContainingFace(Point2DD p)
Overload provides the default behavior of getContaingFace(), that with allow_iso_coincidence false.
|
int |
getContainingFace(Point2DD p, boolean allow_iso_coincidence)
From the faces in the instance cache, determines the one, if any, that contains the test point in its open set.
|
Edge |
getEdge(int id)
Returns a reference to an Edge object given its logical ID.
|
java.util.ArrayList |
getEdgeAdditions()
Provides a list of the edges that have been added in the cache.
|
java.util.ArrayList<java.lang.Integer> |
getEdgeChanges()
Provides a list of the edges that have been changed in the cache.
|
java.util.ArrayList<java.lang.Integer> |
getEdgeDeletions()
Provides a list of the edges that have been marked as deleted in the cache: deleted since the cache topology was loaded from the database, but not yet removed from the database.
|
java.util.Iterator<Edge> |
getEdgeIterator()
Provides an Iterator for traversal of all the Edge objects contained in the instance cache.
|
Face |
getFace(int id)
Returns a reference to a Face object given its logical ID.
|
java.util.ArrayList<java.lang.Integer> |
getFaceAdditions()
Provides a list of the faces that have been added in the cache.
|
int[] |
getFaceBoundary(int faceID, int option)
Returns an array of edge IDs making up the boundary of a face, with several options
|
java.util.ArrayList<java.lang.Integer> |
getFaceChanges()
Provides a list of the faces that have been changed in the cache.
|
java.util.ArrayList<java.lang.Integer> |
getFaceDeletions()
Provides a list of the faces that have been marked as deleted in the cache: deleted since the cache topology was loaded from the database, but not yet removed from the database.
|
java.util.Iterator<Face> |
getFaceIterator()
Provides an Iterator for traversal of all the Face objects contained in the instance cache.
|
boolean |
getIsEditable()
Returns the editing state.
|
int |
getNearestEdge(Point2DD point)
Returns the ID of the Edge object that is nearest to the specified point.
|
int |
getNearestEdgeInCache(Point2DD point)
Returns the ID of the Edge object that of the edges loaded in the cache is nearest to the specified point.
|
int |
getNearestNode(Point2DD point)
Returns the ID of the Node object that is nearest to the specified point.
|
int |
getNearestNodeInCache(Point2DD p)
Returns the ID of the Node object that of the nodes loaded in the cache is nearest to the specified point.
|
Node |
getNode(int id)
Returns a reference to a Node object given its logical ID.
|
java.util.ArrayList |
getNodeAdditions()
Provides a list of the nodes that have been added in the cache.
|
java.util.ArrayList<java.lang.Integer> |
getNodeChanges()
Provides a list of the nodes that have been changed in the cache.
|
java.util.ArrayList<java.lang.Integer> |
getNodeDeletions()
Provides a list of the nodes that have been marked as deleted in the cache: deleted since the cache topology was loaded from the database, but not yet removed from the database.
|
int[] |
getNodeFaceStar(int nodeID)
Gets an array of integers representing the IDs of a clockwise enumeration of all the faces adjoining the given node.
|
java.util.Iterator<Node> |
getNodeIterator()
Provides an Iterator for traversal of all the Node objects contained in the instance cache.
|
int[] |
getNodeStar(int nodeID)
Gets an array of integers representing the IDs of a clockwise enumeration of all the edges connected to the given node.
|
int |
getNodeStarCount(int nodeID)
Gets a count of the number of edges connected at a node.
|
int |
getSrid()
Returns the SRID of the topology.
|
Point2DD[] |
getTopologyBounds()
Determines the bounds of the data contained in the database topology, using the spatial index in the database.
|
int |
getTopologyEdgeCount()
Returns the number of edges in the <topologyName>_EDGE$table.
|
int |
getTopologyFaceCount()
Returns the number of faces in the <topologyName>_FACE$table.
|
int |
getTopologyNodeCount()
Returns the number of nodes in the <topologyName>_NODE$table.
|
java.lang.String |
getTopoName()
Returns the name of the topology.
|
int |
getTopoTransactionID()
Returns the topology transaction ID if there is data loaded in the cache for update.
|
Edge |
loadEdge(int id)
Loads an edge from the database if the edge is not already in the cache.
|
Face |
loadFace(int id)
Loads a face from the database if the face is not already in the cache.
|
Node |
loadNode(int id)
Loads a node from the database if the node is not already in the cache.
|
boolean |
loadTopology(boolean lockForUpdate)
Loads the entire topology from the database into the instance cache.
|
boolean |
loadTopology(boolean lockForUpdate, boolean buildIndexes)
Loads the entire topology from the database into the instance cache.
|
boolean |
loadWindow(double xMin, double yMin, double xMax, double yMax, boolean lockForUpdate)
Loads a portion of the topology specified by a query window.
|
boolean |
loadWindow(double xMin, double yMin, double xMax, double yMax, boolean lockForUpdate, boolean buildIndexes)
Loads a portion of the topology specified by a query window.
|
boolean |
loadWindow(double xMin, double yMin, double xMax, double yMax, boolean lockForUpdate, boolean buildIndexes, boolean nextLoadWindow)
Loads a portion of the topology specified by a query window.
|
void |
moveEdge(int edgeID, int sNodeID, int tNodeID, Point2DD[] edgeCoords)
Moves one endpoint of an edge and changes the edge coordinates after checking that no topological changes would be required, other than some possible exceptions.
|
void |
moveEdge(int edgeID, int sNodeID, int tNodeID, Point2DD[] edgeCoords, java.util.ArrayList<java.lang.Integer> movedIsoNodes, java.util.ArrayList<java.lang.Integer> movedIsoEdges, boolean allowIsoMoves)
Moves one endpoint of an edge and changes the edge coordinates after checking that no topological changes would be required, other than some possible exceptions.
|
void |
moveIsolatedNode(int nodeID, Point2DD point)
Moves an isolated node.
|
void |
moveIsolatedNode(int nodeID, Point2DD point, boolean allowFaceChange)
Moves an isolated node to a new face.
|
void |
moveIsolatedNode(int nodeID, Point2DD point, int faceID)
Moves an isolated node to a new face.
|
void |
moveNode(int nodeID, Point2DD[][] edgesCoords)
Moves a node and its attached edges after checking that no topological changes would be required, except that island edges and nodes may change containing faces.
|
void |
moveNode(int nodeID, Point2DD[][] edgesCoords, java.util.ArrayList<java.lang.Integer> movedIsoNodes, java.util.ArrayList<java.lang.Integer> movedIsoEdges, boolean allowIsoMoves)
Moves a node and its attached edges after checking that no topological changes would be required.
|
void |
removeEdge(int edgeID)
Remove an edge, merging faces if there are different faces on each side of the edge.
|
void |
removeNode(int nodeID)
Removes an isolated node or a node at the joining of two edges, merging the edges into one.
|
boolean |
removeObsoleteNodes()
Removes any nodes in the cache which are connected to two and only two distinct edges, are not assigned to point features, and do not serve as the demarcation between mismatched linear features.
|
void |
rollbackDB()
Rolls back any updates to the database and clears any row locks.
|
boolean |
searchEdgeRTree(double[][] h, java.util.ArrayList a)
Return the list of edges from edgeRtree for the given query MBR.
|
boolean |
searchFaceRTree(double[][] h, java.util.ArrayList a)
Return the list of faces from faceRtree for the given query MBR.
|
void |
setPreprocess(TopoPreprocess tp)
Sets the preprocessing listener for addXXXX methods
|
double |
snapToGrid(double d)
Snaps a single double precision value to the instance grid
|
void |
snapToGrid(Point2DD p)
Snaps the coordinate pair of the argument Point2DD to the instance grid.
|
void |
snapToGrid(Point2DD[] p)
Snaps all the coordinate pairs of the array of Point2DD to the instance grid.
|
void |
updateTopology()
Updates to the database topological changes in the instance.
|
boolean |
validateCache()
Wrapper for validateCache(int level).
|
boolean |
validateCache(int level)
Performs a topological validation of the cache, checking the consistency of all pointer relationships in the edge/node/face graph.
|
public static final int NOID
public static final int UNIVERSE_FACE
public static final int BATCH_SIZE
public TopoMap(java.sql.Connection con, java.lang.String topoName, int numberOfEdges, int numberOfNodes, int numberOfFaces, TopoPreprocess tp) throws java.sql.SQLException, TopoEntityNotFoundException
con
- an Oracle Connection object (produced, for example, by a call to getConnection() )topoName
- the name of the topology in the databasenumberOfEdges
- best estimate of the number of edges to be loaded into the object cache at one time. Will not overflow if the estimate is too low.numberOfNodes
- like numberOfEdges; typically there will be half the number of edgesnumberOfFaces
- like numberOfEdges; typically there will be half the number of edgestp
- An implementation of the TopoPreprocess interfacejava.sql.SQLException
TopoEntityNotFoundException
public TopoMap(java.sql.Connection con, java.lang.String topoName, int numberOfEdges, int numberOfNodes, int numberOfFaces) throws java.sql.SQLException, TopoEntityNotFoundException
con
- an Oracle Connection object (produced, for example, by a call to getConnection() )topoName
- the name of the topology in the databasenumberOfEdges
- best estimate of the number of edges to be loaded into the object cache at one time. Will not overflow if the estimate is too low.numberOfNodes
- like numberOfEdges; typically there will be half the number of edgesnumberOfFaces
- like numberOfEdges; typically there will be half the number of edgesjava.sql.SQLException
TopoEntityNotFoundException
public static java.sql.Connection getConnection(java.lang.String connectString, java.lang.String userID, java.lang.String passwd) throws java.sql.SQLException, java.lang.ClassNotFoundException
connectString
- a connection string, for example: "jdbc:oracle:thin:@<host>:<port>:<sid>" - for a thin JDBC driver, or "jdbc:oracle:oci:@<host>:<port>:<sid>" - for a thick JDBC driveruserID
- user ID for databasepasswd
- the password for the user accountjava.sql.SQLException
- if cannot get connection from the databasejava.lang.ClassNotFoundException
- if unable to load the OracleDriver classpublic void snapToGrid(Point2DD p)
p
- the input pointpublic double snapToGrid(double d)
d
- the input doublepublic void snapToGrid(Point2DD[] p)
p
- the array of pointspublic void setPreprocess(TopoPreprocess tp)
tp
- An object implementing the TopoPreprocess interfacepublic void clearPreprocess()
public int getTopologyEdgeCount() throws java.sql.SQLException
java.sql.SQLException
public int getCacheEdgeCount()
public int getCacheNodeCount()
public int getCacheFaceCount()
public int getTopologyNodeCount() throws java.sql.SQLException
java.sql.SQLException
public int getTopologyFaceCount() throws java.sql.SQLException
java.sql.SQLException
public void createEdgeIndex() throws java.lang.Exception
java.lang.Exception
public void createFaceIndex() throws java.lang.Exception
java.lang.Exception
public void clearCache() throws java.sql.SQLException, InvalidTopoOperationException
java.sql.SQLException
InvalidTopoOperationException
public void clearCacheForNLW() throws java.sql.SQLException, InvalidTopoOperationException
java.sql.SQLException
InvalidTopoOperationException
public Point2DD[] getCacheBounds() throws InvalidTopoOperationException
InvalidTopoOperationException
public Point2DD[] getTopologyBounds() throws java.sql.SQLException, InvalidTopoOperationException
java.sql.SQLException
InvalidTopoOperationException
public boolean loadWindow(double xMin, double yMin, double xMax, double yMax, boolean lockForUpdate) throws java.sql.SQLException, TopoEntityNotFoundException, InvalidTopoOperationException, java.lang.Exception
If there is a prior transaction that has been initiated, it must be committed (via commitDB) or rolled back (via rollbackDB) before this method can be called for read-only access, even if the cache has been cleared. The lockForUpdate flag must be true if any edits are to be performed on the data. The client application will be able to delete, modify, or add elements only inside the window specified in the call to this routine. Data cannot be loaded if there is already data loaded. This method automatically builds indexes in the cache for edges and faces.
xMin
- the minimum x-value of the query windowyMin
- the minimum y-value of the query windowxMax
- the maximum x-value of the query windowyMax
- the maximum y-value of the query windowlockForUpdate
- set true if you intend to edit inside the window and update the database. The retrieved entities will be locked for update by others.java.sql.SQLException
TopoEntityNotFoundException
InvalidTopoOperationException
java.lang.Exception
public boolean loadWindow(double xMin, double yMin, double xMax, double yMax, boolean lockForUpdate, boolean buildIndexes) throws java.sql.SQLException, TopoEntityNotFoundException, InvalidTopoOperationException, java.lang.Exception
If there is a prior transaction that has been initiated, it must be committed (via commitDB) or rolled back (via rollbackDB) before this method can be called for read-only access, even if the cache has been cleared. The lockForUpdate flag must be true if any edits are to be performed on the data. The client application will be able to delete, modify, or add elements only inside the window specified in the call to this routine. Data cannot be loaded if there is already data loaded. At the user's option, the edges and faces can be indexed in the cache.
xMin
- The minimum x-value of the query windowyMin
- The minimum y-value of the query windowxMax
- The maximum x-value of the query windowyMax
- The maximum y-value of the query windowlockForUpdate
- set true if you intend to edit inside the window and update the database. The retrieved entities will be locked for update by others.buildIndexes
- set true to auto-build indexes in the cache for edges and facesjava.sql.SQLException
TopoEntityNotFoundException
InvalidTopoOperationException
java.lang.Exception
public boolean loadWindow(double xMin, double yMin, double xMax, double yMax, boolean lockForUpdate, boolean buildIndexes, boolean nextLoadWindow) throws java.sql.SQLException, TopoEntityNotFoundException, InvalidTopoOperationException, java.lang.Exception
If there is a prior transaction that has been initiated, this loadWindow method will continue that txn, provided a updateTopology() is issued before calling this method. The lockForUpdate flag must be true if any edits are to be performed on the data. The client application will be able to delete, modify, or add elements only inside the window specified in the call to this routine. Data cannot be loaded if there is already data loaded. At the user's option, the edges and faces can be indexed in the cache.
xMin
- The minimum x-value of the query windowyMin
- The minimum y-value of the query windowxMax
- The maximum x-value of the query windowyMax
- The maximum y-value of the query windowlockForUpdate
- set true if you intend to edit inside the window and update the database. The retrieved entities will be locked for update by others.buildIndexes
- set true to auto-build indexes in the cache for edges and facesnextLoadWindow
- set true if this is not the first loadWindow in a sequence of loadWindow operationsjava.sql.SQLException
TopoEntityNotFoundException
InvalidTopoOperationException
java.lang.Exception
public boolean loadTopology(boolean lockForUpdate) throws java.sql.SQLException, InvalidTopoOperationException, TopoEntityNotFoundException, java.lang.Exception
lockForUpdate
- whether the data is loaded read-only (false) or for editing (true).java.sql.SQLException
InvalidTopoOperationException
TopoEntityNotFoundException
java.lang.Exception
public boolean loadTopology(boolean lockForUpdate, boolean buildIndexes) throws java.sql.SQLException, InvalidTopoOperationException, TopoEntityNotFoundException, java.lang.Exception
lockForUpdate
- whether the data is loaded read-only (false) or for editing (true).buildIndexes
- whether (true) or not (false) to build edge and face indexesjava.sql.SQLException
InvalidTopoOperationException
TopoEntityNotFoundException
java.lang.Exception
public void updateTopology() throws java.sql.SQLException, TopoEntityNotFoundException, TopoValidationException, java.lang.Exception
If the data has not been validated (via a call to validateCache(0) ) since anything was changed, a call to validateCache(0) is made implicitly by this method before updating the database. If any exception except a TopoValidationException is raised, the connection is rolled back (which clears the cache implicitly) before the exception is rethrown.
java.sql.SQLException
TopoEntityNotFoundException
TopoValidationException
java.lang.Exception
public void commitDB() throws java.sql.SQLException, TopoEntityNotFoundException, TopoValidationException, java.lang.Exception
java.sql.SQLException
TopoEntityNotFoundException
TopoValidationException
java.lang.Exception
public void rollbackDB() throws java.sql.SQLException
java.sql.SQLException
public boolean searchEdgeRTree(double[][] h, java.util.ArrayList a)
h
- two dimensional array of doubles which are the minimum bounding MBR defining the search. The first index ranges over 0,1 (X and Y) and is the dimension of the space. The second index ranges over 0,1 and specifies the min and max.a
- The ArrayList holds the objects found to satisfy the search. Should be preallocated by the caller and set via the constructor or ensureCapacity(int) for expected result size (for efficiency). Will not overflow if undersized.public boolean searchFaceRTree(double[][] h, java.util.ArrayList a)
h
- two dimensional array of doubles which are the minimum bounding MBR defining the search. The first index ranges over 0,1 (X and Y) and is the dimension of the space. The second index ranges over 0,1 and specifies the min and max.a
- The ArrayList holds the objects found to satisfy the search. Should be preallocated by the caller and set via the constructor or ensureCapacity(int) for expected result size (for efficiency). Will not overflow if undersized.public Edge getEdge(int id) throws TopoEntityNotFoundException
id
- the entity's logical IDTopoEntityNotFoundException
public Node getNode(int id) throws TopoEntityNotFoundException
id
- the entity's logical IDTopoEntityNotFoundException
public Face getFace(int id) throws TopoEntityNotFoundException
id
- the entity's logical IDTopoEntityNotFoundException
public int[] getFaceBoundary(int faceID, int option) throws TopoEntityNotFoundException, TopoDataException
faceID
- The face for which the boundary edges are desiredoption
- What type of boundary return is desired (0, 1, or 2).
0 = external boundary ring without doubly traced edges (spurs)
1 = external and internal rings without spurs
2 = external and internal rings with spurs - i.e. the full, possibly degenerate, boundary
TopoEntityNotFoundException
TopoDataException
public int getNearestEdge(Point2DD point) throws java.sql.SQLException, TopoEntityNotFoundException
If there are changed, added, or deleted edges in the instance and if the database has not been updated to reflect those changes, the result of this operator may not reflect the true situation in the cache.
point
- the point for which the closest edge is soughtjava.sql.SQLException
TopoEntityNotFoundException
public int getNearestEdgeInCache(Point2DD point)
point
- the point for which the closest edge is soughtpublic int getNearestNode(Point2DD point) throws java.sql.SQLException, TopoEntityNotFoundException
If there are changed, added, or deleted nodes in the instance and if the database has not been updated to reflect those changes, the result of this operator may not reflect the true situation in the cache.
point
- the point for which the closest node is soughtjava.sql.SQLException
TopoEntityNotFoundException
public int getNearestNodeInCache(Point2DD p)
p
- the point for which the closest node is soughtpublic java.util.Iterator<Edge> getEdgeIterator()
public java.util.Iterator<Node> getNodeIterator()
public java.util.Iterator<Face> getFaceIterator()
public java.util.ArrayList<java.lang.Integer> getEdgeChanges()
public java.util.ArrayList<java.lang.Integer> getNodeChanges()
public java.util.ArrayList<java.lang.Integer> getFaceChanges()
public java.util.ArrayList getEdgeAdditions()
public java.util.ArrayList getNodeAdditions()
public java.util.ArrayList<java.lang.Integer> getFaceAdditions()
public java.util.ArrayList<java.lang.Integer> getEdgeDeletions()
public java.util.ArrayList<java.lang.Integer> getNodeDeletions()
public java.util.ArrayList<java.lang.Integer> getFaceDeletions()
public void moveIsolatedNode(int nodeID, Point2DD point, boolean allowFaceChange) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.sql.SQLException, java.lang.Exception
nodeID
- the ID of the node being movedpoint
- the new node coordinateallowFaceChange
- specify whether to allow the target face to be different from the containing face of nodeIDInvalidTopoOperationException
TopoEntityNotFoundException
java.sql.SQLException
java.lang.Exception
public void moveIsolatedNode(int nodeID, Point2DD point) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.sql.SQLException, java.lang.Exception
nodeID
- the ID of the node being movedpoint
- the new node coordinateInvalidTopoOperationException
TopoEntityNotFoundException
java.sql.SQLException
java.lang.Exception
public void moveIsolatedNode(int nodeID, Point2DD point, int faceID) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.sql.SQLException, java.lang.Exception
nodeID
- the ID of the node being movedpoint
- the new node coordinatefaceID
- the ID of the new face to contain the nodeInvalidTopoOperationException
TopoEntityNotFoundException
java.sql.SQLException
java.lang.Exception
public void moveNode(int nodeID, Point2DD[][] edgesCoords) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.lang.Exception, java.sql.SQLException
If the node is isolated, you must use the method moveIsolatedNode() which has a simpler interface.
nodeID
- the ID of the node being moved with its attached edgesedgesCoords
- an array of arrays of new edge coordinates for each attached edge, starting with the node start edge and proceeding in clockwise sequence as would be obtained by a call to getNodeStar(). The array for each edge must include the endpoints, match the others at the moved node and be unchanged at the other node, and be in the same sense as the original edge. Any loops which connect twice at the moved node should be in the array twice, again in the same sense.InvalidTopoOperationException
TopoEntityNotFoundException
java.lang.Exception
java.sql.SQLException
public void moveNode(int nodeID, Point2DD[][] edgesCoords, java.util.ArrayList<java.lang.Integer> movedIsoNodes, java.util.ArrayList<java.lang.Integer> movedIsoEdges, boolean allowIsoMoves) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.lang.Exception, java.sql.SQLException
If the node is isolated, you must use the method moveIsolatedNode(), which has a simpler interface.
If a SQLException is raised, the connection is rolled back (implicitly clearing the cache) before the exception is rethrown.
nodeID
- the ID of the node being moved with its attached edgesedgesCoords
- an array of arrays of new edge coordinates for each attached edge, starting with the node start edge and proceeding in clockwise sequence as would be obtained by a call to getNodeStar(). The array for each edge must include the endpoints, match the others at the moved node and be unchanged at the other node, and be in the same sense as the original edge. Any loops which connect twice at the moved node should be in the array twice, again in the same sense.movedIsoNodes
- allocate with default capacity; this method will fill it with the IDs of isolated nodes which change faces as a result of the movemovedIsoEdges
- allocate with default capacity; this method will fill it with the IDs of isolated edges which change faces as a result of the moveallowIsoMoves
- whether (true) or not (false) to allow a node move operation that would cause any isolated nodes or edges to be in a different face. If such moves are allowed and any do occur, the containing face information for such isolated nodes and edges is adjusted.InvalidTopoOperationException
TopoEntityNotFoundException
java.lang.Exception
java.sql.SQLException
public void moveEdge(int edgeID, int sNodeID, int tNodeID, Point2DD[] edgeCoords) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.lang.Exception, java.sql.SQLException
Because no topological changes are permitted at the unmoved end of the edge, this also precludes a loop edge being opened up or a non-loop edge being turned into a loop, and this will be trapped.
The edge to be moved must have different faces on each side. That means the edge is part of two face boundary components, at least one of which must be the outside boundary component of its face.
The node to which the end of the edge is moved must be located in one of the two boundary components of which the original edge is a part; that is, the node must be reachable in a trace starting with the edge's nextEdgeL or nextEdgeR. Note that it is possible for the two boundary components to be the inside and outside of the same component, in which case the destination node would be found in both.
Since no topological elements are allowed to be created or destroyed (or even modified in most cases), there are no changes to the relationships of features to topological elements as a result of this method.
edgeID
- the moved edgesNodeID
- the ID of the node from which the edge is detached (source node)tNodeID
- the ID of the node to which the edge is reattached (target node)edgeCoords
- an array of coordinates for the moved edge. The array must match the node coordinates at the new node and at the node at the other end, and be in the same sense as the old edge coordinates.InvalidTopoOperationException
TopoEntityNotFoundException
java.lang.Exception
java.sql.SQLException
public void moveEdge(int edgeID, int sNodeID, int tNodeID, Point2DD[] edgeCoords, java.util.ArrayList<java.lang.Integer> movedIsoNodes, java.util.ArrayList<java.lang.Integer> movedIsoEdges, boolean allowIsoMoves) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.lang.Exception, java.sql.SQLException
Because no topological changes are permitted at the unmoved end of the edge, this also precludes a loop edge being opened up or a non-loop edge being turned into a loop, and this will be trapped.
The edge to be moved must have different faces on each side. That means the edge is part of two face boundary components, at least one of which must be the outside boundary component of its face.
The node to which the end of the edge is moved must be located in one of the two boundary components of which the original edge is a part; that is, the node must be reachable in a trace starting with the edge's nextEdgeL or nextEdgeR. Note that it is possible for the two boundary components to be the inside and outside of the same component, in which case the destination node would be found in both.
Since no topological elements are allowed to be created or destroyed (or even modified in most cases), there are no changes to the relationships of features to topological elements as a result of this method.
If a SQLException is raised, the connection is rolled back (implicitly clearing the cache) before the exception is rethrown.
edgeID
- the moved edgesNodeID
- the ID of the node from which the edge is detached (source node)tNodeID
- the ID of the node to which the edge is reattached (target node)edgeCoords
- an array of coordinates for the moved edge. The array must match the node coordinates at the new node and at the node at the other end, and be in the same sense as the old edge coordinates.movedIsoNodes
- allocate with default capacity; this method will fill it with the IDs of isolated nodes which change faces as a result of the movemovedIsoEdges
- allocate with default capacity; this method will fill it with the IDs of isolated edges which change faces as a result of the moveallowIsoMoves
- whether (true) or not (false) to allow an edge move operation that would cause any isolated nodes or edges to be in a different face. If such moves are allowed and if any do occur, the containing face information for such isolated nodes and edges is adjusted.InvalidTopoOperationException
TopoEntityNotFoundException
java.lang.Exception
java.sql.SQLException
public int addEdge(int node1, int node2, Point2DD[] coords) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.sql.SQLException
If a SQLException is raised, the connection is rolled back (implicitly clearing the cache) before the exception is rethrown.
node1
- the logical ID of the start node of the new edgenode2
- the logical ID of the end node of the new edgecoords
- an array of points, including the endpoints (nodes), constituting the edgeInvalidTopoOperationException
TopoEntityNotFoundException
java.sql.SQLException
public int addLoop(int nodeID, Point2DD[] coords) throws TopoEntityNotFoundException, java.sql.SQLException, InvalidTopoOperationException
If a SQLException is raised, the connection is rolled back (implicitly clearing the cache) before the exception is rethrown.
nodeID
- the node to which the loop is to be connectedcoords
- array of points describing the loop, including the endpointsTopoEntityNotFoundException
java.sql.SQLException
- on database errorInvalidTopoOperationException
- if data is not loadedpublic int[] addLinearGeometry(JGeometry geom) throws InvalidTopoOperationException, java.sql.SQLException, TopoEntityNotFoundException, java.lang.Exception
Returns an array of the edge IDs of the inserted and shared edges in sequence from the start to the end of the geometry. The coordinate order of all inserted edges is in the same sense as the input geometry and are returned positive, but there may be edges shared with the original topology that are listed in negative sense.
geom
- an sdoapi geometry representing a single or multi- line-string in order from start to finishInvalidTopoOperationException
java.sql.SQLException
TopoEntityNotFoundException
java.lang.Exception
public int[] addLinearGeometry(Point2DD[] coords) throws InvalidTopoOperationException, java.sql.SQLException, TopoEntityNotFoundException, java.lang.Exception
Returns an array of the edge IDs of the inserted and shared edges in sequence from the start to the end of the geometry. The coordinate order of all inserted edges is in the same sense as the input geometry and are returned positive, but there may be edges shared with the original topology that are listed in negative sense.
coords
- an array of points representing a single line string in order from start to finishInvalidTopoOperationException
java.sql.SQLException
TopoEntityNotFoundException
java.lang.Exception
public int[] addPolygonGeometry(JGeometry geom) throws InvalidTopoOperationException, java.sql.SQLException, TopoEntityNotFoundException, java.lang.Exception
Returns an array of the face IDs of all the faces which are contained inside any of the outer rings and are outside any inner rings.
The geometry may not intersect itself and this will be trapped.
geom
- the geometry which must be one outer ring each with zero or more interior island ringsInvalidTopoOperationException
java.sql.SQLException
TopoEntityNotFoundException
java.lang.Exception
public int[] addPolygonGeometry(Point2DD[] coords) throws InvalidTopoOperationException, java.sql.SQLException, TopoEntityNotFoundException, java.lang.Exception
The polygon must be stored counterclockwise. The polygon may not intersect itself and this will be trapped.
coords
- an array of points representing the vertices of the polygon in counterclockwise order with the first vertex repeated in the lastInvalidTopoOperationException
java.sql.SQLException
TopoEntityNotFoundException
java.lang.Exception
public boolean fixFaceMBRs() throws TopoEntityNotFoundException, InvalidTopoOperationException
TopoEntityNotFoundException
InvalidTopoOperationException
public boolean removeObsoleteNodes() throws TopoEntityNotFoundException, java.sql.SQLException
TopoEntityNotFoundException
java.sql.SQLException
public int addPointGeometry(JGeometry geom) throws InvalidTopoOperationException, java.sql.SQLException, TopoEntityNotFoundException, java.lang.Exception
geom
- the geometry which represents the pointInvalidTopoOperationException
java.sql.SQLException
TopoEntityNotFoundException
java.lang.Exception
public int addPointGeometry(Point2DD coord) throws InvalidTopoOperationException, java.sql.SQLException, TopoEntityNotFoundException, java.lang.Exception
coord
- the pointInvalidTopoOperationException
java.sql.SQLException
TopoEntityNotFoundException
java.lang.Exception
public void changeEdgeCoords(int edge, Point2DD[] coords) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.sql.SQLException
The changed edge coordinates cannot move the nodes at the endpoints. If that is desired, the edge must be deleted, the node(s) deleted (if permissible), and new node(s) and edge added, or you must use the moveNode() and/or moveEdge() methods.
The changed edge cannot reorder the node stars at the edge endpoints. The changed edge cannot be such as to reverse the faces on the left and right sides in the case of different faces on the two sides.
If a SQLException is raised, the connection is rolled back (implicitly clearing the cache) before the exception is rethrown.
edge
- the edge ID of the edge to be spatially changedcoords
- the new coordinates of the edge, including the node coordinates at both ends, which must match the existing node coordinates and therefore the terminal coordinates of the existing edge. The direction of the edge must also be preserved.InvalidTopoOperationException
TopoEntityNotFoundException
java.sql.SQLException
public void changeEdgeCoords(int edge, Point2DD[] coords, java.util.ArrayList<java.lang.Integer> movedIsoNodes, java.util.ArrayList<java.lang.Integer> movedIsoEdges, boolean allowIsoMoves) throws InvalidTopoOperationException, TopoEntityNotFoundException, java.sql.SQLException
The changed edge coordinates cannot move the nodes at the endpoints. If that is desired, the edge must be deleted, the node(s) deleted (if permissible), and new node(s) and edge added, or you must use the moveEdge() and/or moveNode() methods.
The changed edge cannot reorder the node stars at the edge endpoints. The changed edge cannot be such as to reverse the faces on the left and right sides in the case of different faces on the two sides.
If a SQLException is raised, the connection is rolled back (implicitly clearing the cache) before the exception is rethrown.
edge
- the edge ID of the edge to be spatially changedcoords
- the new coordinates of the edge, including the node coordinates at both ends, which must match the existing node coordinates and therefore the terminal coordinates of the existing edge. The direction of the edge must also be preserved.movedIsoNodes
- allocate with default capacity; this method will fill it with the IDs of isolated nodes which change faces as a result of the changemovedIsoEdges
- allocate with default capacity; this method will fill it with the IDs of isolated edges which change faces as a result of the changeallowIsoMoves
- whether (true) or not (false) to allow the move of isolated entities, and to adjust edge coordinates and island reassignments as needed.InvalidTopoOperationException
TopoEntityNotFoundException
java.sql.SQLException
public int addNode(int edgeID, Point2DD p, int coordIndex, boolean isNewShapePoint) throws TopoEntityNotFoundException, InvalidTopoOperationException, java.sql.SQLException
If a SQLException is raised, the connection is rolled back (implicitly clearing the cache) before the exception is rethrown.
edgeID
- the edge to be split by the added node (positive sense only)p
- the Point2DD representing the position of the added nodecoordIndex
- the index of the array position in the edge coord array on or after which the node is to be added (index is 0 for start)isNewShapePoint
- true if the added node is to be a new shape point following the indexed vertex of the edge; false if the added node is to be exactly on the exactly on the indexed vertexTopoEntityNotFoundException
InvalidTopoOperationException
java.sql.SQLException
public int addIsolatedNode(Point2DD p) throws TopoEntityNotFoundException, InvalidTopoOperationException, java.sql.SQLException, java.lang.Exception
p
- coordinates of the nodeTopoEntityNotFoundException
InvalidTopoOperationException
java.sql.SQLException
java.lang.Exception
public int addIsolatedNode(int faceID, Point2DD p) throws TopoEntityNotFoundException, InvalidTopoOperationException, java.sql.SQLException
faceID
- the logical ID of the facep
- coordinates of the nodeTopoEntityNotFoundException
InvalidTopoOperationException
java.sql.SQLException
public void removeNode(int nodeID) throws InvalidTopoOperationException, java.sql.SQLException, TopoEntityNotFoundException
If a SQLException is raised, the connection is rolled back (implicitly clearing the cache) before the exception is rethrown.
nodeID
- the node to be removedInvalidTopoOperationException
java.sql.SQLException
TopoEntityNotFoundException
public void removeEdge(int edgeID) throws java.sql.SQLException, TopoEntityNotFoundException, InvalidTopoOperationException
If a linear feature is associated with the edge, if different area features are associated with the faces on the two sides in the merge face case, or if any portion of the edge is outside the editable window, an InvalidTopoOperationException is thrown. If the edge does not exist an InvalidTopoOperationException is also thrown. If any other exception is raised, the connection is rolled back (which implicitly clears the cache) before the exception is rethrown.
edgeID
- the edge to be removedjava.sql.SQLException
TopoEntityNotFoundException
InvalidTopoOperationException
public boolean validateCache() throws TopoValidationException, TopoEntityNotFoundException, java.sql.SQLException, java.lang.Exception
TopoValidationException
TopoEntityNotFoundException
java.sql.SQLException
java.lang.Exception
public boolean validateCache(int level) throws TopoValidationException, TopoEntityNotFoundException, java.sql.SQLException, java.lang.Exception
level
- whether to check computational geometry (0 or 1).
0 = without computational geometry: face trace closure including infinite loop trap; edge next/previous pointer consistency; edges meet at common nodes; island nodes point back to faces; all edges on a face boundary (inner and outer) link to the face.
1 = all of level 0, plus computational geometry: island entities are inside face outer boundary; no edge intersects itself or another edge; end coordinates of edges match node coordinates; node stars are properly ordered geometrically.
TopoValidationException
- if an error is found in any testjava.lang.Exception
- if there is some missing data during computational geometry checksvalidateCacheTopoEntityNotFoundException
- if some entity cannot be found and is pointed to by another entityjava.sql.SQLException
public int getContainingFace(Point2DD p) throws TopoEntityNotFoundException, java.sql.SQLException, java.lang.Exception
p
- the test pointTopoEntityNotFoundException
java.sql.SQLException
java.lang.Exception
public int getContainingFace(Point2DD p, boolean allow_iso_coincidence) throws TopoEntityNotFoundException, java.sql.SQLException, java.lang.Exception
If the point is exactly on an edge or node, NOID is returned. EXCEPT: If allow_iso_coincidence is passed true the method will return a face ID if the point is inside the outer boundary of the face but coincident with an isolated node or isolated dendritic edge (same face both sides) contained in the face.
If a point is found not to be in any of the finite faces in the cache several situations exist for the return:
1. The whole topology has been cached -- returns UNIVERSE_FACE
2. A window has been loaded and:
a. The point is outside the window -- returns NOID
b. The point is inside the window -- returns UNIVERSE_FACE
3. Neither a window nor the whole topology has been loaded -- returns NOID
p
- the test point.allow_iso_coincidence
- whether to ignore iso coincidence of test pointTopoEntityNotFoundException
java.sql.SQLException
java.lang.Exception
public int getNodeStarCount(int nodeID) throws TopoEntityNotFoundException
TopoEntityNotFoundException
public int[] getNodeStar(int nodeID) throws TopoEntityNotFoundException
If there are loops connected to the node, edges may appear in the list twice with opposite signs.
TopoEntityNotFoundException
public int[] getNodeFaceStar(int nodeID) throws TopoEntityNotFoundException, java.sql.SQLException
TopoEntityNotFoundException
java.sql.SQLException
public Edge loadEdge(int id) throws TopoEntityNotFoundException, InvalidTopoOperationException, java.sql.SQLException
TopoEntityNotFoundException
InvalidTopoOperationException
java.sql.SQLException
public Node loadNode(int id) throws TopoEntityNotFoundException, java.sql.SQLException, InvalidTopoOperationException
TopoEntityNotFoundException
java.sql.SQLException
InvalidTopoOperationException
public Face loadFace(int id) throws TopoEntityNotFoundException, java.sql.SQLException, InvalidTopoOperationException
TopoEntityNotFoundException
java.sql.SQLException
InvalidTopoOperationException
public int getSrid()
public int getTopoTransactionID()
public java.lang.String getTopoName()
public boolean getIsEditable()
public void closeStmt() throws java.sql.SQLException
java.sql.SQLException
- if a database error occurspublic void dispose()