2 // object.cpp: Base class for all CAD objects
4 // Part of the Architektonas Project
5 // (C) 2011 Underground Software
6 // See the README and GPLv3 files for licensing and warranty information
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- ------------------------------------------------------------
12 // JLH 03/22/2011 Created this file
13 // JLH 04/01/2011 Added constructor to allow derived objects to have empty
14 // constructor bodies, added state querying
15 // JLH 04/02/2001 Added static methods for global states (fixed angle, etc)
19 // Initialize static variables
20 bool Object::fixedAngle = false;
21 bool Object::fixedLength = false;
22 QFont * Object::font = 0;
23 int Object::viewportHeight = 0;
24 bool Object::deleteActive = false;
25 bool Object::dimensionActive = false;
28 Object::Object(): position(Vector(0, 0)), parent(0), state(OSInactive), oldState(OSInactive),
29 needUpdate(false), attachedDimension(0)
33 Object::Object(Vector v, Object * passedInParent/*= 0*/): position(v), parent(passedInParent),
34 state(OSInactive), oldState(OSInactive), needUpdate(false), attachedDimension(0)
42 /*virtual*/ void Object::Draw(QPainter *)
46 /*virtual*/ Vector Object::Center(void)
51 /*virtual*/ bool Object::Collided(Vector)
56 /*virtual*/ void Object::PointerMoved(Vector)
60 /*virtual*/ void Object::PointerReleased(void)
64 /*virtual*/ bool Object::NeedsUpdate(void)
69 // This is intended to be overridden by the Container class, for object morphing
70 /*virtual*/ void Object::Transmute(Object *, Object *)
74 /*virtual*/ Object * Object::GetParent(void)
79 /*virtual*/ void Object::Add(Object *)
83 ObjectState Object::GetState(void)
90 void Object::SetFixedAngle(bool state/*= true*/)
95 void Object::SetFixedLength(bool state/*= true*/)
100 void Object::SetFont(QFont * f)
105 void Object::SetViewportHeight(int height)
107 viewportHeight = height;
110 void Object::SetDeleteActive(bool state/*= true*/)
112 deleteActive = state;
115 void Object::SetDimensionActive(bool state/*= true*/)
117 dimensionActive = state;