VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
dynamicTerrainCommand.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include "vrfplan/simCommand.h"
12 #include "vrfplan/vrfplanDefines.h"
13 #include <readerWriter/rwInt.h>
14 #include <readerWriter/rwReal.h>
15 #include "vrfutil/rwKeyValueList.h"
16 #include "vrfutil/rwVectorList.h"
17 
21 {
22 public:
23 
25  {
28  WholeWorld
29  };
30 
33 
35  DtDynamicTerrainCommand(const DtString& writeName,
36  DtReaderWriterRegistry* parentRegistry = NULL);
37 
39  DtDynamicTerrainCommand(const DtString & writeName, const DtDynamicTerrainCommand& orig,
40  DtReaderWriterRegistry* parentRegistry = NULL);
41 
43  virtual ~DtDynamicTerrainCommand();
44 
47 
49 
50  virtual void setGeometryType(GeometryType geomType);
51  virtual GeometryType geometryType() const;
53 
56 
57  virtual void setCenterOfCircle(const DtVector& location);
58  virtual DtVector centerOfCircle() const;
60 
63 
64  virtual void setRadiusOfCircle(double radius);
65  virtual double radiusOfCircle() const;
67 
70 
71  virtual void setVerticesOfPolygon(const DtRwVectorList& locations);
72  virtual const DtRwVectorList& verticesOfPolygon() const;
73  virtual void addVertexToPolygon(const DtVector& location);
75 
77 
78  virtual void setChanges(const std::map<DtString, DtString>& changes);
79  virtual void setChanges(const DtRwKeyValueList& changes);
80  virtual const DtRwKeyValueList& changes() const;
81  virtual void addChange(const DtString& changeType, const DtString& changeVal);
83 
85  virtual DtString stringRep() const;
86 
88  virtual int netRepSize() const;
89 
91  virtual bool setFromNet(const char* contentBuffer,
92  unsigned contentSize);
93 
95  virtual bool setToNet();
96 
97 protected:
103 };
104 
105 template<class CommandType>
107 {
108  return new CommandType();
109 }
110 
111 
115 {
116 public:
117 
119 
121  DtReaderWriterRegistry* parentRegistry = NULL)
122  : DtDynamicTerrainCommand(writeName, parentRegistry) {};
123 
125  DtReaderWriterRegistry* parentRegistry = NULL)
126  : DtDynamicTerrainCommand(writeName, orig, parentRegistry) {};
127 
129 
131 
132  virtual DtSimCommand* clone(const DtString & name, DtReaderWriterRegistry* parentRegistry = 0) const
133  { return new DtAddDynamicTerrainChangesCommand(name, *this, parentRegistry); }
134 
135 };
136 
140 {
141 public:
142 
144 
146  DtReaderWriterRegistry* parentRegistry = NULL)
147  : DtDynamicTerrainCommand(writeName, parentRegistry) {};
148 
150  DtReaderWriterRegistry* parentRegistry = NULL)
151  : DtDynamicTerrainCommand(writeName, orig, parentRegistry) {};
152 
154 
156 
157  virtual DtSimCommand* clone(const DtString & name, DtReaderWriterRegistry* parentRegistry = 0) const
158  { return new DtResetDynamicTerrainChangesCommand(name, *this, parentRegistry); }
159 
161 
162  virtual void setChangesToReset(const std::vector<DtString>& changes);
163  virtual std::vector<DtString> changesToReset() const;
164  virtual void addChangeToReset(const DtString& changeType);
166 };
167 
171 {
172 public:
173 
175 
177  DtReaderWriterRegistry* parentRegistry = NULL)
178  : DtDynamicTerrainCommand(writeName, parentRegistry) {};
179 
181  DtReaderWriterRegistry* parentRegistry = NULL)
182  : DtDynamicTerrainCommand(writeName, orig, parentRegistry) {};
183 
185 
187 
188  virtual DtSimCommand* clone(const DtString & name, DtReaderWriterRegistry* parentRegistry = 0) const
189  { return new DtResetAllDynamicTerrainChangesCommand(name, *this, parentRegistry); }
190 };
191 
195 {
196 public:
197 
199 
201  DtReaderWriterRegistry* parentRegistry = NULL)
202  : DtDynamicTerrainCommand(writeName, parentRegistry) {};
203 
205  DtReaderWriterRegistry* parentRegistry = NULL)
206  : DtDynamicTerrainCommand(writeName, orig, parentRegistry) {};
207 
209 
211 
212  virtual DtSimCommand* clone(const DtString & name, DtReaderWriterRegistry* parentRegistry = 0) const
213  { return new DtRemoveDynamicTerrainDamageCommand(name, *this, parentRegistry); }
214 
215 };
216 
DtRwKeyValueList myChanges
Definition: dynamicTerrainCommand.h:102
DtRwReal myRadiusOfCircle
Definition: dynamicTerrainCommand.h:100
Base class for any DtSimCommand which causes dynamic terrain changes to be added or removed...
Definition: dynamicTerrainCommand.h:20
DtRemoveDynamicTerrainDamageCommand(const DtString &writeName, const DtRemoveDynamicTerrainDamageCommand &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: dynamicTerrainCommand.h:204
Class which holds a list of string key and string value pairs. This class is a DtReaderWriter, and also has associated DtBufferSerialize methods available.
Definition: rwKeyValueList.h:21
DtRwInt myGeometryType
Definition: dynamicTerrainCommand.h:98
virtual ~DtResetDynamicTerrainChangesCommand()
Definition: dynamicTerrainCommand.h:153
DtRemoveDynamicTerrainDamageCommand()
Definition: dynamicTerrainCommand.h:198
DtRwVectorList myVerticesOfPolygon
Definition: dynamicTerrainCommand.h:101
virtual ~DtResetAllDynamicTerrainChangesCommand()
Definition: dynamicTerrainCommand.h:184
DtSimCommand which causes a specific list of dynamic terrain changes to take place at the specified g...
Definition: dynamicTerrainCommand.h:114
virtual bool setToNet()
Calls netRep() to create the network buffer. Casts the resulting myNetRep to type DtNetSimSimCommand*...
DtAddDynamicTerrainChangesCommand(const DtString &writeName, const DtAddDynamicTerrainChangesCommand &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: dynamicTerrainCommand.h:124
virtual const DtSimCommandMessageType & type() const
Definition: dynamicTerrainCommand.h:130
virtual DtSimCommand * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const
Make a copy of this sim command. Returns a newly allocated instance of a DtSimCommand. Override this member function to return a pointer to a newly allocated instance of the derived class.
Definition: dynamicTerrainCommand.h:188
Changes within radius of point.
Definition: dynamicTerrainCommand.h:27
const DtSimCommandMessageType DtResetDynamicTerrainChangesCommandType("reset-dynamic-terrain-changes-command")
virtual DtString stringRep() const =0
Returns a human-readable string representation of the command. This string representation is used to ...
DtResetAllDynamicTerrainChangesCommand()
Definition: dynamicTerrainCommand.h:174
Definition: readerWriterRegistry.h:39
DtAddDynamicTerrainChangesCommand()
Definition: dynamicTerrainCommand.h:118
Definition: rwVector.h:23
const DtSimCommandMessageType DtAddDynamicTerrainChangesCommandType("add-dynamic-terrain-changes-command")
Definition: dynamicTerrainCommand.h:26
const DtSimCommandMessageType DtResetAllDynamicTerrainChangesCommandType("reset-all-dynamic-terrain-changes-command")
virtual ~DtAddDynamicTerrainChangesCommand()
Definition: dynamicTerrainCommand.h:128
const DtSimCommandMessageType DtRemoveDynamicTerrainDamageCommandType("remove-dynamic-terrain-damage-command")
virtual DtSimCommand * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const
Make a copy of this sim command. Returns a newly allocated instance of a DtSimCommand. Override this member function to return a pointer to a newly allocated instance of the derived class.
Definition: dynamicTerrainCommand.h:157
virtual int netRepSize() const
Returns the size in bytes of the network representation of the class. This is the size in bytes of th...
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Sets mySubsimCommand member from the incoming contentBuffer (cast to type DtNetSimSimCommand). Derived classes should call down to this function first, and then extract their own data starting at the location contentBuffer + DtSimCommand::netRepSize().
Description: Readable, Writable int.
Definition: rwInt.h:25
DtAddDynamicTerrainChangesCommand(const DtString &writeName, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: dynamicTerrainCommand.h:120
DtRemoveDynamicTerrainDamageCommand(const DtString &writeName, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: dynamicTerrainCommand.h:200
const DtSimCommand & operator=(const DtSimCommand &orig)
assignment operator; same as copy constructor
virtual DtSimCommand * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const
Make a copy of this sim command. Returns a newly allocated instance of a DtSimCommand. Override this member function to return a pointer to a newly allocated instance of the derived class.
Definition: dynamicTerrainCommand.h:212
DtSimCommand * dynamicTerrainCommandCreator()
Definition: dynamicTerrainCommand.h:106
DtRwVector myCenterOfCircle
Definition: dynamicTerrainCommand.h:99
DtSimCommand is an abstract base class from which commands can derive. It manages the read/write capa...
Definition: simCommand.h:32
DtResetDynamicTerrainChangesCommand(const DtString &writeName, const DtResetDynamicTerrainChangesCommand &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: dynamicTerrainCommand.h:149
GeometryType
Definition: dynamicTerrainCommand.h:24
Description: Readable, Writable DtReal (double)
Definition: rwReal.h:27
virtual const DtSimCommandMessageType & type() const
Definition: dynamicTerrainCommand.h:155
DtResetDynamicTerrainChangesCommand(const DtString &writeName, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: dynamicTerrainCommand.h:145
DtSimCommand which causes all dynamic terrain damage to be removed at the specified geometry...
Definition: dynamicTerrainCommand.h:194
virtual const DtSimCommandMessageType & type() const
Definition: dynamicTerrainCommand.h:186
virtual DtSimCommand * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const
Make a copy of this sim command. Returns a newly allocated instance of a DtSimCommand. Override this member function to return a pointer to a newly allocated instance of the derived class.
Definition: dynamicTerrainCommand.h:132
DtSimCommand which causes a specific list of dynamic terrain changes to be reset to their original st...
Definition: dynamicTerrainCommand.h:139
DtResetAllDynamicTerrainChangesCommand(const DtString &writeName, const DtResetAllDynamicTerrainChangesCommand &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: dynamicTerrainCommand.h:180
DtResetDynamicTerrainChangesCommand()
Definition: dynamicTerrainCommand.h:143
#define DT_DLL_vrfplan
This file is used to determine how to build.
Definition: vrfplanDefines.h:28
virtual ~DtRemoveDynamicTerrainDamageCommand()
Definition: dynamicTerrainCommand.h:208
DtResetAllDynamicTerrainChangesCommand(const DtString &writeName, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: dynamicTerrainCommand.h:176
DtSimCommand which causes all dynamic terrain changes to be reset to their original state at the spec...
Definition: dynamicTerrainCommand.h:170
class DtRwVectorList:
Definition: rwVectorList.h:22
virtual const DtSimCommandMessageType & type() const
Definition: dynamicTerrainCommand.h:210

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)