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(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(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(const char **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(OGRFieldDefn *poField,
725 int bApproxOK = TRUE) override;
726 virtual OGRErr CreateGeomField(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
OGRGNMWrappedResultLayer
The OGRGNMWrappedResultLayer class for search paths queries results.
Definition: gnm.h:710
GNMNetwork::Create
virtual CPLErr Create(const char *pszFilename, char **papszOptions)=0
Create network system layers.
OGRLineString
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1681
GNMGenericLayer::SetIgnoredFields
virtual OGRErr SetIgnoredFields(const char **papszFields) override
Set which fields can be omitted when retrieving features from the layer.
Definition: gnmlayer.cpp:60
GNMGenericLayer::GetStyleTable
virtual OGRStyleTable * GetStyleTable() override
Returns layer style table.
Definition: gnmlayer.cpp:337
GDALOpenInfo
Class for dataset open functions.
Definition: gdal_priv.h:276
GNMGenericLayer::ResetReading
virtual void ResetReading() override
Reset feature reading to start on the first feature.
Definition: gnmlayer.cpp:211
OGRLayer::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature)
Create and write a new feature within a layer.
Definition: ogrlayer.cpp:649
GNMGenericLayer::GetGeomType
virtual OGRwkbGeometryType GetGeomType() override
Return the layer geometry type.
Definition: gnmlayer.cpp:261
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
OGRGNMWrappedResultLayer::ResetReading
virtual void ResetReading() override
Reset feature reading to start on the first feature.
Definition: gnmresultlayer.cpp:61
GNMGenericLayer::GetNextFeature
virtual OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition: gnmlayer.cpp:216
OGRStyleTable
This class represents a style table.
Definition: ogr_featurestyle.h:84
GNMGenericLayer::CreateField
virtual OGRErr CreateField(OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition: gnmlayer.cpp:297
OGRGNMWrappedResultLayer::GetSpatialRef
virtual OGRSpatialReference * GetSpatialRef() override
Fetch the spatial reference system for this layer.
Definition: gnmresultlayer.cpp:118
GNMGenericLayer::SetStyleTable
virtual void SetStyleTable(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition: gnmlayer.cpp:347
GNMGraph
The simple graph class, which holds the appropriate for calculations graph in memory (based on STL co...
Definition: gnmgraph.h:89
GNMNetwork::DisconnectAll
virtual CPLErr DisconnectAll()=0
DisconnectAll method clears the network graph.
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1693
OGRGNMWrappedResultLayer::GetFeatureCount
virtual GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition: gnmresultlayer.cpp:86
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:166
GNMGenericLayer
GNM layer which represents a geography network layer of generic format.
Definition: gnm.h:490
GNMGenericLayer::SetSpatialFilterRect
virtual void SetSpatialFilterRect(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) override
Set a new rectangular spatial filter.
Definition: gnmlayer.cpp:188
GDALDataset::GetLayer
virtual OGRLayer * GetLayer(int iLayer)
Fetch a layer by index.
Definition: gdaldataset.cpp:7009
GNMGenericLayer::DeleteField
virtual OGRErr DeleteField(int iField) override
Delete an existing field on a layer.
Definition: gnmlayer.cpp:302
GNMGenericLayer::TestCapability
virtual int TestCapability(const char *) override
Test if this layer supported the named capability.
Definition: gnmlayer.cpp:292
GNMGenericLayer::GetExtent
virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce=TRUE) override
Fetch the extent of this layer.
Definition: gnmlayer.cpp:281
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:334
GNMGenericLayer::SymDifference
OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
SymDifference.
Definition: gnmlayer.cpp:83
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:72
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:311
GNMGenericLayer::GetFeatureCount
virtual GIntBig GetFeatureCount(int bForce=TRUE) override
Fetch the feature count in this layer.
Definition: gnmlayer.cpp:276
GNMGenericLayer::SetSpatialFilter
virtual void SetSpatialFilter(OGRGeometry *) override
Set a new spatial filter.
Definition: gnmlayer.cpp:183
OGRPoint
Point class.
Definition: ogr_geometry.h:1083
OGRLayer::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature)
Rewrite/replace an existing feature.
Definition: ogrlayer.cpp:609
GDALDataset::CopyLayer
virtual OGRLayer * CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName, char **papszOptions=nullptr)
Duplicate an existing layer.
Definition: gdaldataset.cpp:5166
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:347
GNMGenericLayer::CommitTransaction
virtual OGRErr CommitTransaction() override
For datasources which support transactions, CommitTransaction commits a transaction.
Definition: gnmlayer.cpp:357
GNMNetwork
General GNM class which represents a geography network of common format.
Definition: gnm.h:74
GNMGenericLayer::RollbackTransaction
virtual OGRErr RollbackTransaction() override
For datasources which support transactions, RollbackTransaction will roll back a datasource to its st...
Definition: gnmlayer.cpp:362
GNMGenericLayer::SetStyleTableDirectly
virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable) override
Set layer style table.
Definition: gnmlayer.cpp:342
GNMNetwork::GetPath
virtual OGRLayer * GetPath(GNMGFID nStartFID, GNMGFID nEndFID, GNMGraphAlgorithmType eAlgorithm, char **papszOptions)=0
Create path between start and end GFIDs.
OGRMultiLineString
A collection of OGRLineString.
Definition: ogr_geometry.h:3798
GNMGenericLayer::SetAttributeFilter
virtual OGRErr SetAttributeFilter(const char *) override
Set a new attribute query.
Definition: gnmlayer.cpp:206
GNMGenericLayer::Erase
OGRErr Erase(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Erase.
Definition: gnmlayer.cpp:118
GNMNetwork::GetVersion
virtual int GetVersion() const
GetVersion return the network version if applicable.
Definition: gnm.h:133
GDALDataset::Open
static GDALDataset * Open(const char *pszFilename, unsigned int nOpenFlags=0, const char *const *papszAllowedDrivers=nullptr, const char *const *papszOpenOptions=nullptr, const char *const *papszSiblingFiles=nullptr)
Definition: gdal_priv.h:700
GNMGenericLayer::CreateGeomField
virtual OGRErr CreateGeomField(OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition: gnmlayer.cpp:326
GNMGenericLayer::FindFieldIndex
virtual int FindFieldIndex(const char *pszFieldName, int bExactMatch) override
Find the index of field in the layer.
Definition: gnmlayer.cpp:266
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:113
ogrsf_frmts.h
GNMGenericLayer::GetFeaturesRead
GIntBig GetFeaturesRead()
GetFeaturesRead.
Definition: gnmlayer.cpp:126
GNMGenericLayer::SyncToDisk
virtual OGRErr SyncToDisk() override
Flush pending changes to disk.
Definition: gnmlayer.cpp:332
GNMGenericLayer::GNMGenericLayer
GNMGenericLayer(OGRLayer *poLayer, GNMGenericNetwork *poNetwork)
GNMGenericLayer.
Definition: gnmlayer.cpp:36
OGRGNMWrappedResultLayer::GetLayerDefn
virtual OGRFeatureDefn * GetLayerDefn() override
Fetch the schema information for this layer.
Definition: gnmresultlayer.cpp:81
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h: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:108
OGRGNMWrappedResultLayer::TestCapability
virtual int TestCapability(const char *pszCap) override
Test if this layer supported the named capability.
Definition: gnmresultlayer.cpp:91
GNMGenericLayer::DeleteFeature
virtual OGRErr DeleteFeature(GIntBig nFID) override
Delete feature from layer.
Definition: gnmlayer.cpp:232
GDALDataset::CloseDependentDatasets
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:4190
OGRGeomFieldDefn
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:275
OGRGNMWrappedResultLayer::OGRGNMWrappedResultLayer
OGRGNMWrappedResultLayer(GDALDataset *poDS, OGRLayer *poLayer)
Constructor.
Definition: gnmresultlayer.cpp:34
OGRGNMWrappedResultLayer::GetNextFeature
virtual OGRFeature * GetNextFeature() override
Fetch the next available feature from this layer.
Definition: gnmresultlayer.cpp:66
GNMGenericLayer::GetLayerDefn
virtual OGRFeatureDefn * GetLayerDefn() override
Fetch the schema information for this layer.
Definition: gnmlayer.cpp:367
GNMGenericLayer::~GNMGenericLayer
virtual ~GNMGenericLayer()
~GNMGenericLayer
Definition: gnmlayer.cpp:46
OGRGNMWrappedResultLayer::CreateField
virtual OGRErr CreateField(OGRFieldDefn *poField, int bApproxOK=TRUE) override
Create a new field on a layer.
Definition: gnmresultlayer.cpp:96
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:378
GDALDataset::GetSpatialRef
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:1060
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:235
GDALDataset::GetFileList
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:3058
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:406
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
GNMNetwork::GetFeatureByGlobalFID
virtual OGRFeature * GetFeatureByGlobalFID(GNMGFID nGFID)=0
GetFeatureByGlobalFID search all network layers for given feature identificator.
GNMGenericLayer::Intersection
OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Intersection.
Definition: gnmlayer.cpp:65
GNMGenericLayer::SetNextByIndex
virtual OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition: gnmlayer.cpp:227
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:669
GNMGenericLayer::Clip
OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Clip.
Definition: gnmlayer.cpp:110
OGRGNMWrappedResultLayer::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature) override
Create and write a new feature within a layer.
Definition: gnmresultlayer.cpp:215
GDALDataset::GetLayerCount
virtual int GetLayerCount()
Get the number of layers in this dataset.
Definition: gdaldataset.cpp:6979
GNMGenericLayer::Union
OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Union.
Definition: gnmlayer.cpp:75
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:52
GNMGenericLayer::Identity
OGRErr Identity(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Identity.
Definition: gnmlayer.cpp:93
OGRGNMWrappedResultLayer::GetFeature
virtual OGRFeature * GetFeature(GIntBig nFID) override
Fetch a feature by its identifier.
Definition: gnmresultlayer.cpp:76
OGRGNMWrappedResultLayer::InsertFeature
virtual OGRErr InsertFeature(OGRFeature *poFeature, const CPLString &soLayerName, int nPathNo, bool bIsEdge)
Undocumented.
Definition: gnmresultlayer.cpp:124
GNMGenericLayer::AttributeFilterEvaluationNeedsGeometry
int AttributeFilterEvaluationNeedsGeometry()
AttributeFilterEvaluationNeedsGeometry.
Definition: gnmlayer.cpp:131
OGRGNMWrappedResultLayer::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature) override
Rewrite/replace an existing feature.
Definition: gnmresultlayer.cpp:210
GNMGenericLayer::Update
OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
Update.
Definition: gnmlayer.cpp:102
OGREnvelope
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:57
GNMGenericLayer::StartTransaction
virtual OGRErr StartTransaction() override
For datasources which support transactions, StartTransaction creates a transaction.
Definition: gnmlayer.cpp:352
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition: ogr_feature.h:374
GDALDataset::TestCapability
virtual int TestCapability(const char *)
Test if capability is available.
Definition: gdaldataset.cpp:7368
GNMGenericLayer::ReorderFields
virtual OGRErr ReorderFields(int *panMap) override
Reorder all the fields of a layer.
Definition: gnmlayer.cpp:311
GNMGenericLayer::GetName
virtual const char * GetName() override
Return the layer name.
Definition: gnmlayer.cpp:256
OGRGNMWrappedResultLayer::CreateGeomField
virtual OGRErr CreateGeomField(OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
Create a new geometry field on a layer.
Definition: gnmresultlayer.cpp:102
GNMGenericNetwork
GNM class which represents a geography network of generic format.
Definition: gnm.h:193
GNMGenericLayer::GetSpatialRef
virtual OGRSpatialReference * GetSpatialRef() override
Fetch the spatial reference system for this layer.
Definition: gnmlayer.cpp:271
GNMRule
The simple class for rules.
Definition: gnm.h:631
OGRGNMWrappedResultLayer::SetNextByIndex
virtual OGRErr SetNextByIndex(GIntBig nIndex) override
Move read cursor to the nIndex'th feature in the current resultset.
Definition: gnmresultlayer.cpp:71
GNMGenericLayer::GetSpatialFilter
virtual OGRGeometry * GetSpatialFilter() override
This method returns the current spatial filter for this layer.
Definition: gnmlayer.cpp:178
GDALDataset::FlushCache
virtual CPLErr FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:519
GDALDataset::DeleteLayer
virtual OGRErr DeleteLayer(int iLayer)
Delete the indicated layer from the datasource.
Definition: gdaldataset.cpp:5530
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:316
GNMNetwork::Delete
virtual CPLErr Delete()=0
Delete network.