4 using namespace entity;
7 const Layer_CSPtr layer,
const MetaInfo_CSPtr metaInfo,
const Block_CSPtr block) :
9 geo::
Arc(center, radius, startAngle, endAngle, isCCW) {
12 Arc::Arc(
const geo::Arc &a,
const Layer_CSPtr layer,
const MetaInfo_CSPtr metaInfo,
const Block_CSPtr block) :
18 geo::
Arc(other->center(), other->radius(), other->startAngle(),
19 other->endAngle(), other->CCW()) {
24 geo::
Arc(builder.center(), builder.radius(), builder.startAngle(), builder.endAngle(), builder.isCCW()) {
28 double minDistanceToSnap,
int maxNumberOfSnapPoints)
const {
29 std::vector<EntityCoordinate> points;
33 points.emplace_back(coord, 0);
34 points.emplace_back(
startP(), 1);
35 points.emplace_back(
endP(), 2);
41 points.emplace_back(coord, 1);
46 points.emplace_back(coord, 2);
51 points.emplace_back(coord, 3);
56 points.emplace_back(coord, 4);
63 points.emplace_back(npoe, -1);
71 points.emplace_back(npoe, -1);
96 newArc->setID(this->
id());
107 auto newArc = std::make_shared<Arc>(this->
center().
rotate(rotation_center, rotation_angle),
110 newArc->setID(this->
id());
115 auto newArc = std::make_shared<Arc>(this->
center().
scale(scale_center, scale_factor),
116 this->
radius() * fabs(scale_factor.
x()),
118 newArc->setID(this->
id());
124 double a= (axis2- axis1).
angle()*2;
126 auto newArc = std::make_shared<Arc>(this->
center().
mirror(axis1,axis2),
131 newArc->setID(this->
id());
140 CADEntity_CSPtr
Arc::modify(Layer_CSPtr layer,
const MetaInfo_CSPtr metaInfo, Block_CSPtr block)
const {
143 newArc->setID(this->
id());
149 std::map<unsigned int, lc::geo::Coordinate>
dragPoints;
152 dragPoints[1] =
endP();
161 newEntity->setID(
id());
164 catch(std::out_of_range& e) {
165 return shared_from_this();
Coordinate mirror(const Coordinate &axis1, const Coordinate &axis2) const
mirror a coordinate
Coordinate startP() const
Arc(const geo::Coordinate ¢er, double radius, double startAngle, double endAngle, bool CCW, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
Arc, Arc constructor.
virtual CADEntity_CSPtr setDragPoints(std::map< unsigned int, lc::geo::Coordinate > dragPoints) const override
Return modified entity.
static const uint16_t LOGICAL
double x() const
Returns x of Coordinate.
virtual CADEntity_CSPtr mirror(const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
static const uint16_t ON_ENTITYPATH
Layer_CSPtr layer() const
layer return the layer this entity is placed on
virtual CADEntity_CSPtr copy(const geo::Coordinate &offset) const override
copy, copies line by an offset
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...
Coordinate scale(const double &scale_factor) const
virtual CADEntity_CSPtr move(const geo::Coordinate &offset) const override
move, moves by an offset
static Arc createArcBulge(const Coordinate &p1, const Coordinate &p2, const double bulge)
MetaInfo_CSPtr metaInfo() const
static const uint16_t ON_ENTITY
bool CCW() const
Returns of the arc is in reversed direction.
double endAngle() const
Returns the EndAngle.
Coordinate nearestPointOnPath(const Coordinate &coord) const
Coordinate rotate(const Coordinate &angleVector) const
rotate around (0.,0.) with a given angle vector
static void snapPointsCleanup(std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const unsigned int maxNumberOfSnapPoints, const double minDistanceToSnap)
virtual CADEntity_CSPtr rotate(const geo::Coordinate &rotation_center, const double rotation_angle) const override
rotate, rotate operation
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...
virtual const geo::Area boundingBox() const override
boundingBox of the entity
Block_CSPtr block() const
Return the current entity block.
virtual CADEntity_CSPtr scale(const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override
scale, scales the entity
static double correctAngle(double a)
correctAngle, Corrects angle to be in -PI to PI
const uint16_t constrain() const
double radius() const
Returns the radius of Arc.
virtual std::map< unsigned int, lc::geo::Coordinate > dragPoints() const override
Get all points of the entity that can be dragged.
bool isAngleBetween(double angle) const
double startAngle() const
Returns the startAngle.
const Coordinate center() const
Returns center of Arc.
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...