// (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
// --- ---------- ------------------------------------------------------------
// 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"
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)
{
}
{
}
-/*virtual*/ void Object::Draw(QPainter *)
+/*virtual*/ void Object::Draw(Painter *)
{
}
{
}
+// 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*/)
{
dimensionActive = state;
}
+
+void Object::SetSnapMode(bool state/*= true*/)
+{
+ snapToGrid = state;
+}