VR-Forces 5.0.3 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(const std::string& file, const std::string& defaultOverlay = "") const;
63 
64  protected:
66  virtual bool importLayer(GDALDataset* dataSource, OGRLayer*, const std::string&, const std::string& shapeFileName,
67  std::vector<DtDataFileCreationData>& importedData) const;
68 
70  virtual DtDataFileCreationData importFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*, const std::string&, const std::string& shapeFileName) const;
71 
73  virtual int getForceFromFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*, const std::string&) const;
74 
79  virtual DtEntityType getEntityTypeToCreateFromFeature(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
80 
82  virtual int geometryType(OGRGeometry*) const;
83 
85  virtual std::vector<DtVector> getFeatureGeometry(OGRFeature*) const;
86 
87  virtual DtVector convertPointToLocal(OGRPoint*) const;
88 
90  virtual std::string nameFromFeature(OGRFeature*, const std::string& shapeFileName) const;
91 
92  struct FeatureStyle
93  {
94  int penColor;
95  int penWidth;
97  };
98 
100  virtual FeatureStyle getStyleForFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*) const;
101 
102  static void GDALErrorHandler(int eclass, int code, const char *msg );
103 
104  protected:
105  std::string myGDALDriver;
106  };
107 
110  {
111  public:
113  virtual ~DtOGRReaderCreator();
114 
115  virtual DtOGRReader* create(const std::string& gdalDriver);
116 
117  static DtOGRReaderCreator& instance(makVrv::DtDe& de);
118  static void registerInstance(makVrv::DtDe& de, DtOGRReaderCreator*);
119 
121  virtual int getForceFromFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*, const std::string&) const;
122 
123  virtual DtEntityType lineType(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
124  virtual DtEntityType pointType(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
125  virtual DtEntityType areaType(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
126 
127  protected:
129  };
130 
135  {
136  public:
137  typedef std::map<std::string, std::pair<DtDataFileReader*, makVrv::DtUnicode> > Drivers;
138 
141 
144 
145  static DtOverlayShapeFileLoadHandler& instance(makVrv::DtDe& de);
146  static void registerInstance(makVrv::DtDe& de, DtOverlayShapeFileLoadHandler*);
147 
149  virtual void setDefaultDriver(const std::string&);
150  virtual const std::string& defaultDriver() const;
151 
154  virtual bool importShapeFileOntoOverlay(const std::string& shapefile, const std::string& overlay, bool keepLocal = false);
155 
158  virtual const DtFilename& importFrom() const;
159 
161  virtual DtDataFileReader* readerBasedOnFilename(const std::string&) const;
162 
164  virtual void addDriver(const std::string& extension, DtDataFileReader*, const makVrv::DtUnicode& displayString);
165 
166  const Drivers& drivers() const
167  {
168  return myDrivers;
169  }
170 
171  protected:
175  std::string myDefaultDriver;
176  };
177 }
int penColor
Definition: overlayShapeFileLoadHandler.h:94
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:109
The DtOverlayShapeFileLoadHandler class is the interface to be used when loading a shape file and hav...
Definition: overlayShapeFileLoadHandler.h:134
DtFilename myImportFromDirectory
Definition: overlayShapeFileLoadHandler.h:173
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:172
Contains makVrv::DtVirtualBaseClass class.
const Drivers & drivers() const
Definition: overlayShapeFileLoadHandler.h:166
int force
Definition: overlayShapeFileLoadHandler.h:35
int brushColor
Definition: overlayShapeFileLoadHandler.h:96
makVrv::DtDe & myDe
Definition: overlayShapeFileLoadHandler.h:50
std::string myDefaultDriver
Definition: overlayShapeFileLoadHandler.h:175
Drivers myDrivers
Definition: overlayShapeFileLoadHandler.h:174
int penWidth
Definition: overlayShapeFileLoadHandler.h:95
std::map< std::string, std::pair< DtDataFileReader *, makVrv::DtUnicode > > Drivers
Definition: overlayShapeFileLoadHandler.h:137
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:70
Base OGR Reader class that will use GDAL and OGR to parse file.
Definition: overlayShapeFileLoadHandler.h:54
Definition: overlayShapeFileLoadHandler.h:92
std::string myGDALDriver
Definition: overlayShapeFileLoadHandler.h:105
makVrv::DtDe & myDe
Definition: overlayShapeFileLoadHandler.h:128
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 Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)