3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 05/08/2010 Moved implementation from header to this file. :-)
17 #include "atomicentity.h"
22 AtomicEntity::AtomicEntity(EntityContainer * parent/*= NULL*/): Entity(parent)
29 /*virtual*/ AtomicEntity::~AtomicEntity()
34 * @return false because entities made from subclasses are
37 /*virtual*/ bool AtomicEntity::isContainer() const
43 * @return true because entities made from subclasses are
46 /*virtual*/ bool AtomicEntity::isAtomic() const
52 * @return Always 1 for atomic entities.
54 /*virtual*/ unsigned long int AtomicEntity::count()
60 * @return Always 1 for atomic entities.
62 /*virtual*/ unsigned long int AtomicEntity::countDeep()
68 * Implementation must return the endpoint of the entity or
69 * an invalid vector if the entity has no endpoint.
71 /*virtual*/ Vector AtomicEntity::getEndpoint() const
77 * Implementation must return the startpoint of the entity or
78 * an invalid vector if the entity has no startpoint.
80 /*virtual*/ Vector AtomicEntity::getStartpoint() const
86 * Implementation must return the angle in which direction the entity starts.
88 /*virtual*/ double AtomicEntity::getDirection1() const
94 * Implementation must return the angle in which direction the entity starts the opposite way.
96 /*virtual*/ double AtomicEntity::getDirection2() const
102 * (De-)selects startpoint.
104 /*virtual*/ void AtomicEntity::setStartpointSelected(bool select)
107 setFlag(RS2::FlagSelected1);
109 delFlag(RS2::FlagSelected1);
113 * (De-)selects endpoint.
115 /*virtual*/ void AtomicEntity::setEndpointSelected(bool select)
118 setFlag(RS2::FlagSelected2);
120 delFlag(RS2::FlagSelected2);
124 * @return True if the entities startpoint is selected.
126 bool AtomicEntity::isStartpointSelected() const
128 return getFlag(RS2::FlagSelected1);
132 * @return True if the entities endpoint is selected.
134 bool AtomicEntity::isEndpointSelected() const
136 return getFlag(RS2::FlagSelected2);
140 * Implementation must move the startpoint of the entity to
141 * the given position.
143 /*virtual*/ void AtomicEntity::moveStartpoint(const Vector & /*pos*/)
148 * Implementation must move the endpoint of the entity to
149 * the given position.
151 /*virtual*/ void AtomicEntity::moveEndpoint(const Vector & /*pos*/)
156 * Implementation must trim the startpoint of the entity to
157 * the given position.
159 /*virtual*/ void AtomicEntity::trimStartpoint(const Vector & pos)
165 * Implementation must trim the endpoint of the entity to
166 * the given position.
168 /*virtual*/ void AtomicEntity::trimEndpoint(const Vector & pos)
174 * Implementation must return which ending of the entity will
175 * be trimmed if 'coord' is the coordinate chosen to indicate the
176 * trim entity and 'trimPoint' is the point to which the entity will
179 /*virtual*/ RS2::Ending AtomicEntity::getTrimPoint(const Vector & /*coord*/, const Vector & /*trimPoint*/)
181 return RS2::EndingNone;
184 /*virtual*/ void AtomicEntity::reverse()
188 /*virtual*/ void AtomicEntity::moveSelectedRef(const Vector & ref, const Vector & offset)
191 moveRef(ref, offset);