![]() |
MapLink Pro 11.2
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This class represents a generic network of nodes and links, where the nodes are TSLNode objects and the links are TSLLink objects. A link inserted between two nodes is considered uni-directional; therefore 2 links are required for bi-directional linkage.
The network also introduces the concept of inter-link relationships (turns). For example, in a road network, whilst two junctions may be physically connected, traffic may be prohibited from following a particular set of links (e.g. no left turn at a junction). A traditional solution to this is to locally expand the number of junction nodes and create 'dummy' one-way links which can lead to an explosion of nodes and links. The solution used by MapLink is to allow clients to specify relationships between links, where this is required. The absence of such a relationship implies freedom of connection between corresponding links. This allows clients to create networks corresponding directly to those in their problem domain; to then add the costs of inter-link communication where necessary, again corresponding directly to the problem domain. The accompanying route-traversal class is intelligent enough to use this information for routing network flow appropriately.
A Spatial Index can be created that provides a more efficient search mechanism for links. Functions exist to query the Spatial Index status, invalidate it and to update it. Additionally, the Spatial Index can be saved to a file and loaded from a previously stored file. It is advisable to save the Spatial Index, when the Network is stable, as it is much quicker to load from file than to recreate it. Adding nodes or links invalidates the Spatial Index. However, if a link's geometry is changed, the user should invalidate the Spatial Index explicitly.
Classes | |
class | const_link_iterator |
class | const_node_iterator |
class | const_turn_iterator |
class | link_iterator |
class | node_iterator |
class | Query |
class | Streamer |
class | turn_iterator |
Public Types | |
enum | find_type { tsl_nwk_find_nodes = 0 , tsl_nwk_find_links = 1 , tsl_nwk_find_both = 2 } |
bool TSLNetwork::appendNetwork | ( | TSLNetwork * | other | ) |
Append one network to another. Invalidates the other network.
other | Pointer to the network to append. |
Return true on success, false otherwise.
bool TSLNetwork::appendNetworkCopy | ( | const TSLNetwork * | other | ) |
Append a copy of one network to another.
other | Pointer to the network to append. |
Return true on success, false otherwise.
link_iterator TSLNetwork::begin_links | ( | ) |
Access method for links in the network.
Returns a link_iterator to the first link.
const_link_iterator TSLNetwork::begin_links | ( | ) | const |
Access method (const) for links in the network.
Returns a const_link_iterator to the first link.
const_link_iterator TSLNetwork::begin_links | ( | const const_node_iterator & | it | ) | const |
Access method (const) for the links outgoing from a given node in the network.
it | Reference to the node iterator. |
link_iterator TSLNetwork::begin_links | ( | const node_iterator & | it | ) |
Access method for the links outgoing from a given node in the network.
it | Reference to the node iterator. |
link_iterator TSLNetwork::begin_links | ( | int | src | ) |
Access method for the links outgoing from a given node in the network.
src | The index of the node. |
const_link_iterator TSLNetwork::begin_links | ( | int | src | ) | const |
Access method (const) for the links outgoing from a given node in the network.
src | The index of the node. |
node_iterator TSLNetwork::begin_nodes | ( | ) |
Access method for nodes in the network.
Returns a node_iterator to the first node.
const_node_iterator TSLNetwork::begin_nodes | ( | ) | const |
Access method (const ) for nodes in the network.
Returns a const_node_iterator to the first node.
turn_iterator TSLNetwork::begin_turns | ( | ) |
Access method for turns in the network.
Returns a turn_iterator to the first turn.
const_turn_iterator TSLNetwork::begin_turns | ( | ) | const |
Access method (const) for turns in the network.
Returns a const_turn_iterator to the first turn.
const_turn_iterator TSLNetwork::begin_turns | ( | const const_node_iterator & | it | ) | const |
Access method (const) for the turns outgoing from a given node in the network.
it | A reference to the const node iterator. |
turn_iterator TSLNetwork::begin_turns | ( | const node_iterator & | it | ) |
Access method for the turns outgoing from a given node in the network.
it | A reference to the node iterator. |
turn_iterator TSLNetwork::begin_turns | ( | int | src | ) |
Access method for the turns outgoing from a given node in the network.
src | The index of the node. |
const_turn_iterator TSLNetwork::begin_turns | ( | int | src | ) | const |
Access method (const) for the turns outgoing from a given node in the network.
src | The index of the node. |
int TSLNetwork::capacity | ( | ) | const |
void TSLNetwork::clear | ( | ) |
Removes all the nodes, links and turns.
void TSLNetwork::clear_links | ( | ) |
Removes all links (& therefore any associated turns).
void TSLNetwork::clear_turns | ( | ) |
Removes all the turns.
void TSLNetwork::destroy | ( | ) |
Deletes the TSLNetwork object (but does not delete contained node & link objects).
bool TSLNetwork::empty | ( | ) |
Query method for nodes in the network.
Returns true if there are no nodes in the network, false otherwise.
bool TSLNetwork::empty_links | ( | ) |
Query method for links in the network.
Returns true if there are no links in the network, false otherwise.
bool TSLNetwork::empty_turns | ( | ) |
Query method for turns in the network.
Returns true if there are no turns in the network, false otherwise.
link_iterator TSLNetwork::end_links | ( | ) |
Access method for links in the network.
Returns a link_iterator to one past the last link.
const_link_iterator TSLNetwork::end_links | ( | ) | const |
Access method (const) for links in the network.
Returns a const_link_iterator to one past the last link.
const_link_iterator TSLNetwork::end_links | ( | const const_node_iterator & | it | ) | const |
Access method (const) for the links outgoing from a given node in the network.
it | A reference to the const node iterator. |
link_iterator TSLNetwork::end_links | ( | const node_iterator & | it | ) |
Access method for the links outgoing from a given node in the network.
it | A reference to the node iterator. |
link_iterator TSLNetwork::end_links | ( | int | src | ) |
Access method for the links outgoing from a given node in the network.
src | The index of the node. |
const_link_iterator TSLNetwork::end_links | ( | int | src | ) | const |
Access method (const) for the links outgoing from a given node in the network.
src | The index of the node. |
node_iterator TSLNetwork::end_nodes | ( | ) |
Access method for nodes in the network.
Returns a node_iterator to one past the last node.
const_node_iterator TSLNetwork::end_nodes | ( | ) | const |
Access method (const) for nodes in the network.
Returns a const_node_iterator to one past the last node.
turn_iterator TSLNetwork::end_turns | ( | ) |
Access method for turns in the network.
Returns a turn_iterator to one past the last turn.
const_turn_iterator TSLNetwork::end_turns | ( | ) | const |
Access method (const) for turns in the network.
Returns a const_turn_iterator to one past the last turn.
const_turn_iterator TSLNetwork::end_turns | ( | const const_node_iterator & | it | ) | const |
Access method (const) for the turns outgoing from a given node in the network.
it | A reference to the const node iterator. |
turn_iterator TSLNetwork::end_turns | ( | const node_iterator & | it | ) |
Access method for the turns outgoing from a given node in the network.
it | A reference to the node iterator. |
turn_iterator TSLNetwork::end_turns | ( | int | src | ) |
Access method for the turns outgoing from a given node in the network.
src | The index of the node. |
const_turn_iterator TSLNetwork::end_turns | ( | int | src | ) | const |
Access method (const) for the turns outgoing from a given node in the network.
src | The index of the node. |
link_iterator TSLNetwork::erase_links | ( | const link_iterator & | first, |
const link_iterator & | last ) |
Remove the links in the range [first, last).
first | A reference to the link_iterator pointing to the first link to remove. |
last | A reference to the link_iterator pointing to the last link. |
link_iterator TSLNetwork::erase_links | ( | const link_iterator & | it | ) |
Remove the link pointed to by the link_iterator.
it | A reference to the link_iterator pointing to the link to remove. |
void TSLNetwork::erase_links | ( | int | dest | ) |
Remove all links that have the given node as their destination.
dest | The index of the destination node. |
node_iterator TSLNetwork::erase_nodes | ( | const node_iterator & | first, |
const node_iterator & | last ) |
Remove the nodes in the range [first, last).
first | A reference to the node_iterator pointing to the first node to remove. |
last | A reference to the node_iterator pointing to the last node. |
node_iterator TSLNetwork::erase_nodes | ( | const node_iterator & | it | ) |
Remove the node pointed to by the node_iterator.
it | A reference to the node_iterator pointing to the node to remove. |
node_iterator TSLNetwork::erase_nodes | ( | int | first, |
int | last ) |
Remove the nodes in the range [first, last).
first | The index of the first node to remove. |
last | The index of the last node. |
node_iterator TSLNetwork::erase_nodes | ( | int | src | ) |
Remove the node at the given index.
src | The index of the node to remove. |
void TSLNetwork::erase_turns | ( | const link_iterator & | it | ) |
Remove all the turns associated with the given link_iterator.
it | A reference to the link_iterator pointing to the link. |
void TSLNetwork::erase_turns | ( | int | the_node | ) |
Remove all the turns that are associated with the given node.
the_node | The index of the node. |
Query * TSLNetwork::find | ( | const TSLEnvelope & | extent, |
const TSLNwkFinder & | filter, | ||
find_type | filter_mode = tsl_nwk_find_both ) const |
Returns a query object which contains the elements satisfying the filter criteria and search mode supplied by the client. Checks the status of the Spatial Index. If the Spatial Index is valid, then if links are being searched for the Spatial Index is used.
extent | The region to query. |
filter | A reference finder object. filter_mode: Any of TSLNetwork::tsl_nwk_find_nodes / tsl_nwk_find_links / tsl_nwk_find_both.. |
const_link_iterator TSLNetwork::find_link | ( | const TSLCoord & | location, |
int | aperture ) const |
Finds the nearest link based on location and (square) aperture. Checks the status of the Spatial Index. If the Spatial Index is valid, then the Spatial Index is used.
location | The centre point of area to search. |
aperture | The distance from the centre point to search. |
Query * TSLNetwork::find_links | ( | const TSLCoord & | location, |
int | aperture, | ||
const TSLNwkFinder * | filter = NULL, | ||
int | limit = -1, | ||
bool | useSpatialIndex = true ) |
Function that returns a set (Query) of Links within the boundary of the search area, dependent on additional optional filter logic. If the Spatial Index is valid, then it is used for the search and the links within the query object are ordered by distance and the distance is also stored in the query. All links should be within the aperture distance set. Initially, the set should contain all the Links that are within the boundary of the aperture from the location. This can be reduced by the optional filter and limit. If the Limit is supplied then the query object is restricted to return only this number of links or less. The limit is only used if the Spatial Index is valid.
location | The centre point of area to search. |
aperture | The distance from the centre point to search. |
filter | Optional Filter object. |
limit | Optional limit on the number of links to return. |
useSpatialIndex | If true the spatial index for the loaded network will be used if it is valid. If no spatial index is available then the standard search method will be used. Defaults to true. |
const_node_iterator TSLNetwork::find_node | ( | const TSLCoord & | location, |
int | aperture ) const |
Finds the nearest node based on location and (square) aperture.
location | The centre point of area to search. |
aperture | The distance from the centre point to search. |
TSLNode & TSLNetwork::get_node | ( | int | pos | ) |
Access method for nodes.
pos | The index position. |
const TSLNode & TSLNetwork::get_node | ( | int | pos | ) | const |
Access method (const) for nodes.
pos | The index position. |
link_iterator TSLNetwork::insert_link | ( | const link_iterator & | link_it, |
const node_iterator & | dest_it, | ||
const TSLLink & | the_link = TSLLink() ) |
Inserts a link between two nodes in the network, given the source node's link _iterator and the node_iterator object for the destination node.
link_it | A reference to the source link_iterator. |
dest_it | A reference to the destination node_iterator. |
the_link | A reference to the link to insert. |
link_iterator TSLNetwork::insert_link | ( | const node_iterator & | src_it, |
const node_iterator & | dest_it, | ||
const TSLLink & | the_link = TSLLink() ) |
Inserts a link between two nodes in the network, given the node_iterator objects for the source and destination nodes.
src_it | A reference to the source node_iterator. |
dest_it | A reference to the destination node_iterator. |
the_link | A reference to the link to insert. |
Insert a link between two nodes given the iterators to both nodes.
link_iterator TSLNetwork::insert_link | ( | int | src, |
int | dest, | ||
const TSLLink & | the_link = TSLLink() ) |
Inserts a link between two nodes in the network, given the index position of the source and destination nodes.
src | The source node index. |
dest | The destination node index. |
the_link | A reference to the link to insert. |
link_iterator TSLNetwork::insert_link_between | ( | int | src, |
int | dest, | ||
const TSLLink & | the_link = TSLLink() ) |
Inserts a link between two nodes in the network, given the index position of the source and destination nodes.
The destination node need not exist.
This method is provided to aid in constructing tiled networks.
src | The source node index. |
dest | The destination node index. |
the_link | A reference to the link to insert. |
node_iterator TSLNetwork::insert_nodes | ( | const node_iterator & | it, |
const TSLNode & | the_node = TSLNode() ) |
Inserts a node into the network, before the node pointed to by the given node _iterator.
it | A reference to the node iterator. |
the_node | A reference to the node to insert. |
void TSLNetwork::insert_nodes | ( | const node_iterator & | it, |
int | N, | ||
const TSLNode & | the_node = TSLNode() ) |
Inserts a repetition of N nodes of value the_node into the network, before the node pointed to by the given node_iterator.
it | A reference to the node iterator. |
N | The number of nodes required. |
the_node | A reference to the node to insert. |
turn_iterator TSLNetwork::insert_turn | ( | const link_iterator & | src_it, |
const link_iterator & | dest_it, | ||
const TSLTurn & | the_turn = TSLTurn() ) |
Inserts a turn (inter-link relationship) between two links in the network, given the link_iterator objects of the source and destination links.
src_it | A reference to the source link_iterator. |
dest_it | A reference to the destination link_iterator. |
the_turn | A reference to the turn to insert. |
turn_iterator TSLNetwork::insert_turn | ( | int | src, |
int | dest, | ||
int | via, | ||
const TSLTurn & | the_turn = TSLTurn() ) |
Inserts a turn (inter-link relationship) between two links in the network, given the source, destination & via node index positions.
src | The source node index. |
dest | The destination node index. |
via | The via node index. |
the_turn | A reference to the turn to insert. |
void TSLNetwork::invalidateSpatialIndex | ( | ) |
Function that invalidates the Spatial Index. An example of when to use this function would be when a Link has had its geometry changed.
bool TSLNetwork::isEdgeNode | ( | int | index | ) | const |
Returns true if the node is an edge node, false otherwise.
index | the index position of the node |
bool TSLNetwork::isStitchNode | ( | int | index | ) | const |
Returns true if the node is a stitch node, false otherwise.
index | the index position of the node |
const TSLNode & TSLNetwork::linkDestinNode | ( | const const_link_iterator & | it | ) | const |
Query method for links.
it | A reference to the const_link_iterator pointing to the link. |
int TSLNetwork::linkDestinNodePos | ( | const const_link_iterator & | it | ) | const |
Query method for links.
it | A reference to the const_link_iterator pointing to the link. |
bool TSLNetwork::linkNodes | ( | const const_link_iterator & | it, |
TSLNode & | src, | ||
TSLNode & | dst ) const |
Query method for links. Returns the link's source & destination Node objects, via the supplied arguments.
it | A reference to the const_link_iterator pointing to the link. |
src | A reference to the link's source Node object. |
dst | A reference to the link's destination Node object. |
Query method for links. Returns the link's source & destination Node objects, via the supplied arguments.
link | A reference to the Link object. |
src | A reference to the link's source Node object. |
dst | A reference to the link's destination Node object. |
Streamer TSLNetwork::links | ( | ) |
This method extracts the network links for subsequent streaming.
const TSLNode & TSLNetwork::linkSourceNode | ( | const const_link_iterator & | it | ) | const |
Query method for links.
it | A reference to the const_link_iterator pointing to the link. |
int TSLNetwork::linkSourceNodePos | ( | const const_link_iterator & | it | ) | const |
Query method for links.
it | A reference to the const_link_iterator pointing to the link. |
bool TSLNetwork::loadSpatialIndex | ( | TSLifstream & | inputStream | ) |
Function that reads and creates the Spatial Index from a file stream. If the Spatial Index already exists, it is deleted. Returns true on success or false on error.
inputStream | Reference to stream. |
void TSLNetwork::markEdgeNode | ( | int | index | ) |
Indicates that the node at the supplied position is an edge node i.e. it originated from the edge of a dataset.
index | The node index. |
void TSLNetwork::markStitchNode | ( | int | index | ) |
Indicates that the node at the supplied position is a stitch node i.e. its purpose in the original data is to break links across datasets.
index | The node index. |
void TSLNetwork::mendEdgeNodes | ( | TSLNetwork * | other, |
const TSLNodeCmp & | nodePred ) |
This method tags nodes in other network as stitch nodes where appropriate.
void TSLNetwork::mergeEdgeNodes | ( | const TSLNodeCmp & | nodePred, |
const TSLLinkCmp & | linkPred ) |
For every link crossing a tile boundary, its segments are replaced by a single link and the corresponding edge nodes are removed.
nodePred | A reference to the TSLNodeCmp object. |
linkPred | A reference to the TSLLinkCmp object. |
void TSLNetwork::mergeNetwork | ( | TSLNetwork * | other, |
const TSLNodeCmp & | nodePred ) |
Merges the supplied network into the current one.
other | The network to merge into this one. |
nodePred | A reference to the TSLNodeCmp object. |
Streamer TSLNetwork::net__ | ( | ) |
This method extracts the network internals for subsequent streaming.
Streamer TSLNetwork::nodes | ( | ) |
This method extracts the network nodes for subsequent streaming.
void * TSLNetwork::operator new | ( | size_t | size | ) |
These are here to avoid being documented Allocation override for API redirection.
void * TSLNetwork::operator new | ( | size_t | size, |
char * | filename, | ||
int | line ) |
When included in an MFC application in debug mode, the debug new expects this to be here. Override it and return the same as the normal one. The library must include it when compiled in release mode, since the user's application may be in debug mode.
void TSLNetwork::pop_back | ( | ) |
Removes the last node in the network - clients must ensure that at least some nodes have been added to the network prior to calling this method.
void TSLNetwork::push_back | ( | const TSLNode & | the_node | ) |
Inserts a node into the end of the network.
the_node | A reference to the node to insert. |
void TSLNetwork::removeEdgeNode | ( | int | index | ) |
Indicates that the node at the supplied position is no longer an edge node.
index | The node index. |
void TSLNetwork::reserve | ( | int | N | ) |
The member function ensures that capacity() henceforth returns at least N.
N | The number of nodes to reserve space for. |
Ensures that size() henceforth returns N. If it must lengthen the storage for nodes, it appends nodes with value the_node.
N | The required number of nodes. |
the_node | The node to insert. |
bool TSLNetwork::saveSpatialIndex | ( | TSLofstream & | outputStream | ) | const |
Function that saves the Spatial Index to a file stream. Returns true on success, or false on error.
outputStream | Reference to stream. |
int TSLNetwork::size | ( | ) | const |
Query method for nodes in the network.
Returns the number of nodes in the network.
int TSLNetwork::size_links | ( | ) | const |
Query method for links in the network.
Returns the number of links in the network.
int TSLNetwork::size_turns | ( | ) | const |
Query method for turns in the network.
Returns the number of turns in the network.
bool TSLNetwork::spatialIndexUpToDate | ( | ) | const |
Returns the status of the Spatial Index.
Returns true if the spatial index is valid and can be used, false otherwise.
const_link_iterator TSLNetwork::turnDestinLink | ( | const const_turn_iterator & | it | ) | const |
Query method for turns.
it | A reference to the const_turn_iterator pointing to the turn. |
Streamer TSLNetwork::turns | ( | ) |
This method extracts the network turns for subsequent streaming.
const_link_iterator TSLNetwork::turnSourceLink | ( | const const_turn_iterator & | it | ) | const |
Query method for turns.
it | A reference to the const_turn_iterator pointing to the turn. |
bool TSLNetwork::updateSpatialIndex | ( | ) |
Function that updates the Networks Spatial Index. If the Spatial Index exists, it is deleted and rebuilt. If the Spatial Index doesn't exist it is constructed.
Returns true if the Spatial Index was created successfully. Returns false if an error was encountered. The TSLErrorStack should be interrogated for further information.