• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

step/stepcore

  • sources
  • kde-4.12
  • kdeedu
  • step
  • stepcore
tool.cc
Go to the documentation of this file.
1 /* This file is part of StepCore library.
2  Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
3 
4  StepCore library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  StepCore library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with StepCore; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include "tool.h"
20 #include "particle.h"
21 #include "rigidbody.h"
22 #include <QtGlobal>
23 
24 namespace StepCore {
25 
26 STEPCORE_META_OBJECT(NoteImage, QT_TRANSLATE_NOOP("ObjectClass", "NoteImage"), QT_TR_NOOP("NoteImage: an image embedded in Note"), 0,
27  STEPCORE_SUPER_CLASS(Item),
28  STEPCORE_PROPERTY_RW(QByteArray, image, QT_TRANSLATE_NOOP("PropertyName", "image"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Image data"), image, setImage)
29  )
30 
31 STEPCORE_META_OBJECT(NoteFormula, QT_TRANSLATE_NOOP("ObjectClass", "NoteFormula"), QT_TR_NOOP("NoteFormula: a formula embedded in Note"), 0,
32  STEPCORE_SUPER_CLASS(NoteImage),
33  STEPCORE_PROPERTY_RW(QString, code, QT_TRANSLATE_NOOP("PropertyName", "code"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Formula code"), code, setCode)
34  )
35 
36 STEPCORE_META_OBJECT(Note, QT_TRANSLATE_NOOP("ObjectClass", "Note"), QT_TR_NOOP("Note: displays a textual note on the scene"), 0,
37  STEPCORE_SUPER_CLASS(ItemGroup) STEPCORE_SUPER_CLASS(Tool),
38  STEPCORE_PROPERTY_RW(StepCore::Vector2d, position, QT_TRANSLATE_NOOP("PropertyName", "position"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Note position on the scene"), position, setPosition)
39  STEPCORE_PROPERTY_RW(StepCore::Vector2d, size, QT_TRANSLATE_NOOP("PropertyName", "size"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Note size on the scene"), size, setSize)
40  STEPCORE_PROPERTY_RW(QString, text, QT_TRANSLATE_NOOP("PropertyName", "text"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Text"), text, setText)
41  )
42 
43 STEPCORE_META_OBJECT(Graph, QT_TRANSLATE_NOOP("ObjectClass", "Graph"), QT_TR_NOOP("Graph: plots a graph of any properties"), 0,
44  STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Tool),
45  STEPCORE_PROPERTY_RW(StepCore::Vector2d, position, QT_TRANSLATE_NOOP("PropertyName", "position"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Graph position on the scene"), position, setPosition)
46  STEPCORE_PROPERTY_RW(StepCore::Vector2d, size, QT_TRANSLATE_NOOP("PropertyName", "size"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Graph size on the scene"), size, setSize)
47  STEPCORE_PROPERTY_RW(Object*, objectX, QT_TRANSLATE_NOOP("PropertyName", "objectX"), STEPCORE_UNITS_NULL, QT_TR_NOOP("X axis: object"), objectX, setObjectX)
48  STEPCORE_PROPERTY_RW(QString, propertyX, QT_TRANSLATE_NOOP("PropertyName", "propertyX"), STEPCORE_UNITS_NULL, QT_TR_NOOP("X axis: object property"), propertyX, setPropertyX)
49  STEPCORE_PROPERTY_RW(int, indexX, QT_TRANSLATE_NOOP("PropertyName", "indexX"), STEPCORE_UNITS_NULL, QT_TR_NOOP("X axis: vector index"), indexX, setIndexX)
50  STEPCORE_PROPERTY_RW(Object*, objectY, QT_TRANSLATE_NOOP("PropertyName", "objectY"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Y axis: object"), objectY, setObjectY)
51  STEPCORE_PROPERTY_RW(QString, propertyY, QT_TRANSLATE_NOOP("PropertyName", "propertyY"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Y axis: property"), propertyY, setPropertyY)
52  STEPCORE_PROPERTY_RW(int, indexY, QT_TRANSLATE_NOOP("PropertyName", "indexY"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Y axis: vector index"), indexY, setIndexY)
53  STEPCORE_PROPERTY_RW(bool, autoLimitsX, QT_TRANSLATE_NOOP("PropertyName", "autoLimitsX"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Auto-limits along X axis"), autoLimitsX, setAutoLimitsX)
54  STEPCORE_PROPERTY_RW(bool, autoLimitsY, QT_TRANSLATE_NOOP("PropertyName", "autoLimitsY"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Auto-limits along Y axis"), autoLimitsY, setAutoLimitsY)
55  STEPCORE_PROPERTY_RW(StepCore::Vector2d, limitsX, QT_TRANSLATE_NOOP("PropertyName", "limitsX"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Limits along X axis"), limitsX, setLimitsX)
56  STEPCORE_PROPERTY_RW(StepCore::Vector2d, limitsY, QT_TRANSLATE_NOOP("PropertyName", "limitsY"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Limits along Y axis"), limitsY, setLimitsY)
57  STEPCORE_PROPERTY_RW(bool, showPoints, QT_TRANSLATE_NOOP("PropertyName", "showPoints"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Show points on the graph"), showPoints, setShowPoints)
58  STEPCORE_PROPERTY_RW(bool, showLines, QT_TRANSLATE_NOOP("PropertyName", "showLines"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Show lines on the graph"), showLines, setShowLines)
59  STEPCORE_PROPERTY_R (StepCore::Vector2d, currentValue, QT_TR_NOOP("currentValue"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Current value"), currentValue)
60  STEPCORE_PROPERTY_RW_D(StepCore::Vector2dList, points, QT_TRANSLATE_NOOP("PropertyName", "points"), STEPCORE_UNITS_NULL, QT_TR_NOOP("points"), points, setPoints)
61  STEPCORE_PROPERTY_R (QString, unitsX, QT_TR_NOOP("unitsX"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Units along X axis"), unitsX)
62  STEPCORE_PROPERTY_R (QString, unitsY, QT_TR_NOOP("unitsY"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Units along Y axis"), unitsY)
63  )
64 
65 STEPCORE_META_OBJECT(Meter, QT_TRANSLATE_NOOP("ObjectClass", "Meter"), QT_TR_NOOP("Meter: displays any property on the scene"), 0,
66  STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Tool),
67  STEPCORE_PROPERTY_RW(StepCore::Vector2d, position, QT_TRANSLATE_NOOP("PropertyName", "position"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Meter position on the scene"), position, setPosition)
68  STEPCORE_PROPERTY_RW(StepCore::Vector2d, size, QT_TRANSLATE_NOOP("PropertyName", "size"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Meter size on the scene"), size, setSize)
69  STEPCORE_PROPERTY_RW(Object*, object, QT_TRANSLATE_NOOP("PropertyName", "object"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Observed object"), object, setObject)
70  STEPCORE_PROPERTY_RW(QString, property, QT_TRANSLATE_NOOP("PropertyName", "property"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Observed property"), property, setProperty)
71  STEPCORE_PROPERTY_RW(int, index, QT_TRANSLATE_NOOP("PropertyName", "index"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Vector index"), index, setIndex)
72  STEPCORE_PROPERTY_RW(int, digits, QT_TRANSLATE_NOOP("PropertyName", "digits"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Display digits"), digits, setDigits)
73  STEPCORE_PROPERTY_R (double, value, QT_TR_NOOP("value"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Value"), value)
74  STEPCORE_PROPERTY_R (QString, units, QT_TR_NOOP("units"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Units of measured property"), units)
75  )
76 
77 STEPCORE_META_OBJECT(Controller, QT_TRANSLATE_NOOP("ObjectClass", "Controller"), QT_TR_NOOP("Controller: allows to easily control any property"), 0,
78  STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Tool),
79  STEPCORE_PROPERTY_RW(StepCore::Vector2d, position, QT_TRANSLATE_NOOP("PropertyName", "position"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Controller position on the scene"), position, setPosition)
80  STEPCORE_PROPERTY_RW(StepCore::Vector2d, size, QT_TRANSLATE_NOOP("PropertyName", "size"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Controller size on the scene"), size, setSize)
81  STEPCORE_PROPERTY_RW(Object*, object, QT_TRANSLATE_NOOP("PropertyName", "object"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Controlled object"), object, setObject)
82  STEPCORE_PROPERTY_RW(QString, property, QT_TRANSLATE_NOOP("PropertyName", "property"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Controlled property"), property, setProperty)
83  STEPCORE_PROPERTY_RW(int, index, QT_TRANSLATE_NOOP("PropertyName", "index"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Vector index"), index, setIndex)
84  STEPCORE_PROPERTY_RW(StepCore::Vector2d, limits, QT_TRANSLATE_NOOP("PropertyName", "limits"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Limits"), limits, setLimits)
85  STEPCORE_PROPERTY_RW(QString, increaseShortcut, QT_TRANSLATE_NOOP("PropertyName", "increaseShortcut"), STEPCORE_UNITS_NULL,
86  QT_TR_NOOP("Shortcut to increase the value"), increaseShortcut, setIncreaseShortcut)
87  STEPCORE_PROPERTY_RW(QString, decreaseShortcut, QT_TRANSLATE_NOOP("PropertyName", "decreaseShortcut"), STEPCORE_UNITS_NULL,
88  QT_TR_NOOP("Shortcut to decrease the value"), decreaseShortcut, setDecreaseShortcut)
89  STEPCORE_PROPERTY_RW(double, increment, QT_TRANSLATE_NOOP("PropertyName", "increment"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Increment value"), increment, setIncrement)
90  STEPCORE_PROPERTY_RWF(double, value, QT_TRANSLATE_NOOP("PropertyName", "value"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Value"),
91  MetaProperty::DYNAMIC | MetaProperty::SIDEEFFECTS, value, setValue)
92  STEPCORE_PROPERTY_R (QString, units, QT_TR_NOOP("units"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Units of controlled property"), units)
93  )
94 
95 STEPCORE_META_OBJECT(Tracer, QT_TRANSLATE_NOOP("ObjectClass", "Tracer"), QT_TR_NOOP("Tracer: traces trajectory of a point on a body"), 0,
96  STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Tool),
97  STEPCORE_PROPERTY_RW(Object*, body, QT_TRANSLATE_NOOP("PropertyName", "body"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Traced body"), body, setBody)
98  STEPCORE_PROPERTY_RW(StepCore::Vector2d, localPosition, QT_TRANSLATE_NOOP("PropertyName", "localPosition"), QT_TRANSLATE_NOOP("Units", "m"),
99  QT_TR_NOOP("Local position"), localPosition, setLocalPosition)
100  STEPCORE_PROPERTY_R_D(StepCore::Vector2d, position, QT_TRANSLATE_NOOP("PropertyName", "position"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Position"), position)
101  STEPCORE_PROPERTY_RW_D(StepCore::Vector2dList, points, QT_TRANSLATE_NOOP("PropertyName", "points"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("points"), points, setPoints)
102  )
103 
104 namespace {
105 
106 static double variantToDouble(const QVariant& v, int index, bool *ok)
107 {
108  if(ok) *ok = true;
109 
110  if(v.userType() == qMetaTypeId<Vector2d>()) {
111  if(index >= 0 && index < 2) return v.value<Vector2d>()[index];
112  } else {
113  if(index == -1) return v.toDouble(ok);
114  }
115 
116  if(ok) *ok = false;
117  return 0.0;
118 }
119 
120 static QVariant doubleToVariant(const QVariant& v, int index, double newV, bool *ok)
121 {
122  if(ok) *ok = true;
123 
124  if(v.userType() == qMetaTypeId<Vector2d>()) {
125  if(index >= 0 && index < 2) {
126  Vector2d vector = v.value<Vector2d>();
127  vector[index] = newV;
128  return QVariant::fromValue(vector);
129  }
130  } else {
131  if(index == -1) {
132  bool ok1; v.toDouble(&ok1);
133  if(ok1) return newV;
134  }
135  }
136 
137  if(ok) *ok = false;
138  return 0.0;
139 }
140 
141 }
142 
143 Note::Note(Vector2d position, Vector2d size, QString text)
144  : _position(position), _size(size), _text(text)
145 {
146 }
147 
148 Graph::Graph(Vector2d position, Vector2d size)
149  : _position(position), _size(size),
150  _objectX(0), _propertyX(), _indexX(-1),
151  _objectY(0), _propertyY(), _indexY(-1),
152  _autoLimitsX(true), _autoLimitsY(true),
153  _limitsX(0,1), _limitsY(0,1),
154  _showLines(true), _showPoints(false)
155 {
156 }
157 
158 bool Graph::isValidX() const
159 {
160  bool ok;
161  const MetaProperty* prX = propertyXPtr(); if(!prX) return false;
162  variantToDouble(prX->readVariant(_objectX), _indexX, &ok);
163  return ok;
164 }
165 
166 bool Graph::isValidY() const
167 {
168  bool ok;
169  const MetaProperty* prY = propertyYPtr(); if(!prY) return false;
170  variantToDouble(prY->readVariant(_objectY), _indexY, &ok);
171  return ok;
172 }
173 
174 Vector2d Graph::currentValue(bool* ok) const
175 {
176  const MetaProperty* prX = propertyXPtr();
177  const MetaProperty* prY = propertyYPtr();
178 
179  if(prX && prY) {
180  bool ok1, ok2;
181  Vector2d point(variantToDouble(prX->readVariant(_objectX), _indexX, &ok1),
182  variantToDouble(prY->readVariant(_objectY), _indexY, &ok2));
183  if(ok1 && ok2) {
184  if(ok) *ok = true;
185  return point;
186  }
187  }
188 
189  if(ok) *ok = false;
190  return Vector2d::Zero();
191 }
192 
193 Vector2d Graph::recordPoint(bool* ok)
194 {
195  bool ok1;
196  Vector2d point(currentValue(&ok1));
197  if(ok1) {
198  if(ok) *ok = true;
199  _points.push_back(point);
200  return point;
201  }
202 
203  if(ok) *ok = false;
204  return Vector2d::Zero();
205 }
206 
207 /*
208 void Graph::worldItemRemoved(Item* item)
209 {
210  if(item == 0) return;
211  if(item == _objectX) setObjectX(0);
212  if(item == _objectY) setObjectY(0);
213 }
214 
215 void Graph::setWorld(World* world)
216 {
217  if(world == NULL) {
218  setObjectX(0);
219  setObjectY(0);
220  } else if(this->world() != NULL) {
221  if(_objectX != NULL) _objectX = world->object(_objectX->name());
222  if(_objectY != NULL) _objectY = world->object(_objectY->name());
223  }
224  Item::setWorld(world);
225 }
226 */
227 
228 QString Graph::unitsX() const
229 {
230  const MetaProperty* pr = propertyXPtr();
231  if(!pr && !isValidX()) return QString();
232 
233  return pr->units();
234 }
235 
236 QString Graph::unitsY() const
237 {
238  const MetaProperty* pr = propertyYPtr();
239  if(!pr && !isValidY()) return QString();
240 
241  return pr->units();
242 }
243 
244 Meter::Meter(Vector2d position, Vector2d size)
245  : _position(position), _size(size),
246  _object(0), _property(), _index(-1),
247  _digits(7)
248 {
249 }
250 
251 bool Meter::isValid() const
252 {
253  bool ok;
254  const MetaProperty* pr = propertyPtr(); if(!pr) return false;
255  variantToDouble(pr->readVariant(_object), _index, &ok);
256  return ok;
257 }
258 
259 double Meter::value(bool* ok) const
260 {
261  const MetaProperty* pr = propertyPtr();
262 
263  if(pr) {
264  bool ok1;
265  double v = variantToDouble(pr->readVariant(_object), _index, &ok1);
266  if(ok1) {
267  if(ok) *ok = true;
268  return v;
269  }
270  }
271 
272  if(ok) *ok = false;
273  return 0;
274 }
275 
276 QString Meter::units() const
277 {
278  const MetaProperty* pr = propertyPtr();
279  if(!pr && !isValid()) return QString();
280 
281  return pr->units();
282 }
283 
284 /*
285 void Meter::worldItemRemoved(Item* item)
286 {
287  if(item == 0) return;
288  if(item == _object) setObject(0);
289 }
290 
291 void Meter::setWorld(World* world)
292 {
293  if(world == NULL) {
294  setObject(0);
295  } else if(this->world() != NULL) {
296  if(_object != NULL) _object = world->object(_object->name());
297  }
298  Item::setWorld(world);
299 }
300 */
301 
302 Controller::Controller(Vector2d position, Vector2d size)
303  : _position(position), _size(size),
304  _object(0), _property(), _index(-1),
305  _limits(-1,1), _increment(0.1)
306 {
307 }
308 
309 bool Controller::isValid() const
310 {
311  bool ok;
312  const MetaProperty* pr = propertyPtr(); if(!pr) return false;
313  variantToDouble(pr->readVariant(_object), _index, &ok);
314  return ok && pr->isWritable();
315 }
316 
317 double Controller::value(bool* ok) const
318 {
319  const MetaProperty* pr = propertyPtr();
320 
321  if(pr && pr->isWritable()) {
322  bool ok1;
323  double v = variantToDouble(pr->readVariant(_object), _index, &ok1);
324  if(ok1) {
325  if(ok) *ok = true;
326  return v;
327  }
328  }
329 
330  if(ok) *ok = false;
331  return 0;
332 }
333 
334 void Controller::setValue(double value, bool* ok = 0)
335 {
336  const MetaProperty* pr = propertyPtr();
337 
338  if(pr && pr->isWritable()) {
339  bool ok1;
340  QVariant v = doubleToVariant(pr->readVariant(_object), _index, value, &ok1);
341  if(ok1) {
342  if(ok) *ok = true;
343  pr->writeVariant(_object, v);
344  }
345  }
346 
347  if(ok) *ok = false;
348 }
349 
350 QString Controller::units() const
351 {
352  const MetaProperty* pr = propertyPtr();
353  if(!pr && !isValid()) return QString();
354 
355  return pr->units();
356 }
357 
358 /*
359 void Controller::worldItemRemoved(Item* item)
360 {
361  if(item == 0) return;
362  if(item == _object) setObject(0);
363 }
364 
365 void Controller::setWorld(World* world)
366 {
367  if(world == NULL) {
368  setObject(0);
369  } else if(this->world() != NULL) {
370  if(_object != NULL) _object = world->object(_object->name());
371  }
372  Item::setWorld(world);
373 }
374 */
375 
376 Tracer::Tracer(Object* body, const Vector2d& localPosition)
377  : _localPosition(localPosition)
378 {
379  setColor(0xff0000ff);
380  setBody(body);
381 }
382 
383 void Tracer::setBody(Object* body)
384 {
385  if(body) {
386  if(body->metaObject()->inherits<Particle>()) {
387  _body = body;
388  _p = static_cast<Particle*>(body);
389  _r = NULL;
390  return;
391  } else if(body->metaObject()->inherits<RigidBody>()) {
392  _body = body;
393  _p = NULL;
394  _r = static_cast<RigidBody*>(body);
395  return;
396  }
397  }
398  _body = NULL;
399  _p = NULL;
400  _r = NULL;
401 }
402 
403 Vector2d Tracer::position() const
404 {
405  if(_p) return _p->position() + _localPosition;
406  else if(_r) return _r->pointLocalToWorld(_localPosition);
407  return _localPosition;
408 }
409 
410 /*
411 void Tracer::worldItemRemoved(Item* item)
412 {
413  if(item == _body) setBody(NULL);
414 }
415 
416 void Tracer::setWorld(World* world)
417 {
418  if(world == NULL) {
419  setBody(NULL);
420  } else if(this->world() != NULL) {
421  if(_body != NULL) setBody(world->item(body()->name()));
422  }
423  Item::setWorld(world);
424 }
425 */
426 
427 } // namespace StepCore
428 
StepCore::Meter::isValid
bool isValid() const
Returns true if observed property is valid.
Definition: tool.cc:251
rigidbody.h
RigidBody class.
StepCore::STEPCORE_PROPERTY_RWF
setAngleVariance setAngularVelocityVariance angularAccelerationVariance torqueVariance setInertiaVariance STEPCORE_PROPERTY_RWF(StepCore::Vector2d, momentumVariance, QT_TRANSLATE_NOOP("PropertyName","momentumVariance"), QT_TRANSLATE_NOOP("Units","kg m/s"), QT_TR_NOOP("momentum variance"), StepCore::MetaProperty::DYNAMIC, momentumVariance, setMomentumVariance) STEPCORE_PROPERTY_RWF(double
StepCore::Tracer::_body
Object * _body
Definition: tool.h:499
StepCore::Meter::_index
int _index
Definition: tool.h:346
StepCore::Controller::Controller
Controller(Vector2d position=Vector2d::Zero(), Vector2d size=Vector2d(200, 60))
Constructs Controller.
Definition: tool.cc:302
StepCore::Controller::setValue
void setValue(double value)
Set value of the controlled property.
Definition: tool.h:421
StepCore::Graph::_objectY
Object * _objectY
Definition: tool.h:256
STEPCORE_PROPERTY_R
#define STEPCORE_PROPERTY_R(_type, _name, _nameNoop, _units, _description, _read)
Definition: object.h:399
StepCore::Tracer::body
Object * body() const
Get pointer to the first body.
Definition: tool.h:470
StepCore::Controller::_object
Object * _object
Definition: tool.h:441
StepCore::Vector2d
Eigen::Vector2d Vector2d
Two-dimensional vector with double components.
Definition: vector.h:29
StepCore::Object
Root of the StepCore classes hierarchy.
Definition: object.h:57
StepCore::Controller::propertyPtr
const MetaProperty * propertyPtr() const
Get pointer to the controlled property.
Definition: tool.h:414
StepCore::Controller::value
double value() const
Get value of the controlled property.
Definition: tool.h:419
StepCore::MetaProperty::readVariant
QVariant readVariant(const Object *obj) const
Read property as QVariant.
Definition: object.h:131
StepCore::Meter::value
double value() const
Get value of the observed property.
Definition: tool.h:325
StepCore::Graph::_objectX
Object * _objectX
Definition: tool.h:252
StepCore::doubleToVariant
static QVariant doubleToVariant(const QVariant &v, int index, double newV, bool *ok)
Definition: tool.cc:120
StepCore::STEPCORE_SUPER_CLASS
STEPCORE_SUPER_CLASS(CollisionSolver)
StepCore::MetaProperty::writeVariant
bool writeVariant(Object *obj, const QVariant &v) const
Write property as QVariant.
Definition: object.h:133
StepCore::RigidBody
Rigid body.
Definition: rigidbody.h:144
StepCore::Tracer::_localPosition
Vector2d _localPosition
Definition: tool.h:500
StepCore::Meter::Meter
Meter(Vector2d position=Vector2d::Zero(), Vector2d size=Vector2d(70, 24))
Constructs Meter.
Definition: tool.cc:244
StepCore::Graph::_points
Vector2dList _points
Definition: tool.h:269
StepCore::QT_TRANSLATE_NOOP
QT_TRANSLATE_NOOP("ObjectClass","GJKCollisionSolver")
StepCore::Tracer::setBody
void setBody(Object *body)
Set pointer to the first connected body.
Definition: tool.cc:383
StepCore::Graph::Graph
Graph(Vector2d position=Vector2d::Zero(), Vector2d size=Vector2d(400, 300))
Constructs Graph.
Definition: tool.cc:148
StepCore::Graph::isValidY
bool isValidY() const
Returns true if Y-axis data source is valid.
Definition: tool.cc:166
StepCore::Tracer::position
Vector2d position() const
Position of the tracer.
Definition: tool.cc:403
StepCore::Graph::isValidX
bool isValidX() const
Returns true if X-axis data source is valid.
Definition: tool.cc:158
StepCore::Item::setColor
void setColor(Color color)
Set item color (for use in GUI)
Definition: world.h:112
StepCore::MetaProperty::units
const QString & units() const
Returns property units (if appropriate)
Definition: object.h:115
StepCore::Tracer::_p
Particle * _p
Definition: tool.h:503
StepCore::Tracer::_r
RigidBody * _r
Definition: tool.h:504
StepCore::Graph::propertyYPtr
const MetaProperty * propertyYPtr() const
Get pointer to the property for Y axis (or zero if not defined)
Definition: tool.h:214
StepCore::Tracer
Traces position of the body.
Definition: tool.h:461
StepCore::Item
The root class for any world items (bodies and forces)
Definition: world.h:69
StepCore::RigidBody::pointLocalToWorld
Vector2d pointLocalToWorld(const Vector2d &p) const
Translate local coordinates on body to world coordinates.
Definition: rigidbody.cc:201
StepCore::Graph
Graph item.
Definition: tool.h:125
StepCore::QT_TR_NOOP
QT_TR_NOOP("Errors class for CoulombForce")
StepCore::Controller::isValid
bool isValid() const
Returns true if controlled property is valid.
Definition: tool.cc:309
StepCore::Graph::recordPoint
Vector2d recordPoint(bool *ok=0)
Get current point value and add it to points list.
Definition: tool.cc:193
StepCore::STEPCORE_PROPERTY_RW
STEPCORE_PROPERTY_RW(double, depth, QT_TRANSLATE_NOOP("PropertyName","depth"), QT_TRANSLATE_NOOP("Units","J"), QT_TR_NOOP("Potential depth"), depth, setDepth) STEPCORE_PROPERTY_RW(double
StepCore::Particle
Particle with mass.
Definition: particle.h:103
STEPCORE_UNITS_NULL
#define STEPCORE_UNITS_NULL
Definition: object.h:365
StepCore::STEPCORE_PROPERTY_RW_D
STEPCORE_PROPERTY_RW_D(StepCore::Vector2d, positionVariance, QT_TRANSLATE_NOOP("PropertyName","positionVariance"), QT_TRANSLATE_NOOP("Units","m"), QT_TR_NOOP("position variance"), positionVariance, setPositionVariance) STEPCORE_PROPERTY_RW_D(double
StepCore::Graph::currentValue
Vector2d currentValue() const
Get current point value.
Definition: tool.h:226
StepCore::Controller
Controller item to control properties of other objects.
Definition: tool.h:357
StepCore::Meter::propertyPtr
const MetaProperty * propertyPtr() const
Get pointer to the observed property.
Definition: tool.h:320
StepCore::Graph::_indexY
int _indexY
Definition: tool.h:258
StepCore::STEPCORE_PROPERTY_R_D
setRmin setRminVariance STEPCORE_PROPERTY_R_D(double, rectPressureVariance, QT_TRANSLATE_NOOP("PropertyName","rectPressureVariance"), QT_TRANSLATE_NOOP("Units","Pa"), QT_TR_NOOP("Variance of pressure of particles in the measureRect"), rectPressureVariance) STEPCORE_PROPERTY_R_D(double
StepCore::Controller::units
QString units() const
Return units of measured property.
Definition: tool.cc:350
particle.h
Particle and ChargedParticle classes.
StepCore::Particle::position
const Vector2d & position() const
Get position of the particle.
Definition: particle.h:117
StepCore::STEPCORE_META_OBJECT
STEPCORE_META_OBJECT(CollisionSolver, QT_TRANSLATE_NOOP("ObjectClass","CollisionSolver"),"CollisionSolver", MetaObject::ABSTRACT, STEPCORE_SUPER_CLASS(Object), STEPCORE_PROPERTY_RW(double, toleranceAbs, QT_TRANSLATE_NOOP("PropertyName","toleranceAbs"), STEPCORE_UNITS_1, QT_TR_NOOP("Allowed absolute tolerance"), toleranceAbs, setToleranceAbs) STEPCORE_PROPERTY_R_D(double, localError, QT_TRANSLATE_NOOP("PropertyName","localError"), STEPCORE_UNITS_1, QT_TR_NOOP("Maximal local error during last step"), localError)) STEPCORE_META_OBJECT(GJKCollisionSolver
StepCore::Vector2dList
std::vector< Vector2d, Eigen::aligned_allocator< Vector2d > > Vector2dList
Definition: types.h:117
StepCore::Controller::_index
int _index
Definition: tool.h:443
StepCore::Tracer::Tracer
Tracer(Object *body=0, const Vector2d &localPosition=Vector2d::Zero())
Constructs Spring.
Definition: tool.cc:376
StepCore::MetaProperty
Meta-information about property.
Definition: object.h:77
StepCore::Graph::_indexX
int _indexX
Definition: tool.h:254
StepCore::Graph::unitsX
QString unitsX() const
Return units of propertyX.
Definition: tool.cc:228
StepCore::Meter::_object
Object * _object
Definition: tool.h:344
StepCore::Meter::units
QString units() const
Return units of measured property.
Definition: tool.cc:276
tool.h
Note class.
StepCore::MetaProperty::isWritable
bool isWritable() const
Returns true if this property is writable.
Definition: object.h:143
StepCore::Note::Note
Note(Vector2d position=Vector2d::Zero(), Vector2d size=Vector2d(250, 100), QString text=QString())
Constructs Note.
Definition: tool.cc:143
StepCore::Meter
Meter to observe properties of other objects.
Definition: tool.h:278
StepCore::Graph::unitsY
QString unitsY() const
Return units of propertyY.
Definition: tool.cc:236
StepCore::Graph::propertyXPtr
const MetaProperty * propertyXPtr() const
Get pointer to the property for X axis (or zero if not defined)
Definition: tool.h:209
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:43:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

step/stepcore

Skip menu "step/stepcore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal