VR-Forces 4.8 Class Documentation
 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 <vrvUtil/signalslib.h>
11 #include <vrfGuiCore/vrfGuiCore.h>
13 #include <vrvUtil/DtUnicode.h>
14 #include <vrvCore/DtUniqueID.h>
15 #include <vlpi/entityType.h>
17 
18 class OGRLayer;
19 class OGRFeature;
20 class OGRPoint;
21 class OGRGeometry;
22 class GDALDataset;
23 
24 namespace makVrv
25 {
26  class DtDe;
27 }
28 
29 namespace makVrf
30 {
33  {
35  DtEntityType entityType;
36  int force;
37  std::vector<DtVector> localLocations;
38  };
39 
43  {
44  public:
46 
48  virtual std::vector<DtDataFileCreationData> loadDataFile(const std::string& file, const std::string& defaultOverlay = "") const = 0;
49 
50  protected:
52  };
53 
56  {
57  public:
59  DtOGRReader(makVrv::DtDe& de, const std::string& gdalDriver);
60 
61  virtual ~DtOGRReader();
62 
63  virtual std::vector<DtDataFileCreationData> loadDataFile(const std::string& file, const std::string& defaultOverlay = "") const;
64 
65  protected:
67  virtual bool importLayer(GDALDataset* dataSource, OGRLayer*, const std::string&, const std::string& shapeFileName,
68  std::vector<DtDataFileCreationData>& importedData) const;
69 
71  virtual DtDataFileCreationData importFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*, const std::string&, const std::string& shapeFileName) const;
72 
74  virtual int getForceFromFeature(GDALDataset* dataSource, OGRLayer*, OGRFeature*, const std::string&) const;
75 
80  virtual DtEntityType getEntityTypeToCreateFromFeature(GDALDataset* dataSource, OGRLayer* layer, OGRFeature*, const std::string& shapeFileName) const;
81 
83  virtual int geometryType(OGRGeometry*) const;
84 
86  virtual std::vector<DtVector> getFeatureGeometry(OGRFeature*) 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();
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 
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:34
Virtual base class.
Definition: DtVirtualBaseClass.h:22
A unicode string.
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:32
#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:36
int brushColor
Definition: overlayShapeFileLoadHandler.h:97
makVrv::DtDe & myDe
Definition: overlayShapeFileLoadHandler.h:51
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:35
Contains makVrv::DtUniqueID type.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
Base OGR Reader class that will use GDAL and OGR to parse file.
Definition: overlayShapeFileLoadHandler.h:55
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:37
Base class for loading external data files to convert to local overlay objects.
Definition: overlayShapeFileLoadHandler.h:42

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)