]> Shamusworld >> Repos - architektonas/commitdiff
In the middle of refactoring objects for loading/saving.
authorShamus Hammons <jlhamm@acm.org>
Fri, 22 Feb 2013 16:50:43 +0000 (10:50 -0600)
committerShamus Hammons <jlhamm@acm.org>
Fri, 22 Feb 2013 16:50:43 +0000 (10:50 -0600)
This is a bit more hairy than it would seem: it requires clarity in the
data structures which isn't quite there yet. Hopefully that clarity will
be coming sooner than later. :-P

18 files changed:
architektonas.pro
src/applicationwindow.cpp
src/arc.cpp
src/arc.h
src/circle.cpp
src/circle.h
src/container.cpp
src/container.h
src/dimension.cpp
src/dimension.h
src/ellipse.cpp [new file with mode: 0644]
src/ellipse.h [new file with mode: 0644]
src/fileio.cpp
src/fileio.h
src/line.cpp
src/line.h
src/object.cpp
src/object.h

index 68ced077e6ec22d58024e8ed26f43f7362a206c7..1d1000d8d4f47cf0ad3bb4460763eb314df362df 100644 (file)
@@ -51,6 +51,7 @@ HEADERS = \
        src/drawingview.h \
        src/drawcircleaction.h \
        src/drawlineaction.h \
+       src/ellipse.h \
        src/fileio.h \
        src/generaltab.h \
        src/line.h \
@@ -72,6 +73,7 @@ SOURCES = \
        src/drawingview.cpp \
        src/drawcircleaction.cpp \
        src/drawlineaction.cpp \
+       src/ellipse.cpp \
        src/fileio.cpp \
        src/generaltab.cpp \
        src/line.cpp \
index a9c7fb6b25c64e1451beb26ed35f41775a58a511..0911b8e3742881eba036979b353391346339136c 100644 (file)
@@ -118,6 +118,7 @@ void ApplicationWindow::FileOpen(void)
                return;
        }
 
+printf("FileOpen: container size = %li\n", container.objects.size());
        drawing->document = container;
        drawing->update();
        documentName = filename;
index c9eab157d06a95676328644cc9fe388646154c2b..a4efa39de9c03b2f4922907d6737188dda986f04 100644 (file)
@@ -24,10 +24,12 @@ Arc::Arc(Vector p1, double r, double a1, double a2, Object * p/*= NULL*/): Objec
 {
 }
 
+
 Arc::~Arc()
 {
 }
 
+
 /*virtual*/ void Arc::Draw(Painter * painter)
 {
        QPen pen;
@@ -117,11 +119,13 @@ Arc::~Arc()
        painter->DrawArc(position, radius, startAngle, angleSpan);
 }
 
+
 /*virtual*/ Vector Arc::Center(void)
 {
        return position;
 }
 
+
 /*
  We need at least *four* handles for this object:
  - one for moving
@@ -225,6 +229,7 @@ so let's do like this:
        return false;
 }
 
+
 /*virtual*/ void Arc::PointerMoved(Vector point)
 {
        // The TLC will send these messages if the object is selected but not clicked on.
@@ -265,6 +270,7 @@ so let's do like this:
        needUpdate = true;
 }
 
+
 /*virtual*/ void Arc::PointerReleased(void)
 {
        hitHandle1 = hitHandle2 = hitHandle3 = hitHandle4 = false;
@@ -293,6 +299,7 @@ but this is actually more compact and cleaner.
 }
 #endif
 
+
 /*
 start = 350, span = 20, end = 10, angle = 5
 angle < start, so angle = 365
@@ -312,3 +319,10 @@ bool Arc::AngleInArcSpan(double angle)
 
        return (passedInSpan <= angleSpan ?  true : false);
 }
+
+
+/*virtual*/ void Arc::Enumerate(FILE * file)
+{
+       fprintf(file, "ARC (%lf,%lf) %lf, %lf, %lf\n", position.x, position.y, radius, startAngle, angleSpan);
+}
+
index ee9c567a0b1c038790ad2160b464f20f94cbcb3f..262fc852fa6d7e53189a9306558bc8a317aaa027 100644 (file)
--- a/src/arc.h
+++ b/src/arc.h
@@ -15,6 +15,8 @@ class Arc: public Object
                virtual void PointerMoved(Vector);
                virtual void PointerReleased(void);
 //             virtual bool NeedsUpdate(void);
