]> Shamusworld >> Repos - architektonas/blobdiff - src/object.cpp
Added Architektonas drawing file loading/saving infrastructure.
[architektonas] / src / object.cpp
index eaef4d4484eb9d002d34777354554704cac985b7..ab95c0ea16fb5a35cf56af5074671b17cf8377b2 100644 (file)
@@ -5,7 +5,7 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
@@ -13,6 +13,7 @@
 // JLH  04/01/2011  Added constructor to allow derived objects to have empty
 //                  constructor bodies, added state querying
 // JLH  04/02/2001  Added static methods for global states (fixed angle, etc)
+//
 
 #include "object.h"
 
@@ -21,15 +22,18 @@ bool Object::fixedAngle = false;
 bool Object::fixedLength = false;
 QFont * Object::font = 0;
 int Object::viewportHeight = 0;
+bool Object::deleteActive = false;
+bool Object::dimensionActive = false;
+bool Object::snapToGrid = true;
 
 
 Object::Object(): position(Vector(0, 0)), parent(0), state(OSInactive), oldState(OSInactive),
-       needUpdate(false), dimPoint1(0), dimPoint2(0)
+       needUpdate(false), attachedDimension(0)
 {
 }
 
 Object::Object(Vector v,  Object * passedInParent/*= 0*/): position(v), parent(passedInParent),
-       state(OSInactive), oldState(OSInactive), needUpdate(false), dimPoint1(0), dimPoint2(0)
+       state(OSInactive), oldState(OSInactive), needUpdate(false), attachedDimension(0)
 {
 }
 
@@ -37,7 +41,7 @@ Object::~Object()
 {
 }
 
-/*virtual*/ void Object::Draw(QPainter *)
+/*virtual*/ void Object::Draw(Painter *)
 {
 }
 
@@ -69,11 +73,36 @@ Object::~Object()
 {
 }
 
+/*virtual*/ Object * Object::GetParent(void)
+{
+       return parent;
+}
+
+/*virtual*/ void Object::Add(Object *)
+{
+}
+
+// This returns a pointer to the point passed in, if it coincides. Otherwise returns NULL.
+/*virtual*/ Vector * Object::GetPointAt(Vector)
+{
+       return 0;
+}
+
 ObjectState Object::GetState(void)
 {
        return state;
 }
 
+void Object::Reparent(Object * newParent)
+{
+       parent = newParent;
+}
+
+Dimension * Object::GetAttachedDimension(void)
+{
+       return attachedDimension;
+}
+
 // Class methods...
 
 void Object::SetFixedAngle(bool state/*= true*/)
@@ -95,3 +124,18 @@ void Object::SetViewportHeight(int height)
 {
        viewportHeight = height;
 }
+
+void Object::SetDeleteActive(bool state/*= true*/)
+{
+       deleteActive = state;
+}
+
+void Object::SetDimensionActive(bool state/*= true*/)
+{
+       dimensionActive = state;
+}
+
+void Object::SetSnapMode(bool state/*= true*/)
+{
+       snapToGrid = state;
+}