VR-Forces 4.7 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 

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)