]> Shamusworld >> Repos - architektonas/blobdiff - src/base/leader.cpp
Major refactor of Architektonas: Jettisoning old cruft.
[architektonas] / src / base / leader.cpp
diff --git a/src/base/leader.cpp b/src/base/leader.cpp
deleted file mode 100644 (file)
index 995a21b..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-// leader.cpp
-//
-// Part of the Architektonas Project
-// Originally part of QCad Community Edition by Andrew Mustun
-// Extensively rewritten and refactored by James L. Hammons
-// Portions copyright (C) 2001-2003 RibbonSoft
-// Copyright (C) 2010 Underground Software
-// See the README and GPLv2 files for licensing and warranty information
-//
-// JLH = James L. Hammons <jlhamm@acm.org>
-//
-// Who  When        What
-// ---  ----------  -----------------------------------------------------------
-// JLH  06/01/2010  Added this text. :-)
-//
-
-#include "leader.h"
-
-#include "debug.h"
-#include "line.h"
-#include "solid.h"
-
-/**
- * Constructor.
- */
-Leader::Leader(EntityContainer * parent): EntityContainer(parent)
-{
-    empty = true;
-}
-
-/**
- * Constructor.
- * @param d Leader data
- */
-Leader::Leader(EntityContainer * parent, const LeaderData & d):
-       EntityContainer(parent), data(d)
-{
-    empty = true;
-}
-
-/**
- * Destructor
- */
-Leader::~Leader()
-{
-}
-
-/*virtual*/ Entity * Leader::clone()
-{
-       Leader * p = new Leader(*this);
-#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
-//     p->entities.setAutoDelete(entities.autoDelete());
-       p->initId();
-       p->detach();
-       return p;
-}
-
-/**    @return RS2::EntityDimLeader */
-/*virtual*/ RS2::EntityType Leader::rtti() const
-{
-       return RS2::EntityDimLeader;
-}
-
-/**
- * Implementation of update. Updates the arrow.
- */
-void Leader::update()
-{
-       // find and delete arrow:
-       for(Entity * e=firstEntity(); e!=NULL; e=nextEntity())
-       {
-               if (e->rtti() == RS2::EntitySolid)
-               {
-                       removeEntity(e);
-                       break;
-               }
-       }
-
-       if (isUndone())
-       {
-               setVisible(false);
-               return;
-       }
-
-       Entity * fe = firstEntity();
-
-       if (fe != NULL && fe->isAtomic())
-       {
-               Vector p1 = ((AtomicEntity *)fe)->getStartpoint();
-               Vector p2 = ((AtomicEntity *)fe)->getEndpoint();
-
-               // first entity must be the line which gets the arrow:
-               if (hasArrowHead())
-               {
-                       Solid * s = new Solid(this, SolidData());
-                       s->shapeArrow(p1, p2.angleTo(p1), getGraphicVariableDouble("$DIMASZ", 2.5));
-                       s->setPen(Pen(RS2::FlagInvalid));
-                       s->setLayer(NULL);
-                       EntityContainer::addEntity(s);
-               }
-       }
-}
-
-/** @return Copy of data that defines the leader. */
-LeaderData Leader::getData() const
-{
-       return data;
-}
-
-/** @return true: if this leader has an arrow at the beginning. */
-bool Leader::hasArrowHead()
-{
-       return data.arrowHead;
-}
-
-/**
- * Adds a vertex from the endpoint of the last element or
- * sets the startpoint to the point 'v'.
- *
- * The very first vertex added is the starting point.
- *
- * @param v vertex coordinate
- *
- * @return Pointer to the entity that was addded or NULL if this
- *         was the first vertex added.
- */
-Entity * Leader::addVertex(const Vector & v)
-{
-       Entity * entity = NULL;
-       static Vector last = Vector(false);
-
-       if (empty)
-       {
-               last = v;
-               empty = false;
-       }
-       else
-       {
-               // add line to the leader:
-               entity = new Line(this, LineData(last, v));
-               entity->setPen(Pen(RS2::FlagInvalid));
-               entity->setLayer(NULL);
-               EntityContainer::addEntity(entity);
-
-               if (count() == 1 && hasArrowHead())
-                       update();
-
-               last = v;
-       }
-
-       return entity;
-}
-
-/**
- * Reimplementation of the addEntity method for a normal container.
- * This reimplementation deletes the given entity!
- *
- * To add entities use addVertex() instead.
- */
-void Leader::addEntity(Entity * entity)
-{
-       DEBUG->print(Debug::D_WARNING, "Leader::addEntity: should never be called");
-
-       if (entity == NULL)
-               return;
-
-       delete entity;
-}
-
-/*virtual*/ double Leader::getLength()
-{
-       return -1.0;
-}
-
-void Leader::move(Vector offset)
-{
-       EntityContainer::move(offset);
-       update();
-}
-
-void Leader::rotate(Vector center, double angle)
-{
-       EntityContainer::rotate(center, angle);
-       update();
-}
-
-void Leader::scale(Vector center, Vector factor)
-{
-       EntityContainer::scale(center, factor);
-       update();
-}
-
-void Leader::mirror(Vector axisPoint1, Vector axisPoint2)
-{
-       EntityContainer::mirror(axisPoint1, axisPoint2);
-       update();
-}
-
-void Leader::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
-{
-       EntityContainer::stretch(firstCorner, secondCorner, offset);
-       update();
-}
-
-/**
- * Dumps the leader's data to stdout.
- */
-std::ostream & operator<<(std::ostream & os, const Leader & l)
-{
-       os << " Leader: " << l.getData() << " {\n";
-       os << (EntityContainer &)l;
-       os << "\n}\n";
-
-       return os;
-}