VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
overlayShapeFileLoadHandler.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2016 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
8 #pragma once
9 
10 #include <vrfGuiCore/vrfGuiCore.h>
12 #include <vrvUtil/DtUnicode.h>
13 #include <vrvCore/DtUniqueID.h>
14 #include <vlpi/entityType.h>
16 
17 class OGRLayer;
18 class OGRFeature;
19 class OGRPoint;
20 class OGRGeometry;
21 class GDALDataset;
22 
23 namespace makVrv
24 {
25  class DtDe;
26 }
27 
28 namespace makVrf
29 {
32  {
34  DtEntityType entityType;
35  int force;
36  std::vector<DtVector> localLocations;
37  };
38 
42  {
43  public:
45 
47  virtual std::vector<DtDataFileCreationData> loadDataFile(const std::string& file, const std::string& defaultOverlay = "") const = 0;
48 
49  protected:
51  };
52 
55  {
56  public:
58  DtOGRReader(makVrv::DtDe& de, const std::string& gdalDriver);
59 
60  virtual ~DtOGRReader();
61 
62  virtual std::vector<DtDataFileCreationData> loadDataFile(
63  const std::string& file, const std::string& defaultOverlay = "") const override;
64 
66  virtual std::vector<DtVector> getFeatureGeometry(OGRFeature*) const;
67 
68  protected:
70  virtual bool importLayer(GDALDataset* dataSource, OGRLayer*, const std::string&, const std::string& shapeFileName,
71  std::vector<DtDataFileCreationData>& importedData) const;
72 
74  virtual DtDataFileCreationData importFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*, const std::string&, const std::string& shapeFileName) const;
75 
77  virtual int getForceFromFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*, const std::string&) const;
78 
83  virtual DtEntityType getEntityTypeToCreateFromFeature(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
84 
86  virtual int geometryType(OGRGeometry*) const;
87 
88  virtual DtVector convertPointToLocal(OGRPoint*) const;
89 
91  virtual std::string nameFromFeature(OGRFeature*, const std::string& shapeFileName) const;
92 
93  struct FeatureStyle
94  {
95  int penColor;
96  int penWidth;
98  };
99 
101  virtual FeatureStyle getStyleForFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*) const;
102 
103  static void GDALErrorHandler(int eclass, int code, const char *msg );
104 
105  protected:
106  std::string myGDALDriver;
107  };
108 
111  {
112  public:
114  virtual ~DtOGRReaderCreator() override;
115 
116  virtual DtOGRReader* create(const std::string& gdalDriver);
117 
118  static DtOGRReaderCreator& instance(makVrv::DtDe& de);
119  static void registerInstance(makVrv::DtDe& de, DtOGRReaderCreator*);
120 
122  virtual int getForceFromFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*, const std::string&) const;
123 
124  virtual DtEntityType lineType(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
125  virtual DtEntityType pointType(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
126  virtual DtEntityType areaType(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
127 
128  protected:
130  };
131 
136  {
137  public:
138  typedef std::map<std::string, std::pair<DtDataFileReader*, makVrv::DtUnicode> > Drivers;
139 
142 
144  virtual ~DtOverlayShapeFileLoadHandler() override;
145 
146  static DtOverlayShapeFileLoadHandler& instance(makVrv::DtDe& de);
147  static void registerInstance(makVrv::DtDe& de, DtOverlayShapeFileLoadHandler*);
148 
150  virtual void setDefaultDriver(const std::string&);
151  virtual const std::string& defaultDriver() const;
152 
155  virtual bool importShapeFileOntoOverlay(const std::string& shapefile, const std::string& overlay, bool keepLocal = false);
156 
159  virtual const DtFilename& importFrom() const;
160 
162  virtual DtDataFileReader* readerBasedOnFilename(const std::string&) const;
163 
165  virtual void addDriver(const std::string& extension, DtDataFileReader*, const makVrv::DtUnicode& displayString);
166 
167  const Drivers& drivers() const
168  {
169  return myDrivers;
170  }
171 
172  protected:
176  std::string myDefaultDriver;
177  };
178 }
int penColor
Definition: overlayShapeFileLoadHandler.h:95
DtEnvironmentalCreationData data
Definition: overlayShapeFileLoadHandler.h:33
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
Definition: environmentalCreationData.h:27
Creator used to create the OGR Reader. Install your own version in an initDeModile to create your own...
Definition: overlayShapeFileLoadHandler.h:110
The DtOverlayShapeFileLoadHandler class is the interface to be used when loading a shape file and hav...
Definition: overlayShapeFileLoadHandler.h:135
DtFilename myImportFromDirectory
Definition: overlayShapeFileLoadHandler.h:174
The structure that needs to be filled in to create the environmental object.
Definition: overlayShapeFileLoadHandler.h:31
#define DT_DLL_VRFGUICORE
Contains DLL export macros.
Definition: vrfGuiCore.h:25
makVrv::DtDe & myDe
Definition: overlayShapeFileLoadHandler.h:173
Contains makVrv::DtVirtualBaseClass class.
const Drivers & drivers() const
Definition: overlayShapeFileLoadHandler.h:167
int force
Definition: overlayShapeFileLoadHandler.h:35
int brushColor
Definition: overlayShapeFileLoadHandler.h:97
makVrv::DtDe & myDe
Definition: overlayShapeFileLoadHandler.h:50
std::string myDefaultDriver
Definition: overlayShapeFileLoadHandler.h:176
Drivers myDrivers
Definition: overlayShapeFileLoadHandler.h:175
int penWidth
Definition: overlayShapeFileLoadHandler.h:96
std::map< std::string, std::pair< DtDataFileReader *, makVrv::DtUnicode > > Drivers
Definition: overlayShapeFileLoadHandler.h:138
DtEntityType entityType
Definition: overlayShapeFileLoadHandler.h:34
Contains makVrv::DtUniqueID type.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
Base OGR Reader class that will use GDAL and OGR to parse file.
Definition: overlayShapeFileLoadHandler.h:54
Definition: overlayShapeFileLoadHandler.h:93
std::string myGDALDriver
Definition: overlayShapeFileLoadHandler.h:106
makVrv::DtDe & myDe
Definition: overlayShapeFileLoadHandler.h:129
std::vector< DtVector > localLocations
Definition: overlayShapeFileLoadHandler.h:36
Base class for loading external data files to convert to local overlay objects. This class is only ex...
Definition: overlayShapeFileLoadHandler.h:41

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)