VR-Forces 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/optional.hpp>
17 
18 #include <luabind/luabind.hpp>
19 
21 
28  : public DtAsciiSerializable
29 #ifdef DtObjectDebugger_Enable
30  , public DtObjectDebugger<DtLuaFeatureSet>
31 #endif
32 {
33 public:
34  typedef std::vector<DtLocation3D> LocationVector;
35  typedef std::map<std::string, std::string> AttributeMap;
36 
38  DtLuaFeatureSet(DtSimulationServices* = 0, const std::string& type="");
39 
41 
42  DtLuaFeatureSet& operator=(const DtLuaFeatureSet&);
43 
45  DtLuaFeatureSet getFeaturesWithinArea(luabind::object const& points, luabind::object const& attributes);
46 
49  DtLuaFeatureSet getFeaturesWithinRange(const DtLocation3D&, double range, luabind::object const& attributes);
50 
51  DtLuaFeatureSet filter(const DtLuaFeatureGeometry& geom, luabind::object const& attributes);
52  DtLuaFeatureSet filterGeometry(const DtLuaFeatureGeometry& geom);
53  DtLuaFeatureSet filterAttributes(luabind::object const& attributes);
54 
55 public:
57 
59  virtual void setSimulationServices(DtSimulationServices* simManager);
60 
61  virtual DtString objectType() const override;
62 
64  virtual DtString serialize() override;
65 
68  virtual bool deserialize(const DtString& data) override;
69 
71  static DtAsciiSerializable* creator();
72 
73 public:
76 
78  bool getIsLoaded() const;
79 
81  int getFeatureCount();
82 
85  bool getIsPointFeature(int);
86 
89  bool getIsLinearFeature(int);
90 
93  bool getIsArealFeature(int);
94 
97  std::string getFeatureType(int);
98 
101  std::vector<std::string> getFeatureAttributeNames(int);
102 
104  bool getHasAttributeNamed(int, const std::string);
105 
108  DtLocation3D getLocation3D(int);
109 
112  std::vector<DtLocation3D> getLocations3D(int);
113 
116  static luabind::object getFeatureAttributeValue(DtLuaFeatureSet&, int, const std::string, lua_State*);
117 
119  MAKVRinTerra::DtFeature::CPtr feature(int);
120 
122  DtLuaFeatureGeometry geometry(int);
123 
124  DtLuaFeatureSet load();
126 
127 protected:
129  virtual void gatherFeatures(const MAKVRinTerra::DtFeature&);
130 
133  virtual void testLoaded();
134 
135  void update(MAKVRinTerra::DtFeatureGeometry);
136  void update(const LocationVector& locations);
137  void update(const AttributeMap& attributes);
138  void updateRange(const DtLocation3D& center, double range);
139  void updatePoints(luabind::object const& points);
140  void updateAttributes(luabind::object const& attributes);
141 
142  void filterFeatures();
143 
144 protected:
145  typedef std::vector<MAKVRinTerra::DtFeature::CPtr> Features;
146 
148 
150  std::vector<DtLocation3D> myLocations;
151  std::map<std::string, std::string> myAttributes;
152 
153  std::shared_ptr<MAKVRinTerra::DtFeatureSet> myFeatureSet;
156 
157  std::string myType;
158  boost::optional<MAKVRinTerra::DtQuery> myQuery;
159  boost::optional<MAKVRinTerra::DtFeatureGeometry> myGeomFilter;
160 };
161 
163 DT_DLL_vrfLua std::ostream& operator<<(std::ostream& stream, const DtLuaFeatureSet& set);
164 
boost::optional< MAKVRinTerra::DtFeatureGeometry > myGeomFilter
Definition: luaFeatureSet.h:159
std::map< std::string, std::string > AttributeMap
Definition: luaFeatureSet.h:35
Definition: asciiSerializable.h:40
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:31
Default on in debug, off in release.
Definition: objectCounter.h:27
DT_DLL_features std::ostream & operator<<(std::ostream &, const DtFeatureTransform &)
std::ostream output.
bool myProcessed
Definition: luaFeatureSet.h:154
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:34
DtSimulationServices * mySimServices
Definition: luaFeatureSet.h:147
std::vector< MAKVRinTerra::DtFeature::CPtr > Features
Definition: luaFeatureSet.h:145
boost::optional< MAKVRinTerra::DtQuery > myQuery
Definition: luaFeatureSet.h:158
Represents a feature geometry.
Definition: luaFeatureGeometry.h:25
#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:151
std::string myType
Definition: luaFeatureSet.h:157
std::shared_ptr< const DtFeature > CPtr
Definition: feature.h:45
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:155
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:96
The DtLuaFeatureSet class is a wrapper around a DtFeatureSet that will provide feature information fo...
Definition: luaFeatureSet.h:27
std::shared_ptr< MAKVRinTerra::DtFeatureSet > myFeatureSet
Definition: luaFeatureSet.h:153
Represents a GIS feature. Features consist of a DtFeatureGeometry (2.5D geometric vector data) and a ...
Definition: feature.h:36
std::vector< DtLocation3D > myLocations
Items used to be stored into or restored from saved state.
Definition: luaFeatureSet.h:150
Represents a feature geometry.
Definition: featureGeometry.h:40
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)