GDAL
Public Member Functions | Protected Member Functions
GNMGenericNetwork Class Reference

GNM class which represents a geography network of generic format. More...

#include <gnm.h>

Inheritance diagram for GNMGenericNetwork:
GNMNetwork GDALDataset GDALMajorObject

List of all members.

Public Member Functions

virtual int GetLayerCount () CPL_OVERRIDE
 Get the number of layers in this dataset.
virtual OGRLayerGetLayer (int) CPL_OVERRIDE
 Fetch a layer by index.
virtual OGRErr DeleteLayer (int) CPL_OVERRIDE
 Delete the indicated layer from the datasource.
virtual int TestCapability (const char *) CPL_OVERRIDE
 Test if capability is available.
virtual OGRLayerCopyLayer (OGRLayer *poSrcLayer, const char *pszNewName, char **papszOptions=NULL) CPL_OVERRIDE
 Duplicate an existing layer.
virtual int CloseDependentDatasets () CPL_OVERRIDE
 Drop references to any other datasets referenced by this dataset.
virtual void FlushCache (void) CPL_OVERRIDE
 Flush all write cached data to disk.
virtual CPLErr Create (const char *pszFilename, char **papszOptions) CPL_OVERRIDE=0
 Create network system layers.
virtual CPLErr Delete () CPL_OVERRIDE
 Delete network.
virtual int GetVersion () const CPL_OVERRIDE
 GetVersion return the network version if applicable.
virtual GNMGFID GetNewGlobalFID ()
 GetNewGlobalFID increase the global ID counter.
virtual CPLString GetAlgorithmName (GNMDirection eAlgorithm, bool bShortName)
 Get the algorithm name.
virtual CPLErr AddFeatureGlobalFID (GNMGFID nFID, const char *pszLayerName)
 AddFeatureGlobalFID add the FID <-> Layer name link to fast access features by global FID.
virtual CPLErr ConnectFeatures (GNMGFID nSrcFID, GNMGFID nTgtFID, GNMGFID nConFID=-1, double dfCost=1, double dfInvCost=1, GNMDirection eDir=GNM_EDGE_DIR_BOTH)
 Connects two features via third feature (may be virtual, so the identificator should be -1).
virtual CPLErr DisconnectFeatures (GNMGFID nSrcFID, GNMGFID nTgtFID, GNMGFID nConFID)
 Remove features connection.
virtual CPLErr DisconnectFeaturesWithId (GNMGFID nFID)
 Find the corresponding identificator in graph (source, target, connector) and remove such connections.
virtual CPLErr ReconnectFeatures (GNMGFID nSrcFID, GNMGFID nTgtFID, GNMGFID nConFID, double dfCost=1, double dfInvCost=1, GNMDirection eDir=GNM_EDGE_DIR_BOTH)
 Change connection attributes.
virtual CPLErr DisconnectAll () CPL_OVERRIDE
 DisconnectAll method clears the network graph.
virtual OGRFeatureGetFeatureByGlobalFID (GNMGFID nFID) CPL_OVERRIDE
 GetFeatureByGlobalFID search all network layers for given feature identificator.
virtual CPLErr CreateRule (const char *pszRuleStr)
 Create network rule.
virtual CPLErr DeleteAllRules ()
 Delete all rules from network.
virtual CPLErr DeleteRule (const char *pszRuleStr)
 Delete the specified rule.
virtual char ** GetRules () const
 Get the rule list.
virtual CPLErr ConnectPointsByLines (char **papszLayerList, double dfTolerance, double dfCost, double dfInvCost, GNMDirection eDir)
 Attempts to build the network topology automatically.
virtual CPLErr ChangeBlockState (GNMGFID nFID, bool bIsBlock)
 Change the block state of edge or vertex.
virtual CPLErr ChangeAllBlockState (bool bIsBlock=false)
 Change all vertices and edges block state.
virtual OGRLayerGetPath (GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions) CPL_OVERRIDE
 Create path between start and end GFIDs.

Protected Member Functions

virtual CPLErr CheckLayerDriver (const char *pszDefaultDriverName, char **papszOptions)
 Check or create layer OGR driver.
virtual bool CheckStorageDriverSupport (const char *pszDriverName)=0
 Check if provided OGR driver accepted as storage for network data.

Detailed Description

GNM class which represents a geography network of generic format.

Since:
GDAL 2.1

Member Function Documentation

virtual CPLErr GNMGenericNetwork::AddFeatureGlobalFID ( GNMGFID  nFID,
const char *  pszLayerName 
) [virtual]

AddFeatureGlobalFID add the FID <-> Layer name link to fast access features by global FID.

