LibreCAD
|
The EntityContainer class manages a set of entities. This call will allow to select (but not manipulate) entities. More...
#include <entitycontainer.h>
Public Member Functions | |
EntityContainer () | |
EntityContainer Default constructor. Usually you would retrieve a EntityContainer from the document. More... | |
EntityContainer (const EntityContainer &other) | |
EntityContainer Copy Constructor. More... | |
virtual | ~EntityContainer () |
EntityContainer & | operator= (const EntityContainer &ec) |
void | insert (CT entity) |
add an entity to the EntityContainer If the entity already exists, it will be replaced More... | |
void | combine (const EntityContainer &entities) |
Add all entities to this container Any entity that already exists will get replaced. More... | |
void | remove (CT entity) |
remove an Entity from the document. More... | |
std::vector< CT > | asVector (short maxLevel=std::numeric_limits< short >::max()) const |
asVector return all entities as std::vector optionally up until a given level This is useful to return entities for screen rendering where you don't want to render very small entities (< XX pixels) More... | |
CT | entityByID (ID_DATATYPE id) const |
entityByID return a entity by it's id, return's a empty shared ptr when not found More... | |
EntityContainer | entitiesByLayer (const Layer_CSPtr layer) const |
findEntitiesByLayer Return a entities container with all entities from a specific layer More... | |
EntityContainer | entitiesByMetaType (const std::string &metaName) const |
entitiesByMetaType Return all entities that contain's a specific metaInfo More... | |
EntityContainer | entitiesFullWithinArea (const geo::Area &area, const short maxLevel=std::numeric_limits< short >::max()) const |
entitiesByArea Find all entities within a selected area based on boundingbox of the entities More... | |
geo::Area | boundingBox () const |
EntityContainer | entitiesWithinAndCrossingArea (const geo::Area &area, const short maxLevel=std::numeric_limits< short >::max()) const |
entitiesWithinAndCrossingArea Find all entities within a selected area or where the path is crossing the area bounderies More... | |
EntityContainer | entitiesWithinAndCrossingAreaFast (const geo::Area &area, const short maxLevel=std::numeric_limits< short >::max()) const |
entitiesWithinAndCrossingAreaFast Find all entities within a selected area. Unlike entitiesWithinAndCrossingArea it this will return entities based on it's boundig box. That means that the resulting EntityContainer may or may not have entities which are visible. More... | |
std::vector< lc::EntityDistance > | getEntityPathsNearCoordinate (const lc::geo::Coordinate &point, double distance) const |
getEntityPathsNearCoordinate More... | |
lc::geo::Area | bounds () const |
bound returns the size of the document More... | |
void | optimise () |
optimise this container More... | |
template<typename U , typename T > | |
void | each (T func) |
template<typename U , typename T > | |
void | each (T func) const |
Private Attributes | |
QuadTree< CT > * | _tree |
The EntityContainer class manages a set of entities. This call will allow to select (but not manipulate) entities.
Considerations: Make the underlaying entities older configurable. At this moment a quad tree is used but we could add a option to also support a simple map. When the never of entities are low this might be a little fast, but marginally... A other option could be is to configure the quadtree to set a large number of objects
Definition at line 33 of file entitycontainer.h.
|
inline |
EntityContainer Default constructor. Usually you would retrieve a EntityContainer from the document.
Definition at line 40 of file entitycontainer.h.
|
inline |
|
inlinevirtual |
Definition at line 55 of file entitycontainer.h.
|
inline |
asVector return all entities as std::vector optionally up until a given level This is useful to return entities for screen rendering where you don't want to render very small entities (< XX pixels)
Definition at line 103 of file entitycontainer.h.
|
inline |
Calculate boundingBox of all entities in this container
Definition at line 179 of file entitycontainer.h.
|
inline |
bound returns the size of the document
Definition at line 322 of file entitycontainer.h.
|
inline |
Add all entities to this container Any entity that already exists will get replaced.
EntityContainer | to be combined to the document. |
Definition at line 82 of file entitycontainer.h.
|
inline |
Each allows to run a function of all set's of object's within this container
Example:
LcDrawOptions lcDrawOptions; _entityContainer.each< LCVDrawItem >([&](LCVDrawItem_SPtr item) { item->draw(painter, &lcDrawOptions, _visibleUserArea); });
Definition at line 346 of file entitycontainer.h.
|
inline |
Definition at line 350 of file entitycontainer.h.
|
inline |
findEntitiesByLayer Return a entities container with all entities from a specific layer
layer |
Definition at line 122 of file entitycontainer.h.
|
inline |
entitiesByMetaType Return all entities that contain's a specific metaInfo
metaTypeName | : this does nothing |
Definition at line 141 of file entitycontainer.h.
|
inline |
entitiesByArea Find all entities within a selected area based on boundingbox of the entities
area |
Definition at line 161 of file entitycontainer.h.
|
inline |
entitiesWithinAndCrossingArea Find all entities within a selected area or where the path is crossing the area bounderies
area |
TODO: create a version like this to get a rought estimate of what's located within a area this can be used to accelerate drawing performance. TODO: Consider giving a container to drop entities into. This can be used for example during drawing where we don't require a QuadTree but just a linear array of entities tobe drawn
Definition at line 203 of file entitycontainer.h.
|
inline |
entitiesWithinAndCrossingAreaFast Find all entities within a selected area. Unlike entitiesWithinAndCrossingArea it this will return entities based on it's boundig box. That means that the resulting EntityContainer may or may not have entities which are visible.
Definition at line 272 of file entitycontainer.h.
|
inline |
entityByID return a entity by it's id, return's a empty shared ptr when not found
id |
Definition at line 112 of file entitycontainer.h.
|
inline |
getEntityPathsNearCoordinate
point | point where to look for entities |
distance | maximum distance from this point where the function would consider adding it to a list |
Definition at line 294 of file entitycontainer.h.
|
inline |
add an entity to the EntityContainer If the entity already exists, it will be replaced
entity | entity to be added to the document. |
Definition at line 72 of file entitycontainer.h.
|
inline |
Definition at line 59 of file entitycontainer.h.
|
inline |
optimise this container
Definition at line 330 of file entitycontainer.h.
|
inline |
remove an Entity from the document.
id | Entity ID of entity which is to be removed. |
Definition at line 92 of file entitycontainer.h.
|
private |
Definition at line 354 of file entitycontainer.h.