GDAL

gnm.h
1/******************************************************************************
2 *
3 * Project: GDAL/OGR Geography Network support (Geographic Network Model)
4 * Purpose: GNM general public declarations.
5 * Authors: Mikhail Gusev (gusevmihs at gmail dot com)
6 * Dmitry Baryshnikov, polimax@mail.ru
7 *
8 ******************************************************************************
9 * Copyright (c) 2014, Mikhail Gusev
10 * Copyright (c) 2014-2015, NextGIS <info@nextgis.com>
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 * DEALINGS IN THE SOFTWARE.
29 ****************************************************************************/
30
31#ifndef GNM
32#define GNM
33
34#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
35#include "ogrsf_frmts.h"
36#endif
37#include "gnmgraph.h"
38
39// Direction of an edge.
40 typedef int GNMDirection; // We use int values in order to save them to the
41 // network data.
42
43// Network's metadata parameters names.
44#define GNM_MD_NAME "net_name"
45#define GNM_MD_DESCR "net_description"
46#define GNM_MD_SRS "net_srs"
47#define GNM_MD_VERSION "net_version"
48#define GNM_MD_RULE "net_rule"
49#define GNM_MD_FORMAT "FORMAT"
50#define GNM_MD_FETCHEDGES "fetch_edge"
51#define GNM_MD_FETCHVERTEX "fetch_vertex"
52#define GNM_MD_NUM_PATHS "num_paths"
53#define GNM_MD_EMITTER "emitter"
54
55// TODO: Constants for capabilities.
56// #define GNMCanChangeConnections "CanChangeConnections"
57
58 typedef enum
59{
GATDijkstraShortestPath = 1, GATKShortestPath, GATConnectedComponents
63} GNMGraphAlgorithmType;
64
65#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
66
73 class CPL_DLL GNMNetwork : public GDALDataset
74{
75 public:
76 GNMNetwork();
77 ~GNMNetwork() override;
78
79 // GDALDataset Interface
80 const OGRSpatialReference *GetSpatialRef() const override;
81 char **GetFileList(void) override;
82
83 // GNMNetwork Interface
84
105 virtual CPLErr Create(const char *pszFilename, char **papszOptions) = 0;
106
112 virtual CPLErr Open(GDALOpenInfo *poOpenInfo) = 0;
113
118 virtual CPLErr Delete() = 0;
119
126 virtual const char *GetName() const;
127
132 virtual int GetVersion() const
133 {
134 return 0;
135 }
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,
164 char **papszOptions) = 0;
165
167 static inline GNMNetwork *FromHandle(GNMGenericNetworkH hNet)
168 {
169 return static_cast<GNMNetwork *>(hNet);
170 }
171
173 static inline GNMGenericNetworkH ToHandle(GNMNetwork *poNetwork)
174 {
175 return static_cast<GNMGenericNetworkH>(poNetwork);
176 }
177
178 protected:
185 virtual int CheckNetworkExist(const char *pszFilename,
186 char **papszOptions) = 0;
187
188 protected:
190 CPLString m_soName{};
191 OGRSpatialReference m_oSRS{};
193};
194
195 class GNMRule;
196 class OGRGNMWrappedResultLayer;
197
204 class CPL_DLL GNMGenericNetwork : public GNMNetwork
205{
206 public:
207 GNMGenericNetwork();
208 ~GNMGenericNetwork() override;
209
210 // GDALDataset Interface
211
212 int GetLayerCount() const override;
213 OGRLayer *GetLayer(int) const override;
214 OGRErr DeleteLayer(int) override;
215
216 int TestCapability(const char *) const override;
217
218 virtual OGRLayer *CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName,
219 char **papszOptions = nullptr) override;
220
221 int CloseDependentDatasets() override;
222 CPLErr FlushCache(bool bAtClosing) override;
223
224 // GNMNetwork Interface
225
226 virtual CPLErr Create(const char *pszFilename,
227 char **papszOptions) override = 0;
228 CPLErr Delete() override;
229
230 int GetVersion() const override;
235 virtual GNMGFID GetNewGlobalFID();
236
243 virtual CPLString GetAlgorithmName(GNMDirection eAlgorithm,
244 bool bShortName);
245
253 virtual CPLErr AddFeatureGlobalFID(GNMGFID nFID, const char *pszLayerName);
254
269 virtual CPLErr ConnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID,
270 GNMGFID nConFID = -1, double dfCost = 1,
271 double dfInvCost = 1,
272 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
273
281 virtual CPLErr DisconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID,
282 GNMGFID nConFID);
283
290 virtual CPLErr DisconnectFeaturesWithId(GNMGFID nFID);
291
304 virtual CPLErr ReconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID,
305 GNMGFID nConFID, double dfCost = 1,
306 double dfInvCost = 1,
307 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
308
309 CPLErr DisconnectAll() override;
310
311 OGRFeature *GetFeatureByGlobalFID(GNMGFID nFID) override;
312
347 virtual CPLErr CreateRule(const char *pszRuleStr);
348
353 virtual CPLErr DeleteAllRules();
354
360 virtual CPLErr DeleteRule(const char *pszRuleStr);
361
367 virtual char **GetRules() const;
368
393 virtual CPLErr ConnectPointsByLines(char **papszLayerList,
394 double dfTolerance, double dfCost,
395 double dfInvCost, GNMDirection eDir);
396
403 virtual CPLErr ChangeBlockState(GNMGFID nFID, bool bIsBlock);
404
413 virtual CPLErr ChangeAllBlockState(bool bIsBlock = false);
414
415 virtual OGRLayer *GetPath(GNMGFID nStartFID, GNMGFID nEndFID,
416 GNMGraphAlgorithmType eAlgorithm,
417 char **papszOptions) override;
418
420 static inline GNMGenericNetwork *FromHandle(GNMGenericNetworkH hNet)
421 {
422 return static_cast<GNMGenericNetwork *>(hNet);
423 }
424
426 static inline GNMGenericNetworkH ToHandle(GNMGenericNetwork *poNetwork)
427 {
428 return static_cast<GNMGenericNetworkH>(poNetwork);
429 }
430
431 protected:
438 virtual CPLErr CheckLayerDriver(const char *pszDefaultDriverName,
439 char **papszOptions);
445 virtual bool CheckStorageDriverSupport(const char *pszDriverName) = 0;
446
447 protected:
449 virtual CPLErr CreateMetadataLayer(GDALDataset *const pDS, int nVersion,
450 size_t nFieldSize = 1024);
451 virtual CPLErr StoreNetworkSrs();
452 virtual CPLErr LoadNetworkSrs();
453 virtual CPLErr CreateGraphLayer(GDALDataset *const pDS);
454 virtual CPLErr CreateFeaturesLayer(GDALDataset *const pDS);
455 virtual CPLErr LoadMetadataLayer(GDALDataset *const pDS);
456 virtual CPLErr LoadGraphLayer(GDALDataset *const pDS);
457 virtual CPLErr LoadGraph();
458 virtual CPLErr LoadFeaturesLayer(GDALDataset *const pDS);
459 virtual CPLErr DeleteMetadataLayer() = 0;
460 virtual CPLErr DeleteGraphLayer() = 0;
461 virtual CPLErr DeleteFeaturesLayer() = 0;
462 virtual CPLErr LoadNetworkLayer(const char *pszLayername) = 0;
463 virtual CPLErr DeleteNetworkLayers() = 0;
464 virtual void ConnectPointsByMultiline(
465 GIntBig nFID, const OGRMultiLineString *poMultiLineString,
466 const std::vector<OGRLayer *> &paPointLayers, double dfTolerance,
467 double dfCost, double dfInvCost, GNMDirection eDir);
468 virtual void
469 ConnectPointsByLine(GIntBig nFID, const OGRLineString *poLineString,
470 const std::vector<OGRLayer *> &paPointLayers,
471 double dfTolerance, double dfCost, double dfInvCost,
472 GNMDirection eDir);
473 virtual GNMGFID
474 FindNearestPoint(const OGRPoint *poPoint,
475 const std::vector<OGRLayer *> &paPointLayers,
476 double dfTolerance);
477 virtual OGRFeature *FindConnection(GNMGFID nSrcFID, GNMGFID nTgtFID,
478 GNMGFID nConFID);
479 virtual bool SaveRules();
480 virtual GNMGFID GetNewVirtualFID();
481 virtual void FillResultLayer(OGRGNMWrappedResultLayer *poResLayer,
482 const GNMPATH &path, int nNoOfPath,
483 bool bReturnVertices, bool bReturnEdges);
485 protected:
487 int m_nVersion = 0;
488 GNMGFID m_nGID = 0;
489 GNMGFID m_nVirtualConnectionGID = -1;
490 OGRLayer *m_poMetadataLayer = nullptr;
491 OGRLayer *m_poGraphLayer = nullptr;
492 OGRLayer *m_poFeaturesLayer = nullptr;
493
494 GDALDriver *m_poLayerDriver = nullptr;
495
496 std::map<GNMGFID, CPLString> m_moFeatureFIDMap{};
497 std::vector<OGRLayer *> m_apoLayers{};
498 std::vector<GNMRule> m_asRules;
499 bool m_bIsRulesChanged = false;
500
501 GNMGraph m_oGraph{};
502 bool m_bIsGraphLoaded = false;
504 private:
505 CPL_DISALLOW_COPY_ASSIGN(GNMGenericNetwork)
506};
507
515 class GNMGenericLayer final : public OGRLayer
516{
517 public:
518 GNMGenericLayer(OGRLayer *poLayer, GNMGenericNetwork *poNetwork);
519 ~GNMGenericLayer() override;
520
521 // OGRLayer Interface
522
523 OGRGeometry *GetSpatialFilter() override;
524
525 virtual OGRErr ISetSpatialFilter(int iGeomField,
526 const OGRGeometry *) override;
527
528 OGRErr SetAttributeFilter(const char *) override;
529
530 void ResetReading() override;
531 OGRFeature *GetNextFeature() override;
532 OGRErr SetNextByIndex(GIntBig nIndex) override;
533
534 OGRErr DeleteFeature(GIntBig nFID) override;
535
536 const char *GetName() const override;
537 OGRwkbGeometryType GetGeomType() const override;
538 const OGRFeatureDefn *GetLayerDefn() const override;
539 virtual int FindFieldIndex(const char *pszFieldName,
540 int bExactMatch) override;
541
542 const OGRSpatialReference *GetSpatialRef() const override;
543
544 GIntBig GetFeatureCount(int bForce = TRUE) override;
545
546 virtual OGRErr IGetExtent(int iGeomField, OGREnvelope *psExtent,
547 bool bForce = true) override;
548
549 int TestCapability(const char *) const override;
550
551 virtual OGRErr CreateField(const OGRFieldDefn *poField,
552 int bApproxOK = TRUE) override;
553 OGRErr DeleteField(int iField) override;
554 OGRErr ReorderFields(int *panMap) override;
555 virtual OGRErr AlterFieldDefn(int iField, OGRFieldDefn *poNewFieldDefn,
556 int nFlagsIn) override;
557
558 virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField,
559 int bApproxOK = TRUE) override;
560
561 OGRErr SyncToDisk() override;
562
563 OGRStyleTable *GetStyleTable() override;
564 void SetStyleTableDirectly(OGRStyleTable *poStyleTable) override;
565
566 void SetStyleTable(OGRStyleTable *poStyleTable) override;
567
568 OGRErr StartTransaction() override;
569 OGRErr CommitTransaction() override;
570 OGRErr RollbackTransaction() override;
571
572 const char *GetFIDColumn() const override;
573 const char *GetGeometryColumn() const override;
574
575 OGRErr SetIgnoredFields(CSLConstList papszFields) override;
576
578 OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
579 char **papszOptions = nullptr,
580 GDALProgressFunc pfnProgress = nullptr,
581 void *pProgressArg = nullptr);
583 OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
584 char **papszOptions = nullptr,
585 GDALProgressFunc pfnProgress = nullptr,
586 void *pProgressArg = nullptr);
588 OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
589 char **papszOptions, GDALProgressFunc pfnProgress,
590 void *pProgressArg);
592 OGRErr Identity(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
593 char **papszOptions = nullptr,
594 GDALProgressFunc pfnProgress = nullptr,
595 void *pProgressArg = nullptr);
597 OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
598 char **papszOptions = nullptr,
599 GDALProgressFunc pfnProgress = nullptr,
600 void *pProgressArg = nullptr);
602 OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
603 char **papszOptions = nullptr,
604 GDALProgressFunc pfnProgress = nullptr,
605 void *pProgressArg = nullptr);
607 OGRErr Erase(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
608 char **papszOptions = nullptr,
609 GDALProgressFunc pfnProgress = nullptr,
610 void *pProgressArg = nullptr);
611
613 GIntBig GetFeaturesRead();
614
616 int AttributeFilterEvaluationNeedsGeometry();
617
619 /* consider these private */
620 OGRErr InitializeIndexSupport(const char *);
621 OGRLayerAttrIndex *GetIndex();
623
624 protected:
626 OGRErr ISetFeature(OGRFeature *poFeature) override;
627 OGRErr ICreateFeature(OGRFeature *poFeature) override;
628
629 protected:
630 CPLString m_soLayerName{};
631 OGRLayer *m_poLayer = nullptr;
632 GNMGenericNetwork *m_poNetwork = nullptr;
633 std::map<GNMGFID, GIntBig> m_mnFIDMap{};
635
636 private:
637 CPL_DISALLOW_COPY_ASSIGN(GNMGenericLayer)
638};
639
640 typedef enum
641{
GRTConnection = 0
643} GNMRuleType;
644
654 class CPL_DLL GNMRule /* non final */
655{
656 public:
658 GNMRule();
660 explicit GNMRule(const std::string &oRule);
662 explicit GNMRule(const char *pszRule);
663
665 GNMRule(const GNMRule &) = default;
666
668 GNMRule(GNMRule &&) = default;
669
671 GNMRule &operator=(const GNMRule &) = default;
672
674 GNMRule &operator=(GNMRule &&) = default;
675
677 virtual ~GNMRule();
678
683 virtual bool IsValid() const;
688 virtual bool IsAcceptAny() const;
694 virtual GNMRuleType GetType() const;
703 virtual bool CanConnect(const CPLString &soSrcLayerName,
704 const CPLString &soTgtLayerName,
705 const CPLString &soConnLayerName = "");
707 virtual CPLString GetSourceLayerName() const;
709 virtual CPLString GetTargetLayerName() const;
711 virtual CPLString GetConnectorLayerName() const;
713 const char *c_str() const;
715 operator const char *(void) const;
716
717 protected:
719 virtual bool ParseRuleString();
720
721 protected:
722 CPLString m_soSrcLayerName{};
723 CPLString m_soTgtLayerName{};
724 CPLString m_soConnLayerName{};
725 bool m_bAllow = false;
726 bool m_bValid = false;
727 bool m_bAny = false;
728 CPLString m_soRuleString{};
730};
731
738 class OGRGNMWrappedResultLayer final : public OGRLayer
739{
740 public:
741 OGRGNMWrappedResultLayer(GDALDataset *poDS, OGRLayer *poLayer);
742 ~OGRGNMWrappedResultLayer() override;
743
744 // OGRLayer
745 void ResetReading() override;
746 OGRFeature *GetNextFeature() override;
747 OGRErr SetNextByIndex(GIntBig nIndex) override;
748 OGRFeature *GetFeature(GIntBig nFID) override;
749 const OGRFeatureDefn *GetLayerDefn() const override;
750 GIntBig GetFeatureCount(int bForce = TRUE) override;
751 int TestCapability(const char *pszCap) const override;
752 virtual OGRErr CreateField(const OGRFieldDefn *poField,
753 int bApproxOK = TRUE) override;
754 virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField,
755 int bApproxOK = TRUE) override;
756 const char *GetFIDColumn() const override;
757 const char *GetGeometryColumn() const override;
758 const OGRSpatialReference *GetSpatialRef() const override;
759
760 // OGRGNMWrappedResultLayer
761 OGRErr InsertFeature(OGRFeature *poFeature, const CPLString &soLayerName,
762 int nPathNo, bool bIsEdge);
763
764 protected:
765 OGRErr ISetFeature(OGRFeature *poFeature) override;
766 OGRErr ICreateFeature(OGRFeature *poFeature) override;
767
768 protected:
770 GDALDataset *poDS = nullptr;
771 OGRLayer *poLayer = nullptr;
773
774 private:
775 CPL_DISALLOW_COPY_ASSIGN(OGRGNMWrappedResultLayer)
776};
777
778#endif // __cplusplus
779
780#endif // GNM
CPLString
Convenient string class based on std::string.
Definition cpl_string.h:320
GDALDataset
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:76
GDALDataset::GetSpatialRef
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition gdaldataset.cpp:1251
GDALDataset::GetFileList
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition gdaldataset.cpp:3562
GDALDriver
Format specific driver.
Definition gdal_driver.h:63
GDALOpenInfo
Class for dataset open functions.
Definition gdal_openinfo.h:28
GNMGenericLayer
GNM layer which represents a geography network layer of generic format.
Definition gnm.h:516
GNMGenericLayer::GetSpatialRef
const OGRSpatialReference * GetSpatialRef() const override
Fetch the spatial reference system for this layer.
Definition gnmlayer.cpp:254
GNMGenericLayer::ReorderFields
OGRErr ReorderFields(int *panMap) override
Reorder all the fields of a layer.
Definition gnmlayer.cpp:289
GNMGenericLayer::~GNMGenericLayer
~GNMGenericLayer() override
~GNMGenericLayer
GNMGenericLayer::SetStyleTable
void SetStyleTable(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition gnmlayer.cpp:325
GNMGenericLayer::TestCapability
int TestCapability(const char *) const override
Test if this layer supported the named capability.
Definition gnmlayer.cpp:270
GNMGenericLayer::GetGeometryColumn
const char * GetGeometryColumn() const override
This method returns the name of the underlying database column being used as the geometry column,...
Definition gnmlayer.cpp:53
GNMGenericLayer::SyncToDisk
OGRErr SyncToDisk() override
Flush pending changes to disk.
Definition gnmlayer.cpp:310
GNMGenericLayer::Union
OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Union.
Definition gnmlayer.cpp:73
GNMGenericLayer::FindFieldIndex
virtual int FindFieldIndex(const char *pszFieldName, int bExactMatch) override
Find the index of field in the layer.
Definition gnmlayer.cpp:249
GNMGenericLayer::GetFeatureCount
GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition gnmlayer.cpp:259
GNMGenericLayer::ResetReading
void ResetReading() override
Reset feature reading to start on the first feature.
Definition gnmlayer.cpp:193
GNMGenericLayer::Clip
OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Clip.
Definition gnmlayer.cpp:108
GNMGenericLayer::RollbackTransaction
OGRErr RollbackTransaction() override
For datasources which support transactions, RollbackTransaction will roll back a datasource to its st...
Definition gnmlayer.cpp:340
GNMGenericLayer::GetGeomType
OGRwkbGeometryType GetGeomType() const override
Return the layer geometry type.
Definition gnmlayer.cpp:244
GNMGenericLayer::GetStyleTable
OGRStyleTable * GetStyleTable() override
Returns layer style table.
Definition gnmlayer.cpp:315
GNMGenericLayer::IGetExtent
virtual OGRErr IGetExtent(int iGeomField, OGREnvelope *psExtent, bool bForce=true) override
Fetch the extent of this layer, on the specified geometry field.
Definition gnmlayer.cpp:264
GNMGenericLayer::SetNextByIndex
OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition gnmlayer.cpp:209
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:294
GNMGenericLayer::Update
OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Update.
Definition gnmlayer.cpp:100
GNMGenericLayer::DeleteField
OGRErr DeleteField(int iField) override
Delete an existing field on a layer.
Definition gnmlayer.cpp:280
GNMGenericLayer::CreateGeomField
virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition gnmlayer.cpp:304
GNMGenericLayer::SetIgnoredFields
OGRErr SetIgnoredFields(CSLConstList papszFields) override
Set which fields can be omitted when retrieving features from the layer.
Definition gnmlayer.cpp:58
GNMGenericLayer::GetName
const char * GetName() const override
Return the layer name.
Definition gnmlayer.cpp:239
GNMGenericLayer::GetNextFeature
OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition gnmlayer.cpp:198
GNMGenericLayer::CommitTransaction
OGRErr CommitTransaction() override
For datasources which support transactions, CommitTransaction commits a transaction.
Definition gnmlayer.cpp:335
GNMGenericLayer::GetFeaturesRead
GIntBig GetFeaturesRead()
GetFeaturesRead.
Definition gnmlayer.cpp:124
GNMGenericLayer::GetLayerDefn
const OGRFeatureDefn * GetLayerDefn() const override
Fetch the schema information for this layer.
Definition gnmlayer.cpp:345
GNMGenericLayer::StartTransaction
OGRErr StartTransaction() override
For datasources which support transactions, StartTransaction creates a transaction.
Definition gnmlayer.cpp:330
GNMGenericLayer::Intersection
OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Intersection.
Definition gnmlayer.cpp:63
GNMGenericLayer::GetFIDColumn
const char * GetFIDColumn() const override
This method returns the name of the underlying database column being used as the FID column,...
Definition gnmlayer.cpp:48
GNMGenericLayer::SetAttributeFilter
OGRErr SetAttributeFilter(const char *) override
Set a new attribute query.
Definition gnmlayer.cpp:188
GNMGenericLayer::CreateField
virtual OGRErr CreateField(const OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition gnmlayer.cpp:275
GNMGenericLayer::GetSpatialFilter
OGRGeometry * GetSpatialFilter() override
This method returns the current spatial filter for this layer.
Definition gnmlayer.cpp:177
GNMGenericLayer::ISetSpatialFilter
virtual OGRErr ISetSpatialFilter(int iGeomField, const OGRGeometry *) override
Set a new spatial filter.
Definition gnmlayer.cpp:182
GNMGenericLayer::AttributeFilterEvaluationNeedsGeometry
int AttributeFilterEvaluationNeedsGeometry()
AttributeFilterEvaluationNeedsGeometry.
Definition gnmlayer.cpp:129
GNMGenericLayer::SetStyleTableDirectly
void SetStyleTableDirectly(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition gnmlayer.cpp:320
GNMGenericLayer::DeleteFeature
OGRErr DeleteFeature(GIntBig nFID) override
Delete feature from layer.
Definition gnmlayer.cpp:214
GNMGenericLayer::SymDifference
OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
SymDifference.
Definition gnmlayer.cpp:81
GNMGenericLayer::Identity
OGRErr Identity(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Identity.
Definition gnmlayer.cpp:91
GNMGenericLayer::Erase
OGRErr Erase(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Erase.
Definition gnmlayer.cpp:116
GNMGenericNetwork
GNM class which represents a geography network of generic format.
Definition gnm.h:205
GNMGenericNetwork::TestCapability
int TestCapability(const char *) const override
Test if capability is available.
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::FromHandle
static GNMGenericNetwork * FromHandle(GNMGenericNetworkH hNet)
Casts a handle to a pointer.
Definition gnm.h:420
GNMGenericNetwork::DeleteRule
virtual CPLErr DeleteRule(const char *pszRuleStr)
Delete the specified rule.
GNMGenericNetwork::GetRules
virtual char ** GetRules() const
Get the rule list.
GNMGenericNetwork::CheckLayerDriver
virtual CPLErr CheckLayerDriver(const char *pszDefaultDriverName, char **papszOptions)
Check or create layer OGR driver.
GNMGenericNetwork::GetFeatureByGlobalFID
OGRFeature * GetFeatureByGlobalFID(GNMGFID nFID) override
GetFeatureByGlobalFID search all network layers for given feature identificator.
GNMGenericNetwork::DeleteAllRules
virtual CPLErr DeleteAllRules()
Delete all rules from network.
GNMGenericNetwork::DeleteLayer
OGRErr DeleteLayer(int) override
Delete the indicated layer from the datasource.
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::GetAlgorithmName
virtual CPLString GetAlgorithmName(GNMDirection eAlgorithm, bool bShortName)
Get the algorithm name.
GNMGenericNetwork::GetLayer
OGRLayer * GetLayer(int) const override
Fetch a layer by index.
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::DisconnectFeaturesWithId
virtual CPLErr DisconnectFeaturesWithId(GNMGFID nFID)
Find the corresponding identificator in graph (source, target, connector) and remove such connections...
GNMGenericNetwork::GetLayerCount
int GetLayerCount() const override
Get the number of layers in this dataset.
GNMGenericNetwork::ChangeAllBlockState
virtual CPLErr ChangeAllBlockState(bool bIsBlock=false)
Change all vertices and edges block state.
GNMGenericNetwork::DisconnectFeatures
virtual CPLErr DisconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID, GNMGFID nConFID)
Remove features connection.
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::ToHandle
static GNMGenericNetworkH ToHandle(GNMGenericNetwork *poNetwork)
Casts a pointer to a handle.
Definition gnm.h:426
GNMGenericNetwork::DisconnectAll
CPLErr DisconnectAll() override
DisconnectAll method clears the network graph.
GNMGenericNetwork::CopyLayer
virtual OGRLayer * CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName, char **papszOptions=nullptr) override
Duplicate an existing layer.
GNMGenericNetwork::FlushCache
CPLErr FlushCache(bool bAtClosing) override
Flush all write cached data to disk.
GNMGenericNetwork::GetNewGlobalFID
virtual GNMGFID GetNewGlobalFID()
GetNewGlobalFID increase the global ID counter.
GNMGenericNetwork::CreateRule
virtual CPLErr CreateRule(const char *pszRuleStr)
Create network rule.
GNMGenericNetwork::GetPath
virtual OGRLayer * GetPath(GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions) override
Create path between start and end GFIDs.
GNMGenericNetwork::GetVersion
int GetVersion() const override
GetVersion return the network version if applicable.
GNMGenericNetwork::ConnectPointsByLines
virtual CPLErr ConnectPointsByLines(char **papszLayerList, double dfTolerance, double dfCost, double dfInvCost, GNMDirection eDir)
Attempts to build the network topology automatically.
GNMGenericNetwork::CloseDependentDatasets
int CloseDependentDatasets() override
Drop references to any other datasets referenced by this dataset.
GNMGenericNetwork::ChangeBlockState
virtual CPLErr ChangeBlockState(GNMGFID nFID, bool bIsBlock)
Change the block state of edge or vertex.
GNMGenericNetwork::Delete
CPLErr Delete() override
Delete network.
GNMGraph
The simple graph class, which holds the appropriate for calculations graph in memory (based on STL co...
Definition gnmgraph.h:89
GNMNetwork
General GNM class which represents a geography network of common format.
Definition gnm.h:74
GNMNetwork::Delete
virtual CPLErr Delete()=0
Delete network.
GNMNetwork::DisconnectAll
virtual CPLErr DisconnectAll()=0
DisconnectAll method clears the network graph.
GNMNetwork::ToHandle
static GNMGenericNetworkH ToHandle(GNMNetwork *poNetwork)
Casts a pointer to a handle.
Definition gnm.h:173
GNMNetwork::FromHandle
static GNMNetwork * FromHandle(GNMGenericNetworkH hNet)
Casts a handle to a pointer.
Definition gnm.h:167
GNMNetwork::GetPath
virtual OGRLayer * GetPath(GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions)=0
Create path between start and end GFIDs.
GNMNetwork::GetVersion
virtual int GetVersion() const
GetVersion return the network version if applicable.
Definition gnm.h:132
GNMNetwork::GetFeatureByGlobalFID
virtual OGRFeature * GetFeatureByGlobalFID(GNMGFID nGFID)=0
GetFeatureByGlobalFID search all network layers for given feature identificator.
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:655
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(GNMRule &&)=default
Move constructor.
GNMRule::c_str
const char * c_str() const
Return rule as a string.
GNMRule::GetConnectorLayerName
virtual CPLString GetConnectorLayerName() const
Return connector layer name.
GNMRule::GNMRule
GNMRule(const GNMRule &)=default
Copy constructor.
GNMRule::GetSourceLayerName
virtual CPLString GetSourceLayerName() const
Return source layer name.
GNMRule::operator=
GNMRule & operator=(const GNMRule &)=default
Assignment operator.
GNMRule::GNMRule
GNMRule(const std::string &oRule)
Constructor.
GNMRule::operator=
GNMRule & operator=(GNMRule &&)=default
Move assignment operator.
GNMRule::IsValid
virtual bool IsValid() const
This function indicate if rule string was parsed successfully.
GNMRule::~GNMRule
virtual ~GNMRule()
Destructor.
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:44
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition ogr_feature.h:504
OGRFeature
A simple feature, including geometry and attributes.
Definition ogr_feature.h:934
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition ogr_feature.h:69
OGRGNMWrappedResultLayer
The OGRGNMWrappedResultLayer class for search paths queries results.
Definition gnm.h:739
OGRGNMWrappedResultLayer::InsertFeature
OGRErr InsertFeature(OGRFeature *poFeature, const CPLString &soLayerName, int nPathNo, bool bIsEdge)
Undocumented.
Definition gnmresultlayer.cpp:125
OGRGNMWrappedResultLayer::SetNextByIndex
OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition gnmresultlayer.cpp:71
OGRGNMWrappedResultLayer::ICreateFeature
OGRErr ICreateFeature(OGRFeature *poFeature) override
Create and write a new feature within a layer.
Definition gnmresultlayer.cpp:204
OGRGNMWrappedResultLayer::ISetFeature
OGRErr ISetFeature(OGRFeature *poFeature) override
Rewrite/replace an existing feature.
Definition gnmresultlayer.cpp:199
OGRGNMWrappedResultLayer::CreateGeomField
virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition gnmresultlayer.cpp:103
OGRGNMWrappedResultLayer::CreateField
virtual OGRErr CreateField(const OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition gnmresultlayer.cpp:96
OGRGNMWrappedResultLayer::GetNextFeature
OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition gnmresultlayer.cpp:66
OGRGNMWrappedResultLayer::GetFIDColumn
const char * GetFIDColumn() const override
This method returns the name of the underlying database column being used as the FID column,...
Definition gnmresultlayer.cpp:109
OGRGNMWrappedResultLayer::TestCapability
int TestCapability(const char *pszCap) const override
Test if this layer supported the named capability.
Definition gnmresultlayer.cpp:91
OGRGNMWrappedResultLayer::GetFeature
OGRFeature * GetFeature(GIntBig nFID) override
Fetch a feature by its identifier.
Definition gnmresultlayer.cpp:76
OGRGNMWrappedResultLayer::GetLayerDefn
const OGRFeatureDefn * GetLayerDefn() const override
Fetch the schema information for this layer.
Definition gnmresultlayer.cpp:81
OGRGNMWrappedResultLayer::GetFeatureCount
GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition gnmresultlayer.cpp:86
OGRGNMWrappedResultLayer::GetSpatialRef
const OGRSpatialReference * GetSpatialRef() const override
Fetch the spatial reference system for this layer.
Definition gnmresultlayer.cpp:119
OGRGNMWrappedResultLayer::GetGeometryColumn
const char * GetGeometryColumn() const override
This method returns the name of the underlying database column being used as the geometry column,...
Definition gnmresultlayer.cpp:114
OGRGNMWrappedResultLayer::ResetReading
void ResetReading() override
Reset feature reading to start on the first feature.
Definition gnmresultlayer.cpp:61
OGRGeomFieldDefn
Definition of a geometry field of an OGRFeatureDefn.
Definition ogr_feature.h:332
OGRGeometry
Abstract base class for all geometry classes.
Definition ogr_geometry.h:357
OGRLayer
This class represents a layer of simple features, with access methods.
Definition ogrsf_frmts.h:61
OGRLayer::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature)
Create and write a new feature within a layer.
Definition ogrlayer.cpp:1462
OGRLayer::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature)
Rewrite/replace an existing feature.
Definition ogrlayer.cpp:1343
OGRLineString
Concrete representation of a multi-vertex line.
Definition ogr_geometry.h:1726
OGRMultiLineString
A collection of OGRLineString.
Definition ogr_geometry.h:4062
OGRPoint
Point class.
Definition ogr_geometry.h:1095
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
OGRStyleTable
This class represents a style table.
Definition ogr_featurestyle.h:69
CPLErr
CPLErr
Error category.
Definition cpl_error.h:37
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition cpl_port.h:936
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:205
GNMGenericNetworkH
void * GNMGenericNetworkH
Opaque type for a GNMGenericNetwork.
Definition gdal_fwd.h:212
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:405
OGRErr
int OGRErr
Type for a OGR error.
Definition ogr_core.h:370
ogrsf_frmts.h
Classes related to registration of format support, and opening datasets.