LibreCAD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lc::entity::Spline Class Reference

The Spline class. More...

#include <spline.h>

Inheritance diagram for lc::entity::Spline:
Collaboration diagram for lc::entity::Spline:

Public Member Functions

 Spline (const std::vector< geo::Coordinate > &controlPoints, const std::vector< double > &knotPoints, const std::vector< geo::Coordinate > &fitPoints, int degree, bool closed, double fitTolerance, double stanx, double stany, double stanz, double etanx, double etany, double etanz, double nx, double ny, double nz, splineflag flags, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
 Spline, Constructor with MetaTypes. More...
 
 Spline (const Spline_CSPtr other, bool sameID=false)
 
virtual std::vector
< EntityCoordinate
snapPoints (const geo::Coordinate &coord, const SimpleSnapConstrain &constrain, double minDistanceToSnap, int maxNumberOfSnapPoints) const override
 Find a number of snap points the line has available This function returns a ordered list, closest to coord and can return multiple snap points. More...
 
virtual geo::Coordinate nearestPointOnPath (const geo::Coordinate &coord) const override
 Find the nearest point on the path for this entity for the coordinate coord The path of a entity that it can possibly take. More...
 
virtual CADEntity_CSPtr move (const geo::Coordinate &offset) const override
 move, moves by an offset More...
 
virtual CADEntity_CSPtr copy (const geo::Coordinate &offset) const override
 copy, copies line by an offset More...
 
virtual CADEntity_CSPtr rotate (const geo::Coordinate &rotation_center, const double rotation_angle) const override
 rotate, rotate operation More...
 
virtual CADEntity_CSPtr scale (const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override
 scale, scales the entity More...
 
virtual CADEntity_CSPtr mirror (const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
 
virtual const geo::Area boundingBox () const override
 boundingBox of the entity More...
 
virtual CADEntity_CSPtr modify (Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo, Block_CSPtr block) const override
 modify Return a new entity with the same ID bit with possible modified metainfo and/pr layer information #return new entity with same ID More...
 
virtual void accept (GeoEntityVisitor &v) const override
 
virtual void dispatch (EntityDispatch &ed) const override
 
virtual std::map< unsigned int,
lc::geo::Coordinate
dragPoints () const override
 Get all points of the entity that can be dragged. More...
 
virtual CADEntity_CSPtr setDragPoints (std::map< unsigned int, lc::geo::Coordinate > dragPoints) const override
 Return modified entity. More...
 
- Public Member Functions inherited from lc::entity::CADEntity
 CADEntity ()
 
 CADEntity (Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
 CADEntity Constructor. More...
 
 CADEntity (CADEntity_CSPtr cadEntity, bool sameID)
 
 CADEntity (CADEntity_CSPtr cadEntity)
 
virtual ~CADEntity ()=default
 
Layer_CSPtr layer () const
 layer return the layer this entity is placed on More...
 
template<typename T >
const std::shared_ptr< const T > metaInfo (std::string metaName) const
 
MetaInfo_CSPtr metaInfo () const
 
Block_CSPtr block () const
 Return the current entity block. More...
 
- Public Member Functions inherited from lc::ID
 ID ()
 Default constructor, provides a new unique ID to each entity. More...
 
 ID (ID_DATATYPE)
 
virtual ~ID ()=default
 
ID_DATATYPE id () const
 returns the ID of the entity More...
 
bool operator== (const ID &id) const
 
void setID (ID_DATATYPE id)
 
- Public Member Functions inherited from lc::Visitable
virtual ~Visitable ()=default
 
- Public Member Functions inherited from lc::geo::Spline
 Spline (const std::vector< Coordinate > &control_points, const std::vector< double > &knotPoints, const std::vector< Coordinate > &fitPoints, int degree, bool closed, double fitTolerance, double stanx, double stany, double stanz, double etanx, double etany, double etanz, double nx, double ny, double nz, splineflag flags)
 
const std::vector< Coordinate > & controlPoints () const
 control_points, Returns Control points of spline More...
 
short degree () const
 degree, Returns degree of spline More...
 
const std::vector< double > & knotPoints () const
 Return a vector of knotpoints. More...
 
const std::vector< Coordinate > & fitPoints () const
 Return a vector of fitpoints. More...
 
double fitTolerance () const
 Returns the fit point tolerance of the spline. More...
 
double startTanX () const
 
double startTanY () const
 
double startTanZ () const
 
double endTanX () const
 
double endTanY () const
 
double endTanZ () const
 
double nX () const
 
double nY () const
 
double nZ () const
 
splineflag flags () const
 
bool closed () const
 closed, returns if spline is closed or not More...
 
const std::vector< BB_CSPtrbeziers () const
 
void generateBeziers ()
 
void trimAtPoint (const geo::Coordinate &c)
 
void populateCurve ()
 Fills the opennurbs curve with the data from spline constructor. More...
 
Coordinate nearestPointOnPath (const Coordinate &coord) const
 returns the nearest Point On Path More...
 
Coordinate nearestPointOnEntity (const Coordinate &coord) const
 returns the nearest Point On Entity itself. More...
 
- Public Member Functions inherited from lc::geo::Base
virtual ~Base ()=default
 

Private Member Functions

void calculateBoundingBox ()
 

Private Attributes

geo::Area _boundingBox
 

Additional Inherited Members

- Public Types inherited from lc::geo::Spline
enum  splineflag {
  CLOSED =1, PERIODIC =2, RATIONAL =4, PLANAR =8,
  LINEAR =16
}
 
- Static Public Member Functions inherited from lc::Snapable
static void remove_ifDistanceGreaterThen (std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const double distance)
 
static void snapPointsCleanup (std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const unsigned int maxNumberOfSnapPoints, const double minDistanceToSnap)
 
- Static Public Attributes inherited from lc::ID
static std::atomic< ID_DATATYPE__idCounter
 
- Protected Member Functions inherited from lc::entity::CADEntity
 CADEntity (const lc::builder::CADEntityBuilder &builder)
 

Detailed Description

The Spline class.

TODO SPLINE IMPLEMENTATION. THIS CLASS NEEDS TO BE VERIFIED. SPLINE IS DEPENDENT ON BEZIER CURVE.

Definition at line 27 of file spline.h.

Constructor & Destructor Documentation

Spline::Spline ( const std::vector< geo::Coordinate > &  controlPoints,
const std::vector< double > &  knotPoints,
const std::vector< geo::Coordinate > &  fitPoints,
int  degree,
bool  closed,
double  fitTolerance,
double  stanx,
double  stany,
double  stanz,
double  etanx,
double  etany,
double  etanz,
double  nx,
double  ny,
double  nz,
enum Spline::splineflag  flags,
const Layer_CSPtr  layer,
const MetaInfo_CSPtr  metaInfo = nullptr,
const Block_CSPtr  block = nullptr 
)

Spline, Constructor with MetaTypes.

Parameters
vector<Coordinate>control_points
intdegree
boolclosed
Layer_CSPtrlayer
MetaTypesmetaTypes

Definition at line 8 of file spline.cpp.

19  :
22  knotPoints,
23  fitPoints,
24  degree,
25  closed,
27  stanx, stany, stanz,
28  etanx, etany, etanz,
29  nx, ny, nz,
30  flags
31  ) {
33 }
splineflag flags() const
Definition: geospline.cpp:61
short degree() const
degree, Returns degree of spline
Definition: geospline.cpp:14
double fitTolerance() const
Returns the fit point tolerance of the spline.
Definition: geospline.cpp:64
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
bool closed() const
closed, returns if spline is closed or not
Definition: geospline.cpp:10
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
void calculateBoundingBox()
Definition: spline.cpp:151
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
Definition: geospline.cpp:18
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
Spline::Spline ( const Spline_CSPtr  other,
bool  sameID = false 
)

Definition at line 35 of file spline.cpp.

35  :
36  CADEntity(other, sameID),
38  other->controlPoints(),
39  other->knotPoints(),
40  other->fitPoints(),
41  other->degree(),
42  other->closed(),
43  other->fitTolerance(),
44  other->startTanX(), other->startTanY(), other->startTanZ(),
45  other->endTanX(), other->endTanY(), other->endTanZ(),
46  other->nX(), other->nY(), other->nZ(),
47  other->flags()
48  ),
49  _boundingBox(other->boundingBox()) {
50 }
geo::Area _boundingBox
Definition: spline.h:115

Member Function Documentation

virtual void lc::entity::Spline::accept ( GeoEntityVisitor v) const
inlineoverridevirtual

Reimplemented from lc::entity::CADEntity.

Definition at line 103 of file spline.h.

103 { v.visit(*this); }
const geo::Area Spline::boundingBox ( ) const
overridevirtual

boundingBox of the entity

Returns
geo::Area area

Implements lc::entity::CADEntity.

Definition at line 127 of file spline.cpp.

127  {
128  return this->_boundingBox;
129 }
geo::Area _boundingBox
Definition: spline.h:115
void Spline::calculateBoundingBox ( )
private

Definition at line 151 of file spline.cpp.

151  {
152  //TODO: better bounding box generation
153  _boundingBox = geo::Area(this->controlPoints()[0], this->controlPoints()[0]);
154 
155  for(auto cp : this->controlPoints()) {
157  }
158 }
Area merge(const Area &other) const
merge two area's and expand if required to largest containing area
Definition: geoarea.h:156
geo::Area _boundingBox
Definition: spline.h:115
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
CADEntity_CSPtr Spline::copy ( const geo::Coordinate offset) const
overridevirtual

copy, copies line by an offset

Parameters
geo::Coordinateoffset
Returns
CADEntity_CSPtr copied entity

Implements lc::entity::CADEntity.

Definition at line 78 of file spline.cpp.

78  {
79  std::vector<geo::Coordinate> control_pts;
80 
81  for (auto point : this->controlPoints()) {
82  control_pts.push_back(point + offset);
83  }
84 
85  auto newSpline = std::make_shared<Spline>(control_pts, knotPoints(), fitPoints(), degree(), closed(), fitTolerance(), startTanX(), startTanY(), startTanZ(), endTanX(), endTanY(), endTanZ(), nX(), nY(), nZ(), flags(), layer(), metaInfo());
86  return newSpline;
87 }
splineflag flags() const
Definition: geospline.cpp:61
double startTanY() const
Definition: geospline.cpp:31
double startTanZ() const
Definition: geospline.cpp:35
short degree() const
degree, Returns degree of spline
Definition: geospline.cpp:14
double fitTolerance() const
Returns the fit point tolerance of the spline.
Definition: geospline.cpp:64
double endTanX() const
Definition: geospline.cpp:40
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
double nX() const
Definition: geospline.cpp:52
bool closed() const
closed, returns if spline is closed or not
Definition: geospline.cpp:10
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
double endTanY() const
Definition: geospline.cpp:44
double nZ() const
Definition: geospline.cpp:58
double nY() const
Definition: geospline.cpp:55
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
Definition: geospline.cpp:18
double endTanZ() const
Definition: geospline.cpp:48
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
double startTanX() const
Definition: geospline.cpp:27
virtual void lc::entity::Spline::dispatch ( EntityDispatch ed) const
inlineoverridevirtual

Implements lc::entity::CADEntity.

Definition at line 105 of file spline.h.

105  {
106  ed.visit(shared_from_this());
107  }
std::map< unsigned int, lc::geo::Coordinate > Spline::dragPoints ( ) const
overridevirtual

Get all points of the entity that can be dragged.

Returns
Map of points

Implements lc::Draggable.

Definition at line 161 of file spline.cpp.

161  {
162  std::map<unsigned int, lc::geo::Coordinate> dragpoints;
163 
164  unsigned int i = 0;
165 
166  for(auto point : fitPoints()) {
167  dragpoints[i] = point;
168  i++;
169  }
170 
171  for(auto point : controlPoints()) {
172  dragpoints[i] = point;
173  i++;
174  }
175 
176  return dragpoints;
177 }
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
CADEntity_CSPtr Spline::mirror ( const geo::Coordinate axis1,
const geo::Coordinate axis2 
) const
overridevirtual

Implements lc::entity::CADEntity.

Definition at line 115 of file spline.cpp.

115  {
116  std::vector<geo::Coordinate> control_pts;
117 
118  for (auto point : this->controlPoints()) {
119  control_pts.push_back(point.mirror(axis1, axis2));
120  }
121 
122  auto newSpline = std::make_shared<Spline>(control_pts, knotPoints(), fitPoints(), degree(), closed(), fitTolerance(), startTanX(), startTanY(), startTanZ(), endTanX(), endTanY(), endTanZ(), nX(), nY(), nZ(), flags(), layer(), metaInfo());
123  newSpline->setID(this->id());
124  return newSpline;
125 }
splineflag flags() const
Definition: geospline.cpp:61
double startTanY() const
Definition: geospline.cpp:31
double startTanZ() const
Definition: geospline.cpp:35
short degree() const
degree, Returns degree of spline
Definition: geospline.cpp:14
double fitTolerance() const
Returns the fit point tolerance of the spline.
Definition: geospline.cpp:64
double endTanX() const
Definition: geospline.cpp:40
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
double nX() const
Definition: geospline.cpp:52
bool closed() const
closed, returns if spline is closed or not
Definition: geospline.cpp:10
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
double endTanY() const
Definition: geospline.cpp:44
double nZ() const
Definition: geospline.cpp:58
double nY() const
Definition: geospline.cpp:55
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
Definition: geospline.cpp:18
double endTanZ() const
Definition: geospline.cpp:48
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
double startTanX() const
Definition: geospline.cpp:27
CADEntity_CSPtr Spline::modify ( Layer_CSPtr  layer,
const MetaInfo_CSPtr  metaInfo,
Block_CSPtr  block 
) const
overridevirtual

modify Return a new entity with the same ID bit with possible modified metainfo and/pr layer information #return new entity with same ID

Implements lc::entity::CADEntity.

Definition at line 131 of file spline.cpp.

131  {
132  auto newSpline = std::make_shared<Spline>(
133  controlPoints(),
134  knotPoints(),
135  fitPoints(),
136  degree(),
137  closed(),
138  fitTolerance(),
139  startTanX(), startTanY(), startTanZ(),
140  endTanX(), endTanY(), endTanZ(),
141  nX(), nY(), nZ(), flags(),
142  layer,
143  metaInfo,
144  block
145  );
146  newSpline->setID(id());
147 
148  return newSpline;
149 }
splineflag flags() const
Definition: geospline.cpp:61
double startTanY() const
Definition: geospline.cpp:31
double startTanZ() const
Definition: geospline.cpp:35
short degree() const
degree, Returns degree of spline
Definition: geospline.cpp:14
double fitTolerance() const
Returns the fit point tolerance of the spline.
Definition: geospline.cpp:64
double endTanX() const
Definition: geospline.cpp:40
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
double nX() const
Definition: geospline.cpp:52
bool closed() const
closed, returns if spline is closed or not
Definition: geospline.cpp:10
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
double endTanY() const
Definition: geospline.cpp:44
double nZ() const
Definition: geospline.cpp:58
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
double nY() const
Definition: geospline.cpp:55
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
Definition: geospline.cpp:18
double endTanZ() const
Definition: geospline.cpp:48
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
double startTanX() const
Definition: geospline.cpp:27
CADEntity_CSPtr Spline::move ( const geo::Coordinate offset) const
overridevirtual

move, moves by an offset

Parameters
geo::Coordinateoffset
Returns
CADEntity_CSPtr moved entity

Implements lc::entity::CADEntity.

Definition at line 66 of file spline.cpp.

66  {
67  std::vector<geo::Coordinate> control_pts;
68 
69  for (auto point : this->controlPoints()) {
70  control_pts.push_back(point + offset);
71  }
72 
73  auto newSpline = std::make_shared<Spline>(control_pts, knotPoints(), fitPoints(), degree(), closed(), fitTolerance(), startTanX(), startTanY(), startTanZ(), endTanX(), endTanY(), endTanZ(), nX(), nY(), nZ(), flags(), layer(), metaInfo());
74  newSpline->setID(this->id());
75  return newSpline;
76 }
splineflag flags() const
Definition: geospline.cpp:61
double startTanY() const
Definition: geospline.cpp:31
double startTanZ() const
Definition: geospline.cpp:35
short degree() const
degree, Returns degree of spline
Definition: geospline.cpp:14
double fitTolerance() const
Returns the fit point tolerance of the spline.
Definition: geospline.cpp:64
double endTanX() const
Definition: geospline.cpp:40
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
double nX() const
Definition: geospline.cpp:52
bool closed() const
closed, returns if spline is closed or not
Definition: geospline.cpp:10
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
double endTanY() const
Definition: geospline.cpp:44
double nZ() const
Definition: geospline.cpp:58
double nY() const
Definition: geospline.cpp:55
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
Definition: geospline.cpp:18
double endTanZ() const
Definition: geospline.cpp:48
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
double startTanX() const
Definition: geospline.cpp:27
geo::Coordinate Spline::nearestPointOnPath ( const geo::Coordinate coord) const
overridevirtual

Find the nearest point on the path for this entity for the coordinate coord The path of a entity that it can possibly take.

For example for any Arc the path is the full circle if the start/stop angle is 0 to 2*pi

Parameters
coordCoordinate to lookup the nearest coordinate from
See also
lc::entity::CADEntity

Implements lc::Snapable.

Definition at line 59 of file spline.cpp.

59  {
60  /* TODO implement
61  * fix compiler warning
62  */
63  return geo::Coordinate();
64 }
CADEntity_CSPtr Spline::rotate ( const geo::Coordinate rotation_center,
const double  rotation_angle 
) const
overridevirtual

rotate, rotate operation

Parameters
geo::Coordinaterotation_center
doublerotation_angle
Returns
CADEntity_CSPtr rotated entity

Implements lc::entity::CADEntity.

Definition at line 89 of file spline.cpp.

89  {
90  std::vector<geo::Coordinate> control_pts;
91 
92  for (auto point : this->controlPoints()) {
93  control_pts.push_back(point.rotate(rotation_center, rotation_angle));
94  }
95 
96  auto normal = geo::Coordinate(nX(), nY(), nZ()).rotate(rotation_angle);
97 
98  auto newSpline = std::make_shared<Spline>(control_pts, knotPoints(), fitPoints(), degree(), closed(), fitTolerance(), startTanX(), startTanY(), startTanZ(), endTanX(), endTanY(), endTanZ(), normal.x(), normal.y(), normal.z(), flags(), layer(), metaInfo());
99  newSpline->setID(this->id());
100  return newSpline;
101 }
splineflag flags() const
Definition: geospline.cpp:61
double startTanY() const
Definition: geospline.cpp:31
double startTanZ() const
Definition: geospline.cpp:35
short degree() const
degree, Returns degree of spline
Definition: geospline.cpp:14
double fitTolerance() const
Returns the fit point tolerance of the spline.
Definition: geospline.cpp:64
double endTanX() const
Definition: geospline.cpp:40
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
double nX() const
Definition: geospline.cpp:52
bool closed() const
closed, returns if spline is closed or not
Definition: geospline.cpp:10
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
double endTanY() const
Definition: geospline.cpp:44
double nZ() const
Definition: geospline.cpp:58
Coordinate rotate(const Coordinate &angleVector) const
rotate around (0.,0.) with a given angle vector
double nY() const
Definition: geospline.cpp:55
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
Definition: geospline.cpp:18
double endTanZ() const
Definition: geospline.cpp:48
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
double startTanX() const
Definition: geospline.cpp:27
CADEntity_CSPtr Spline::scale ( const geo::Coordinate scale_center,
const geo::Coordinate scale_factor 
) const
overridevirtual

scale, scales the entity

Parameters
geo::Coordinatescale_center
doublescale_factor
Returns

Implements lc::entity::CADEntity.

Definition at line 103 of file spline.cpp.

103  {
104  std::vector<geo::Coordinate> control_pts;
105 
106  for (auto point : this->controlPoints()) {
107  control_pts.push_back(point.scale(scale_center, scale_factor));
108  }
109 
110  auto newSpline = std::make_shared<Spline>(control_pts, knotPoints(), fitPoints(), degree(), closed(), fitTolerance(), startTanX(), startTanY(), startTanZ(), endTanX(), endTanY(), endTanZ(), nX(), nY(), nZ(), flags(), layer(), metaInfo());
111  newSpline->setID(this->id());
112  return newSpline;
113 }
splineflag flags() const
Definition: geospline.cpp:61
double startTanY() const
Definition: geospline.cpp:31
double startTanZ() const
Definition: geospline.cpp:35
short degree() const
degree, Returns degree of spline
Definition: geospline.cpp:14
double fitTolerance() const
Returns the fit point tolerance of the spline.
Definition: geospline.cpp:64
double endTanX() const
Definition: geospline.cpp:40
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
double nX() const
Definition: geospline.cpp:52
bool closed() const
closed, returns if spline is closed or not
Definition: geospline.cpp:10
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
double endTanY() const
Definition: geospline.cpp:44
double nZ() const
Definition: geospline.cpp:58
double nY() const
Definition: geospline.cpp:55
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
Definition: geospline.cpp:18
double endTanZ() const
Definition: geospline.cpp:48
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
double startTanX() const
Definition: geospline.cpp:27
CADEntity_CSPtr Spline::setDragPoints ( std::map< unsigned int, lc::geo::Coordinate dragPoints) const
overridevirtual

Return modified entity.

Parameters
dragPointsModified points
Returns
New entity or same entity if an error occurred Return the new entity which corresponds to the given points. Points must be associated to the same number given in dragPoints().

Implements lc::Draggable.

Definition at line 180 of file spline.cpp.

180  {
181  try {
182  std::vector<lc::geo::Coordinate> fitPoints;
183  std::vector<lc::geo::Coordinate> controlPoints;
184 
185  unsigned int i = 0;
186 
187  for(unsigned int j = 0; j < this->fitPoints().size(); j++) {
188  fitPoints.push_back(dragPoints.at(i));
189  i++;
190  }
191 
192  for(unsigned int j = 0; j < this->controlPoints().size(); j++) {
193  controlPoints.push_back(dragPoints.at(i));
194  i++;
195  }
196 
197  auto newEntity = std::make_shared<Spline>(controlPoints,
198  knotPoints(),
199  fitPoints,
200  degree(),
201  closed(),
202  fitTolerance(),
203  startTanX(), startTanY(), startTanZ(),
204  endTanX(), endTanY(), endTanZ(),
205  nX(), nY(), nZ(),
206  flags(),
207  layer(),
208  metaInfo());
209 
210  newEntity->setID(id());
211 
212  return newEntity;
213  }
214  catch(const std::out_of_range& e) {
215  return shared_from_this();
216  }
217 }
splineflag flags() const
Definition: geospline.cpp:61
double startTanY() const
Definition: geospline.cpp:31
double startTanZ() const
Definition: geospline.cpp:35
short degree() const
degree, Returns degree of spline
Definition: geospline.cpp:14
double fitTolerance() const
Returns the fit point tolerance of the spline.
Definition: geospline.cpp:64
double endTanX() const
Definition: geospline.cpp:40
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
virtual std::map< unsigned int, lc::geo::Coordinate > dragPoints() const override
Get all points of the entity that can be dragged.
Definition: spline.cpp:161
double nX() const
Definition: geospline.cpp:52
bool closed() const
closed, returns if spline is closed or not
Definition: geospline.cpp:10
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
double endTanY() const
Definition: geospline.cpp:44
double nZ() const
Definition: geospline.cpp:58
double nY() const
Definition: geospline.cpp:55
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
Definition: geospline.cpp:18
double endTanZ() const
Definition: geospline.cpp:48
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
Definition: geospline.cpp:22
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
Definition: geospline.cpp:6
double startTanX() const
Definition: geospline.cpp:27
std::vector< EntityCoordinate > Spline::snapPoints ( const geo::Coordinate coord,
const SimpleSnapConstrain simpleSnapConstrain,
double  minDistanceToSnap,
int  maxNumberOfSnapPoints 
) const
overridevirtual

Find a number of snap points the line has available This function returns a ordered list, closest to coord and can return multiple snap points.

Parameters
coordCoordinate to lookup the nearest coordinate from
minDistanceToSnapMinimum distance to the path to snap into. THis is a hint parameter and we should follow this, but it will be later filtered again
maxNumberOfSnapPointsMaximum number of snappoints that have to be looked up
See also
lc::EntityCoordinate

Implements lc::Snapable.

Definition at line 52 of file spline.cpp.

52  {
53  /* TODO implement
54  * fix compiler warning
55  */
56  return std::vector<EntityCoordinate>();
57 }

Member Data Documentation

geo::Area lc::entity::Spline::_boundingBox
private

Definition at line 115 of file spline.h.


The documentation for this class was generated from the following files: