File size: 5,244 Bytes
a5ffdcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/****************************************************************************
**
** This file is part of the LibreCAD project, a 2D CAD program
**

Copyright (C) 2012-2015 Dongxu Li (dongxuli2011@gmail.com)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

**********************************************************************/

#include "rs_atomicentity.h"

RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer* parent) : RS_Entity(parent) {}

bool RS_AtomicEntity::isContainer() const {
	return false;
}

/**
 * @return true because entities made from subclasses are
 *  atomic entities.
 */
bool RS_AtomicEntity::isAtomic() const {
	return true;
}

/**
 * @return Always 1 for atomic entities.
 */
unsigned int RS_AtomicEntity::count() const{
	return 1;
}

/**
 * @return Always 1 for atomic entities.
 */
unsigned int RS_AtomicEntity::countDeep() const{
	return 1;
}

/**
 * Implementation must return the endpoint of the entity or
 * an invalid vector if the entity has no endpoint.
 */
RS_Vector RS_AtomicEntity::getEndpoint() const {
	return RS_Vector(false);
}

/**
 * Implementation must return the startpoint of the entity or
 * an invalid vector if the entity has no startpoint.
 */
RS_Vector RS_AtomicEntity::getStartpoint() const {
	return RS_Vector(false);
}

/**
 * Implementation must return the angle in which direction the entity starts.
 */
double RS_AtomicEntity::getDirection1() const {
	return 0.0;
}

/**
 * Implementation must return the angle in which direction the entity starts the opposite way.
 */
double RS_AtomicEntity::getDirection2() const {
	return 0.0;
}
RS_Vector RS_AtomicEntity::getCenter() const {
	return RS_Vector(false);
}
double RS_AtomicEntity::getRadius() const {
	   return 0.;
   }
/**
* return the nearest center for snapping
* @param coord Coordinate (typically a mouse coordinate)
* @param dist Pointer to a value which will contain the measured
* distance between 'coord' and the closest center point. The passed
* pointer can also be NULL in which case the distance will be
* lost.
*
* @return The closest center point.
*/
RS_Vector RS_AtomicEntity::getNearestCenter(const RS_Vector& /*coord*/,
								  double* /*dist*/) const{
	return RS_Vector(false);
}

/**
 * (De-)selects startpoint.
 */
void RS_AtomicEntity::setStartpointSelected(bool select) {
    if (select) {
        setFlag(RS2::FlagSelected1);
    } else {
        delFlag(RS2::FlagSelected1);
    }
}

/**
 * (De-)selects endpoint.
 */
void RS_AtomicEntity::setEndpointSelected(bool select) {
	if (select) {
		setFlag(RS2::FlagSelected2);
	} else {
		delFlag(RS2::FlagSelected2);
	}
}
bool RS_AtomicEntity::isTangent(const RS_CircleData& /* circleData */) const{
	return false;
}

/**
 * @return True if the entities startpoint is selected.
 */
bool RS_AtomicEntity::isStartpointSelected() const {
	return getFlag(RS2::FlagSelected1);
}

/**
 * @return True if the entities endpoint is selected.
 */
bool RS_AtomicEntity::isEndpointSelected() const {
	return getFlag(RS2::FlagSelected2);
}

void RS_AtomicEntity::revertDirection(){}

/**
 * Implementation must move the startpoint of the entity to
 * the given position.
 */
void RS_AtomicEntity::moveStartpoint(const RS_Vector& /*pos*/) {}

/**
 * Implementation must move the endpoint of the entity to
 * the given position.
 */
void RS_AtomicEntity::moveEndpoint(const RS_Vector& /*pos*/) {}

/**
 * Implementation must trim the startpoint of the entity to
 * the given position.
 */
void RS_AtomicEntity::trimStartpoint(const RS_Vector& pos) {
    moveStartpoint(pos);
}

/**
 * Implementation must trim the endpoint of the entity to
 * the given position.
 */
void RS_AtomicEntity::trimEndpoint(const RS_Vector& pos) {
    moveEndpoint(pos);
}

/**
 * Implementation must return which ending of the entity will
 * be trimmed if 'coord' is the coordinate chosen to indicate the
 * trim entity and 'trimPoint' is the point to which the entity will
 * be trimmed.
 */
RS2::Ending RS_AtomicEntity::getTrimPoint(const RS_Vector& /*coord*/,
								 const RS_Vector& /*trimPoint*/) {
	return RS2::EndingNone;
}

/**
 * Implementation must trim the entity in the case of multiple
 * intersections and return the trimPoint
 * trimCoord indicts the trigger trim position
 * trimSol contains intersections
 * */
RS_Vector RS_AtomicEntity::prepareTrim(const RS_Vector& /*trimCoord*/,
							  const RS_VectorSolutions& /*trimSol*/) {
	return RS_Vector(false);
}

void RS_AtomicEntity::reverse() {}

void RS_AtomicEntity::moveSelectedRef(const RS_Vector& ref, const RS_Vector& offset) {
    if (isSelected()) {
        moveRef(ref, offset);
    }
}