6 using namespace entity;
12 double const lineSpacingFactor,
14 std::string
const& explicitValue,
17 const Layer_CSPtr layer,
18 const MetaInfo_CSPtr metaInfo,
19 const Block_CSPtr block):
21 Dimension(definitionPoint, middleOfText, attachmentPoint, textAngle, lineSpacingFactor, lineSpacingStyle, explicitValue),
22 _definitionPoint2(definitionPoint2),
23 _definitionPoint3(definitionPoint3) {
31 _definitionPoint2(other->_definitionPoint2),
32 _definitionPoint3(other->_definitionPoint3) {
38 std::string
const& explicitValue,
39 const Layer_CSPtr layer,
40 const MetaInfo_CSPtr metaInfo,
41 const Block_CSPtr block) {
43 auto distance = nearestPoint.
distanceTo(middleOfText);
46 if(((p2.
x() - p1.
x()) * (middleOfText.
y() - p1.
y()) - (p2.
y() - p1.
y()) * (middleOfText.
x() - p1.
x())) >= 0) {
55 return std::make_shared<DimAligned>(p0,
57 TextConst::AttachmentPoint::Top_center,
60 TextConst::LineSpacingStyle::AtLeast,
73 auto newDimAligned = std::make_shared<DimAligned>(this->
definitionPoint() + offset, this->
middleOfText() + offset, this->
attachmentPoint(), this->
textAngle(), this->
lineSpacingFactor(), this->
lineSpacingStyle(), this->
explicitValue(), this->
_definitionPoint2 + offset, this->
_definitionPoint3 + offset, this->
layer(), this->
metaInfo());
74 newDimAligned->setID(this->
id());
79 auto newDimAligned = std::make_shared<DimAligned>(this->
definitionPoint() + offset, this->
middleOfText() + offset, this->
attachmentPoint(), this->
textAngle(), this->
lineSpacingFactor(), this->
lineSpacingStyle(), this->
explicitValue(), this->
_definitionPoint2 + offset, this->
_definitionPoint3 + offset, this->
layer(), this->
metaInfo());
84 auto newDimAligned = std::make_shared<DimAligned>(this->
definitionPoint().
rotate(rotation_center, rotation_angle),
85 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->
_definitionPoint3.
rotate(rotation_center, rotation_angle), this->
layer(), this->
metaInfo());
90 auto newDimAligned = std::make_shared<DimAligned>(this->
definitionPoint().
scale(scale_center, scale_factor),
91 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->
_definitionPoint3.
scale(scale_center, scale_factor), this->
layer(), this->
metaInfo());
99 this->
middleOfText().
mirror(axis1, axis2), this->
attachmentPoint(), this->
textAngle(), this->
lineSpacingFactor(), this->
lineSpacingStyle(), this->
explicitValue(), this->
_definitionPoint2.
mirror(axis1, axis2), this->
_definitionPoint3.
mirror(axis1, axis2), this->
layer(), this->
metaInfo());
100 return newDimAligned;
108 CADEntity_CSPtr
DimAligned::modify(Layer_CSPtr layer,
const MetaInfo_CSPtr metaInfo, Block_CSPtr block)
const {
109 auto newDimAligned = std::make_shared<DimAligned>(
124 return newDimAligned;
135 std::map<unsigned int, geo::Coordinate>
dragPoints;
148 auto newEntity = std::make_shared<DimAligned>(dragPoints.at(0),
159 newEntity->setID(
id());
162 catch(std::out_of_range& e) {
163 return shared_from_this();
Coordinate mirror(const Coordinate &axis1, const Coordinate &axis2) const
mirror a coordinate
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 informat...
const geo::Coordinate _definitionPoint2
double x() const
Returns x of Coordinate.
TextConst::LineSpacingStyle lineSpacingStyle() const
const geo::Coordinate & definitionPoint() const noexcept
move, moves by an offset
static DimAligned_SPtr dimAuto(geo::Coordinate const &p1, geo::Coordinate const &p2, geo::Coordinate const &middleOfText, std::string const &explicitValue, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
std::string explicitValue() const
Layer_CSPtr layer() const
layer return the layer this entity is placed on
const geo::Coordinate & definitionPoint3() const noexcept
const geo::Coordinate & definitionPoint2() const noexcept
double y() const
Returns y of Coordinate.
Coordinate scale(const double &scale_factor) const
virtual CADEntity_CSPtr mirror(const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
MetaInfo_CSPtr metaInfo() const
const geo::Coordinate & middleOfText() const noexcept
TextConst::AttachmentPoint const & attachmentPoint() const
virtual CADEntity_CSPtr move(const geo::Coordinate &offset) const override
move, moves by an offset
virtual const geo::Area boundingBox() const override
boundingBox of the entity
Coordinate rotate(const Coordinate &angleVector) const
rotate around (0.,0.) with a given angle vector
virtual CADEntity_CSPtr copy(const geo::Coordinate &offset) const override
copy, copies by an offset
Coordinate move(const Coordinate &direction, double d) const
const Coordinate nearestPointOnPath(const Coordinate &coord) const
double lineSpacingFactor() const
Block_CSPtr block() const
Return the current entity block.
virtual CADEntity_CSPtr rotate(const geo::Coordinate &rotation_center, const double rotation_angle) const override
rotate, rotate operation
virtual CADEntity_CSPtr setDragPoints(std::map< unsigned int, lc::geo::Coordinate > dragPoints) const override
Return modified entity.
virtual CADEntity_CSPtr scale(const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override
scale, scales the entity
const geo::Coordinate _definitionPoint3
virtual std::map< unsigned int, lc::geo::Coordinate > dragPoints() const override
Get all points of the entity that can be dragged.
double distanceTo(const geo::Coordinate &c) const
DimAligned(geo::Coordinate const &definitionPoint, geo::Coordinate const &middleOfText, TextConst::AttachmentPoint const &attachmentPoint, double textAngle, double const lineSpacingFactor, TextConst::LineSpacingStyle const &lineSpacingStyle, std::string const &explicitValue, geo::Coordinate const &definitionPoint2, geo::Coordinate const &definitionPoint3, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
DimAligned, DimAligned constructor with metatypes.