Parameters:
nFID- global FID
pszLayerName- layer name
Returns:
CE_None on success
virtual CPLErr GNMGenericNetwork::ChangeAllBlockState ( bool  bIsBlock = false) [virtual]

Change all vertices and edges block state.

This is mainly use for unblock all vertices and edges.

Parameters:
bIsBlockBlock or unblock
Returns:
CE_None on success
virtual CPLErr GNMGenericNetwork::ChangeBlockState ( GNMGFID  nFID,
bool  bIsBlock 
) [virtual]

Change the block state of edge or vertex.

Parameters:
nFIDIdentificator
bIsBlockBlock or unblock
Returns:
CE_None on success
virtual CPLErr GNMGenericNetwork::CheckLayerDriver ( const char *  pszDefaultDriverName,
char **  papszOptions 
) [protected, virtual]

Check or create layer OGR driver.

Parameters:
pszDefaultDriverName- default driver name
papszOptions- create options
Returns:
CE_None if driver is exist or CE_Failure
virtual bool GNMGenericNetwork::CheckStorageDriverSupport ( const char *  pszDriverName) [protected, pure virtual]

Check if provided OGR driver accepted as storage for network data.

Parameters:
pszDriverNameThe driver name
Returns:
true if supported, else false
virtual int GNMGenericNetwork::CloseDependentDatasets ( ) [virtual]

Drop references to any other datasets referenced by this dataset.

This method should release any reference to other datasets (e.g. a VRT dataset to its sources), but not close the current dataset itself.

If at least, one reference to a dependent dataset has been dropped, this method should return TRUE. Otherwise it *should* return FALSE. (Failure to return the proper value might result in infinite loop)

This method can be called several times on a given dataset. After the first time, it should not do anything and return FALSE.

The driver implementation may choose to destroy its raster bands, so be careful not to call any method on the raster bands afterwards.

Basically the only safe action you can do after calling CloseDependentDatasets() is to call the destructor.

Note: the only legitimate caller of CloseDependentDatasets() is GDALDriverManager::~GDALDriverManager()

Returns:
TRUE if at least one reference to another dataset has been dropped.

Reimplemented from GDALDataset.

virtual CPLErr GNMGenericNetwork::ConnectFeatures ( GNMGFID  nSrcFID,
GNMGFID  nTgtFID,
GNMGFID  nConFID = -1,
double  dfCost = 1,
double  dfInvCost = 1,
GNMDirection  eDir = GNM_EDGE_DIR_BOTH 
) [virtual]

Connects two features via third feature (may be virtual, so the identificator should be -1).

The features may be at the same layer or different layers.

Parameters:
nSrcFID- source feature identificator
nTgtFID- target feature identificator
nConFID- connection feature identificator (-1 for virtual connection)
dfCost- cost moving from source to target (default 1)
dfInvCost- cost moving from target to source (default 1)
eDir- direction, may be source to target, traget to source or both. (default - both)
Returns:
CE_None on success
virtual CPLErr GNMGenericNetwork::ConnectPointsByLines ( char **  papszLayerList,
double  dfTolerance,
double  dfCost,
double  dfInvCost,
GNMDirection  eDir 
) [virtual]

Attempts to build the network topology automatically.

The method simply gets point and line or multiline layers from the papszLayerList and searches for each line which connects two points: start and end, so it can be not so effective in performance when it is called on huge networks. Note, when passing your tolerance value: this value will depend of spatial reference system of the network, and especially of its 0,0 position because dfTolerance is just divided by 2 and added/subtracted to/from both sides of each line-feature end point forming thus the square area around it. The first point-feature occurred inside this area will be given as a start/end point for the current connection. So it is also desirable that at least two layers are passed in papszLayerList (one point and one line), and they are already connected "visually" ("geometrically").

Parameters:
papszLayerListA list of layers to connect. The list should be freed via CSLDestroy.
dfToleranceSnapping tolerance.
dfCostDirect cost.
dfInvCostInverse cost.
eDirDirection.
Returns:
CE_None on success
virtual OGRLayer* GNMGenericNetwork::CopyLayer ( OGRLayer poSrcLayer,
const char *  pszNewName,
char **  papszOptions = NULL 
) [virtual]

Duplicate an existing layer.

This method creates a new layer, duplicate the field definitions of the source layer and then duplicate each features of the source layer. The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation. The source layer may come from another dataset.

This method is the same as the C function GDALDatasetCopyLayer() and the deprecated OGR_DS_CopyLayer().

In GDAL 1.X, this method used to be in the OGRDataSource class.

Parameters:
poSrcLayersource layer.
pszNewNamethe name of the layer to create.
papszOptionsa StringList of name=value options. Options are driver specific. There is a common option to set output layer spatial reference: DST_SRSWKT. The option should be in WKT format.
Returns:
an handle to the layer, or NULL if an error occurs.

