VR-Forces 4.8 Class Documentation
 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) 2012 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 
21 class DtSimManager;
22 
29  : public DtAsciiSerializable
30  , public DtObjectDebugger<DtLuaFeatureSet>
31 {
32 public:
33  typedef std::vector<DtLocation3D> LocationVector;
34  typedef std::map<std::string, std::string> AttributeMap;
35 
37  DtLuaFeatureSet(DtSimManager* = 0, const std::string& type="");
38 
40 
41  DtLuaFeatureSet& operator=(const DtLuaFeatureSet&);
42 
44  DtLuaFeatureSet getFeaturesWithinArea(luabind::object const& points, luabind::object const& attributes);
45 
48  DtLuaFeatureSet getFeaturesWithinRange(const DtLocation3D&, double range, luabind::object const& attributes);
49 
50  DtLuaFeatureSet filter(const DtLuaFeatureGeometry& geom, luabind::object const& attributes);
51  DtLuaFeatureSet filterGeometry(const DtLuaFeatureGeometry& geom);
52  DtLuaFeatureSet filterAttributes(luabind::object const& attributes);
53 
54 public:
56 
58  virtual void setSimManager(DtSimManager* simManager);
59 
60  virtual DtString objectType() const;
61 
64 
67  bool deserialize(const DtString& data);
68 
70  static DtAsciiSerializable* creator();
71 
72 public:
75 
77  bool getIsLoaded() const;
78 
80  int getFeatureCount();
81 
84  bool getIsPointFeature(int);
85 
88  bool getIsLinearFeature(int);
89 
92  bool getIsArealFeature(int);
93 
96  std::string getFeatureType(int);
97 
100  std::vector<std::string> getFeatureAttributeNames(int);
101 
103  bool getHasAttributeNamed(int, const std::string);
104 
107  DtLocation3D getLocation3D(int);
108 
111  std::vector<DtLocation3D> getLocations3D(int);
112 
115  static luabind::object getFeatureAttributeValue(DtLuaFeatureSet&, int, const std::string, lua_State*);
116 
118  MAKVRinTerra::DtFeature::CPtr feature(int);
119 
121  DtLuaFeatureGeometry geometry(int);
122 
123  DtLuaFeatureSet load();
125 
126 protected:
128  virtual void gatherFeatures(const MAKVRinTerra::DtFeature&);
129 
132  virtual void testLoaded();
133 
134  void update(MAKVRinTerra::DtFeatureGeometry);
135  void update(const LocationVector& locations);
136  void update(const AttributeMap& attributes);
137  void updateRange(const DtLocation3D& center, double range);
138  void updatePoints(luabind::object const& points);
139  void updateAttributes(luabind::object const& attributes);
140 
141  void filterFeatures();
142 
143 protected:
144  typedef std::vector<MAKVRinTerra::DtFeature::CPtr> Features;
145 
147 
149  std::vector<DtLocation3D> myLocations;
150  std::map<std::string, std::string> myAttributes;
151 
152  boost::shared_ptr<MAKVRinTerra::DtFeatureSet> myFeatureSet;
155 
156  std::string myType;
157  boost::optional<MAKVRinTerra::DtQuery> myQuery;
158  boost::optional<MAKVRinTerra::DtFeatureGeometry> myGeomFilter;
159 };
160 
boost::optional< MAKVRinTerra::DtFeatureGeometry > myGeomFilter
Definition: luaFeatureSet.h:158
std::map< std::string, std::string > AttributeMap
Definition: luaFeatureSet.h:34
boost::shared_ptr< const DtFeature > CPtr
Definition: feature.h:44
Definition: asciiSerializable.h:33
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
bool myProcessed
Definition: luaFeatureSet.h:153
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:33
std::vector< MAKVRinTerra::DtFeature::CPtr > Features
Definition: luaFeatureSet.h:144
boost::optional< MAKVRinTerra::DtQuery > myQuery
Definition: luaFeatureSet.h:157
Represents a feature geometry.
Definition: luaFeatureGeometry.h:25
DtSimManager * mySimManager
Definition: luaFeatureSet.h:146
boost::shared_ptr< MAKVRinTerra::DtFeatureSet > myFeatureSet
Definition: luaFeatureSet.h:152
#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:150
std::string myType
Definition: luaFeatureSet.h:156
virtual DtString objectType() const =0
Should return the string name of this object.
Features myFeatures
Definition: luaFeatureSet.h:154
The DtLuaFeatureSet class is a wrapper around a DtFeatureSet that will provide feature information fo...
Definition: luaFeatureSet.h:28
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:102
Represents a GIS feature.
Definition: feature.h:37
std::vector< DtLocation3D > myLocations
Items used to be stored into or restored from saved state.
Definition: luaFeatureSet.h:149
Represents a feature geometry.
Definition: featureGeometry.h:35
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22

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)