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

#include <customentity.h>

Inheritance diagram for lc::entity::CustomEntity:
Collaboration diagram for lc::entity::CustomEntity:

Public Member Functions

 CustomEntity (const builder::InsertBuilder &builder)
 
 CustomEntity (Insert_CSPtr insert, bool sameID=false)
 
virtual std::vector
< EntityCoordinate
snapPoints (const geo::Coordinate &coord, const SimpleSnapConstrain &simpleSnapConstrain, double minDistanceToSnap, int maxNumberOfSnapPoints) const override=0
 Find a number of snap points the line has available This function returns a ordered list, closest to coord and can return multiple snap points. More...
 
virtual geo::Coordinate nearestPointOnPath (const geo::Coordinate &coord) const override=0
 Find the nearest point on the path for this entity for the coordinate coord The path of a entity that it can possibly take. More...
 
virtual std::map< unsigned int,
geo::Coordinate
dragPoints () const override=0
 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...
 
virtual CADEntity_CSPtr move (const geo::Coordinate &offset) const override=0
 Function for Move. More...
 
virtual CADEntity_CSPtr copy (const geo::Coordinate &offset) const override=0
 Function for Copy. More...
 
virtual CADEntity_CSPtr rotate (const geo::Coordinate &rotation_center, const double rotation_angle) const override=0
 Function implementation for rotate. More...
 
virtual CADEntity_CSPtr scale (const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override=0
 Function implementation for Scale. More...
 
virtual CADEntity_CSPtr mirror (const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override=0
 
virtual CADEntity_CSPtr modify (Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo, Block_CSPtr block) const override=0
 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...
 
- Public Member Functions inherited from lc::entity::Insert
 Insert (Insert_CSPtr other, bool sameID=false)
 
 ~Insert ()
 
const Block_CSPtr & displayBlock () const
 
const geo::Coordinateposition () const
 
const Document_SPtr & document () const
 
CADEntity_CSPtr move (const geo::Coordinate &offset) const override
 Function for Move. More...
 
CADEntity_CSPtr copy (const geo::Coordinate &offset) const override
 Function for Copy. More...
 
CADEntity_CSPtr rotate (const geo::Coordinate &rotation_center, const double rotation_angle) const override
 Function implementation for rotate. More...
 
CADEntity_CSPtr scale (const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override
 Function implementation for Scale. More...
 
CADEntity_CSPtr mirror (const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
 
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...
 
const geo::Area boundingBox () const override
 boundingBox Return the bounding box of this entity. This should be as tight around the entity as possible but care should be taken that this routine is also as fast as possible. in essence, favor speed over tightness. This routine will in generally be used during testing if entities cross for example to find snap points and to build relationships of tree for example using quad trees More...
 
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. More...
 
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
 
virtual void accept (GeoEntityVisitor &v) const override
 
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::UnmanagedDraggable
virtual void setDragPoint (lc::geo::Coordinate position) const =0
 Function called when a drag point is moved. More...
 
virtual void onDragPointClick (lc::operation::Builder_SPtr builder, unsigned int point) const =0
 Function called when a drag point of the entity is clicked. More...
 
virtual void onDragPointRelease (lc::operation::Builder_SPtr builder) const =0
 Function called when a clicked drag point is released. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from lc::Snapable
static void remove_ifDistanceGreaterThen (std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const double distance)
 
static void snapPointsCleanup (std::vector< EntityCoordinate > &points, const geo::Coordinate &reference, const unsigned int maxNumberOfSnapPoints, const double minDistanceToSnap)
 
- Static Public Attributes inherited from lc::ID
static std::atomic< ID_DATATYPE__idCounter
 
- Protected Member Functions inherited from lc::entity::Insert
 Insert (const builder::InsertBuilder &builder)
 
- Protected Member Functions inherited from lc::entity::CADEntity
 CADEntity (const lc::builder::CADEntityBuilder &builder)
 

Detailed Description

Definition at line 8 of file customentity.h.

Constructor & Destructor Documentation

lc::entity::CustomEntity::CustomEntity ( const builder::InsertBuilder builder)

Definition at line 3 of file customentity.cpp.

3  : Insert(builder) {
4 
5 }
Insert(Insert_CSPtr other, bool sameID=false)
Definition: insert.cpp:6
lc::entity::CustomEntity::CustomEntity ( Insert_CSPtr  insert,
bool  sameID = false 
)

Member Function Documentation

virtual CADEntity_CSPtr lc::entity::CustomEntity::copy ( const geo::Coordinate offset) const
overridepure virtual

Function for Copy.

Parameters
offsetthe offset by which entity is to be copied
Returns
CADEntity std::shared_ptr

Implements lc::entity::CADEntity.

virtual std::map<unsigned int, geo::Coordinate> lc::entity::CustomEntity::dragPoints ( ) const
overridepure virtual

Get all points of the entity that can be dragged.

Returns
Map of points

Implements lc::Draggable.

virtual CADEntity_CSPtr lc::entity::CustomEntity::mirror ( const geo::Coordinate axis1,
const geo::Coordinate axis2 
) const
overridepure virtual

Implements lc::entity::CADEntity.

virtual CADEntity_CSPtr lc::entity::CustomEntity::modify ( Layer_CSPtr  layer,
const MetaInfo_CSPtr  metaInfo,
Block_CSPtr  block 
) const
overridepure virtual

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.

virtual CADEntity_CSPtr lc::entity::CustomEntity::move ( const geo::Coordinate offset) const
overridepure virtual

Function for Move.

Parameters
offsetthe offset by which entity is to be moved
Returns
CADEntity std::shared_ptr

Implements lc::entity::CADEntity.

virtual geo::Coordinate lc::entity::CustomEntity::nearestPointOnPath ( const geo::Coordinate coord) const
overridepure virtual

Find the nearest point on the path for this entity for the coordinate coord The path of a entity that it can possibly take.

For example for any Arc the path is the full circle if the start/stop angle is 0 to 2*pi

Parameters
coordCoordinate to lookup the nearest coordinate from
See also
lc::entity::CADEntity

Reimplemented from lc::entity::Insert.

virtual CADEntity_CSPtr lc::entity::CustomEntity::rotate ( const geo::Coordinate rotation_center,
const double  rotation_angle 
) const
overridepure virtual

Function implementation for rotate.

Parameters
angleangle by which the entity is to be rotated.
Returns
CADEntity std::shared_ptr

Implements lc::entity::CADEntity.

virtual CADEntity_CSPtr lc::entity::CustomEntity::scale ( const geo::Coordinate scale_center,
const geo::Coordinate scale_factor 
) const
overridepure virtual

Function implementation for Scale.

Parameters
scale_center
scale_factor
Returns
CADEntity std::shared_ptr

Implements lc::entity::CADEntity.

lc::entity::CADEntity_CSPtr lc::entity::CustomEntity::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 11 of file customentity.cpp.

11  {
12  return shared_from_this();
13 }
virtual std::vector<EntityCoordinate> lc::entity::CustomEntity::snapPoints ( const geo::Coordinate coord,
const SimpleSnapConstrain simpleSnapConstrain,
double  minDistanceToSnap,
int  maxNumberOfSnapPoints 
) const
overridepure virtual

Find a number of snap points the line has available This function returns a ordered list, closest to coord and can return multiple snap points.

Parameters
coordCoordinate to lookup the nearest coordinate from
minDistanceToSnapMinimum distance to the path to snap into. THis is a hint parameter and we should follow this, but it will be later filtered again
maxNumberOfSnapPointsMaximum number of snappoints that have to be looked up
See also
lc::EntityCoordinate

Reimplemented from lc::entity::Insert.


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