GDAL

gnm.h
1 /******************************************************************************
2 * $Id$
3 *
4 * Project: GDAL/OGR Geography Network support (Geographic Network Model)
5 * Purpose: GNM general public declarations.
6 * Authors: Mikhail Gusev (gusevmihs at gmail dot com)
7 * Dmitry Baryshnikov, polimax@mail.ru
8 *
9 ******************************************************************************
10 * Copyright (c) 2014, Mikhail Gusev
11 * Copyright (c) 2014-2015, NextGIS <info@nextgis.com>
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 ****************************************************************************/
31
32 #ifndef GNM
33 #define GNM
34
35 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
36 #include "ogrsf_frmts.h"
37 #endif
38 #include "gnmgraph.h"
39
40 // Direction of an edge.
41 typedef int GNMDirection; // We use int values in order to save them to the
42 // network data.
43
44 // Network's metadata parameters names.
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"
55
56 // TODO: Constants for capabilities.
57 //#define GNMCanChangeConnections "CanChangeConnections"
58
59 typedef enum
60 { GATDijkstraShortestPath = 1, GATKShortestPath, GATConnectedComponents
64 } GNMGraphAlgorithmType;
65
66 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
67
74 class CPL_DLL GNMNetwork : public GDALDataset
75 {
76 public:
77 GNMNetwork();
78 virtual ~GNMNetwork();
79
80 // GDALDataset Interface
81 const OGRSpatialReference* GetSpatialRef() const override {
82 return GetSpatialRefFromOldGetProjectionRef();
83 }
84 virtual char **GetFileList(void) override;
85
86 // GNMNetwork Interface
87
108 virtual CPLErr Create( const char* pszFilename, char** papszOptions ) = 0;
109
115 virtual CPLErr Open( GDALOpenInfo* poOpenInfo ) = 0;
116
121 virtual CPLErr Delete() = 0;
122
129 virtual const char* GetName() const;
130
135 virtual int GetVersion() const { return 0;}
136
141 virtual CPLErr DisconnectAll () = 0;
142
150 virtual OGRFeature *GetFeatureByGlobalFID (GNMGFID nGFID) = 0;
151
162 virtual OGRLayer *GetPath (GNMGFID nStartFID, GNMGFID nEndFID,
163 GNMGraphAlgorithmType eAlgorithm, char** papszOptions) = 0;
164 protected:
171 virtual int CheckNetworkExist( const char* pszFilename,
172 char** papszOptions ) = 0;
173
175 const char *_GetProjectionRef(void) override;
177
178 protected:
180 CPLString m_soName;
181 CPLString m_soSRS;
183 };
184
185 class GNMRule;
186 class OGRGNMWrappedResultLayer;
187
194 class CPL_DLL GNMGenericNetwork: public GNMNetwork
195 {
196 public:
197 GNMGenericNetwork();
198 virtual ~GNMGenericNetwork();
199
200 // GDALDataset Interface
201
202 virtual int GetLayerCount() override;
203 virtual OGRLayer *GetLayer(int) override;
204 virtual OGRErr DeleteLayer(int) override;
205
206 virtual int TestCapability( const char * ) override;
207
208 virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer,
209 const char *pszNewName,
210 char **papszOptions = nullptr ) override;
211
212 virtual int CloseDependentDatasets() override;
213 virtual void FlushCache(void) override;
214
215 // GNMNetwork Interface
216
217 virtual CPLErr Create( const char* pszFilename, char** papszOptions ) override = 0;
218 virtual CPLErr Delete() override;
219
220 virtual int GetVersion() const override;
225 virtual GNMGFID GetNewGlobalFID();
226
233 virtual CPLString GetAlgorithmName(GNMDirection eAlgorithm, bool bShortName);
234
242 virtual CPLErr AddFeatureGlobalFID(GNMGFID nFID, const char* pszLayerName);
243
257 virtual CPLErr ConnectFeatures (GNMGFID nSrcFID,
258 GNMGFID nTgtFID,
259 GNMGFID nConFID = -1,
260 double dfCost = 1,
261 double dfInvCost = 1,
262 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
263
271 virtual CPLErr DisconnectFeatures (GNMGFID nSrcFID,
272 GNMGFID nTgtFID,
273 GNMGFID nConFID);
274
281 virtual CPLErr DisconnectFeaturesWithId(GNMGFID nFID);
282
295 virtual CPLErr ReconnectFeatures (GNMGFID nSrcFID,
296 GNMGFID nTgtFID,
297 GNMGFID nConFID,
298 double dfCost = 1,
299 double dfInvCost = 1,
300 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
301
302 virtual CPLErr DisconnectAll() override;
303
304 virtual OGRFeature *GetFeatureByGlobalFID(GNMGFID nFID) override;
305
340 virtual CPLErr CreateRule (const char *pszRuleStr);
341
346 virtual CPLErr DeleteAllRules();
347
353 virtual CPLErr DeleteRule(const char *pszRuleStr);
354
359 virtual char** GetRules() const;
360
385 virtual CPLErr ConnectPointsByLines (char **papszLayerList,
386 double dfTolerance,
387 double dfCost,
388 double dfInvCost,
389 GNMDirection eDir);
390
397 virtual CPLErr ChangeBlockState (GNMGFID nFID, bool bIsBlock);
398
407 virtual CPLErr ChangeAllBlockState (bool bIsBlock = false);
408
409 virtual OGRLayer *GetPath (GNMGFID nStartFID, GNMGFID nEndFID,
410 GNMGraphAlgorithmType eAlgorithm, char** papszOptions) override;
411 protected:
418 virtual CPLErr CheckLayerDriver(const char* pszDefaultDriverName,
419 char** papszOptions);
425 virtual bool CheckStorageDriverSupport(const char* pszDriverName) = 0;
426 protected:
428 virtual CPLErr CreateMetadataLayer( GDALDataset* const pDS, int nVersion,
429 size_t nFieldSize = 1024 );
430 virtual CPLErr StoreNetworkSrs();
431 virtual CPLErr LoadNetworkSrs();
432 virtual CPLErr CreateGraphLayer( GDALDataset* const pDS );
433 virtual CPLErr CreateFeaturesLayer( GDALDataset* const pDS );
434 virtual CPLErr LoadMetadataLayer( GDALDataset* const pDS );
435 virtual CPLErr LoadGraphLayer( GDALDataset* const pDS );
436 virtual CPLErr LoadGraph();
437 virtual CPLErr LoadFeaturesLayer( GDALDataset* const pDS );
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,
444 const OGRMultiLineString *poMultiLineString,
445 const std::vector<OGRLayer *> &paPointLayers,
446 double dfTolerance, double dfCost,
447 double dfInvCost, GNMDirection eDir);
448 virtual void ConnectPointsByLine(GIntBig nFID,
449 const OGRLineString *poLineString,
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,
455 double dfTolerance);
456 virtual OGRFeature* FindConnection(GNMGFID nSrcFID, GNMGFID nTgtFID,
457 GNMGFID nConFID);
458 virtual void SaveRules();
459 virtual GNMGFID GetNewVirtualFID();
460 virtual void FillResultLayer(OGRGNMWrappedResultLayer* poResLayer,
461 const GNMPATH &path, int nNoOfPath,
462 bool bReturnVertices, bool bReturnEdges);
464 protected:
466 int m_nVersion;
467 GNMGFID m_nGID;
468 GNMGFID m_nVirtualConnectionGID;
469 OGRLayer* m_poMetadataLayer;
470 OGRLayer* m_poGraphLayer;
471 OGRLayer* m_poFeaturesLayer;
472
473 GDALDriver *m_poLayerDriver;
474
475 std::map<GNMGFID, CPLString> m_moFeatureFIDMap;
476 std::vector<OGRLayer*> m_apoLayers;
477 std::vector<GNMRule> m_asRules;
478 bool m_bIsRulesChanged;
479
480 GNMGraph m_oGraph;
481 bool m_bIsGraphLoaded;
483 };
484
492 class GNMGenericLayer : public OGRLayer
493 {
494 public:
495 GNMGenericLayer(OGRLayer* poLayer, GNMGenericNetwork* poNetwork);
496 virtual ~GNMGenericLayer();
497
498 // OGRLayer Interface
499
500 virtual OGRGeometry *GetSpatialFilter() override;
501 virtual void SetSpatialFilter( OGRGeometry * ) override;
502 virtual void SetSpatialFilterRect( double dfMinX, double dfMinY,
503 double dfMaxX, double dfMaxY ) override;
504
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;
509
510 virtual OGRErr SetAttributeFilter( const char * ) override;
511
512 virtual void ResetReading() override;
513 virtual OGRFeature *GetNextFeature() override;
514 virtual OGRErr SetNextByIndex( GIntBig nIndex ) override;
515
516 virtual OGRErr DeleteFeature( GIntBig nFID ) override;
517
518 virtual const char *GetName() override;
519 virtual OGRwkbGeometryType GetGeomType() override;
520 virtual OGRFeatureDefn *GetLayerDefn() override;
521 virtual int FindFieldIndex( const char *pszFieldName, int bExactMatch ) override;
522
523 virtual OGRSpatialReference *GetSpatialRef() override;
524
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;
529
530 virtual int TestCapability( const char * ) override;
531
532 virtual OGRErr CreateField( OGRFieldDefn *poField,
533 int bApproxOK = TRUE ) override;
534 virtual OGRErr DeleteField( int iField ) override;
535 virtual OGRErr ReorderFields( int* panMap ) override;
536 virtual OGRErr AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn,
537 int nFlagsIn ) override;
538
539 virtual OGRErr CreateGeomField( OGRGeomFieldDefn *poField,
540 int bApproxOK = TRUE ) override;
541
542 virtual OGRErr SyncToDisk() override;
543
544 virtual OGRStyleTable *GetStyleTable() override;
545 virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable ) override;
546
547 virtual void SetStyleTable(OGRStyleTable *poStyleTable) override;
548
549 virtual OGRErr StartTransaction() override;
550 virtual OGRErr CommitTransaction() override;
551 virtual OGRErr RollbackTransaction() override;
552
553 virtual const char *GetFIDColumn() override;
554 virtual const char *GetGeometryColumn() override;
555
556 virtual OGRErr SetIgnoredFields( const char **papszFields ) override;
557
559 OGRErr Intersection( OGRLayer *pLayerMethod,
560 OGRLayer *pLayerResult,
561 char** papszOptions = nullptr,
562 GDALProgressFunc pfnProgress = nullptr,
563 void * pProgressArg = nullptr );
565 OGRErr Union( OGRLayer *pLayerMethod,
566 OGRLayer *pLayerResult,
567 char** papszOptions = nullptr,
568 GDALProgressFunc pfnProgress = nullptr,
569 void * pProgressArg = nullptr );
571 OGRErr SymDifference( OGRLayer *pLayerMethod,
572 OGRLayer *pLayerResult,
573 char** papszOptions,
574 GDALProgressFunc pfnProgress,
575 void * pProgressArg );
577 OGRErr Identity( OGRLayer *pLayerMethod,
578 OGRLayer *pLayerResult,
579 char** papszOptions = nullptr,
580 GDALProgressFunc pfnProgress = nullptr,
581 void * pProgressArg = nullptr );
583 OGRErr Update( OGRLayer *pLayerMethod,
584 OGRLayer *pLayerResult,
585 char** papszOptions = nullptr,
586 GDALProgressFunc pfnProgress = nullptr,
587 void * pProgressArg = nullptr );
589 OGRErr Clip( OGRLayer *pLayerMethod,
590 OGRLayer *pLayerResult,
591 char** papszOptions = nullptr,
592 GDALProgressFunc pfnProgress = nullptr,
593 void * pProgressArg = nullptr );
595 OGRErr Erase( OGRLayer *pLayerMethod,
596 OGRLayer *pLayerResult,
597 char** papszOptions = nullptr,
598 GDALProgressFunc pfnProgress = nullptr,
599 void * pProgressArg = nullptr );
600
602 GIntBig GetFeaturesRead();
603
605 int AttributeFilterEvaluationNeedsGeometry();
606
608 /* consider these private */
609 OGRErr InitializeIndexSupport( const char * );
610 OGRLayerAttrIndex *GetIndex();
612
613 protected:
615 virtual OGRErr ISetFeature( OGRFeature *poFeature ) override;
616 virtual OGRErr ICreateFeature( OGRFeature *poFeature ) override;
617
618 protected:
619 CPLString m_soLayerName;
620 OGRLayer *m_poLayer;
621 GNMGenericNetwork* m_poNetwork;
622 std::map<GNMGFID, GIntBig> m_mnFIDMap;
624 };
625
626 typedef enum
627 { GRTConnection = 0
629 } GNMRuleType;
630
640 class CPL_DLL GNMRule
641 {
642 // to hopefully please Coverity Scan which complains about missing
643 // move assignment operator for performance reasons
644 GNMRule& operator==(GNMRule&&) = delete;
645
646 public:
648 GNMRule();
650 explicit GNMRule(const std::string &oRule );
652 explicit GNMRule(const char* pszRule);
654 GNMRule(const GNMRule &oRule);
655
657 GNMRule& operator=(const GNMRule&) = default;
658
659 virtual ~GNMRule();
664 virtual bool IsValid() const;
669 virtual bool IsAcceptAny() const;
675 virtual GNMRuleType GetType() const;
684 virtual bool CanConnect(const CPLString &soSrcLayerName,
685 const CPLString &soTgtLayerName,
686 const CPLString &soConnLayerName = "");
688 virtual CPLString GetSourceLayerName() const;
690 virtual CPLString GetTargetLayerName() const;
692 virtual CPLString GetConnectorLayerName() const;
694 const char* c_str() const;
696 operator const char* (void) const;
697 protected:
699 virtual bool ParseRuleString();
700 protected:
701 CPLString m_soSrcLayerName;
702 CPLString m_soTgtLayerName;
703 CPLString m_soConnLayerName;
704 bool m_bAllow;
705 bool m_bValid;
706 bool m_bAny;
707 CPLString m_soRuleString;
709 };
710
717 class OGRGNMWrappedResultLayer : public OGRLayer
718 {
719 public:
720 OGRGNMWrappedResultLayer(GDALDataset* poDS, OGRLayer* poLayer);
721 ~OGRGNMWrappedResultLayer();
722
723 // OGRLayer
724 virtual void ResetReading() override;
725 virtual OGRFeature *GetNextFeature() override;
726 virtual OGRErr SetNextByIndex( GIntBig nIndex ) override;
727 virtual OGRFeature *GetFeature( GIntBig nFID ) override;
728 virtual OGRFeatureDefn *GetLayerDefn() override;
729 virtual GIntBig GetFeatureCount( int bForce = TRUE ) override;
730 virtual int TestCapability( const char * pszCap ) override;
731 virtual OGRErr CreateField( OGRFieldDefn *poField, int bApproxOK = TRUE ) override;
732 virtual OGRErr CreateGeomField( OGRGeomFieldDefn *poField,
733 int bApproxOK = TRUE ) override;
734 virtual const char *GetFIDColumn() override;
735 virtual const char *GetGeometryColumn() override;
736 virtual OGRSpatialReference *GetSpatialRef() override;
737
738 // OGRGNMWrappedResultLayer
739 virtual OGRErr InsertFeature(OGRFeature* poFeature,
740 const CPLString &soLayerName, int nPathNo,
741 bool bIsEdge);
742 protected:
743 virtual OGRErr ISetFeature( OGRFeature *poFeature ) override;
744 virtual OGRErr ICreateFeature( OGRFeature *poFeature ) override;
745 protected:
747 GDALDataset *poDS;
748 OGRLayer *poLayer;
750 };
751
752 #endif // __cplusplus
753
754 #endif // GNM
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:333
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:340
GDALDataset::GetFileList
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2950
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1483
GDALOpenInfo
Class for dataset open functions.
Definition: gdal_priv.h:269
GNMGenericLayer
GNM layer which represents a geography network layer of generic format.
Definition: gnm.h:493
GNMGenericLayer::GetFIDColumn
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
GNMGenericLayer::GetName
virtual const char * GetName() override
Return the layer name.
Definition: gnmlayer.cpp:255
GNMGenericLayer::ReorderFields
virtual OGRErr ReorderFields(int *panMap) override
Reorder all the fields of a layer.
Definition: gnmlayer.cpp:309
GNMGenericLayer::SetIgnoredFields
virtual OGRErr SetIgnoredFields(const char **papszFields) override
Set which fields can be omitted when retrieving features from the layer.
Definition: gnmlayer.cpp:62
GNMGenericLayer::GetLayerDefn
virtual OGRFeatureDefn * GetLayerDefn() override
Fetch the schema information for this layer.
Definition: gnmlayer.cpp:363
GNMGenericLayer::CreateField
virtual OGRErr CreateField(OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition: gnmlayer.cpp:295
GNMGenericLayer::SetStyleTable
virtual void SetStyleTable(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition: gnmlayer.cpp:343
GNMGenericLayer::GetExtent
virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce=TRUE) override
Fetch the extent of this layer.
Definition: gnmlayer.cpp:280
GNMGenericLayer::SyncToDisk
virtual OGRErr SyncToDisk() override
Flush pending changes to disk.
Definition: gnmlayer.cpp:328
GNMGenericLayer::Union
OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Union.
Definition: gnmlayer.cpp:77
GNMGenericLayer::FindFieldIndex
virtual int FindFieldIndex(const char *pszFieldName, int bExactMatch) override
Find the index of field in the layer.
Definition: gnmlayer.cpp:265
GNMGenericLayer::GetFeatureCount
virtual GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition: gnmlayer.cpp:275
GNMGenericLayer::~GNMGenericLayer
virtual ~GNMGenericLayer()
~GNMGenericLayer
Definition: gnmlayer.cpp:50
GNMGenericLayer::ResetReading
virtual void ResetReading() override
Reset feature reading to start on the first feature.
Definition: gnmlayer.cpp:209
GNMGenericLayer::Clip
OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Clip.
Definition: gnmlayer.cpp:109
GNMGenericLayer::RollbackTransaction
virtual OGRErr RollbackTransaction() override
For datasources which support transactions, RollbackTransaction will roll back a datasource to its st...
Definition: gnmlayer.cpp:358
GNMGenericLayer::GetStyleTable
virtual OGRStyleTable * GetStyleTable() override
Returns layer style table.
Definition: gnmlayer.cpp:333
GNMGenericLayer::SetSpatialFilter
virtual void SetSpatialFilter(OGRGeometry *) override
Set a new spatial filter.
Definition: gnmlayer.cpp:181
GNMGenericLayer::TestCapability
virtual int TestCapability(const char *) override
Test if this layer supported the named capability.
Definition: gnmlayer.cpp:290
GNMGenericLayer::SetNextByIndex
virtual OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition: gnmlayer.cpp:225
GNMGenericLayer::AlterFieldDefn
virtual OGRErr AlterFieldDefn(int iField, OGRFieldDefn *poNewFieldDefn, int nFlagsIn) override
Alter the definition of an existing field on a layer.
Definition: gnmlayer.cpp:314
GNMGenericLayer::Update
OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Update.
Definition: gnmlayer.cpp:101
GNMGenericLayer::GetSpatialRef
virtual OGRSpatialReference * GetSpatialRef() override
Fetch the spatial reference system for this layer.
Definition: gnmlayer.cpp:270
GNMGenericLayer::DeleteField
virtual OGRErr DeleteField(int iField) override
Delete an existing field on a layer.
Definition: gnmlayer.cpp:300
GNMGenericLayer::SetSpatialFilterRect
virtual void SetSpatialFilterRect(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) override
Set a new rectangular spatial filter.
Definition: gnmlayer.cpp:186
GNMGenericLayer::GetGeomType
virtual OGRwkbGeometryType GetGeomType() override
Return the layer geometry type.
Definition: gnmlayer.cpp:260
GNMGenericLayer::GetNextFeature
virtual OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition: gnmlayer.cpp:214
GNMGenericLayer::CommitTransaction
virtual OGRErr CommitTransaction() override
For datasources which support transactions, CommitTransaction commits a transaction.
Definition: gnmlayer.cpp:353
GNMGenericLayer::GetFeaturesRead
GIntBig GetFeaturesRead()
GetFeaturesRead.
Definition: gnmlayer.cpp:125
GNMGenericLayer::StartTransaction
virtual OGRErr StartTransaction() override
For datasources which support transactions, StartTransaction creates a transaction.
Definition: gnmlayer.cpp:348
GNMGenericLayer::Intersection
OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Intersection.
Definition: gnmlayer.cpp:67
GNMGenericLayer::SetAttributeFilter
virtual OGRErr SetAttributeFilter(const char *) override
Set a new attribute query.
Definition: gnmlayer.cpp:204
GNMGenericLayer::GetGeometryColumn
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
GNMGenericLayer::GetSpatialFilter
virtual OGRGeometry * GetSpatialFilter() override
This method returns the current spatial filter for this layer.
Definition: gnmlayer.cpp:176
GNMGenericLayer::AttributeFilterEvaluationNeedsGeometry
int AttributeFilterEvaluationNeedsGeometry()
AttributeFilterEvaluationNeedsGeometry.
Definition: gnmlayer.cpp:130
GNMGenericLayer::SetStyleTableDirectly
virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition: gnmlayer.cpp:338
GNMGenericLayer::DeleteFeature
virtual OGRErr DeleteFeature(GIntBig nFID) override
Delete feature from layer.
Definition: gnmlayer.cpp:230
GNMGenericLayer::CreateGeomField
virtual OGRErr CreateGeomField(OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition: gnmlayer.cpp:323
GNMGenericLayer::SymDifference
OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
SymDifference.
Definition: gnmlayer.cpp:85
GNMGenericLayer::GNMGenericLayer
GNMGenericLayer(OGRLayer *poLayer, GNMGenericNetwork *poNetwork)
GNMGenericLayer.
Definition: gnmlayer.cpp:38
GNMGenericLayer::Identity
OGRErr Identity(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Identity.
Definition: gnmlayer.cpp:93
GNMGenericLayer::Erase
OGRErr Erase(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Erase.
Definition: gnmlayer.cpp:117
GNMGenericNetwork
GNM class which represents a geography network of generic format.
Definition: gnm.h:195
GNMGenericNetwork::DisconnectAll
virtual CPLErr DisconnectAll() override
DisconnectAll method clears the network graph.
GNMGenericNetwork::AddFeatureGlobalFID
virtual CPLErr AddFeatureGlobalFID(GNMGFID nFID, const char *pszLayerName)
AddFeatureGlobalFID add the FID <-> Layer name link to fast access features by global FID.
GNMGenericNetwork::FlushCache
virtual void FlushCache(void) override
Flush all write cached data to disk.
GNMGenericNetwork::DeleteRule
virtual CPLErr DeleteRule(const char *pszRuleStr)
Delete the specified rule.
GNMGenericNetwork::GetRules
virtual char ** GetRules() const
Get the rule list.
GNMGenericNetwork::TestCapability
virtual int TestCapability(const char *) override
Test if capability is available.
GNMGenericNetwork::CheckLayerDriver
virtual CPLErr CheckLayerDriver(const char *pszDefaultDriverName, char **papszOptions)
Check or create layer OGR driver.
GNMGenericNetwork::DeleteAllRules
virtual CPLErr DeleteAllRules()
Delete all rules from network.
GNMGenericNetwork::ReconnectFeatures
virtual CPLErr ReconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID, GNMGFID nConFID, double dfCost=1, double dfInvCost=1, GNMDirection eDir=GNM_EDGE_DIR_BOTH)
Change connection attributes.
GNMGenericNetwork::GetLayer
virtual OGRLayer * GetLayer(int) override
Fetch a layer by index.
GNMGenericNetwork::GetLayerCount
virtual int GetLayerCount() override
Get the number of layers in this dataset.
GNMGenericNetwork::GetAlgorithmName
virtual CPLString GetAlgorithmName(GNMDirection eAlgorithm, bool bShortName)
Get the algorithm name.
GNMGenericNetwork::GetFeatureByGlobalFID
virtual OGRFeature * GetFeatureByGlobalFID(GNMGFID nFID) override
GetFeatureByGlobalFID search all network layers for given feature identificator.
GNMGenericNetwork::ConnectFeatures
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).
GNMGenericNetwork::CopyLayer
virtual OGRLayer * CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName, char **papszOptions=nullptr) override
Duplicate an existing layer.
GNMGenericNetwork::DisconnectFeaturesWithId
virtual CPLErr DisconnectFeaturesWithId(GNMGFID nFID)
Find the corresponding identificator in graph (source, target, connector) and remove such connections...
GNMGenericNetwork::ChangeAllBlockState
virtual CPLErr ChangeAllBlockState(bool bIsBlock=false)
Change all vertices and edges block state.
GNMGenericNetwork::GetPath
virtual OGRLayer * GetPath(GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions) override
Create path between start and end GFIDs.
GNMGenericNetwork::GetVersion
virtual int GetVersion() const override
GetVersion return the network version if applicable.
GNMGenericNetwork::DisconnectFeatures
virtual CPLErr DisconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID, GNMGFID nConFID)
Remove features connection.
GNMGenericNetwork::CloseDependentDatasets
virtual int CloseDependentDatasets() override
Drop references to any other datasets referenced by this dataset.
GNMGenericNetwork::Create
virtual CPLErr Create(const char *pszFilename, char **papszOptions) override=0
Create network system layers.
GNMGenericNetwork::CheckStorageDriverSupport
virtual bool CheckStorageDriverSupport(const char *pszDriverName)=0
Check if provided OGR driver accepted as storage for network data.
GNMGenericNetwork::GetNewGlobalFID
virtual GNMGFID GetNewGlobalFID()
GetNewGlobalFID increase the global ID counter.
GNMGenericNetwork::CreateRule
virtual CPLErr CreateRule(const char *pszRuleStr)
Create network rule.
GNMGenericNetwork::ConnectPointsByLines
virtual CPLErr ConnectPointsByLines(char **papszLayerList, double dfTolerance, double dfCost, double dfInvCost, GNMDirection eDir)
Attempts to build the network topology automatically.
GNMGenericNetwork::ChangeBlockState
virtual CPLErr ChangeBlockState(GNMGFID nFID, bool bIsBlock)
Change the block state of edge or vertex.
GNMGenericNetwork::Delete
virtual CPLErr Delete() override
Delete network.
GNMGenericNetwork::DeleteLayer
virtual OGRErr DeleteLayer(int) override
Delete the indicated layer from the datasource.
GNMGraph
The simple graph class, which holds the appropriate for calculations graph in memory (based on STL co...
Definition: gnmgraph.h:90
GNMNetwork
General GNM class which represents a geography network of common format.
Definition: gnm.h:75
GNMNetwork::GetPath
virtual OGRLayer * GetPath(GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions)=0
Create path between start and end GFIDs.
GNMNetwork::Delete
virtual CPLErr Delete()=0
Delete network.
GNMNetwork::DisconnectAll
virtual CPLErr DisconnectAll()=0
DisconnectAll method clears the network graph.
GNMNetwork::GetFeatureByGlobalFID
virtual OGRFeature * GetFeatureByGlobalFID(GNMGFID nGFID)=0
GetFeatureByGlobalFID search all network layers for given feature identificator.
GNMNetwork::GetSpatialRef
const OGRSpatialReference * GetSpatialRef() const override
Fetch the spatial reference for this dataset.
Definition: gnm.h:81
GNMNetwork::GetVersion
virtual int GetVersion() const
GetVersion return the network version if applicable.
Definition: gnm.h:135
GNMNetwork::Open
virtual CPLErr Open(GDALOpenInfo *poOpenInfo)=0
Open a network.
GNMNetwork::Create
virtual CPLErr Create(const char *pszFilename, char **papszOptions)=0
Create network system layers.
GNMNetwork::CheckNetworkExist
virtual int CheckNetworkExist(const char *pszFilename, char **papszOptions)=0
Check if network already exist.
GNMRule
The simple class for rules.
Definition: gnm.h:641
GNMRule::GNMRule
GNMRule()
Constructor.
GNMRule::GetTargetLayerName
virtual CPLString GetTargetLayerName() const
Return target layer name.
GNMRule::IsAcceptAny
virtual bool IsAcceptAny() const
Indicator of any layer state.
GNMRule::CanConnect
virtual bool CanConnect(const CPLString &soSrcLayerName, const CPLString &soTgtLayerName, const CPLString &soConnLayerName="")
Check if connection can take place.
GNMRule::GNMRule
GNMRule(const char *pszRule)
Constructor.
GNMRule::GNMRule
GNMRule(const GNMRule &oRule)
Constructor.
GNMRule::GetConnectorLayerName
virtual CPLString GetConnectorLayerName() const
Return connector layer name.
GNMRule::c_str
const char * c_str() const
Return rule as a string.
GNMRule::GetSourceLayerName
virtual CPLString GetSourceLayerName() const
Return source layer name.
GNMRule::GNMRule
GNMRule(const std::string &oRule)
Constructor.
GNMRule::IsValid
virtual bool IsValid() const
This function indicate if rule string was parsed successfully.
GNMRule::operator=
GNMRule & operator=(const GNMRule &)=default
Assignment operator.
GNMRule::GetType
virtual GNMRuleType GetType() const
This is for future use to indicate the rule type/ Now return only GRTConnection type.
OGREnvelope
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:58
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition: ogr_feature.h:279
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:374
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:99
OGRGNMWrappedResultLayer
The OGRGNMWrappedResultLayer class for search paths queries results.
Definition: gnm.h:718
OGRGNMWrappedResultLayer::InsertFeature
virtual OGRErr InsertFeature(OGRFeature *poFeature, const CPLString &soLayerName, int nPathNo, bool bIsEdge)
Undocumented.
Definition: gnmresultlayer.cpp:125
OGRGNMWrappedResultLayer::SetNextByIndex
virtual OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition: gnmresultlayer.cpp:73
OGRGNMWrappedResultLayer::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature) override
Create and write a new feature within a layer.
Definition: gnmresultlayer.cpp:212
OGRGNMWrappedResultLayer::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature) override
Rewrite an existing feature.
Definition: gnmresultlayer.cpp:207
OGRGNMWrappedResultLayer::GetLayerDefn
virtual OGRFeatureDefn * GetLayerDefn() override
Fetch the schema information for this layer.
Definition: gnmresultlayer.cpp:83
OGRGNMWrappedResultLayer::CreateField
virtual OGRErr CreateField(OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition: gnmresultlayer.cpp:98
OGRGNMWrappedResultLayer::GetNextFeature
virtual OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition: gnmresultlayer.cpp:68
OGRGNMWrappedResultLayer::CreateGeomField
virtual OGRErr CreateGeomField(OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition: gnmresultlayer.cpp:103
OGRGNMWrappedResultLayer::GetFIDColumn
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
OGRGNMWrappedResultLayer::GetFeature
virtual OGRFeature * GetFeature(GIntBig nFID) override
Fetch a feature by its identifier.
Definition: gnmresultlayer.cpp:78
OGRGNMWrappedResultLayer::GetFeatureCount
virtual GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition: gnmresultlayer.cpp:88
OGRGNMWrappedResultLayer::GetSpatialRef
virtual OGRSpatialReference * GetSpatialRef() override
Fetch the spatial reference system for this layer.
Definition: gnmresultlayer.cpp:119
OGRGNMWrappedResultLayer::GetGeometryColumn
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
OGRGNMWrappedResultLayer::TestCapability
virtual int TestCapability(const char *pszCap) override
Test if this layer supported the named capability.
Definition: gnmresultlayer.cpp:93
OGRGNMWrappedResultLayer::ResetReading
virtual void ResetReading() override
Reset feature reading to start on the first feature.
Definition: gnmresultlayer.cpp:63
OGRGNMWrappedResultLayer::OGRGNMWrappedResultLayer
OGRGNMWrappedResultLayer(GDALDataset *poDS, OGRLayer *poLayer)
Constructor.
Definition: gnmresultlayer.cpp:36
OGRGeomFieldDefn
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:202
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:327
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:71
OGRLayer::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature)
Create and write a new feature within a layer.
Definition: ogrlayer.cpp:637
OGRLayer::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature)
Rewrite an existing feature.
Definition: ogrlayer.cpp:598
OGRLineString
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1407
OGRMultiLineString
A collection of OGRLineString.
Definition: ogr_geometry.h:3128
OGRPoint
Point class.
Definition: ogr_geometry.h:936
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
OGRStyleTable
This class represents a style table.
Definition: ogr_featurestyle.h:85
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:53
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:248
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:346
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:318
ogrsf_frmts.h
Classes related to registration of format support, and opening datasets.