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

#include <dimradial.h>

Inheritance diagram for lc::entity::DimRadial:
Collaboration diagram for lc::entity::DimRadial:

Public Member Functions

 DimRadial (geo::Coordinate const &definitionPoint, geo::Coordinate const &middleOfText, TextConst::AttachmentPoint const &attachmentPoint, double angle, double const lineSpacingFactor, TextConst::LineSpacingStyle const &lineSpacingStyle, std::string const &explicitValue, geo::Coordinate const &definitionPoint2, const double leader, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
 DimRadial. More...
 
 DimRadial (geo::Coordinate const &definitionPoint, TextConst::AttachmentPoint const &attachmentPoint, double const lineSpacingFactor, TextConst::LineSpacingStyle const &lineSpacingStyle, std::string const &explicitValue, geo::Coordinate const &definitionPoint2, const double leader, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
 
 DimRadial (const DimRadial_CSPtr other, bool sameID=false)
 
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 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...
 
double leader () const
 
geo::Coordinate definitionPoint2 () const
 
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::entity::Dimension
 Dimension (geo::Coordinate const &definitionPoint, geo::Coordinate const &middleOfText, TextConst::AttachmentPoint const &attachmentPoint, double const textAngle, double lineSpacingFactor, TextConst::LineSpacingStyle const &lineSpacingStyle, std::string const &explicitValue)
 Dimension. More...
 
 Dimension (geo::Coordinate const &_definitionPoint, geo::Coordinate const &_middleOfText, TextConst::AttachmentPoint _attachPt, double _angle)
 Dimension. More...
 
 Dimension (Dimension const &other)
 
const geo::CoordinatedefinitionPoint () const noexcept
 move, moves by an offset More...
 
const geo::CoordinatemiddleOfText () const noexcept
 
TextConst::AttachmentPoint const & attachmentPoint () const
 
double textAngle () const
 
double lineSpacingFactor () const
 
TextConst::LineSpacingStyle lineSpacingStyle () const
 
std::string explicitValue () const
 

Protected Attributes

const double _leader
 
const geo::Coordinate _definitionPoint2
 

Additional Inherited Members

- 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

DimRadial dimension DefinitionPoint hold's the center of the radius DefinitionPoint2 holds the circle/arc edge CenterText holds' the location of the text

Definition at line 21 of file dimradial.h.

Constructor & Destructor Documentation

DimRadial::DimRadial ( geo::Coordinate const &  definitionPoint,
geo::Coordinate const &  middleOfText,
TextConst::AttachmentPoint const &  attachmentPoint,
double  angle,
double const  lineSpacingFactor,
TextConst::LineSpacingStyle const &  lineSpacingStyle,
std::string const &  explicitValue,
geo::Coordinate const &  definitionPoint2,
const double  leader,
const Layer_CSPtr  layer,
const MetaInfo_CSPtr  metaInfo = nullptr,
const Block_CSPtr  block = nullptr 
)

DimRadial.

Parameters
Dimensiondimension
doubleleader
Layer_CSPtrlayer
MetaTypes_CSPtrmetaTypes

Definition at line 6 of file dimradial.cpp.

17  :
20  _leader(leader),
22 
23 }
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
const double _leader
Definition: dimradial.h:110
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
double lineSpacingFactor() const
Definition: dimension.cpp:87
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
double leader() const
Definition: dimradial.cpp:97
Dimension(geo::Coordinate const &definitionPoint, geo::Coordinate const &middleOfText, TextConst::AttachmentPoint const &attachmentPoint, double const textAngle, double lineSpacingFactor, TextConst::LineSpacingStyle const &lineSpacingStyle, std::string const &explicitValue)
Dimension.
Definition: dimension.cpp:7
geo::Coordinate definitionPoint2() const
Definition: dimradial.cpp:101
DimRadial::DimRadial ( geo::Coordinate const &  definitionPoint,
TextConst::AttachmentPoint const &  attachmentPoint,
double const  lineSpacingFactor,
TextConst::LineSpacingStyle const &  lineSpacingStyle,
std::string const &  explicitValue,
geo::Coordinate const &  definitionPoint2,
const double  leader,
const Layer_CSPtr  layer,
const MetaInfo_CSPtr  metaInfo = nullptr,
const Block_CSPtr  block = nullptr 
)

Simplified version that set's the midpoint to the middle of the radius and angle to the angle of definitionPoint and definitionPoint2

Definition at line 25 of file dimradial.cpp.

34  :
37  _leader(leader),
39 }
Coordinate mid(const Coordinate &other) const
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
const double _leader
Definition: dimradial.h:110
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
double lineSpacingFactor() const
Definition: dimension.cpp:87
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
double leader() const
Definition: dimradial.cpp:97
Dimension(geo::Coordinate const &definitionPoint, geo::Coordinate const &middleOfText, TextConst::AttachmentPoint const &attachmentPoint, double const textAngle, double lineSpacingFactor, TextConst::LineSpacingStyle const &lineSpacingStyle, std::string const &explicitValue)
Dimension.
Definition: dimension.cpp:7
geo::Coordinate definitionPoint2() const
Definition: dimradial.cpp:101
DimRadial::DimRadial ( const DimRadial_CSPtr  other,
bool  sameID = false 
)