+               virtual void Enumerate(FILE *);
+               virtual Object * Copy(void);
 
        private:
                bool AngleInArcSpan(double angle);
index 8e5f6cddc7fc3937e116d25340e8af1ffc4738e0..af8f91f3be2c152bf4c906d4ed3dd767f2e0054c 100644 (file)
@@ -24,10 +24,12 @@ Circle::Circle(Vector p1, double r, Object * p/*= NULL*/): Object(p1, p), radius
 {
 }
 
+
 Circle::~Circle()
 {
 }
 
+
 /*virtual*/ void Circle::Draw(Painter * painter)
 {
        if (state == OSSelected || hitCircle || hitCenter)
@@ -52,11 +54,13 @@ Circle::~Circle()
                painter->DrawHandle(dragPoint);
 }
 
+
 /*virtual*/ Vector Circle::Center(void)
 {
        return position;
 }
 
+
 /*virtual*/ bool Circle::Collided(Vector point)
 {
        // We can assume this, since this is a mouse down event here.
@@ -79,6 +83,7 @@ Circle::~Circle()
        return false;
 }
 
+
 /*virtual*/ void Circle::PointerMoved(Vector point)
 {
        // Hit test tells us what we hit (if anything) through boolean variables. It
@@ -95,6 +100,7 @@ Circle::~Circle()
        dragPoint = point;
 }
 
+
 /*virtual*/ void Circle::PointerReleased(void)
 {
        // Mouse went up, so our dragging is done (if any *was* done, that is)
@@ -107,6 +113,7 @@ Circle::~Circle()
                state = oldState;
 }
 
+
 bool Circle::HitTest(Point point)
 {
        SaveState();
@@ -129,12 +136,14 @@ since we generally *don't* want those to scale with the zoom level. ;-)
        return StateChanged();
 }
 
+
 void Circle::SaveState(void)
 {
        oldHitCenter = hitCenter;
        oldHitCircle = hitCircle;
 }
 
+
 bool Circle::StateChanged(void)
 {
        if ((hitCenter != oldHitCenter) || (hitCircle != oldHitCircle))
@@ -142,3 +151,10 @@ bool Circle::StateChanged(void)
 
        return false;
 }
+
+
+/*virtual*/ void Circle::Enumerate(FILE * file)
+{
+       fprintf(file, "CIRCLE (%lf,%lf) %lf\n", position.x, position.y, radius);
+}
+
index cae030830d10951eaede7b37a30e3ffe8ec72489..72bdea268947203e685bc124d2d822214ce4e111 100644 (file)
@@ -14,6 +14,8 @@ class Circle: public Object
                virtual bool Collided(Vector);
                virtual void PointerMoved(Vector);
                virtual void PointerReleased(void);
+               virtual void Enumerate(FILE *);
+               virtual Object * Copy(void);
 
        protected:
                bool HitTest(Point);
index 2ee9c7afa2291d9591302d14d051c1ffd82217d1..48e412a9dc29ee29eada20f753dfa5576a304156 100644 (file)
@@ -35,30 +35,29 @@ Container::Container(const Container & copy): Object(copy.position, copy.parent)
 
 Container::~Container()
 {
-#if 0
-       // No memory leaks!
-       while (objects.size() > 0)
-       {
-               delete objects[0];
-               objects.erase(objects.begin());
-       }
-#else
        Clear();
-#endif
 }
 
 
 // Assignment operator
-Container & Container::operator=(const Container & copy)
+Container & Container::operator=(const Container & from)
 {
        // Take care of self-assignment
-       if (this == &copy)
+       if (this == &from)
                return *this;
 
        Clear();
 
-       for(int i=0; i<(int)copy.objects.size(); i++)
-               objects.push_back(copy.objects[i]);
+       // Small problem with this approach: if the copied object goes out of scope,
+       // all of the objects we copied in here will be deleted. D'oh!
+       for(uint i=0; i<from.objects.size(); i++)
+       {
+               Object * object = from.objects[i];
+
+               // Need to copy the object here...
+
+               objects.push_back(object);
+       }
 
        return *this;
 }
