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 virtual char **GetFileList(void) override;
83
84 // GNMNetwork Interface
85
106 virtual CPLErr Create(const char *pszFilename, char **papszOptions) = 0;
107
113 virtual CPLErr Open(GDALOpenInfo *poOpenInfo) = 0;
114
119 virtual CPLErr Delete() = 0;
120
127 virtual const char *GetName() const;
128
133 virtual int GetVersion() const
134 {
135 return 0;
136 }
137
142 virtual CPLErr DisconnectAll() = 0;
143
151 virtual OGRFeature *GetFeatureByGlobalFID(GNMGFID nGFID) = 0;
152
163 virtual OGRLayer *GetPath(GNMGFID nStartFID, GNMGFID nEndFID,
164 GNMGraphAlgorithmType eAlgorithm,
165 char **papszOptions) = 0;
166
167 protected:
174 virtual int CheckNetworkExist(const char *pszFilename,
175 char **papszOptions) = 0;
176
177 protected:
179 CPLString m_soName;
180 OGRSpatialReference m_oSRS{};
182};
183
184 class GNMRule;
185 class OGRGNMWrappedResultLayer;
186
193 class CPL_DLL GNMGenericNetwork : public GNMNetwork
194{
195 public:
196 GNMGenericNetwork();
197 virtual ~GNMGenericNetwork();
198
199 // GDALDataset Interface
200
201 virtual int GetLayerCount() override;
202 virtual OGRLayer *GetLayer(int) override;
203 virtual OGRErr DeleteLayer(int) override;
204
205 virtual int TestCapability(const char *) override;
206
207 virtual OGRLayer *CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName,
208 char **papszOptions = nullptr) override;
209
210 virtual int CloseDependentDatasets() override;
211 virtual CPLErr FlushCache(bool bAtClosing) override;
212
213 // GNMNetwork Interface
214
215 virtual CPLErr Create(const char *pszFilename,
216 char **papszOptions) override = 0;
217 virtual CPLErr Delete() override;
218
219 virtual int GetVersion() const override;
224 virtual GNMGFID GetNewGlobalFID();
225
232 virtual CPLString GetAlgorithmName(GNMDirection eAlgorithm,
233 bool bShortName);
234
242 virtual CPLErr AddFeatureGlobalFID(GNMGFID nFID, const char *pszLayerName);
243
258 virtual CPLErr ConnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID,
259 GNMGFID nConFID = -1, double dfCost = 1,
260 double dfInvCost = 1,
261 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
262
270 virtual CPLErr DisconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID,
271 GNMGFID nConFID);
272
279 virtual CPLErr DisconnectFeaturesWithId(GNMGFID nFID);
280
293 virtual CPLErr ReconnectFeatures(GNMGFID nSrcFID, GNMGFID nTgtFID,
294 GNMGFID nConFID, double dfCost = 1,
295 double dfInvCost = 1,
296 GNMDirection eDir = GNM_EDGE_DIR_BOTH);
297
298 virtual CPLErr DisconnectAll() override;
299
300 virtual OGRFeature *GetFeatureByGlobalFID(GNMGFID nFID) override;
301
336 virtual CPLErr CreateRule(const char *pszRuleStr);
337
342 virtual CPLErr DeleteAllRules();
343
349 virtual CPLErr DeleteRule(const char *pszRuleStr);
350
356 virtual char **GetRules() const;
357
382 virtual CPLErr ConnectPointsByLines(char **papszLayerList,
383 double dfTolerance, double dfCost,
384 double dfInvCost, GNMDirection eDir);
385
392 virtual CPLErr ChangeBlockState(GNMGFID nFID, bool bIsBlock);
393
402 virtual CPLErr ChangeAllBlockState(bool bIsBlock = false);
403
404 virtual OGRLayer *GetPath(GNMGFID nStartFID, GNMGFID nEndFID,
405 GNMGraphAlgorithmType eAlgorithm,
406 char **papszOptions) override;
407
408 protected:
415 virtual CPLErr CheckLayerDriver(const char *pszDefaultDriverName,
416 char **papszOptions);
422 virtual bool CheckStorageDriverSupport(const char *pszDriverName) = 0;
423
424 protected:
426 virtual CPLErr CreateMetadataLayer(GDALDataset *const pDS, int nVersion,
427 size_t nFieldSize = 1024);
428 virtual CPLErr StoreNetworkSrs();
429 virtual CPLErr LoadNetworkSrs();
430 virtual CPLErr CreateGraphLayer(GDALDataset *const pDS);
431 virtual CPLErr CreateFeaturesLayer(GDALDataset *const pDS);
432 virtual CPLErr LoadMetadataLayer(GDALDataset *const pDS);
433 virtual CPLErr LoadGraphLayer(GDALDataset *const pDS);
434 virtual CPLErr LoadGraph();
435 virtual CPLErr LoadFeaturesLayer(GDALDataset *const pDS);
436 virtual CPLErr DeleteMetadataLayer() = 0;
437 virtual CPLErr DeleteGraphLayer() = 0;
438 virtual CPLErr DeleteFeaturesLayer() = 0;
439 virtual CPLErr LoadNetworkLayer(const char *pszLayername) = 0;
440 virtual CPLErr DeleteNetworkLayers() = 0;
441 virtual void ConnectPointsByMultiline(
442 GIntBig nFID, const OGRMultiLineString *poMultiLineString,
443 const std::vector<OGRLayer *> &paPointLayers, double dfTolerance,
444 double dfCost, double dfInvCost, GNMDirection eDir);
445 virtual void
446 ConnectPointsByLine(GIntBig nFID, const OGRLineString *poLineString,
447 const std::vector<OGRLayer *> &paPointLayers,
448 double dfTolerance, double dfCost, double dfInvCost,
449 GNMDirection eDir);
450 virtual GNMGFID
451 FindNearestPoint(const OGRPoint *poPoint,
452 const std::vector<OGRLayer *> &paPointLayers,
453 double dfTolerance);
454 virtual OGRFeature *FindConnection(GNMGFID nSrcFID, GNMGFID nTgtFID,
455 GNMGFID nConFID);
456 virtual bool SaveRules();
457 virtual GNMGFID GetNewVirtualFID();
458 virtual void FillResultLayer(OGRGNMWrappedResultLayer *poResLayer,
459 const GNMPATH &path, int nNoOfPath,
460 bool bReturnVertices, bool bReturnEdges);
462 protected:
464 int m_nVersion;
465 GNMGFID m_nGID;
466 GNMGFID m_nVirtualConnectionGID;
467 OGRLayer *m_poMetadataLayer;
468 OGRLayer *m_poGraphLayer;
469 OGRLayer *m_poFeaturesLayer;
470
471 GDALDriver *m_poLayerDriver;
472
473 std::map<GNMGFID, CPLString> m_moFeatureFIDMap;
474 std::vector<OGRLayer *> m_apoLayers;
475 std::vector<GNMRule> m_asRules;
476 bool m_bIsRulesChanged;
477
478 GNMGraph m_oGraph;
479 bool m_bIsGraphLoaded;
481};
482
490 class GNMGenericLayer : public OGRLayer
491{
492 public:
493 GNMGenericLayer(OGRLayer *poLayer, GNMGenericNetwork *poNetwork);
494 virtual ~GNMGenericLayer();
495
496 // OGRLayer Interface
497
498 virtual OGRGeometry *GetSpatialFilter() override;
499 virtual void SetSpatialFilter(OGRGeometry *) override;
500 virtual void SetSpatialFilterRect(double dfMinX, double dfMinY,
501 double dfMaxX, double dfMaxY) override;
502
503 virtual void SetSpatialFilter(int iGeomField, OGRGeometry *) override;
504 virtual void SetSpatialFilterRect(int iGeomField, double dfMinX,
505 double dfMinY, double dfMaxX,
506 double dfMaxY) override;
507
508 virtual OGRErr SetAttributeFilter(const char *) override;
509
510 virtual void ResetReading() override;
511 virtual OGRFeature *GetNextFeature() override;
512 virtual OGRErr SetNextByIndex(GIntBig nIndex) override;
513
514 virtual OGRErr DeleteFeature(GIntBig nFID) override;
515
516 virtual const char *GetName() override;
517 virtual OGRwkbGeometryType GetGeomType() override;
518 virtual OGRFeatureDefn *GetLayerDefn() override;
519 virtual int FindFieldIndex(const char *pszFieldName,
520 int bExactMatch) override;
521
522 virtual OGRSpatialReference *GetSpatialRef() override;
523
524 virtual GIntBig GetFeatureCount(int bForce = TRUE) override;
525 virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE) override;
526 virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent,
527 int bForce = TRUE) override;
528
529 virtual int TestCapability(const char *) override;
530
531 virtual OGRErr CreateField(const OGRFieldDefn *poField,
532 int bApproxOK = TRUE) override;
533 virtual OGRErr DeleteField(int iField) override;
534 virtual OGRErr ReorderFields(int *panMap) override;
535 virtual OGRErr AlterFieldDefn(int iField, OGRFieldDefn *poNewFieldDefn,
536 int nFlagsIn) override;
537
538 virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField,
539 int bApproxOK = TRUE) override;
540
541 virtual OGRErr SyncToDisk() override;
542
543 virtual OGRStyleTable *GetStyleTable() override;
544 virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable) override;
545
546 virtual void SetStyleTable(OGRStyleTable *poStyleTable) override;
547
548 virtual OGRErr StartTransaction() override;
549 virtual OGRErr CommitTransaction() override;
550 virtual OGRErr RollbackTransaction() override;
551
552 virtual const char *GetFIDColumn() override;
553 virtual const char *GetGeometryColumn() override;
554
555 virtual OGRErr SetIgnoredFields(CSLConstList papszFields) override;
556
558 OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
559 char **papszOptions = nullptr,
560 GDALProgressFunc pfnProgress = nullptr,
561 void *pProgressArg = nullptr);
563 OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
564 char **papszOptions = nullptr,
565 GDALProgressFunc pfnProgress = nullptr,
566 void *pProgressArg = nullptr);
568 OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
569 char **papszOptions, GDALProgressFunc pfnProgress,
570 void *pProgressArg);
572 OGRErr Identity(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
573 char **papszOptions = nullptr,
574 GDALProgressFunc pfnProgress = nullptr,
575 void *pProgressArg = nullptr);
577 OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
578 char **papszOptions = nullptr,
579 GDALProgressFunc pfnProgress = nullptr,
580 void *pProgressArg = nullptr);
582 OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
583 char **papszOptions = nullptr,
584 GDALProgressFunc pfnProgress = nullptr,
585 void *pProgressArg = nullptr);
587 OGRErr Erase(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
588 char **papszOptions = nullptr,
589 GDALProgressFunc pfnProgress = nullptr,
590 void *pProgressArg = nullptr);
591
593 GIntBig GetFeaturesRead();
594
596 int AttributeFilterEvaluationNeedsGeometry();
597
599 /* consider these private */
600 OGRErr InitializeIndexSupport(const char *);
601 OGRLayerAttrIndex *GetIndex();
603
604 protected:
606 virtual OGRErr ISetFeature(OGRFeature *poFeature) override;
607 virtual OGRErr ICreateFeature(OGRFeature *poFeature) override;
608
609 protected:
610 CPLString m_soLayerName;
611 OGRLayer *m_poLayer;
612 GNMGenericNetwork *m_poNetwork;
613 std::map<GNMGFID, GIntBig> m_mnFIDMap;
615};
616
617 typedef enum
618{
GRTConnection = 0
620} GNMRuleType;
621
631 class CPL_DLL GNMRule
632{
633 // to hopefully please Coverity Scan which complains about missing
634 // move assignment operator for performance reasons
635 GNMRule &operator==(GNMRule &&) = delete;
636
637 public:
639 GNMRule();
641 explicit GNMRule(const std::string &oRule);
643 explicit GNMRule(const char *pszRule);
645 GNMRule(const GNMRule &oRule);
646
648 GNMRule &operator=(const GNMRule &) = default;
649
650 virtual ~GNMRule();
655 virtual bool IsValid() const;
660 virtual bool IsAcceptAny() const;
666 virtual GNMRuleType GetType() const;
675 virtual bool CanConnect(const CPLString &soSrcLayerName,
676 const CPLString &soTgtLayerName,
677 const CPLString &soConnLayerName = "");
679 virtual CPLString GetSourceLayerName() const;
681 virtual CPLString GetTargetLayerName() const;
683 virtual CPLString GetConnectorLayerName() const;
685 const char *c_str() const;
687 operator const char *(void) const;
688
689 protected:
691 virtual bool ParseRuleString();
692
693 protected:
694 CPLString m_soSrcLayerName;
695 CPLString m_soTgtLayerName;
696 CPLString m_soConnLayerName;
697 bool m_bAllow = false;
698 bool m_bValid = false;
699 bool m_bAny = false;
700 CPLString m_soRuleString;
702};
703
710 class OGRGNMWrappedResultLayer : public OGRLayer
711{
712 public:
713 OGRGNMWrappedResultLayer(GDALDataset *poDS, OGRLayer *poLayer);
714 ~OGRGNMWrappedResultLayer();
715
716 // OGRLayer
717 virtual void ResetReading() override;
718 virtual OGRFeature *GetNextFeature() override;
719 virtual OGRErr SetNextByIndex(GIntBig nIndex) override;
720 virtual OGRFeature *GetFeature(GIntBig nFID) override;
721 virtual OGRFeatureDefn *GetLayerDefn() override;
722 virtual GIntBig GetFeatureCount(int bForce = TRUE) override;
723 virtual int TestCapability(const char *pszCap) override;
724 virtual OGRErr CreateField(const OGRFieldDefn *poField,
725 int bApproxOK = TRUE) override;
726 virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField,
727 int bApproxOK = TRUE) override;
728 virtual const char *GetFIDColumn() override;
729 virtual const char *GetGeometryColumn() override;
730 virtual OGRSpatialReference *GetSpatialRef() override;
731
732 // OGRGNMWrappedResultLayer
733 virtual OGRErr InsertFeature(OGRFeature *poFeature,
734 const CPLString &soLayerName, int nPathNo,
735 bool bIsEdge);
736
737 protected:
738 virtual OGRErr ISetFeature(OGRFeature *poFeature) override;
739 virtual OGRErr ICreateFeature(OGRFeature *poFeature) override;
740
741 protected:
743 GDALDataset *poDS;
744 OGRLayer *poLayer;
746};
747
748#endif // __cplusplus
749
750#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_priv.h:490
GDALDataset::GetSpatialRef
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition gdaldataset.cpp:1192
GDALDataset::GetFileList
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition gdaldataset.cpp:3233
GDALDriver
Format specific driver.
Definition gdal_priv.h:1949
GDALOpenInfo
Class for dataset open functions.
Definition gdal_priv.h:301
GNMGenericLayer
GNM layer which represents a geography network layer of generic format.
Definition gnm.h:491
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:50
GNMGenericLayer::GetName
virtual const char * GetName() override
Return the layer name.
Definition gnmlayer.cpp:257
GNMGenericLayer::ReorderFields
virtual OGRErr ReorderFields(int *panMap) override
Reorder all the fields of a layer.
Definition gnmlayer.cpp:312
GNMGenericLayer::GetLayerDefn
virtual OGRFeatureDefn * GetLayerDefn() override
Fetch the schema information for this layer.
Definition gnmlayer.cpp:368
GNMGenericLayer::SetStyleTable
virtual void SetStyleTable(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition gnmlayer.cpp:348
GNMGenericLayer::GetExtent
virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce=TRUE) override
Fetch the extent of this layer.
Definition gnmlayer.cpp:282
GNMGenericLayer::SyncToDisk
virtual OGRErr SyncToDisk() override
Flush pending changes to disk.
Definition gnmlayer.cpp:333
GNMGenericLayer::Union
OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Union.
Definition gnmlayer.cpp:75
GNMGenericLayer::FindFieldIndex
virtual int FindFieldIndex(const char *pszFieldName, int bExactMatch) override
Find the index of field in the layer.
Definition gnmlayer.cpp:267
GNMGenericLayer::GetFeatureCount
virtual GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition gnmlayer.cpp:277
GNMGenericLayer::~GNMGenericLayer
virtual ~GNMGenericLayer()
~GNMGenericLayer
Definition gnmlayer.cpp:46
GNMGenericLayer::ResetReading
virtual void ResetReading() override
Reset feature reading to start on the first feature.
Definition gnmlayer.cpp:212
GNMGenericLayer::Clip
OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Clip.
Definition gnmlayer.cpp:110
GNMGenericLayer::RollbackTransaction
virtual OGRErr RollbackTransaction() override
For datasources which support transactions, RollbackTransaction will roll back a datasource to its st...
Definition gnmlayer.cpp:363
GNMGenericLayer::GetStyleTable
virtual OGRStyleTable * GetStyleTable() override
Returns layer style table.
Definition gnmlayer.cpp:338
GNMGenericLayer::SetSpatialFilter
virtual void SetSpatialFilter(OGRGeometry *) override
Set a new spatial filter.
Definition gnmlayer.cpp:184
GNMGenericLayer::TestCapability
virtual int TestCapability(const char *) override
Test if this layer supported the named capability.
Definition gnmlayer.cpp:293
GNMGenericLayer::SetNextByIndex
virtual OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition gnmlayer.cpp:228
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:317
GNMGenericLayer::Update
OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Update.
Definition gnmlayer.cpp:102
GNMGenericLayer::GetSpatialRef
virtual OGRSpatialReference * GetSpatialRef() override
Fetch the spatial reference system for this layer.
Definition gnmlayer.cpp:272
GNMGenericLayer::DeleteField
virtual OGRErr DeleteField(int iField) override
Delete an existing field on a layer.
Definition gnmlayer.cpp:303
GNMGenericLayer::SetSpatialFilterRect
virtual void SetSpatialFilterRect(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) override
Set a new rectangular spatial filter.
Definition gnmlayer.cpp:189
GNMGenericLayer::GetGeomType
virtual OGRwkbGeometryType GetGeomType() override
Return the layer geometry type.
Definition gnmlayer.cpp:262
GNMGenericLayer::CreateGeomField
virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition gnmlayer.cpp:327
GNMGenericLayer::SetIgnoredFields
virtual OGRErr SetIgnoredFields(CSLConstList papszFields) override
Set which fields can be omitted when retrieving features from the layer.
Definition gnmlayer.cpp:60
GNMGenericLayer::GetNextFeature
virtual OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition gnmlayer.cpp:217
GNMGenericLayer::CommitTransaction
virtual OGRErr CommitTransaction() override
For datasources which support transactions, CommitTransaction commits a transaction.
Definition gnmlayer.cpp:358
GNMGenericLayer::GetFeaturesRead
GIntBig GetFeaturesRead()
GetFeaturesRead.
Definition gnmlayer.cpp:126
GNMGenericLayer::StartTransaction
virtual OGRErr StartTransaction() override
For datasources which support transactions, StartTransaction creates a transaction.
Definition gnmlayer.cpp:353
GNMGenericLayer::Intersection
OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Intersection.
Definition gnmlayer.cpp:65
GNMGenericLayer::SetAttributeFilter
virtual OGRErr SetAttributeFilter(const char *) override
Set a new attribute query.
Definition gnmlayer.cpp:207
GNMGenericLayer::CreateField
virtual OGRErr CreateField(const OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition gnmlayer.cpp:298
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:55
GNMGenericLayer::GetSpatialFilter
virtual OGRGeometry * GetSpatialFilter() override
This method returns the current spatial filter for this layer.
Definition gnmlayer.cpp:179
GNMGenericLayer::AttributeFilterEvaluationNeedsGeometry
int AttributeFilterEvaluationNeedsGeometry()
AttributeFilterEvaluationNeedsGeometry.
Definition gnmlayer.cpp:131
GNMGenericLayer::SetStyleTableDirectly
virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition gnmlayer.cpp:343
GNMGenericLayer::DeleteFeature
virtual OGRErr DeleteFeature(GIntBig nFID) override
Delete feature from layer.
Definition gnmlayer.cpp:233
GNMGenericLayer::SymDifference
OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
SymDifference.
Definition gnmlayer.cpp:83
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:118
GNMGenericNetwork
GNM class which represents a geography network of generic format.
Definition gnm.h:194
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::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::FlushCache
virtual CPLErr FlushCache(bool bAtClosing) override
Flush all write cached data to disk.
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::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::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::GetLayer
virtual OGRLayer * GetLayer(int) override
Fetch a layer by index.
GNMGenericNetwork::ChangeAllBlockState
virtual CPLErr ChangeAllBlockState(bool bIsBlock=false)
Change all vertices and edges block state.
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::GetFeatureByGlobalFID
virtual OGRFeature * GetFeatureByGlobalFID(GNMGFID nFID) override
GetFeatureByGlobalFID search all network layers for given feature identificator.
GNMGenericNetwork::CopyLayer
virtual OGRLayer * CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName, char **papszOptions=nullptr) override
Duplicate an existing layer.
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::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::Delete
virtual CPLErr Delete()=0
Delete network.
GNMNetwork::DisconnectAll
virtual CPLErr DisconnectAll()=0
DisconnectAll method clears the network graph.
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:133
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:632
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::c_str
const char * c_str() const
Return rule as a string.
GNMRule::GetConnectorLayerName
virtual CPLString GetConnectorLayerName() const
Return connector layer name.
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::IsValid
virtual bool IsValid() const
This function indicate if rule string was parsed successfully.
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:61
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition ogr_feature.h:517
OGRFeature
A simple feature, including geometry and attributes.
Definition ogr_feature.h:893
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition ogr_feature.h:111
OGRGNMWrappedResultLayer
The OGRGNMWrappedResultLayer class for search paths queries results.
Definition gnm.h:711
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:71
OGRGNMWrappedResultLayer::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature) override
Create and write a new feature within a layer.
Definition gnmresultlayer.cpp:216
OGRGNMWrappedResultLayer::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature) override
Rewrite/replace an existing feature.
Definition gnmresultlayer.cpp:211
OGRGNMWrappedResultLayer::GetLayerDefn
virtual OGRFeatureDefn * GetLayerDefn() override
Fetch the schema information for this layer.
Definition gnmresultlayer.cpp:81
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
virtual OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition gnmresultlayer.cpp:66
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:76
OGRGNMWrappedResultLayer::GetFeatureCount
virtual GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition gnmresultlayer.cpp:86
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:91
OGRGNMWrappedResultLayer::ResetReading
virtual 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:346
OGRGeometry
Abstract base class for all geometry classes.
Definition ogr_geometry.h:377
OGRLayer
This class represents a layer of simple features, with access methods.
Definition ogrsf_frmts.h:74
OGRLayer::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature)
Create and write a new feature within a layer.
Definition ogrlayer.cpp:793
OGRLayer::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature)
Rewrite/replace an existing feature.
Definition ogrlayer.cpp:753
OGRLineString
Concrete representation of a multi-vertex line.
Definition ogr_geometry.h:1763
OGRMultiLineString
A collection of OGRLineString.
Definition ogr_geometry.h:4012
OGRPoint
Point class.
Definition ogr_geometry.h:1142
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:169
OGRStyleTable
This class represents a style table.
Definition ogr_featurestyle.h:86
CPLErr
CPLErr
Error category.
Definition cpl_error.h:53
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1183
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:215
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:416
OGRErr
int OGRErr
Type for a OGR error.
Definition ogr_core.h:387
ogrsf_frmts.h
Classes related to registration of format support, and opening datasets.