GlobeEngine
ModelLayer.h
Go to the documentation of this file.
1 
8 #ifndef GlobeEngine_ModelLayer_h
9 #define GlobeEngine_ModelLayer_h
10 
11 #include <string>
12 #include <vector>
13 
14 #include "Shader.h"
15 #include "TextureBundle.h"
16 #include "BorderObject.h"
17 #include "NamesObject.h"
18 #include "GPUProgramFactory.h"
19 #include "SceneBluePrint.h"
20 #include "ReferenceSystem.h"
21 #include "GlobeEngine.h"
22 #include "CommuterObject.h"
23 #include "Heightfield.h"
24 #include "DrawablePolyLine.h"
26 #include "Mesh.h"
27 #include "BundlingObject.h"
28 #include "MultiLineObject.h"
29 #include "HousingObject.h"
30 #include "MessageQueue.h"
31 #include "TrafficInfoObject.h"
32 #include "ChartObject.h"
33 #include "GreatCircleObject.h"
34 #include "CoatOfArmsObject.h"
35 #include "GlobeRasterModule.h"
36 #include "ArrowField.h"
37 #include "WeatherData.h"
38 
39 #ifndef Q_MOC_RUN
40 #include <pcl/point_types.h>
41 #endif // Q_MOC_RUN
42 
43 // TMS Support
44 #include "TileMapService.h"
45 
46 // AGR Support
47 #include "agrio.h"
48 
49 namespace geGIS {
50  class TrafficObject;
51 
53  {
54  enum MODELTYPE{ NONE=0,
77  POI,
82  };
83  };
84 
86  {
87  int index;
90  };
91 
93  {
94  std::string name;
98  bool isVisible;
99  };
100 
102  {
104  std::shared_ptr<FeatureBlueprint> blueprint;
105  };
106 
108  {
109  private:
110  static const int CATEGORYCOUNT = 13;
111  public:
112 
113 
114  public:
115  ModelLayer();
116  ~ModelLayer();
117 
118  void clear();
119  void clearInitial();
120  void deleteShader();
121  void create(std::shared_ptr<SceneBlueprint> _sceneBlueprint, GlobeEngine* _engine);
122  // runs update loop in case of loading jobs
123  void update();
124  void loadModelByBlueprint(enum ModelLayerCategories::MODELTYPE _type, std::shared_ptr<FeatureBlueprint> _blueprint);
125  void loadFromModelMap();
126 
127  std::shared_ptr<ge::Shader> loadShaderFromBlueprint(std::shared_ptr<ge::ShaderBlueprint> const& _blueprint);
128 
130  void updateNames(vmml::Vector3d _center);
132 
133  int addBundlingObject(vmml::Vector3f _pos);
134 
135  void doModelAnimationStep(ModelLayerSelection _selection);
136  void setObjectExtrusionXZ(float _input, ModelLayerSelection _selection);
137  void setObjectExtrusionY(float _input, ModelLayerSelection _selection);
138  void setObjectVisibility(bool _value, ModelLayerSelection _selection);
139  void setObjectVisualizationMode(int _value, enum ModelLayerCategories::MODELTYPE _type);
140 
141  void setObjectThickness(float _in, ModelLayerSelection _selection);
142  vmml::Vector2d getObjectMinMax(ModelLayerSelection _selection);
144  void updatePickingState(int _groupID, int _objID, int _entID, int _prev_groupID, int _prev_objID, int _prev_entID);
146  void setHeightScaleForAllLayers(float _input);
147  void setHeight(ModelLayerSelection _selection, double _input);
148  void setObjectPosition(ModelLayerSelection _selection, vmml::Vector3d _in);
149 
150  std::shared_ptr<FeatureObject> getWritableFeature(ModelLayerSelection _selection);
151  std::shared_ptr<LineFeatureObject> getWritableLineFeature(ModelLayerSelection _selection);
152  std::shared_ptr<PointFeatureObject> getWritablePointFeature(ModelLayerSelection _selection);
153 
154  const std::shared_ptr<FeatureObject> getFeature(ModelLayerSelection _selection);
155  const std::shared_ptr<LineFeatureObject> getLineFeature(ModelLayerSelection _selection);
156  const std::shared_ptr<ge::DrawableComponent> getObject(ModelLayerSelection _selection);
157  std::shared_ptr<ge::DrawableComponent> getWritableObject(ModelLayerSelection _selection);
158 
160 
161  unsigned int getObjectListSize(ModelLayerSelection _selection);
162  void setObjectColor(ModelLayerSelection _selection, vmml::Vector3f _in);
164  void setSplinesSegmentsDistance(ModelLayerSelection _selection, float _in);
165 
167  if(this->colorisationOnEditor){
168  this->colorisationOnEditor = false;
169  }else{
170  this->colorisationOnEditor = true;
171  }
172  }
173 
174  void setObjectColorRamp(ModelLayerSelection _selection, const std::shared_ptr<geData::ColorisationTable>& _colorTable);
175  void setColorEditorColorisation(ModelLayerSelection _selection, unsigned char* _transferFunctionData);
176 
177 
178  void moveCameraToObject(ModelLayerSelection _selection);
179 
180  void addPath(geData::DouglasPeuckerDrawablePath* _pathLine, vmml::Vector3d _pos, int _bundlingIdx);
181 
182  int addPathObject(std::shared_ptr<geData::PolyLine> _path, std::string _name, bool inLocalCoordinates);
183 
188  int addMultiLineObject(std::shared_ptr<geData::MultiLineObject> _object);
189 
194  int addMultiLineObject();
195 
200  int addPointCloud(std::shared_ptr<geData::PointCloud> _pointCloud);
201 
202 
203 
208  int addPointCloud(int _size);
209 
210  std::shared_ptr<geGIS::GlobeRasterModule> getTerrainModule();
211 
212  void saveObject(ModelLayerSelection _selection, std::string _path, std::string _ext);
213  void triangulateObject(ModelLayerSelection _selection);
214 
215  void setInitialScan(double _minHeight, double _maxHeight, double _interval);
216  void performScanStep(double _height);
217  void updateInitialScanning();
219  return initialScanOn;
220  }
221 
222  std::shared_ptr<geData::PointCloud> getPointCloud(int _id);
223  std::shared_ptr<geData::MultiLineObject> getMultiLineObject(int _id);
224 
225  double getScanHeight(){
226  return scanHeight;
227  }
228 
229  double getHeightScale(){
230  return heightScale;
231  }
232 
233  const std::shared_ptr<ReferenceSystem> getReferenceSystem();
234 
235  bool currentlyPicking();
237 
238  private:
239  // selected item
240  ModelLayerSelection currentSelection;
241  GlobeEngine* engine;
242  std::shared_ptr<SceneBlueprint> sceneBlueprint;
243  std::shared_ptr<ReferenceSystem> referenceSystem;
244 
245  std::vector< std::shared_ptr<CommuterObject> > commuterObjectList;
246  std::vector< std::shared_ptr<BorderObject> > borderObjectList;
247  std::vector< std::shared_ptr<GreatCircle> > greatcircleList;
248  std::vector< std::shared_ptr<HousingObject> > housingObjectList;
249  std::vector< std::shared_ptr<CoatOfArmsObject> > coaObjectList;
250  std::vector< std::shared_ptr<NamesObject> > namesObjectList;
251  std::vector< std::shared_ptr<ChartObject> > chartsObjectList;
252  std::vector< std::shared_ptr<TrafficInfoObject> > trafficInfoObjectList;
253  std::vector< std::shared_ptr<TrafficObject> > trafficObjectList;
254  std::vector< std::shared_ptr<geData::Heightfield> > heightfieldlist;
255  std::vector< std::shared_ptr<geData::PointCloud> > pointcloudlist;
256  std::vector< std::shared_ptr<geData::Mesh> > meshlist;
257  std::vector< std::shared_ptr<BundlingObject> > bundlingObjectList;
258  std::vector< std::shared_ptr<geData::MultiLineObject> > multiLineObjectList;
259  std::vector< std::shared_ptr<geData::DrawablePolyLine> > pathList;
260  std::vector< std::shared_ptr<ge::PositionBlueprint> > pointOfInterestList;
261 
262 
263  // Climate data objects
264  std::vector< std::shared_ptr<geFlow::ArrowField> > climateArrowfields;
265  std::vector<std::shared_ptr<ge::TextureBundle> > climateCloudfields;
266  std::vector< std::shared_ptr<ge::Texture2Df> > climateClouds;
267  std::vector< std::shared_ptr<ge::Plane> > climateCloudPlanes;
268  std::shared_ptr<geFlow::WeatherData> weatherData;
269  // object to animate the streamlines
270  std::shared_ptr<ge::Animation> borderAnimation;
271 
272  // Standardshader
273  //ge::ShaderMap shaderMap;
274  std::string shaderPath;
275  std::string genericShaderPath;
276 
277 
278  // GPU Programs
279  ge::GPUProgramFactory* gpuprogrammanager;
280  ge::GPUProgram* vectorprogram;
281 
282  // Elevation Data
283  float heightScale;
284  std::shared_ptr<geGIS::GlobeRasterModule> terrainmodule;
285 
286  //std::shared_ptr<geData::ColorisationTable> heightColor;
287  //std::shared_ptr<geData::ColorisationTable> editorColor;
288  std::shared_ptr<ge::Texture1Drgba> transferFunctionTexture;
289 
290  bool colorisationOnEditor;
291 
292  // initial occlusion query scanning
293  int steps;
294  double scanHeight;
295  double minScanHeight;
296  double scanStepSize;
297  bool initialScanOn;
298 
299  geSpatial::MessageQueue* featureServiceProvider;
300 
301  bool objectIsCurrentlyPicked;
302  ModelLayerSelection pickingSelection;
303 
304  ge::Timer timer;
305  };
306 }
307 #endif
void switchColorisationEditor()
Definition: ModelLayer.h:166
Definition: MessageQueue.h:26
std::shared_ptr< geGIS::GlobeRasterModule > getTerrainModule()
Definition: ModelLayer.cpp:2016
Definition: ModelLayer.h:101
void setObjectVisualizationMode(int _value, enum ModelLayerCategories::MODELTYPE _type)
Definition: ModelLayer.cpp:1076
void setInitialScan(double _minHeight, double _maxHeight, double _interval)
Definition: ModelLayer.cpp:1332
enum ModelLayerCategories::MODELTYPE type
Definition: ModelLayer.h:88
int numberOfEntities
Definition: ModelLayer.h:95
void updateNames(vmml::Vector3d _center)
void performScanStep(double _height)
Definition: ModelLayer.cpp:1355
const std::shared_ptr< LineFeatureObject > getLineFeature(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1182
ModelLayerObjectInformation getObjectInfo(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1715
void addPath(geData::DouglasPeuckerDrawablePath *_pathLine, vmml::Vector3d _pos, int _bundlingIdx)
Definition: ModelLayer.cpp:961
void setHeight(ModelLayerSelection _selection, double _input)
Definition: ModelLayer.cpp:1302
void moveCameraToObject(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1009
ge::DrawableComponent::RENDERSTATE drawModels(enum ModelLayerCategories::MODELTYPE _type, enum ge::DrawableComponent::RENDERSTATE _state, std::shared_ptr< ge::Camera > _cam)
Definition: ModelLayer.cpp:623
Definition: ModelLayer.h:71
int numberOfPoints
Definition: ModelLayer.h:96
Definition: ModelLayer.h:77
Definition: ModelLayer.h:54
void updateCommuterObjectBundlingProperty(ModelLayerSelection _selection, BundlingPropertyUpdate _input)
Definition: ModelLayer.cpp:1366
Definition: ModelLayer.h:68
Definition: ModelLayer.h:65
void setObjectColorRamp(ModelLayerSelection _selection, const std::shared_ptr< geData::ColorisationTable > &_colorTable)
Definition: ModelLayer.cpp:1935
Definition: ClusterGrid.h:17
Definition: GPUProgramFactory.h:24
void create(std::shared_ptr< SceneBlueprint > _sceneBlueprint, GlobeEngine *_engine)
Definition: ModelLayer.cpp:50
bool isVisible
Definition: ModelLayer.h:98
int addPathObject(std::shared_ptr< geData::PolyLine > _path, std::string _name, bool inLocalCoordinates)
Definition: ModelLayer.cpp:930
Definition: ModelLayer.h:79
Definition: ModelLayer.h:76
const std::shared_ptr< ReferenceSystem > getReferenceSystem()
Definition: ModelLayer.cpp:2149
Definition: ModelLayer.h:66
std::shared_ptr< ge::Shader > loadShaderFromBlueprint(std::shared_ptr< ge::ShaderBlueprint > const &_blueprint)
Definition: ModelLayer.cpp:196
int addMultiLineObject()
Definition: ModelLayer.cpp:1273
void setHeightScaleForAllLayers(float _input)
Definition: ModelLayer.cpp:2020
void setColorEditorColorisation(ModelLayerSelection _selection, unsigned char *_transferFunctionData)
Definition: ModelLayer.cpp:1910
Definition: GlobeEngine.h:62
int index
Definition: ModelLayer.h:87
Definition: DouglasPeuckerDrawablePath.h:69
bool isInitialScanOn()
Definition: ModelLayer.h:218
void setObjectVisibility(bool _value, ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1047
~ModelLayer()
Definition: ModelLayer.cpp:16
void setObjectExtrusionY(float _input, ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1028
std::shared_ptr< FeatureBlueprint > blueprint
Definition: ModelLayer.h:104
void loadModelByBlueprint(enum ModelLayerCategories::MODELTYPE _type, std::shared_ptr< FeatureBlueprint > _blueprint)
Definition: ModelLayer.cpp:210
Definition: ModelLayer.h:107
Definition: ModelLayer.h:69
void setObjectThickness(float _in, ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1088
const std::shared_ptr< ge::DrawableComponent > getObject(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1144
RENDERSTATE
Definition: DrawableComponent.h:28
void updateInitialScanning()
Definition: ModelLayer.cpp:1343
int entityindex
Definition: ModelLayer.h:89
unsigned int getObjectListSize(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1670
void loadFromModelMap()
Definition: ModelLayer.cpp:62
Definition: ModelLayer.h:59
double getScanHeight()
Definition: ModelLayer.h:225
Definition: ModelLayer.h:85
int addBundlingObject(vmml::Vector3f _pos)
Definition: ModelLayer.cpp:1633
Definition: ModelLayer.h:58
Definition: ModelLayer.h:62
Definition: CommuterObject.h:32
void setObjectColor(ModelLayerSelection _selection, vmml::Vector3f _in)
Definition: ModelLayer.cpp:1971
Definition: ModelLayer.h:92
int numberOfEdges
Definition: ModelLayer.h:97
Definition: ModelLayer.h:52
MODELTYPE
Definition: ModelLayer.h:54
Definition: ModelLayer.h:72
ModelLayer()
Definition: ModelLayer.cpp:8
void updatePickingState(int _groupID, int _objID, int _entID, int _prev_groupID, int _prev_objID, int _prev_entID)
Definition: ModelLayer.cpp:1375
std::shared_ptr< ge::DrawableComponent > getWritableObject(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1162
void clearInitial()
Definition: ModelLayer.cpp:27
void saveObject(ModelLayerSelection _selection, std::string _path, std::string _ext)
Definition: ModelLayer.cpp:2062
std::shared_ptr< PointFeatureObject > getWritablePointFeature(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1216
std::shared_ptr< geData::MultiLineObject > getMultiLineObject(int _id)
Definition: ModelLayer.cpp:2144
Definition: ModelLayer.h:78
Definition: ModelLayer.h:67
ModelLayerCategories::MODELTYPE type
Definition: ModelLayer.h:103
Definition: ModelLayer.h:55
double getHeightScale()
Definition: ModelLayer.h:229
Definition: ModelLayer.h:57
ModelLayerSelection getPickedSelection()
Definition: ModelLayer.cpp:2157
std::shared_ptr< geData::PointCloud > getPointCloud(int _id)
Definition: ModelLayer.cpp:2139
void update()
Definition: ModelLayer.cpp:57
Definition: ModelLayer.h:70
const std::shared_ptr< FeatureObject > getFeature(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1177
void setSplinesSegmentsDistance(ModelLayerSelection _selection, float _in)
Definition: ModelLayer.cpp:2124
void doModelAnimationStep(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:885
void triangulateObject(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:987
Definition: ModelLayer.h:81
bool currentlyPicking()
Definition: ModelLayer.cpp:2153
Definition: CommuterObject.h:27
Definition: ModelLayer.h:60
void updateModels(enum ModelLayerCategories::MODELTYPE _type)
Definition: ModelLayer.cpp:821
void setModelLayerSelection(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1538
void bundleObject(ModelLayerSelection _selection, enum BundlingCategories::BUNDLINGTYPE _bundlingType=BundlingCategories::NONE, int _index2=0, enum ModelLayerCategories::MODELTYPE _type2=ModelLayerCategories::NONE)
Definition: ModelLayer.cpp:1544
void setObjectExtrusionXZ(float _input, ModelLayerSelection _selection)
Definition: ModelLayer.cpp:970
void setObjectPosition(ModelLayerSelection _selection, vmml::Vector3d _in)
Definition: ModelLayer.cpp:1291
Definition: Timer.h:17
int addPointCloud(std::shared_ptr< geData::PointCloud > _pointCloud)
Definition: ModelLayer.cpp:1245
Definition: ModelLayer.h:75
Definition: ModelLayer.h:63
BUNDLINGTYPE
Definition: CommuterObject.h:27
Definition: ModelLayer.h:61
Definition: GPUProgramFactory.h:30
std::string name
Definition: ModelLayer.h:94
vmml::Vector2d getObjectMinMax(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1868
Definition: ModelLayer.h:56
void clear()
Definition: ModelLayer.cpp:40
std::shared_ptr< LineFeatureObject > getWritableLineFeature(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1229
Definition: ModelLayer.h:73
std::shared_ptr< FeatureObject > getWritableFeature(ModelLayerSelection _selection)
Definition: ModelLayer.cpp:1187