Reimplemented from GDALDataset.

virtual CPLErr GNMGenericNetwork::Create ( const char *  pszFilename,
char **  papszOptions 
) [pure virtual]

Create network system layers.

Creates the connectivity (the "network path" of data) over the dataset and returns the resulting network. NOTE: This method does not create any connections among features but creates the necessary set of fields, layers, etc. NOTE: After the successful creation the passed dataset must not be modified outside (but can be read as usual). NOTE: For the common network format the creation is forbidden if the passed dataset already has network system layers and OVERWRITE creation option is FALSE.

Parameters:
pszFilename- A path there the network folder (schema, etc.) will be created. The folder (schema, etc.) name get options.
papszOptions- create network options. The create options specific for gnm driver.
Returns:
CE_None on success

Implements GNMNetwork.

virtual CPLErr GNMGenericNetwork::CreateRule ( const char *  pszRuleStr) [virtual]

Create network rule.

Creates the rule in the network according to the special syntax. These rules are declarative and make an effect for the network when they exist. Each rule for layer can be created only if the corresponding layer existed and removed when the layer is being deleted.

Rules syntax for the common network format in GNM contains the key words (words in capital letters or signs) and the modifiers which refers to the network objects. All the following combinations are available:

Notation: layer1, layer2, layer3 - a layer names (the corresponding layers must be exist; field1 - a field name (field must be exist); constant1 - any double constant; string1 - any string;

Rules describing which layer can be connected or not connected with each other, and (optional) which layer must serve as a connector. By default all connections are forbidden. But while network creation process the rule to allow any connection added. During the connection process each rule tested if this connection can be created.

"ALLOW CONNECTS ANY" "DENY CONNECTS ANY" "DENY CONNECTS layer1 WITH layer2" "ALLOW CONNECTS layer1 WITH layer2 VIA layer3"

Parameters:
pszRuleStrRule string which will parsed. If the parsing was successful, the rule will start having effect immediately.
Returns:
CE_None on success.
virtual CPLErr GNMGenericNetwork::Delete ( ) [virtual]

Delete network.

Delete all dependent layers

Returns:
CE_None on success

Implements GNMNetwork.

Delete all rules from network.

Returns:
CE_None on success.
virtual OGRErr GNMGenericNetwork::DeleteLayer ( int  iLayer) [virtual]

Delete the indicated layer from the datasource.

If this method is supported the ODsCDeleteLayer capability will test TRUE on the GDALDataset.

This method is the same as the C function GDALDatasetDeleteLayer() and the deprecated OGR_DS_DeleteLayer().

In GDAL 1.X, this method used to be in the OGRDataSource class.

Parameters:
iLayerthe index of the layer to delete.
Returns:
OGRERR_NONE on success, or OGRERR_UNSUPPORTED_OPERATION if deleting layers is not supported for this datasource.

Reimplemented from GDALDataset.

virtual CPLErr GNMGenericNetwork::DeleteRule ( const char *  pszRuleStr) [virtual]

Delete the specified rule.

Parameters:
pszRuleStr- the rule to delete
Returns:
CE_None on success.

DisconnectAll method clears the network graph.

Returns:
CE_None on success

Implements GNMNetwork.

virtual CPLErr GNMGenericNetwork::DisconnectFeatures ( GNMGFID  nSrcFID,
GNMGFID  nTgtFID,
GNMGFID  nConFID 
) [virtual]

Remove features connection.

Parameters:
nSrcFID- source feature identificator
nTgtFID- target feature identificator
nConFID- connection feature identificator
Returns:
CE_None on success
virtual CPLErr GNMGenericNetwork::DisconnectFeaturesWithId ( GNMGFID  nFID) [virtual]

Find the corresponding identificator in graph (source, target, connector) and remove such connections.

Parameters:
nFID- identificator to find.
Returns:
CE_None on success
virtual void GNMGenericNetwork::FlushCache ( void  ) [virtual]

Flush all write cached data to disk.

Any raster (or other GDAL) data written via GDAL calls, but buffered internally will be written to disk.

The default implementation of this method just calls the FlushCache() method on each of the raster bands and the SyncToDisk() method on each of the layers. Conceptionally, calling FlushCache() on a dataset should include any work that might be accomplished by calling SyncToDisk() on layers in that dataset.

Using this method does not prevent use from calling GDALClose() to properly close a dataset and ensure that important data not addressed by FlushCache() is written in the file.

This method is the same as the C function GDALFlushCache().

Reimplemented from GDALDataset.

virtual CPLString GNMGenericNetwork::GetAlgorithmName ( GNMDirection  eAlgorithm,
bool  bShortName 
) [virtual]

Get the algorithm name.

Parameters:
eAlgorithmGNM algorithm type
bShortNameIndicator which name to return - short or long
Returns:
String with algorithm name
virtual OGRFeature* GNMGenericNetwork::GetFeatureByGlobalFID ( GNMGFID  nGFID) [virtual]

GetFeatureByGlobalFID search all network layers for given feature identificator.

Parameters:
nGFIDfeature identificator.
Returns:
OGRFeature pointer or NULL. The pointer should be freed via OGRFeature::DestroyFeature().

Implements GNMNetwork.

virtual OGRLayer* GNMGenericNetwork::GetLayer ( int  iLayer) [virtual]

Fetch a layer by index.

The returned layer remains owned by the GDALDataset and should not be deleted by the application.

This method is the same as the C function GDALDatasetGetLayer() and the deprecated OGR_DS_GetLayer().

In GDAL 1.X, this method used to be in the OGRDataSource class.

Parameters:
iLayera layer number between 0 and GetLayerCount()-1.
Returns:
the layer, or NULL if iLayer is out of range or an error occurs.

Reimplemented from GDALDataset.

virtual int GNMGenericNetwork::GetLayerCount ( ) [virtual]

Get the number of layers in this dataset.

This method is the same as the C function GDALDatasetGetLayerCount(), and the deprecated OGR_DS_GetLayerCount().

In GDAL 1.X, this method used to be in the OGRDataSource class.

Returns:
layer count.

Reimplemented from GDALDataset.

virtual GNMGFID GNMGenericNetwork::GetNewGlobalFID ( ) [virtual]

GetNewGlobalFID increase the global ID counter.

Returns:
New global feature ID.
virtual OGRLayer* GNMGenericNetwork::GetPath ( GNMGFID  nStartFID,
GNMGFID  nEndFID,
GNMGraphAlgorithmType  eAlgorithm,
char **  papszOptions 
) [virtual]

Create path between start and end GFIDs.

Parameters:
nStartFID- start identificator
nEndFID- end identificator
eAlgorithm- The algorithm to get path
papszOptions- algorithm specific options
Returns:
In memory OGRLayer pointer with features constituting the shortest path (or paths). The caller have to free the pointer via
See also:
ReleaseResultSet().

Implements GNMNetwork.

virtual char** GNMGenericNetwork::GetRules ( ) const [virtual]

Get the rule list.

Returns:
list of rule strings. The caller have to free the lis via CPLDestroy.
virtual int GNMGenericNetwork::GetVersion ( ) const [virtual]

GetVersion return the network version if applicable.

Returns:
version value

Reimplemented from GNMNetwork.

virtual CPLErr GNMGenericNetwork::ReconnectFeatures ( GNMGFID  nSrcFID,
GNMGFID  nTgtFID,
GNMGFID  nConFID,
double  dfCost = 1,
double  dfInvCost = 1,
GNMDirection  eDir = GNM_EDGE_DIR_BOTH 
) [virtual]

Change connection attributes.

Search the connection by source feature identificator, target feature identificator and connection identificator.

Parameters:
nSrcFID- source feature identificator
nTgtFID- target feature identificator
nConFID- connection feature identificator
dfCost- new cost moving from source to target
dfInvCost- new cost moving from target to source
eDir- new direction
Returns:
CE_None on success
virtual int GNMGenericNetwork::TestCapability ( const char *  pszCap) [virtual]

Test if capability is available.

One of the following dataset capability names can be passed into this method, and a TRUE or FALSE value will be returned indicating whether or not the capability is available for this object.

  • ODsCCreateLayer: True if this datasource can create new layers.

  • ODsCDeleteLayer: True if this datasource can delete existing layers.

  • ODsCCreateGeomFieldAfterCreateLayer: True if the layers of this datasource support CreateGeomField() just after layer creation.

  • ODsCCurveGeometries: True if this datasource supports curve geometries.

  • ODsCTransactions: True if this datasource supports (efficient) transactions.

  • ODsCEmulatedTransactions: True if this datasource supports transactions through emulation.

  • ODsCRandomLayerRead: True if this datasource has a dedicated GetNextFeature() implementation, potentially returning features from layers in a non sequential way.

  • ODsCRandomLayerWrite: True if this datasource supports calling CreateFeature() on layers in a non sequential way.

The #define macro forms of the capability names should be used in preference to the strings themselves to avoid misspelling.

This method is the same as the C function GDALDatasetTestCapability() and the deprecated OGR_DS_TestCapability().

In GDAL 1.X, this method used to be in the OGRDataSource class.

Parameters:
pszCapthe capability to test.
Returns:
TRUE if capability available otherwise FALSE.

Reimplemented from GDALDataset.


The documentation for this class was generated from the following file:

Generated for GDAL by doxygen 1.7.6.1.