35 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
41 typedef int GNMDirection;
45 #define GNM_MD_NAME "net_name"
46 #define GNM_MD_DESCR "net_description"
47 #define GNM_MD_SRS "net_srs"
48 #define GNM_MD_VERSION "net_version"
49 #define GNM_MD_RULE "net_rule"
50 #define GNM_MD_FORMAT "FORMAT"
51 #define GNM_MD_FETCHEDGES "fetch_edge"
52 #define GNM_MD_FETCHVERTEX "fetch_vertex"
53 #define GNM_MD_NUM_PATHS "num_paths"
54 #define GNM_MD_EMITTER "emitter"
60 { GATDijkstraShortestPath = 1, GATKShortestPath, GATConnectedComponents
64 } GNMGraphAlgorithmType;
66 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
106 virtual CPLErr Create(
const char* pszFilename,
char** papszOptions ) = 0;
127 virtual const char* GetName()
const;
161 GNMGraphAlgorithmType eAlgorithm,
char** papszOptions) = 0;
170 char** papszOptions ) = 0;
203 const char *pszNewName,
204 char **papszOptions =
nullptr )
override;
211 virtual CPLErr Create(
const char* pszFilename,
char** papszOptions )
override = 0;
253 GNMGFID nConFID = -1,
255 double dfInvCost = 1,
256 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
293 double dfInvCost = 1,
294 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
404 GNMGraphAlgorithmType eAlgorithm,
char** papszOptions)
override;
413 char** papszOptions);
423 size_t nFieldSize = 1024 );
424 virtual CPLErr StoreNetworkSrs();
425 virtual CPLErr LoadNetworkSrs();
430 virtual CPLErr LoadGraph();
432 virtual CPLErr DeleteMetadataLayer() = 0;
433 virtual CPLErr DeleteGraphLayer() = 0;
434 virtual CPLErr DeleteFeaturesLayer() = 0;
435 virtual CPLErr LoadNetworkLayer(
const char* pszLayername) = 0;
436 virtual CPLErr DeleteNetworkLayers() = 0;
437 virtual void ConnectPointsByMultiline(
GIntBig nFID,
439 const std::vector<OGRLayer *> &paPointLayers,
440 double dfTolerance,
double dfCost,
441 double dfInvCost, GNMDirection eDir);
442 virtual void ConnectPointsByLine(
GIntBig nFID,
444 const std::vector<OGRLayer *> &paPointLayers,
445 double dfTolerance,
double dfCost,
446 double dfInvCost, GNMDirection eDir);
447 virtual GNMGFID FindNearestPoint(
const OGRPoint* poPoint,
448 const std::vector<OGRLayer*>& paPointLayers,
450 virtual OGRFeature* FindConnection(GNMGFID nSrcFID, GNMGFID nTgtFID,
452 virtual void SaveRules();
453 virtual GNMGFID GetNewVirtualFID();
455 const GNMPATH &path,
int nNoOfPath,
456 bool bReturnVertices,
bool bReturnEdges);
462 GNMGFID m_nVirtualConnectionGID;
469 std::map<GNMGFID, CPLString> m_moFeatureFIDMap;
470 std::vector<OGRLayer*> m_apoLayers;
471 std::vector<GNMRule> m_asRules;
472 bool m_bIsRulesChanged;
475 bool m_bIsGraphLoaded;
497 double dfMaxX,
double dfMaxY )
override;
501 double dfMinX,
double dfMinY,
502 double dfMaxX,
double dfMaxY )
override;
512 virtual const char *
GetName()
override;
515 virtual int FindFieldIndex(
const char *pszFieldName,
int bExactMatch )
override;
520 virtual OGRErr GetExtent(OGREnvelope *psExtent,
int bForce = TRUE)
override;
522 int bForce = TRUE)
override;
527 int bApproxOK = TRUE )
override;
531 int nFlagsIn )
override;
534 int bApproxOK = TRUE )
override;
555 char** papszOptions =
nullptr,
556 GDALProgressFunc pfnProgress =
nullptr,
557 void * pProgressArg =
nullptr );
561 char** papszOptions =
nullptr,
562 GDALProgressFunc pfnProgress =
nullptr,
563 void * pProgressArg =
nullptr );
568 GDALProgressFunc pfnProgress,
569 void * pProgressArg );
573 char** papszOptions =
nullptr,
574 GDALProgressFunc pfnProgress =
nullptr,
575 void * pProgressArg =
nullptr );
579 char** papszOptions =
nullptr,
580 GDALProgressFunc pfnProgress =
nullptr,
581 void * pProgressArg =
nullptr );
585 char** papszOptions =
nullptr,
586 GDALProgressFunc pfnProgress =
nullptr,
587 void * pProgressArg =
nullptr );
591 char** papszOptions =
nullptr,
592 GDALProgressFunc pfnProgress =
nullptr,
593 void * pProgressArg =
nullptr );
603 OGRErr InitializeIndexSupport(
const char * );
604 OGRLayerAttrIndex *GetIndex();
616 std::map<GNMGFID, GIntBig> m_mnFIDMap;
683 operator const char* (void)
const;
686 virtual bool ParseRuleString();
720 int bApproxOK = TRUE )
override;
727 const CPLString &soLayerName,
int nPathNo,
739 #endif // __cplusplus
virtual CPLErr DisconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID, GNMGFID nConFID)
Remove features connection.
The OGRGNMWrappedResultLayer class for search paths queries results.
Definition: gnm.h:705
virtual CPLErr Delete() override
Delete network.
virtual int GetLayerCount() override
Get the number of layers in this dataset.
virtual CPLErr DisconnectFeaturesWithId(GNMGFID nFID)
Find the corresponding identificator in graph (source, target, connector) and remove such connections...
virtual CPLErr Create(const char *pszFilename, char **papszOptions)=0
Create network system layers.
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1242
virtual OGRErr SetIgnoredFields(const char **papszFields) override
Set which fields can be omitted when retrieving features from the layer.
Definition: gnmlayer.cpp:62
virtual int CloseDependentDatasets() override
Drop references to any other datasets referenced by this dataset.
virtual OGRStyleTable * GetStyleTable() override
Returns layer style table.
Definition: gnmlayer.cpp:333
Class for dataset open functions.
Definition: gdal_priv.h:266
virtual bool IsAcceptAny() const
Indicator of any layer state.
virtual void ResetReading() override
Reset feature reading to start on the first feature.
Definition: gnmlayer.cpp:209
virtual CPLErr DeleteAllRules()
Delete all rules from network.
virtual OGRwkbGeometryType GetGeomType() override
Return the layer geometry type.
Definition: gnmlayer.cpp:260
virtual void FlushCache(void) override
Flush all write cached data to disk.
virtual const char * GetFIDColumn() override
This method returns the name of the underlying database column being used as the FID column,...
Definition: gnmlayer.cpp:52
virtual void ResetReading() override
Reset feature reading to start on the first feature.
Definition: gnmresultlayer.cpp:63
virtual OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition: gnmlayer.cpp:214
GNMRule(const GNMRule &oRule)
Constructor.
GNMRule(const std::string &oRule)
Constructor.
This class represents a style table.
Definition: ogr_featurestyle.h:85
virtual OGRErr CreateField(OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition: gnmlayer.cpp:295
virtual OGRSpatialReference * GetSpatialRef() override
Fetch the spatial reference system for this layer.
Definition: gnmresultlayer.cpp:119
virtual void SetStyleTable(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition: gnmlayer.cpp:343
virtual int CheckNetworkExist(const char *pszFilename, char **papszOptions)=0
Check if network already exist.
The simple graph class, which holds the appropriate for calculations graph in memory (based on STL co...
Definition: gnmgraph.h:90
virtual CPLErr DisconnectAll()=0
DisconnectAll method clears the network graph.
Format specific driver.
Definition: gdal_priv.h:1387
virtual GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition: gnmresultlayer.cpp:88
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:148
GNM layer which represents a geography network layer of generic format.
Definition: gnm.h:487
virtual void SetSpatialFilterRect(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) override
Set a new rectangular spatial filter.
Definition: gnmlayer.cpp:186
virtual OGRErr DeleteField(int iField) override
Delete an existing field on a layer.
Definition: gnmlayer.cpp:300
virtual int TestCapability(const char *) override
Test if this layer supported the named capability.
Definition: gnmlayer.cpp:290
virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce=TRUE) override
Fetch the extent of this layer.
Definition: gnmlayer.cpp:280
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:287
OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
SymDifference.
Definition: gnmlayer.cpp:85
virtual CPLString GetTargetLayerName() const
Return target layer name.
const char * c_str() const
Return rule as a string.
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:71
Convenient string class based on std::string.
Definition: cpl_string.h:330
virtual GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition: gnmlayer.cpp:275
virtual void SetSpatialFilter(OGRGeometry *) override
Set a new spatial filter.
Definition: gnmlayer.cpp:181
GNMRule(const char *pszRule)
Constructor.
Point class.
Definition: ogr_geometry.h:810
virtual const char * GetProjectionRef(void)
Fetch the projection definition string for this dataset.
Definition: gdaldataset.cpp:824
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:336
virtual OGRErr CommitTransaction() override
For datasources which support transactions, CommitTransaction commits a transaction.
Definition: gnmlayer.cpp:353
virtual CPLErr ChangeAllBlockState(bool bIsBlock=false)
Change all vertices and edges block state.
General GNM class which represents a geography network of common format.
Definition: gnm.h:75
virtual OGRErr RollbackTransaction() override
For datasources which support transactions, RollbackTransaction will roll back a datasource to its st...
Definition: gnmlayer.cpp:358
virtual OGRLayer * CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName, char **papszOptions=nullptr) override
Duplicate an existing layer.
virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition: gnmlayer.cpp:338
virtual OGRLayer * GetPath(GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions)=0
Create path between start and end GFIDs.
A collection of OGRLineString.
Definition: ogr_geometry.h:2748
virtual OGRErr SetAttributeFilter(const char *) override
Set a new attribute query.
Definition: gnmlayer.cpp:204
virtual CPLErr CheckLayerDriver(const char *pszDefaultDriverName, char **papszOptions)
Check or create layer OGR driver.
virtual CPLErr ReconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID, GNMGFID nConFID, double dfCost=1, double dfInvCost=1, GNMDirection eDir=GNM_EDGE_DIR_BOTH)
Change connection attributes.
OGRErr Erase(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Erase.
Definition: gnmlayer.cpp:117
virtual int GetVersion() const
GetVersion return the network version if applicable.
Definition: gnm.h:133
virtual char ** GetRules() const
Get the rule list.
virtual OGRErr CreateGeomField(OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition: gnmlayer.cpp:323
virtual CPLErr ChangeBlockState(GNMGFID nFID, bool bIsBlock)
Change the block state of edge or vertex.
virtual int FindFieldIndex(const char *pszFieldName, int bExactMatch) override
Find the index of field in the layer.
Definition: gnmlayer.cpp:265
virtual CPLString GetConnectorLayerName() const
Return connector layer name.
virtual const char * GetGeometryColumn() override
This method returns the name of the underlying database column being used as the geometry column,...
Definition: gnmresultlayer.cpp:114
Classes related to registration of format support, and opening datasets.
GIntBig GetFeaturesRead()
GetFeaturesRead.
Definition: gnmlayer.cpp:125
virtual OGRErr SyncToDisk() override
Flush pending changes to disk.
Definition: gnmlayer.cpp:328
GNMGenericLayer(OGRLayer *poLayer, GNMGenericNetwork *poNetwork)
GNMGenericLayer.
Definition: gnmlayer.cpp:38
virtual int TestCapability(const char *) override
Test if capability is available.
virtual OGRFeatureDefn * GetLayerDefn() override
Fetch the schema information for this layer.
Definition: gnmresultlayer.cpp:83
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:93
virtual const char * GetFIDColumn() override
This method returns the name of the underlying database column being used as the FID column,...
Definition: gnmresultlayer.cpp:109
virtual int TestCapability(const char *pszCap) override
Test if this layer supported the named capability.
Definition: gnmresultlayer.cpp:93
virtual CPLErr ConnectPointsByLines(char **papszLayerList, double dfTolerance, double dfCost, double dfInvCost, GNMDirection eDir)
Attempts to build the network topology automatically.
virtual OGRFeature * GetFeatureByGlobalFID(GNMGFID nFID) override
GetFeatureByGlobalFID search all network layers for given feature identificator.
virtual OGRErr DeleteFeature(GIntBig nFID) override
Delete feature from layer.
Definition: gnmlayer.cpp:230
virtual OGRErr ICreateFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT
Create and write a new feature within a layer.
Definition: ogrlayer.cpp:637
virtual CPLErr DisconnectAll() override
DisconnectAll method clears the network graph.
virtual OGRLayer * GetPath(GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions) override
Create path between start and end GFIDs.
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).
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:183
OGRGNMWrappedResultLayer(GDALDataset *poDS, OGRLayer *poLayer)
Constructor.
Definition: gnmresultlayer.cpp:36
virtual bool CheckStorageDriverSupport(const char *pszDriverName)=0
Check if provided OGR driver accepted as storage for network data.
virtual CPLErr CreateRule(const char *pszRuleStr)
Create network rule.
virtual OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition: gnmresultlayer.cpp:68
virtual OGRFeatureDefn * GetLayerDefn() override
Fetch the schema information for this layer.
Definition: gnmlayer.cpp:363
virtual ~GNMGenericLayer()
~GNMGenericLayer
Definition: gnmlayer.cpp:50
virtual OGRErr CreateField(OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition: gnmresultlayer.cpp:98
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:290
virtual CPLErr AddFeatureGlobalFID(GNMGFID nFID, const char *pszLayerName)
AddFeatureGlobalFID add the FID <-> Layer name link to fast access features by global FID.
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:248
virtual CPLErr Create(const char *pszFilename, char **papszOptions) override=0
Create network system layers.
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2360
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:318
virtual const char * GetGeometryColumn() override
This method returns the name of the underlying database column being used as the geometry column,...
Definition: gnmlayer.cpp:57
virtual OGRFeature * GetFeatureByGlobalFID(GNMGFID nGFID)=0
GetFeatureByGlobalFID search all network layers for given feature identificator.
OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Intersection.
Definition: gnmlayer.cpp:67
virtual OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition: gnmlayer.cpp:225
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:355
virtual CPLErr DeleteRule(const char *pszRuleStr)
Delete the specified rule.
OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Clip.
Definition: gnmlayer.cpp:109
virtual OGRErr ICreateFeature(OGRFeature *poFeature) override
Create and write a new feature within a layer.
Definition: gnmresultlayer.cpp:212
OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Union.
Definition: gnmlayer.cpp:77
CPLErr
Error category.
Definition: cpl_error.h:53
OGRErr Identity(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Identity.
Definition: gnmlayer.cpp:93
virtual OGRFeature * GetFeature(GIntBig nFID) override
Fetch a feature by its identifier.
Definition: gnmresultlayer.cpp:78
virtual OGRErr InsertFeature(OGRFeature *poFeature, const CPLString &soLayerName, int nPathNo, bool bIsEdge)
Undocumented.
Definition: gnmresultlayer.cpp:125
int AttributeFilterEvaluationNeedsGeometry()
AttributeFilterEvaluationNeedsGeometry.
Definition: gnmlayer.cpp:130
virtual OGRErr ISetFeature(OGRFeature *poFeature) override
Rewrite an existing feature.
Definition: gnmresultlayer.cpp:207
OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Update.
Definition: gnmlayer.cpp:101
virtual GNMRuleType GetType() const
This is for future use to indicate the rule type/ Now return only GRTConnection type.
virtual OGRErr StartTransaction() override
For datasources which support transactions, StartTransaction creates a transaction.
Definition: gnmlayer.cpp:348
Definition of a feature class or feature layer.
Definition: ogr_feature.h:260
virtual OGRErr ISetFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT
Rewrite an existing feature.
Definition: ogrlayer.cpp:598
virtual CPLString GetSourceLayerName() const
Return source layer name.
virtual OGRErr ReorderFields(int *panMap) override
Reorder all the fields of a layer.
Definition: gnmlayer.cpp:309
virtual bool IsValid() const
This function indicate if rule string was parsed successfully.
virtual const char * GetName() override
Return the layer name.
Definition: gnmlayer.cpp:255
virtual OGRErr CreateGeomField(OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition: gnmresultlayer.cpp:103
virtual bool CanConnect(const CPLString &soSrcLayerName, const CPLString &soTgtLayerName, const CPLString &soConnLayerName="")
Check if connection can take place.
virtual OGRLayer * GetLayer(int) override
Fetch a layer by index.
GNM class which represents a geography network of generic format.
Definition: gnm.h:189
virtual CPLString GetAlgorithmName(GNMDirection eAlgorithm, bool bShortName)
Get the algorithm name.
virtual CPLErr Open(GDALOpenInfo *poOpenInfo)=0
Open a network.
virtual GNMGFID GetNewGlobalFID()
GetNewGlobalFID increase the global ID counter.
virtual int GetVersion() const override
GetVersion return the network version if applicable.
virtual OGRSpatialReference * GetSpatialRef() override
Fetch the spatial reference system for this layer.
Definition: gnmlayer.cpp:270
The simple class for rules.
Definition: gnm.h:636
virtual OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition: gnmresultlayer.cpp:73
virtual OGRGeometry * GetSpatialFilter() override
This method returns the current spatial filter for this layer.
Definition: gnmlayer.cpp:176
virtual OGRErr AlterFieldDefn(int iField, OGRFieldDefn *poNewFieldDefn, int nFlagsIn) override
Alter the definition of an existing field on a layer.
Definition: gnmlayer.cpp:314
virtual OGRErr DeleteLayer(int) override
Delete the indicated layer from the datasource.
virtual CPLErr Delete()=0
Delete network.
Generated for GDAL by
1.8.20.