VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
setStatePropertyDialog.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
12 
13 #pragma once
14 
15 #if !defined(Q_MOC_RUN)
23 #endif
24 
25 #include <QLabel>
26 #include <QGridLayout>
27 
28 namespace makVrf
29 {
33  {
34  Q_OBJECT
35  public:
36  //CTOR
37  DtSetStatePropertyDialog(makVrv::DtDe& de, QWidget* parent, const DtString& property,
38  const Qt::WindowFlags& flags = 0);
39 
40  //DTOR
41  virtual ~DtSetStatePropertyDialog() override;
42 
43  protected:
44  virtual void setupGui(const std::set<makVrv::DtUniqueID>& data) override;
45  virtual QSize canvasSize() override;
46 
49  void setupProperties(const std::set<makVrv::DtUniqueID>& data)
50  {
51  std::set<makVrv::DtUniqueID>::const_iterator iter = data.begin();
52  bool merge = false;
53  std::vector<DtString> props;
54 
55  myProperty.tokenize(';', props);
56 
57  clearProperties();
58 
60  myStateProperties = DtRwProperties("");
61  myParameterData = DtRwProperties("");
62 
63  if(data.size() == 0)
64  {
66 
67  if (myDefaultPlatformFile.length())
68  {
69  DtEntityType objectType;
70 
71  myIgnoreMaximum = true;
72 
73  objectType = myDefaultPlatformFile.c_str();
74 
75  if (objectType != DtEntityType())
76  {
78  DtVrfModelSetManager::instance(myDe).statePropertiesFor(objectType, myStateProperties);
79  DtVrfModelSetManager::instance(myDe).parameterPropertiesFor(objectType, myParameterData);
80  }
81  else
82  {
84  DtVrfModelSetManager::instance(myDe).statePropertiesForPlatform(myDefaultPlatformFile, myStateProperties);
85  DtVrfModelSetManager::instance(myDe).parameterPropertiesForPlatform(myDefaultPlatformFile, myParameterData);
86  myUsingGeneric = true;
87  }
88  }
89  }
90  else
91  {
92  if (myInvalidSelectionLabel)
93  {
94  delete myInvalidSelectionLabel;
95  myInvalidSelectionLabel = 0;
96  }
97 
98  bool allAggregate = true;
99 
100  while (iter != data.end())
101  {
103  {
104  allAggregate = false;
105  break;
106  }
107 
108  ++iter;
109  }
110 
111  if (allAggregate)
112  {
113  DtAggregateRollUpManager::instance(myDe).statePropertiesFor(data, myStateProperties);
114  DtAggregateRollUpManager::instance(myDe).parameterData(data, myParameterData);
115  }
116  else
117  {
118  iter = data.begin();
119  while (iter != data.end())
120  {
122  {
123  if (iter == data.begin())
124  {
125  DtAggregateRollUpManager::instance(myDe).statePropertiesFor(*iter, myStateProperties);
126  DtAggregateRollUpManager::instance(myDe).parameterData(*iter, myParameterData);
127  }
128  else
129  {
130  DtRwProperties stateProperties("");
131  DtRwProperties parameterData("");
132 
133  DtAggregateRollUpManager::instance(myDe).statePropertiesFor(*iter, stateProperties);
134  myStateProperties.merge(stateProperties, DtPropertyInterface::RollUp);
135  DtAggregateRollUpManager::instance(myDe).parameterData(*iter, parameterData);
136  myParameterData.merge(parameterData, DtPropertyInterface::RollUp);
137  }
138  }
139  else
140  {
142 
143  if(state.isValid())
144  {
145  if (iter == data.begin())
146  {
147  myStateProperties = state->currentFrameStatePropertiesStateComponent()->stateProperties();
148  }
149  else
150  {
151  myStateProperties.merge(state->currentFrameStatePropertiesStateComponent()->stateProperties(), DtPropertyInterface::RollUp);
152  }
153  }
154  }
155 
156  ++iter;
157  }
158  }
159  }
160 
161  if (myStateProperties.registry().registryData().size())
162  {
163  int iLimit = props.size();
164  int i;
165  for (i = 0; i < iLimit; i++)
166  {
167  DtString propString(props[i].c_str());
168  bool hasStar = false;
169  int index = 0;
170 
171  if (propString[0] == '+')
172  {
173  propString = DtString(&propString.c_str()[1], propString.length() - 1);
174  }
175 
176  QString propStr(propString.c_str());
177 
178  if ((index = propStr.indexOf('*')) == propStr.length() - 1)
179  {
180  hasStar = true;
181  propStr[index] = 0;
182  }
183 
184  DtReaderWriter* rw = myStateProperties.findVariableBinding(propStr.toStdString().c_str());
185  DtPropertyInterface* prop = dynamic_cast<DtPropertyInterface*>(rw);
186 
187  if (prop)
188  {
189  if (hasMoreThanDefaultValueInRegistry(rw))
190  {
191  myScrollArea->setFrameShape(QFrame::NoFrame);
192  myScrollArea->setFrameShadow(QFrame::Plain);
193  }
194 
195  addProperty(prop, merge, hasStar);
196  }
197  }
198 
199  if(myPropertyItems.size() == 0)
200  {
202  setupGuiWhenSelectionInvalid();
203  }
204  }
205  else
206  {
207  setupGuiWhenNoSelection();
208  }
209  }
210 
213  virtual void setupGuiWhenNoSelection();
214 
217  virtual void setupGuiWhenSelectionInvalid();
218 
219  protected:
220 
224  };
225 
227  {
228  public:
229  DtSetStatePropertyDialogCreator(makVrv::DtDe&, const DtString& prop, const DtString& defaultPlatformFile = "");
230 
231  virtual DtTaskSetDialogInterface* create(makVrv::DtDe&, QWidget* parent) override;
232  virtual bool supportsType(makVrv::DtDe&, const DtSetMessageType&, const DtSimStatement*) const override;
233 
235  virtual bool isValidFor(
236  makVrv::DtDe& de, const makVrv::DtSelectionManager::IdSet& ids, int partOfPlanDialog) const override;
237 
238  protected:
240  virtual DtTaskSetDialogInterface* createDialog(makVrv::DtDe&, QWidget* parent);
241 
243  virtual bool checkProperties(const DtString&, const DtString&) const;
244  virtual DtString stripModifiers(const DtString&) const;
245 
246  protected:
250  };
251 }
QLabel * myInvalidSelectionLabel
Label displaying text indicating currently selected simulation objects are not valid for this propert...
Definition: setStatePropertyDialog.h:223
DtString myDefaultPlatformFile
Definition: setStatePropertyDialog.h:248
Definition: taskSetDialogInterface.h:63
SpecificRwType * addProperty(DtReaderWriter &properties, const DtString &propertyName)
Adds a property with the specified name to the given set of properties. SpecificRwType must be a subc...
virtual void statePropertiesFor(DtSimObjectReference ref, DtRwProperties &) const
Returns the rolled up state properties or the state properties for the individual (if this is not a p...
DtString myProperty
Definition: setStatePropertyDialog.h:247
Definition: taskSetDialogInterface.h:82
Definition: readerWriter.h:85
virtual void parameterPropertiesFor(const DtEntityType &, DtRwProperties &)
If there is parameter properties in the .ope file referenced by this entity, return them...
Definition: propertyInterface.h:62
virtual void statePropertiesFor(const DtEntityType &, DtRwProperties &) const
If there are state properties in the .ope file referenced by this entity, return them.
makVrv::DtDe & myDe
Definition: setStatePropertyDialog.h:249
static DtAggregateRollUpManager & instance(makVrv::DtDe &de)
Returns instance of the messager.
Interface class used to define minimal interface for a property. The DtPropertyInterface class provid...
Definition: propertyInterface.h:53
virtual bool hasStateProperties(makVrv::DtUniqueID) const
Returns true if the aggregate with the given unique ID has, or has any subordinates with...
virtual void parameterData(DtSimObjectReference ref, DtRwProperties &) const
Given the state, if the state is an aggregate and has subordinates, return a total of all the paramet...
This class is the base for setting state properties. In and of itself it does not populate itself wit...
Definition: setStatePropertiesDialog.h:77
Definition: setStatePropertyDialog.h:226
virtual void statePropertiesForPlatform(const DtString &, DtRwProperties &) const
Returns a copy of the state properties for the given platform, if it exists.
static DtVrfGuiSimObjectManager & instance(makVrv::DtDe &)
[vrfGuiSimObjectManager instanceDefinition]
Sets up the set dialog to be able to change all state properties. If multiple items are selected only...
Definition: setStatePropertyDialog.h:32
class DtSimStatement:
Definition: simStatement.h:38
virtual DtSimObjectReference lookup(makVrv::DtUniqueID) const
[vrfGuiSimObjectManager instanceDefinition]
A list of properties. A DtPropertyInterface object that is a specialized version of DtRwVariableBindi...
Definition: rwProperties.h:122
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
void setupProperties(const std::set< makVrv::DtUniqueID > &data)
If there is a single entry, find it&#39;s location and convert to local to set. This version can be given...
Definition: setStatePropertyDialog.h:49
virtual void parameterPropertiesForPlatform(const DtString &, DtRwProperties &) const
Returns a copy of the parameter properties for the given platform, if it exists.
#define DT_DLL_VRFGUITASKSETQT
Definition: vrfGuiTaskSetQt.h:22
std::set< DtUniqueID > IdSet
Definition: DtSelectionManager.h:32
static DtVrfModelSetManager & instance(makVrv::DtDe &de)
Returns instance of the messager.
const DtStatePropertiesStateComponent * currentFrameStatePropertiesStateComponent() const
Definition: stateDataWrapper.h:373

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)