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) 82 return GetSpatialRefFromOldGetProjectionRef();
108 virtual CPLErr Create(
const char* pszFilename,
char** papszOptions ) = 0;
121 virtual CPLErr Delete() = 0;
129 virtual const char* GetName()
const;
141 virtual CPLErr DisconnectAll () = 0;
150 virtual OGRFeature *GetFeatureByGlobalFID (GNMGFID nGFID) = 0;
162 virtual OGRLayer *GetPath (GNMGFID nStartFID, GNMGFID nEndFID,
163 GNMGraphAlgorithmType eAlgorithm,
char** papszOptions) = 0;
171 virtual int CheckNetworkExist(
const char* pszFilename,
172 char** papszOptions ) = 0;
175 const char *_GetProjectionRef(
void)
override;
209 const char *pszNewName,
210 char **papszOptions =
nullptr )
override;
217 virtual CPLErr Create(
const char* pszFilename,
char** papszOptions )
override = 0;
225 virtual GNMGFID GetNewGlobalFID();
233 virtual CPLString GetAlgorithmName(GNMDirection eAlgorithm,
bool bShortName);
242 virtual CPLErr AddFeatureGlobalFID(GNMGFID nFID,
const char* pszLayerName);
257 virtual CPLErr ConnectFeatures (GNMGFID nSrcFID,
259 GNMGFID nConFID = -1,
261 double dfInvCost = 1,
262 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
271 virtual CPLErr DisconnectFeatures (GNMGFID nSrcFID,
281 virtual CPLErr DisconnectFeaturesWithId(GNMGFID nFID);
295 virtual CPLErr ReconnectFeatures (GNMGFID nSrcFID,
299 double dfInvCost = 1,
300 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
340 virtual CPLErr CreateRule (
const char *pszRuleStr);
346 virtual CPLErr DeleteAllRules();
353 virtual CPLErr DeleteRule(
const char *pszRuleStr);
359 virtual char** GetRules()
const;
385 virtual CPLErr ConnectPointsByLines (
char **papszLayerList,
397 virtual CPLErr ChangeBlockState (GNMGFID nFID,
bool bIsBlock);
407 virtual CPLErr ChangeAllBlockState (
bool bIsBlock =
false);
410 GNMGraphAlgorithmType eAlgorithm,
char** papszOptions)
override;
418 virtual CPLErr CheckLayerDriver(
const char* pszDefaultDriverName,
419 char** papszOptions);
425 virtual bool CheckStorageDriverSupport(
const char* pszDriverName) = 0;
429 size_t nFieldSize = 1024 );
430 virtual CPLErr StoreNetworkSrs();
431 virtual CPLErr LoadNetworkSrs();
436 virtual CPLErr LoadGraph();
438 virtual CPLErr DeleteMetadataLayer() = 0;
439 virtual CPLErr DeleteGraphLayer() = 0;
440 virtual CPLErr DeleteFeaturesLayer() = 0;
441 virtual CPLErr LoadNetworkLayer(
const char* pszLayername) = 0;
442 virtual CPLErr DeleteNetworkLayers() = 0;
443 virtual void ConnectPointsByMultiline(
GIntBig nFID,
445 const std::vector<OGRLayer *> &paPointLayers,
446 double dfTolerance,
double dfCost,
447 double dfInvCost, GNMDirection eDir);
448 virtual void ConnectPointsByLine(
GIntBig nFID,
450 const std::vector<OGRLayer *> &paPointLayers,
451 double dfTolerance,
double dfCost,
452 double dfInvCost, GNMDirection eDir);
453 virtual GNMGFID FindNearestPoint(
const OGRPoint* poPoint,
454 const std::vector<OGRLayer*>& paPointLayers,
456 virtual OGRFeature* FindConnection(GNMGFID nSrcFID, GNMGFID nTgtFID,
458 virtual void SaveRules();
459 virtual GNMGFID GetNewVirtualFID();
461 const GNMPATH &path,
int nNoOfPath,
462 bool bReturnVertices,
bool bReturnEdges);
468 GNMGFID m_nVirtualConnectionGID;
475 std::map<GNMGFID, CPLString> m_moFeatureFIDMap;
476 std::vector<OGRLayer*> m_apoLayers;
477 std::vector<GNMRule> m_asRules;
478 bool m_bIsRulesChanged;
481 bool m_bIsGraphLoaded;
501 virtual void SetSpatialFilter(
OGRGeometry * )
override;
502 virtual void SetSpatialFilterRect(
double dfMinX,
double dfMinY,
503 double dfMaxX,
double dfMaxY )
override;
505 virtual void SetSpatialFilter(
int iGeomField,
OGRGeometry * )
override;
506 virtual void SetSpatialFilterRect(
int iGeomField,
507 double dfMinX,
double dfMinY,
508 double dfMaxX,
double dfMaxY )
override;
510 virtual OGRErr SetAttributeFilter(
const char * )
override;
512 virtual void ResetReading()
override;
513 virtual OGRFeature *GetNextFeature()
override;
518 virtual const char *GetName()
override;
521 virtual int FindFieldIndex(
const char *pszFieldName,
int bExactMatch )
override;
525 virtual GIntBig GetFeatureCount(
int bForce = TRUE )
override;
526 virtual OGRErr GetExtent(OGREnvelope *psExtent,
int bForce = TRUE)
override;
527 virtual OGRErr GetExtent(
int iGeomField, OGREnvelope *psExtent,
528 int bForce = TRUE)
override;
530 virtual int TestCapability(
const char * )
override;
533 int bApproxOK = TRUE )
override;
534 virtual OGRErr DeleteField(
int iField )
override;
535 virtual OGRErr ReorderFields(
int* panMap )
override;
537 int nFlagsIn )
override;
540 int bApproxOK = TRUE )
override;
542 virtual OGRErr SyncToDisk()
override;
545 virtual void SetStyleTableDirectly(
OGRStyleTable *poStyleTable )
override;
547 virtual void SetStyleTable(
OGRStyleTable *poStyleTable)
override;
549 virtual OGRErr StartTransaction()
override;
550 virtual OGRErr CommitTransaction()
override;
551 virtual OGRErr RollbackTransaction()
override;
553 virtual const char *GetFIDColumn()
override;
554 virtual const char *GetGeometryColumn()
override;
556 virtual OGRErr SetIgnoredFields(
const char **papszFields )
override;
561 char** papszOptions =
nullptr,
562 GDALProgressFunc pfnProgress =
nullptr,
563 void * pProgressArg =
nullptr );
567 char** papszOptions =
nullptr,
568 GDALProgressFunc pfnProgress =
nullptr,
569 void * pProgressArg =
nullptr );
574 GDALProgressFunc pfnProgress,
575 void * pProgressArg );
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 );
597 char** papszOptions =
nullptr,
598 GDALProgressFunc pfnProgress =
nullptr,
599 void * pProgressArg =
nullptr );
605 int AttributeFilterEvaluationNeedsGeometry();
609 OGRErr InitializeIndexSupport(
const char * );
610 OGRLayerAttrIndex *GetIndex();
622 std::map<GNMGFID, GIntBig> m_mnFIDMap;
646 explicit GNMRule(
const std::string &oRule );
648 explicit GNMRule(
const char* pszRule);
660 virtual bool IsValid()
const;
665 virtual bool IsAcceptAny()
const;
671 virtual GNMRuleType GetType()
const;
680 virtual bool CanConnect(
const CPLString &soSrcLayerName,
684 virtual CPLString GetSourceLayerName()
const;
686 virtual CPLString GetTargetLayerName()
const;
688 virtual CPLString GetConnectorLayerName()
const;
690 const char* c_str()
const;
692 operator const char* (void)
const;
695 virtual bool ParseRuleString();
720 virtual void ResetReading()
override;
721 virtual OGRFeature *GetNextFeature()
override;
725 virtual GIntBig GetFeatureCount(
int bForce = TRUE )
override;
726 virtual int TestCapability(
const char * pszCap )
override;
729 int bApproxOK = TRUE )
override;
730 virtual const char *GetFIDColumn()
override;
731 virtual const char *GetGeometryColumn()
override;
736 const CPLString &soLayerName,
int nPathNo,
748 #endif // __cplusplus virtual OGRErr DeleteLayer(int iLayer)
Delete the indicated layer from the datasource.
Definition: gdaldataset.cpp:5104
GNM layer which represents a geography network layer of generic format.
Definition: gnm.h:492
virtual OGRLayer * GetLayer(int iLayer)
Fetch a layer by index.
Definition: gdaldataset.cpp:6554
virtual void FlushCache(void)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:418
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1242
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:182
GNM class which represents a geography network of generic format.
Definition: gnm.h:194
virtual OGRFeature * GetFeatureByGlobalFID(GNMGFID nGFID)=0
GetFeatureByGlobalFID search all network layers for given feature identificator.
Convenient string class based on std::string.
Definition: cpl_string.h:329
Definition of a feature class or feature layer.
Definition: ogr_feature.h:259
virtual CPLErr Delete()=0
Delete network.
virtual OGRLayer * CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName, char **papszOptions=nullptr)
Duplicate an existing layer.
Definition: gdaldataset.cpp:4740
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:92
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:317
static GDALDataset * Open(const char *pszFilename, unsigned int nOpenFlags=0, const char *const *papszAllowedDrivers=nullptr, const char *const *papszOpenOptions=nullptr, const char *const *papszSiblingFiles=nullptr)
Definition: gdal_priv.h:613
A collection of OGRLineString.
Definition: ogr_geometry.h:2748
The simple graph class, which holds the appropriate for calculations graph in memory (based on STL co...
Definition: gnmgraph.h:89
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:286
Classes related to registration of format support, and opening datasets.
Class for dataset open functions.
Definition: gdal_priv.h:265
General GNM class which represents a geography network of common format.
Definition: gnm.h:74
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:3913
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2841
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:156
virtual CPLErr Create(const char *pszFilename, char **papszOptions)=0
Create network system layers.
The simple class for rules.
Definition: gnm.h:640
virtual OGRLayer * GetPath(GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions)=0
Create path between start and end GFIDs.
Point class.
Definition: ogr_geometry.h:810
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:70
virtual int GetVersion() const
GetVersion return the network version if applicable.
Definition: gnm.h:135
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:354
This class represents a style table.
Definition: ogr_featurestyle.h:84
virtual CPLErr DisconnectAll()=0
DisconnectAll method clears the network graph.
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:335
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:248
const OGRSpatialReference * GetSpatialRef() const override
Fetch the spatial reference for this dataset.
Definition: gnm.h:81
virtual int GetLayerCount()
Get the number of layers in this dataset.
Definition: gdaldataset.cpp:6527
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:290
The OGRGNMWrappedResultLayer class for search paths queries results.
Definition: gnm.h:713
virtual int TestCapability(const char *)
Test if capability is available.
Definition: gdaldataset.cpp:6887
Format specific driver.
Definition: gdal_priv.h:1423
CPLErr
Error category.
Definition: cpl_error.h:52