VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
luaFeatureSet.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 #pragma once
6 
7 #include <vrfLua/vrfLuaDefines.h>
9 #include <features/featureSet.h>
10 #include <features/query.h>
11 
13 #include "vrfutil/scriptGeometry.h"
14 #include <vrfutil/objectCounter.h>
15 
16 #include <boost/shared_ptr.hpp>
17 #include <boost/optional.hpp>
18 
19 #include <luabind/luabind.hpp>
20 
22 
29  : public DtAsciiSerializable
30 #ifdef DtObjectDebugger_Enable
31  , public DtObjectDebugger<DtLuaFeatureSet>
32 #endif
33 {
34 public:
35  typedef std::vector<DtLocation3D> LocationVector;
36  typedef std::map<std::string, std::string> AttributeMap;
37 
39  DtLuaFeatureSet(DtSimulationServices* = 0, const std::string& type="");
40 
42 
43  DtLuaFeatureSet& operator=(const DtLuaFeatureSet&);
44 
46  DtLuaFeatureSet getFeaturesWithinArea(luabind::object const& points, luabind::object const& attributes);
47 
50  DtLuaFeatureSet getFeaturesWithinRange(const DtLocation3D&, double range, luabind::object const& attributes);
51 
52  DtLuaFeatureSet filter(const DtLuaFeatureGeometry& geom, luabind::object const& attributes);
53  DtLuaFeatureSet filterGeometry(const DtLuaFeatureGeometry& geom);
54  DtLuaFeatureSet filterAttributes(luabind::object const& attributes);
55 
56 public:
58 
60  virtual void setSimulationServices(DtSimulationServices* simManager);
61 
62  virtual DtString objectType() const;
63 
66 
69  bool deserialize(const DtString& data);
70 
72  static DtAsciiSerializable* creator();
73 
74 public:
77 
79  bool getIsLoaded() const;
80 
82  int getFeatureCount();
83 
86  bool getIsPointFeature(int);
87 
90  bool getIsLinearFeature(int);
91 
94  bool getIsArealFeature(int);
95 
98  std::string getFeatureType(int);
99 
102  std::vector<std::string> getFeatureAttributeNames(int);
103 
105  bool getHasAttributeNamed(int, const std::string);
106 
109  DtLocation3D getLocation3D(int);
110 
113  std::vector<DtLocation3D> getLocations3D(int);
114 
117  static luabind::object getFeatureAttributeValue(DtLuaFeatureSet&, int, const std::string, lua_State*);
118 
120  MAKVRinTerra::DtFeature::CPtr feature(int);
121 
123  DtLuaFeatureGeometry geometry(int);
124 
125  DtLuaFeatureSet load();
127 
128 protected:
130  virtual void gatherFeatures(const MAKVRinTerra::DtFeature&);
131 
134  virtual void testLoaded();
135 
136  void update(MAKVRinTerra::DtFeatureGeometry);
137  void update(const LocationVector& locations);
138  void update(const AttributeMap& attributes);
139  void updateRange(const DtLocation3D& center, double range);
140  void updatePoints(luabind::object const& points);
141  void updateAttributes(luabind::object const& attributes);
142 
143  void filterFeatures();
144 
145 protected:
146  typedef std::vector<MAKVRinTerra::DtFeature::CPtr> Features;
147 
149 
151  std::vector<DtLocation3D> myLocations;
152  std::map<std::string, std::string> myAttributes;
153 
154  boost::shared_ptr<MAKVRinTerra::DtFeatureSet> myFeatureSet;
157 
158  std::string myType;
159  boost::optional<MAKVRinTerra::DtQuery> myQuery;
160  boost::optional<MAKVRinTerra::DtFeatureGeometry> myGeomFilter;
161 };
162 
164 DT_DLL_vrfLua std::ostream& operator<<(std::ostream& stream, const DtLuaFeatureSet& set);
165 
boost::optional< MAKVRinTerra::DtFeatureGeometry > myGeomFilter
Definition: luaFeatureSet.h:160
std::map< std::string, std::string > AttributeMap
Definition: luaFeatureSet.h:36
boost::shared_ptr< const DtFeature > CPtr
Definition: feature.h:46
Definition: asciiSerializable.h:34
virtual bool deserialize(const DtString &)=0
This function should take the string that was serialized via serialize() and fill this object with th...
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:265
Default on in debug, off in release.
Definition: objectCounter.h:31
DT_DLL_features std::ostream & operator<<(std::ostream &, const DtFeatureTransform &)
std::ostream output.
bool myProcessed
Definition: luaFeatureSet.h:155
virtual DtString serialize()=0
The following characters are reserved and cannot be used in serialization: &#39;|&#39;, &#39;:&#39;.
std::vector< DtLocation3D > LocationVector
Definition: luaFeatureSet.h:35
DtSimulationServices * mySimServices
Definition: luaFeatureSet.h:148
std::vector< MAKVRinTerra::DtFeature::CPtr > Features
Definition: luaFeatureSet.h:146
boost::optional< MAKVRinTerra::DtQuery > myQuery
Definition: luaFeatureSet.h:159
Represents a feature geometry.
Definition: luaFeatureGeometry.h:25
boost::shared_ptr< MAKVRinTerra::DtFeatureSet > myFeatureSet
Definition: luaFeatureSet.h:154
#define DT_DLL_vrfLua
This file is used to determine how to build.
Definition: vrfLuaDefines.h:25
std::map< std::string, std::string > myAttributes
Definition: luaFeatureSet.h:152
std::string myType
Definition: luaFeatureSet.h:158
virtual DtString objectType() const =0
Should return the string name of this object. The object name should not be part of the serialization...
Features myFeatures
Definition: luaFeatureSet.h:156
voidpf stream
Definition: ioapi.h:39
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:89
The DtLuaFeatureSet class is a wrapper around a DtFeatureSet that will provide feature information fo...
Definition: luaFeatureSet.h:28
Represents a GIS feature. Features consist of a DtFeatureGeometry (2.5D geometric vector data) and a ...
Definition: feature.h:37
std::vector< DtLocation3D > myLocations
Items used to be stored into or restored from saved state.
Definition: luaFeatureSet.h:151
Represents a feature geometry.
Definition: featureGeometry.h:39
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)