Definition at line 41 of file dimradial.cpp.

41  : CADEntity(other, sameID), Dimension(*other), _leader(other->_leader), _definitionPoint2(other->_definitionPoint2) {
42 
43 }
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const double _leader
Definition: dimradial.h:110
Dimension(geo::Coordinate const &definitionPoint, geo::Coordinate const &middleOfText, TextConst::AttachmentPoint const &attachmentPoint, double const textAngle, double lineSpacingFactor, TextConst::LineSpacingStyle const &lineSpacingStyle, std::string const &explicitValue)
Dimension.
Definition: dimension.cpp:7

Member Function Documentation

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

Reimplemented from lc::entity::CADEntity.

Definition at line 113 of file dimradial.h.

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

boundingBox of the entity

Returns
geo::Area area

Implements lc::entity::CADEntity.

Definition at line 74 of file dimradial.cpp.

74  {
75  // TODO create proper bounding box for DimLinear
76  return geo::Area(this->middleOfText(), 0., 0.);
77 }
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
CADEntity_CSPtr DimRadial::copy ( const geo::Coordinate offset) const
overridevirtual

copy, copies by an offset

Parameters
geo::Coordinateoffset
Returns
CADEntity_CSPtr copied entity

Implements lc::entity::CADEntity.

Definition at line 51 of file dimradial.cpp.

51  {
52  auto newDimRadial = std::make_shared<DimRadial>(this->definitionPoint() + offset, this->middleOfText() + offset, this->attachmentPoint(), this->textAngle(), this->lineSpacingFactor(), this->lineSpacingStyle(), this->explicitValue(), this->_definitionPoint2 + offset, this->_leader, this->layer(), this->metaInfo());
53  return newDimRadial;
54 }
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
const double _leader
Definition: dimradial.h:110
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
double lineSpacingFactor() const
Definition: dimension.cpp:87
double textAngle() const
Definition: dimension.cpp:79
geo::Coordinate DimRadial::definitionPoint2 ( ) const

Definition at line 101 of file dimradial.cpp.

101  {
102  return _definitionPoint2;
103 }
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
virtual void lc::entity::DimRadial::dispatch ( EntityDispatch ed) const
inlineoverridevirtual

Implements lc::entity::CADEntity.

Definition at line 115 of file dimradial.h.

115  {
116  ed.visit(shared_from_this());
117  }
std::map< unsigned int, geo::Coordinate > DimRadial::dragPoints ( ) const
overridevirtual

Get all points of the entity that can be dragged.

Returns
Map of points

Implements lc::Draggable.

Definition at line 105 of file dimradial.cpp.

105  {
106  std::map<unsigned int, geo::Coordinate> dragPoints;
107 
108  dragPoints[0] = definitionPoint();
109  dragPoints[1] = middleOfText();
110  dragPoints[2] = _definitionPoint2;
111 
112  return dragPoints;
113 }
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
virtual std::map< unsigned int, lc::geo::Coordinate > dragPoints() const override
Get all points of the entity that can be dragged.
Definition: dimradial.cpp:105
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
double DimRadial::leader ( ) const

Definition at line 97 of file dimradial.cpp.

97  {
98  return _leader;
99 }
const double _leader
Definition: dimradial.h:110
CADEntity_CSPtr DimRadial::mirror ( const geo::Coordinate axis1,
const geo::Coordinate axis2 
) const
overridevirtual

Implements lc::entity::CADEntity.

Definition at line 68 of file dimradial.cpp.

68  {
69  auto newDimRadial = std::make_shared<DimRadial>(this->definitionPoint().mirror(axis1,axis2),
70  this->middleOfText().mirror(axis1,axis2), this->attachmentPoint(), this->textAngle(), this->lineSpacingFactor(), this->lineSpacingStyle(), this->explicitValue(), this->_definitionPoint2.mirror(axis1,axis2), this->_leader, this->layer(), this->metaInfo());
71  return newDimRadial;
72 }
Coordinate mirror(const Coordinate &axis1, const Coordinate &axis2) const
mirror a coordinate
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
const double _leader
Definition: dimradial.h:110
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
double lineSpacingFactor() const
Definition: dimension.cpp:87
double textAngle() const
Definition: dimension.cpp:79
CADEntity_CSPtr DimRadial::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 79 of file dimradial.cpp.

