4 using namespace entity;
8 _document(other->_document),
9 _position(other->_position),
10 _displayBlock(other->_displayBlock) {
20 _document(builder.document()),
21 _position(builder.coordinate()),
22 _displayBlock(builder.displayBlock()) {
44 auto newEntity = std::make_shared<Insert>(shared_from_this(),
true);
45 newEntity->_position =
_position + offset;
51 auto newEntity = std::make_shared<Insert>(shared_from_this());
52 newEntity->_position =
_position + offset;
59 return shared_from_this();
64 return shared_from_this();
69 return shared_from_this();
76 CADEntity_CSPtr
Insert::modify(Layer_CSPtr layer,
const MetaInfo_CSPtr metaInfo, Block_CSPtr block)
const {
79 builder.copy(shared_from_this());
80 builder.setLayer(layer);
81 builder.setMetaInfo(metaInfo);
82 builder.setBlock(block);
84 return builder.build();
92 auto result = std::map<unsigned int, geo::Coordinate>();
94 result.insert(std::pair<unsigned int, geo::Coordinate>(0, _position));
101 auto newEntity = std::make_shared<Insert>(shared_from_this(),
true);
102 newEntity->_position = dragPoints.at(0);
106 catch(std::out_of_range& e) {
107 return shared_from_this();
113 double minDistanceToSnap,
114 int maxNumberOfSnapPoints)
const {
115 std::vector<EntityCoordinate> points;
118 points.emplace_back(_position, 0);
136 if(entities.empty()) {
142 auto it = entities.begin();
147 while (it != entities.end()) {
virtual std::vector< EntityCoordinate > snapPoints(const geo::Coordinate &coord, const SimpleSnapConstrain &simpleSnapConstrain, double minDistanceToSnap, int maxNumberOfSnapPoints) const override
Find a number of snap points the line has available This function returns a ordered list...
entity::CADEntity_CSPtr entity() const
Returns the ID.
CADEntity_CSPtr setDragPoints(std::map< unsigned int, lc::geo::Coordinate > dragPoints) const override
Return modified entity.
static const uint16_t LOGICAL
Block_CSPtr _displayBlock
Insert(Insert_CSPtr other, bool sameID=false)
Area merge(const Area &other) const
merge two area's and expand if required to largest containing area
const Block_CSPtr & displayBlock() const
void dispatch(EntityDispatch &dispatch) const override
std::map< unsigned int, geo::Coordinate > dragPoints() const override
Get all points of the entity that can be dragged.
CADEntity_CSPtr scale(const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override
Function implementation for Scale.
static void snapPointsCleanup(std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const unsigned int maxNumberOfSnapPoints, const double minDistanceToSnap)
const geo::Area boundingBox() const override
boundingBox Return the bounding box of this entity. This should be as tight around the entity as poss...
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...
CADEntity_CSPtr mirror(const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
CADEntity_CSPtr copy(const geo::Coordinate &offset) const override
Function for Copy.
const geo::Coordinate & position() const
void calculateBoundingBox()
const Document_SPtr & document() const
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...
geo::Coordinate _position
CADEntity_CSPtr move(const geo::Coordinate &offset) const override
Function for Move.
void on_addEntityEvent(const lc::AddEntityEvent &)
void on_removeEntityEvent(const lc::RemoveEntityEvent &)
const uint16_t constrain() const
CADEntity_CSPtr rotate(const geo::Coordinate &rotation_center, const double rotation_angle) const override
Function implementation for rotate.
const entity::CADEntity_CSPtr entity() const
Returns the entity without cast.