@@ -67,7 +66,10 @@ Container & Container::operator=(const Container & copy)
 /*virtual*/ void Container::Draw(Painter * painter)
 {
        for(int i=0; i<(int)objects.size(); i++)
+       {
+printf("Container: About to draw (object = $%X)\n", objects[i]);
                objects[i]->Draw(painter);
+       }
 }
 
 
@@ -152,7 +154,9 @@ Like so:
                        {
 Dimension * dimension = objects[i]->GetAttachedDimension();
 
-                               objects.erase(objects.begin() + i);     // Calls the destructor, (deletes the object, I presume... O_o)
+                               Object * objectToDelete = objects[i];
+                               objects.erase(objects.begin() + i);     // Calls the destructor, (deletes the object, I presume... O_o) [NOPE! SURE DOESN'T!]
+                               delete objectToDelete;
 
 // If this object had an attached dimension, reattach it to another object, if any...
 // The only problem with that approach is if the object it gets attached to is deleted,
@@ -246,7 +250,7 @@ about keeping track of old states...
 {
        needUpdate = false;
 
-       for(int i=0; i<(int)objects.size(); i++)
+       for(uint i=0; i<objects.size(); i++)
        {
                if (objects[i]->NeedsUpdate())
                        needUpdate = true;
@@ -259,6 +263,7 @@ about keeping track of old states...
 /*virtual*/ void Container::Add(Object * object)
 {
        objects.push_back(object);
+printf("Container: Added object (=$%X). size = %li\n", object, objects.size());
 }
 
 
@@ -267,7 +272,23 @@ void Container::Clear(void)
        // No memory leaks!
        while (objects.size() > 0)
        {
+printf("Container: Deleting object ($%X)...\n", objects[0]);
                delete objects[0];
                objects.erase(objects.begin());
        }
 }
+
+
+/*virtual*/ void Container::Enumerate(FILE * file)
+{
+       // Only put "CONTAINER" markers if *not* the top level container
+       if (parent != NULL)
+               fprintf(file, "CONTAINER\n");
+
+       for(uint i=0; i<objects.size(); i++)
+               objects[i]->Enumerate(file);
+
+       if (parent != NULL)
+               fprintf(file, "ENDCONTAINER\n");
+}
+
index ac26722b42fafadc59670bd56f2502a9bbc77944..e7bf355217d82d6c7d8a7528797b2ca917e600ec 100644 (file)
@@ -20,13 +20,15 @@ class Container: public Object
                virtual void PointerReleased(void);
                virtual bool NeedsUpdate(void);
                virtual void Add(Object *);
+               virtual void Enumerate(FILE *);
                void Clear(void);
 
        protected:
                Vector oldPoint;                                        // Used for dragging
 
-       private:
+       public:
                std::vector<Object *> objects;
+       private:
                bool dragging;
                bool draggingHandle1;
                bool draggingHandle2;
index 3060ff1b930c8682409f10993b73622562fbb098..ad2ffcbe38a08bd88fbbc85ea8333060306862d1 100644 (file)
@@ -25,6 +25,7 @@ Dimension::Dimension(Vector p1, Vector p2, DimensionType dt/*= DTLinear*/ ,Objec
 {
 }
 
+
 // This is bad, p1 & p2 could be NULL, causing much consternation...
 Dimension::Dimension(Vector * p1, Vector * p2, DimensionType dt/*= DTLinear*/ , Object * p/*= NULL*/):
        Object(*p1, p), endpoint(*p2),
@@ -33,10 +34,12 @@ Dimension::Dimension(Vector * p1, Vector * p2, DimensionType dt/*= DTLinear*/ ,
 {
 }
 
+
 Dimension::~Dimension()
 {
 }
 
+
 /*virtual*/ void Dimension::Draw(Painter * painter)
 {
        // If there are valid Vector pointers in here, use them to update the internal
@@ -130,6 +133,7 @@ retarded is that? :-/
 */
 }
 
+
 /*virtual*/ Vector Dimension::Center(void)
 {
        // Technically, this is the midpoint but who are we to quibble? :-)
@@ -137,6 +141,7 @@ retarded is that? :-/
        return endpoint + v;
 }
 
+
 /*virtual*/ bool Dimension::Collided(Vector /*point*/)
 {
 #if 0
@@ -237,6 +242,7 @@ Like so:
        return false;
 }
 
+
 /*virtual*/ void Dimension::PointerMoved(Vector point)
 {
        // We know this is true because mouse move messages don't come here unless
@@ -277,6 +283,7 @@ Like so:
                needUpdate = false;
 }
 
+
 /*virtual*/ void Dimension::PointerReleased(void)
 {
        if (draggingHandle1 || draggingHandle2)
@@ -319,28 +326,33 @@ about keeping track of old states...
                state = oldState;
 }
 
+
 void Dimension::SetPoint1(Vector * v)
 {
        point1 = v;
        needUpdate = true;
 }
 
+
 void Dimension::SetPoint2(Vector * v)
 {
        point2 = v;
        needUpdate = true;
 }
 
+
 Vector Dimension::GetPoint1(void)
 {
        return position;
 }
 
+
 Vector Dimension::GetPoint2(void)
 {
        return endpoint;
 }
 
+
 void Dimension::FlipSides(void)
 {
 #if 0
@@ -355,3 +367,9 @@ void Dimension::FlipSides(void)
        needUpdate = true;
 }
 
+
+/*virtual*/ void Dimension::Enumerate(FILE * file)
+{
+       fprintf(file, "DIMENSION (%lf,%lf) (%lf,%lf) %i\n", position.x, position.y, endpoint.x, endpoint.y, type);
+}
+
index 0cda92924fa9cd75aabe1e0e64a4a3d7452d5e8e..52f838f665c7cfea629e9148d0470b507cad5c63 100644 (file)
@@ -17,6 +17,8 @@ class Dimension: public Object
                virtual bool Collided(Vector);
                virtual void PointerMoved(Vector);
                virtual void PointerReleased(void);
+               virtual void Enumerate(FILE *);
+               virtual Object * Copy(void);
                void SetPoint1(Vector *);
                void SetPoint2(Vector *);
                Vector GetPoint1(void);
diff --git a/src/ellipse.cpp b/src/ellipse.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/ellipse.h b/src/ellipse.h
new file mode 100644 (file)
index 0000000..e69de29
index 7cd6816d4766f63690d14d7ce0dbca13c7bc31b3..fedddea4fea6729a917fe15510420aa829bef802 100644 (file)
 
 //#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <vector>
+#include "arc.h"
+#include "circle.h"
 #include "container.h"
+#include "dimension.h"
+#include "line.h"
+
+enum ObjectType { OTContainer, OTContainerEnd, OTLine, OTCircle, OTArc, OTDimension,
+       OTPolygon, OTText, OTImage, OTBlock, OTEndOfFile };
 
 
 /*static*/ bool FileIO::SaveAtnsFile(FILE * file, Container * object)
 {
-//     QString filename2 = QFileDialog::getSaveFileName(NULL, tr("Save Drawing"),
-//             "", tr("Architektonas files (*.drawing)"));
+       /* Approach: loop through the container, doing a depth-first traversal. Any extra
+          containers found are looped through until there aren't any more down, then
+          ordinary objects are described. This can be handled by a virtual Object function
+          that reports the object by itself if it's a non-Container, otherwise it
+          enumerates all objects within itself. */
 
+       fprintf(file, "ARCHITEKTONAS DRAWING V1.0\n");
+#if 1
+       object->Enumerate(file);
+       fprintf(file, "END\n");
+       return true;
+#else
        return false;
+#endif
 }
 
 
-/*static*/ bool FileIO::LoadAtnsFile(FILE * file, Container * object)
+/*static*/ bool FileIO::LoadAtnsFile(FILE * file, Container * drawing)
 {
-//     QString filename2 = QFileDialog::getOpenFileName(NULL, tr("Open Drawing"),
-//             "", tr("Architektonas files (*.drawing)"));
+//     char buffer[256];
+       float version;
+
+       fscanf(file, "ARCHITEKTONAS DRAWING V%f", &version);
+
+//printf("Load: version = %f\n", version);
+       if (version != 1.0)
+               return false;
+       /* Approach: read each object in the file, one by one. If the object is a Container,
+          add objects to it until an "endContainer" marker is found. This will require a
+          stack to maintain the current Container. */
+
+#if 1
+       std::vector<Container *> containerStack;
+       Container * currentTopContainer = drawing;//new Container(Vector(0, 0));
+       Object * object;
+//     ObjectType objectType;
+       int objectType;
+
+       while (!feof(file))
+       {
+               if (FileIO::GetObjectFromFile(file, currentTopContainer, &object, &objectType) == false)
+                       return false;
+
+               // object->type down below can be replaced with objType.
+               // Above could be: bool FileIO::GetObjectFromFile(FILE *, Object *, ObjectType *);
+               // where the return value tells if it's a valid object, Object * returns the
+               // reconstructed object and ObjectType * returns the object type.
+
+               if (objectType == OTEndOfFile)
+               {
+printf("Load: container size = %li\n", drawing->objects.size());
+                       return true;
+               }
+               else if (objectType == OTContainer)
+               {
+                       containerStack.push_back(currentTopContainer);
+                       currentTopContainer = new Container(Vector(0, 0), currentTopContainer);
+               }
+               else if (objectType == OTContainerEnd)
+               {
+                       Container * containerToAdd = currentTopContainer;
+                       currentTopContainer = containerStack.back();
+                       containerStack.pop_back();
+                       currentTopContainer->Add(containerToAdd);
+               }
+               else
+               {
+                       currentTopContainer->Add(object);
+printf("Load: Adding object. Container size = %li (%li)\n", drawing->objects.size(), currentTopContainer->objects.size());
+               }
+       }
 
        return false;
+#else
+       return false;
+#endif
 }
 
 
+/*static*/ bool FileIO::GetObjectFromFile(FILE * file, Object * parent, Object ** object, int * objectType)
+{
+       char buffer[256];
+       fscanf(file, "%s ", buffer);
+       bool recognized = false;
+//printf("Load: buffer = \"%s\"\n", buffer);
+
+       if (strcmp(buffer, "LINE") == 0)
+       {
+//printf("      Found LINE.\n");
+               recognized = true;
+               Vector v1, v2;
+               fscanf(file, "(%lf,%lf) (%lf,%lf)", &v1.x, &v1.y, &v2.x, &v2.y);
+//printf("      Number of params recognized: %i\n", n);
+               *object = new Line(v1, v2, parent);
+               *objectType = OTLine;
+       }
+       else if (strcmp(buffer, "CIRCLE") == 0)
+       {
+               recognized = true;
+               Vector v;
+               double r;
+               fscanf(file, "(%lf,%lf) %lf", &v.x, &v.y, &r);
+               *object = new Circle(v, r, parent);
+               *objectType = OTCircle;
+       }
+       else if (strcmp(buffer, "ARC") == 0)
+       {
+               recognized = true;
+               Vector v;
+               double r, a1, a2;
+               fscanf(file, "(%lf,%lf) %lf, %lf, %lf", &v.x, &v.y, &r, &a1, &a2);
+               *object = new Arc(v, r, a1, a2, parent);
+               *objectType = OTArc;
+       }
+       else if (strcmp(buffer, "DIMENSION") == 0)
+       {
+               recognized = true;
+               Vector v1, v2;
+               DimensionType type;
+               fscanf(file, "(%lf,%lf) (%lf,%lf) %i", &v1.x, &v1.y, &v2.x, &v2.y, &type);
+               *object = new Dimension(v1, v2, type, parent);
+               *objectType = OTDimension;
+       }
+       else if (strcmp(buffer, "CONTAINER") == 0)
+       {
+               recognized = true;
+               *objectType = OTContainer;
+       }
+       else if (strcmp(buffer, "ENDCONTAINER") == 0)
+       {
+               recognized = true;
+               *objectType = OTContainerEnd;
+       }
+       else if (strcmp(buffer, "END") == 0)
+       {
+               recognized = true;
+               *objectType = OTEndOfFile;
+       }
+
+       return recognized;
+}
+
index 5994e27eba32482fc7e2b2286900e724a48efe2e..a30ad48c6955e7423e8185c1fd9364a3dcb24f5b 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdio.h>
 
 class Container;
+class Object;
 
 // NB: The methods in this class are all static, so there's no need to
 //     instantiate an object of this type to use its functions.
@@ -13,6 +14,9 @@ class FileIO
        public:
                static bool SaveAtnsFile(FILE *, Container *);
                static bool LoadAtnsFile(FILE *, Container *);
+
+       private:
+               static bool GetObjectFromFile(FILE *, Object *, Object **, int *);
 };
 
 #endif // __FILEIO_H__
index 880a79d60bc48254645794628ce1cb69dbe246fb..739842bbe9bd811d510cc0d071e81cead1c5dd58 100644 (file)
@@ -580,3 +580,23 @@ else
 }
 */
 
+/*virtual*/ void Line::Enumerate(FILE * file)
+{
+       fprintf(file, "LINE (%lf,%lf) (%lf,%lf)\n", position.x, position.y, endpoint.x, endpoint.y);
+}
+
+
+/*virtual*/ Object * Line::Copy(void)
+{
+#warning "!!! This doesn't take care of attached Dimensions !!!"
+/*
+This is a real problem. While having a pointer in the Dimension to this line's points is fast & easy,
+it creates a huge problem when trying to replicate an object like this.
+
+Maybe a way to fix that then, is to have reference numbers instead of pointers. That way, if you copy
+them, ... you might still have problems. Because you can't be sure if a copy will be persistant or not,
+you then *definitely* do not want them to have the same reference number.
+*/
+       return new Line(position, endpoint, parent);
+}
+
index 816bfc284d7dda12bfe0c5d3ad909dd02933b557..de1bbfe15a8ca8c05a99e25d3d984e5086cf6868 100644 (file)
@@ -17,6 +17,8 @@ class Line: public Object
                virtual void PointerMoved(Vector);
                virtual void PointerReleased(void);
                virtual Vector * GetPointAt(Vector);
+               virtual void Enumerate(FILE *);
+               virtual Object * Copy(void);
 //             void SetDimensionOnPoint1(Dimension *);
 //             void SetDimensionOnPoint2(Dimension *);
                void SetDimensionOnLine(Dimension * d = 0);
index ab95c0ea16fb5a35cf56af5074671b17cf8377b2..8f9377bf7345624c61acffb6b9de11735a4ec656 100644 (file)
@@ -32,77 +32,105 @@ Object::Object(): position(Vector(0, 0)), parent(0), state(OSInactive), oldState
 {
 }
 
+
 Object::Object(Vector v,  Object * passedInParent/*= 0*/): position(v), parent(passedInParent),
        state(OSInactive), oldState(OSInactive), needUpdate(false), attachedDimension(0)
 {
 }
 
+
 Object::~Object()
 {
 }
 
+
 /*virtual*/ void Object::Draw(Painter *)
 {
 }
 
+
 /*virtual*/ Vector Object::Center(void)
 {
        return Vector();
 }
 
+
 /*virtual*/ bool Object::Collided(Vector)
 {
        return false;
 }
 
+
 /*virtual*/ void Object::PointerMoved(Vector)
 {
 }
 
+
 /*virtual*/ void Object::PointerReleased(void)
 {
 }
 
+
 /*virtual*/ bool Object::NeedsUpdate(void)
 {
        return needUpdate;
 }
 
+
 // This is intended to be overridden by the Container class, for object morphing
 /*virtual*/ void Object::Transmute(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;
 }
 
+
+// This is meant for writing object data to a file.
+/*virtual*/ void Object::Enumerate(FILE *)
+{
+}
+
+
+/*virtual*/ Object * Object::Copy(void)
+{
+       return new Object(position, parent);
+}
+
+
 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*/)
@@ -110,31 +138,37 @@ void Object::SetFixedAngle(bool state/*= true*/)
        fixedAngle = state;
 }
 
+
 void Object::SetFixedLength(bool state/*= true*/)
 {
        fixedLength = state;
 }
 
+
 void Object::SetFont(QFont * f)
 {
        font = f;
 }
 
+
 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;
index efcffe1f00bd34990cb15102f19a8759990cace6..5b19505d2c94be29bccb49cf44c87de0625b3b3d 100644 (file)
@@ -3,10 +3,12 @@
 
 #include <vector>                                                      // This is a container
 #include "vector.h"                                                    // This is the mathematical construct
+#include <stdio.h>
 
 class Painter;
 class QFont;
 class Dimension;
+//class FILE;
 
 enum ObjectState { OSInactive, OSSelected };
 
@@ -27,6 +29,8 @@ class Object
                virtual Object * GetParent(void);
                virtual void Add(Object *);
                virtual Vector * GetPointAt(Vector);
+               virtual void Enumerate(FILE *);
+               virtual Object * Copy(void);
                ObjectState GetState(void);
                void Reparent(Object *);
                Dimension * GetAttachedDimension(void);