79  {
80  auto newDimRadial = std::make_shared<DimRadial>(
81  this->definitionPoint(),
82  this->middleOfText(),
83  this->attachmentPoint(),
84  this->textAngle(),
85  this->lineSpacingFactor(),
86  this->lineSpacingStyle(),
87  this->explicitValue(),
88  this->_definitionPoint2,
89  this->_leader,
90  layer,
92  );
93 
94  return newDimRadial;
95 }
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
const double _leader
Definition: dimradial.h:110
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
double lineSpacingFactor() const
Definition: dimension.cpp:87
Block_CSPtr block() const
Return the current entity block.
Definition: cadentity.cpp:33
double textAngle() const
Definition: dimension.cpp:79
CADEntity_CSPtr DimRadial::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 45 of file dimradial.cpp.

45  {
46  auto newDimRadial = std::make_shared<DimRadial>(this->definitionPoint() + offset, this->middleOfText() + offset, this->attachmentPoint(), this->textAngle(), this->lineSpacingFactor(), this->lineSpacingStyle(), this->explicitValue(), this->_definitionPoint2 + offset, this->_leader, this->layer(), this->metaInfo());
47  newDimRadial->setID(this->id());
48  return newDimRadial;
49 }
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
const double _leader
Definition: dimradial.h:110
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
double lineSpacingFactor() const
Definition: dimension.cpp:87
double textAngle() const
Definition: dimension.cpp:79
CADEntity_CSPtr DimRadial::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 56 of file dimradial.cpp.

56  {
57  auto newDimRadial = std::make_shared<DimRadial>(this->definitionPoint().rotate(rotation_center, rotation_angle),
58  this->middleOfText().rotate(rotation_center, rotation_angle), this->attachmentPoint(), this->textAngle(), this->lineSpacingFactor(), this->lineSpacingStyle(), this->explicitValue(), this->_definitionPoint2.rotate(rotation_center, rotation_angle), this->_leader, this->layer(), this->metaInfo());
59  return newDimRadial;
60 }
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
const double _leader
Definition: dimradial.h:110
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
Coordinate rotate(const Coordinate &angleVector) const
rotate around (0.,0.) with a given angle vector
double lineSpacingFactor() const
Definition: dimension.cpp:87
double textAngle() const
Definition: dimension.cpp:79
CADEntity_CSPtr DimRadial::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 62 of file dimradial.cpp.

62  {
63  auto newDimRadial = std::make_shared<DimRadial>(this->definitionPoint().scale(scale_center, scale_factor),
64  this->middleOfText().scale(scale_center, scale_factor), this->attachmentPoint(), this->textAngle(), this->lineSpacingFactor(), this->lineSpacingStyle(), this->explicitValue(), this->_definitionPoint2.scale(scale_center, scale_factor), this->_leader, this->layer(), this->metaInfo());
65  return newDimRadial;
66 }
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
const geo::Coordinate _definitionPoint2
Definition: dimradial.h:111
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
Definition: dimension.cpp:71
const double _leader
Definition: dimradial.h:110
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
Coordinate scale(const double &scale_factor) const
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
const geo::Coordinate & middleOfText() const noexcept
Definition: dimension.cpp:75
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
double lineSpacingFactor() const
Definition: dimension.cpp:87
double textAngle() const
Definition: dimension.cpp:79
CADEntity_CSPtr DimRadial::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 116 of file dimradial.cpp.

116  {
117  try {
118  auto newEntity = std::make_shared<DimRadial>(dragPoints.at(0),
119  dragPoints.at(1),
120  attachmentPoint(),
121  textAngle(),
124  explicitValue(),
125  dragPoints.at(2),
126  leader(),
127  layer(),
128  metaInfo());
129  newEntity->setID(id());
130  return newEntity;
131  }
132  catch(std::out_of_range& e) {
133  return shared_from_this();
134  }
135 }
TextConst::LineSpacingStyle lineSpacingStyle() const
Definition: dimension.cpp:91
virtual std::map< unsigned int, lc::geo::Coordinate > dragPoints() const override
Get all points of the entity that can be dragged.
Definition: dimradial.cpp:105
std::string explicitValue() const
Definition: dimension.cpp:95
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Definition: cadentity.cpp:29
MetaInfo_CSPtr metaInfo() const
Definition: cadentity.h:123
TextConst::AttachmentPoint const & attachmentPoint() const
Definition: dimension.cpp:83
double lineSpacingFactor() const
Definition: dimension.cpp:87
double leader() const
Definition: dimradial.cpp:97
double textAngle() const
Definition: dimension.cpp:79

Member Data Documentation

const geo::Coordinate lc::entity::DimRadial::_definitionPoint2
protected

Definition at line 111 of file dimradial.h.

const double lc::entity::DimRadial::_leader
protected

Definition at line 110 of file dimradial.h.


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