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 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 05/08/2010 Moved implementation from header to this file. :-)
15 #include "rs_atomicentity.h"
20 RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Entity(parent)
27 /*virtual*/ RS_AtomicEntity::~RS_AtomicEntity()
32 * @return false because entities made from subclasses are
35 /*virtual*/ bool RS_AtomicEntity::isContainer() const
41 * @return true because entities made from subclasses are
44 /*virtual*/ bool RS_AtomicEntity::isAtomic() const
50 * @return Always 1 for atomic entities.
52 /*virtual*/ unsigned long int RS_AtomicEntity::count()
58 * @return Always 1 for atomic entities.
60 /*virtual*/ unsigned long int RS_AtomicEntity::countDeep()
66 * Implementation must return the endpoint of the entity or
67 * an invalid vector if the entity has no endpoint.
69 /*virtual*/ Vector RS_AtomicEntity::getEndpoint() const
75 * Implementation must return the startpoint of the entity or
76 * an invalid vector if the entity has no startpoint.
78 /*virtual*/ Vector RS_AtomicEntity::getStartpoint() const
84 * Implementation must return the angle in which direction the entity starts.
86 /*virtual*/ double RS_AtomicEntity::getDirection1() const
92 * Implementation must return the angle in which direction the entity starts the opposite way.
94 /*virtual*/ double RS_AtomicEntity::getDirection2() const
100 * (De-)selects startpoint.
102 /*virtual*/ void RS_AtomicEntity::setStartpointSelected(bool select)
105 setFlag(RS2::FlagSelected1);
107 delFlag(RS2::FlagSelected1);
111 * (De-)selects endpoint.
113 /*virtual*/ void RS_AtomicEntity::setEndpointSelected(bool select)
116 setFlag(RS2::FlagSelected2);
118 delFlag(RS2::FlagSelected2);
122 * @return True if the entities startpoint is selected.
124 bool RS_AtomicEntity::isStartpointSelected() const
126 return getFlag(RS2::FlagSelected1);
130 * @return True if the entities endpoint is selected.
132 bool RS_AtomicEntity::isEndpointSelected() const
134 return getFlag(RS2::FlagSelected2);
138 * Implementation must move the startpoint of the entity to
139 * the given position.
141 /*virtual*/ void RS_AtomicEntity::moveStartpoint(const Vector & /*pos*/)
146 * Implementation must move the endpoint of the entity to
147 * the given position.
149 /*virtual*/ void RS_AtomicEntity::moveEndpoint(const Vector & /*pos*/)
154 * Implementation must trim the startpoint of the entity to
155 * the given position.
157 /*virtual*/ void RS_AtomicEntity::trimStartpoint(const Vector & pos)
163 * Implementation must trim the endpoint of the entity to
164 * the given position.
166 /*virtual*/ void RS_AtomicEntity::trimEndpoint(const Vector & pos)
172 * Implementation must return which ending of the entity will
173 * be trimmed if 'coord' is the coordinate chosen to indicate the
174 * trim entity and 'trimPoint' is the point to which the entity will
177 /*virtual*/ RS2::Ending RS_AtomicEntity::getTrimPoint(const Vector & /*coord*/, const Vector & /*trimPoint*/)
179 return RS2::EndingNone;
182 /*virtual*/ void RS_AtomicEntity::reverse()
186 /*virtual*/ void RS_AtomicEntity::moveSelectedRef(const Vector & ref, const Vector & offset)
189 moveRef(ref, offset);