7 using namespace entity;
11 const Layer_CSPtr layer,
12 const MetaInfo_CSPtr metaInfo,
13 const Block_CSPtr block) :
15 geo::Vector(start, end) {
19 const Layer_CSPtr layer,
20 const MetaInfo_CSPtr metaInfo,
21 const Block_CSPtr block) :
26 Line::Line(
const Line_CSPtr other,
bool sameID) :
CADEntity(other, sameID), geo::Vector(other->start(), other->end()) {
31 geo::Vector(builder.start(), builder.end()) {
35 std::vector<EntityCoordinate> points;
38 points.emplace_back(
start(), 0);
39 points.emplace_back(
end(), 1);
40 points.emplace_back(
end().mid(
start()), 1);
46 points.emplace_back(npoe, 2);
51 points.emplace_back(npoe, 3);
65 auto newLine = std::make_shared<Line>(this->
start() + offset,
71 newLine->setID(this->
id());
76 auto newLine = std::make_shared<Line>(this->
start() + offset,
85 auto newLine = std::make_shared<Line>(this->
start().
rotate(rotation_center, rotation_angle),
86 this->
end().
rotate(rotation_center, rotation_angle),
90 newLine->setID(this->
id());
95 auto newLine = std::make_shared<Line>(this->
start().
scale(scale_center, scale_factor),
96 this->
end().
scale(scale_center, scale_factor),
100 newLine->setID(this->
id());
106 auto newLine = std::make_shared<Line>(this->
start().
mirror(axis1, axis2),
111 newLine->setID(this->
id());
119 CADEntity_CSPtr
Line::modify(Layer_CSPtr layer,
const MetaInfo_CSPtr metaInfo, Block_CSPtr block)
const {
120 auto newEntity = std::make_shared<Line>(
127 newEntity->setID(this->
id());
133 std::map<unsigned int, lc::geo::Coordinate> points;
143 auto newEntity = std::make_shared<Line>(dragPoints.at(0),
149 newEntity->setID(this->
id());
152 catch(
const std::out_of_range& e) {
154 return shared_from_this();
virtual CADEntity_CSPtr scale(const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override
scale, scales the entity
Coordinate mirror(const Coordinate &axis1, const Coordinate &axis2) const
mirror a coordinate
const Coordinate end() const
virtual CADEntity_CSPtr copy(const geo::Coordinate &offset) const override
copy, copies line by an offset
static const uint16_t LOGICAL
const Coordinate nearestPointOnEntity(const Coordinate &coord) const
static const uint16_t ON_ENTITYPATH
Layer_CSPtr layer() const
layer return the layer this entity is placed on
Coordinate scale(const double &scale_factor) const
virtual CADEntity_CSPtr rotate(const geo::Coordinate &rotation_center, const double rotation_angle) const override
rotate, rotate operation
MetaInfo_CSPtr metaInfo() const
static const uint16_t ON_ENTITY
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 const geo::Area boundingBox() const override
boundingBox of the entity
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 std::map< unsigned int, lc::geo::Coordinate > dragPoints() const override
Get all points of the entity that can be dragged.
virtual CADEntity_CSPtr move(const geo::Coordinate &offset) const override
move, moves by an offset
const Coordinate nearestPointOnPath(const Coordinate &coord) const
Block_CSPtr block() const
Return the current entity block.
virtual CADEntity_CSPtr setDragPoints(std::map< unsigned int, lc::geo::Coordinate > dragPoints) const override
Return modified entity.
virtual CADEntity_CSPtr mirror(const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
const uint16_t constrain() const
const Coordinate start() const
double distanceTo(const geo::Coordinate &c) const
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...
Line(const geo::Coordinate &start, const geo::Coordinate &end, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
Construct a new line.
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...