LayOut C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Enumerations | Functions
entity.h File Reference
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>

Go to the source code of this file.

Enumerations

enum  LOEntityType {
  LOEntityType_FormattedText = 0, LOEntityType_Group, LOEntityType_Image, LOEntityType_LinearDimension,
  LOEntityType_Path, LOEntityType_Rectangle, LOEntityType_SketchUpModel, LOEntityType_Ellipse,
  LOEntityType_Label, LOEntityType_Table, LOEntityType_AngularDimension, LONumEntityTypes
}
 Defines the different types of entities that may exist in a document. More...
 

Functions

LO_RESULT LOEntityGetAxisAlignedBounds (LOEntityRef entity, LOAxisAlignedRect2D *bounds)
 Gets the bounds of an entity in the x and y axis of the page. More...
 
LO_RESULT LOEntityGetOrientedBounds (LOEntityRef entity, LOOrientedRect2D *bounds)
 Gets a rectangle that bounds an entity. The rectangle returned by this function may not be aligned with the page axis if the entity has an explicit transformation. More...
 
LO_RESULT LOEntityHasExplicitTransform (LOEntityRef entity, bool *has_transform)
 Gets whether or not an entity has an explicit transformation. The following types of entities will always have an explicit transformation: LOFormattedTextRef, LOImageRef, LORectangleRef, LOSketchUpModelRef and LOEllipseRef. More...
 
LO_RESULT LOEntityGetExplicitTransform (LOEntityRef entity, LOTransformMatrix2D *transform_matrix)
 Gets the explicit transformation for an entity. This function is only supported for entities that have an explicit transformation. More...
 
LO_RESULT LOEntityApplyTransform (LOEntityRef entity, const LOTransformMatrix2D *transform_matrix)
 Applies a transformation to an entity. This works for all types of entities, regardless of whether or not they have an explicit transformation. It even works on groups, in which case the transformation is applied to everything inside the group. More...
 
LO_RESULT LOEntityGetUntransformedBounds (LOEntityRef entity, LOAxisAlignedRect2D *bounds)
 Gets the untransformed bounds of an entity. This is the bounds of the entity before its explicit transformation is applied. This function is only supported for entities that have an explicit transformation. More...
 
LO_RESULT LOEntitySetUntransformedBounds (LOEntityRef entity, const LOAxisAlignedRect2D *bounds)
 Sets the untransformed bounds of an entity. This is the bounds of the entity before its explicit transformation is applied. This function is only supported for entities that have an explicit transformation. More...
 
LO_RESULT LOEntityGetEntityType (LOEntityRef entity, LOEntityType *entity_type)
 Gets the entity type of an entity. This can be used to determine which FromEntity function to use for casting the LOEntityRef object to its specific entity object type. More...
 
LO_RESULT LOEntityGetDocument (LOEntityRef entity, LODocumentRef *document)
 Gets the document that an entity belongs to. More...
 
LO_RESULT LOEntityGetLayerInstance (LOEntityRef entity, LOLayerInstanceRef *layer_instance)
 Gets the layer instance that an entity is associated with. Note that groups are never associated with a layer instance. More...
 
LO_RESULT LOEntityMoveToLayer (LOEntityRef entity, LOLayerRef layer, LOPageListRef pages)
 Moves an entity to the given layer. If the layer is non-shared and the entity is is currently on a shared layer, pages must be valid and populated with the pages to move the entity to. In all other cases, pages may be an invalid object. The entity must belong to the same document as the the layer and the pages. More...
 
LO_RESULT LOEntityListMoveToLayer (LOEntityListRef entities, LOLayerRef layer, LOPageListRef pages)
 Moves a list of entities to the given layer. If the layer is non-shared and any entity is on a shared layer, pages must be valid and populated with the pages to move the entities to. In all other cases, pages may be an invalid object. The entities must belong to the same document as the layer and pages. More...
 
LO_RESULT LOEntityGetPage (LOEntityRef entity, LOPageRef *page)
 Gets the page that an entity belongs to. This function will only succeed if the entity is on a non-shared layer. More...
 
LO_RESULT LOEntityIsInGroup (LOEntityRef entity, bool *is_in_group)
 Gets whether or not this entity belongs to a group. More...
 
LO_RESULT LOEntityGetContainingGroup (LOEntityRef entity, LOGroupRef *group)
 Gets the group that an entity belongs to. More...
 
LO_RESULT LOEntityMoveToGroup (LOEntityRef entity, LOGroupRef group)
 Moves an entity into a group. If the entity is already in a group, it will be removed from that group prior to being added to the new group. If this action results in the old group containing only one entity, the old group will be collapsed and the remaining entity will be moved to the old group's parent. More...
 
LO_RESULT LOEntityGetStyle (LOEntityRef entity, LOStyleRef style)
 Gets the style of an entity. More...
 
LO_RESULT LOEntitySetStyle (LOEntityRef entity, LOStyleRef style)
 Sets the style of an entity. More...
 
LO_RESULT LOEntityIsOnSharedLayer (LOEntityRef entity, bool *is_on_shared_layer)
 Gets whether or not an entity is on a shared layer. This function works for all entity types, including groups. Groups do not belong to a specific layer, but their children are all on either a shared or non-shared layer. More...
 
LO_RESULT LOEntityGetLocked (LOEntityRef entity, bool *is_locked)
 Gets whether an entity is locked. More...
 
LO_RESULT LOEntitySetLocked (LOEntityRef entity, bool lock)
 Sets an entity to be locked or unlocked. More...
 

Enumeration Type Documentation

Defines the different types of entities that may exist in a document.

Enumerator
LOEntityType_FormattedText 

The entity is a LOFormattedTextRef.

LOEntityType_Group 

The entity is a LOGroupRef.

LOEntityType_Image 

The entity is a LOImageRef.

LOEntityType_LinearDimension 

The entity is a LOLinearDimensionRef.

LOEntityType_Path 

The entity is a LOPathRef.

LOEntityType_Rectangle 

The entity is a LORectangleRef.

LOEntityType_SketchUpModel 

The entity is a LOSketchUpModelRef.

LOEntityType_Ellipse 

The entity is a LOEllipseRef.

LOEntityType_Label 

The entity is a LOLabelRef.

LOEntityType_Table 

The entity is a LOTableRef.

LOEntityType_AngularDimension 

The entity is a LOAngularDimensionRef.

LONumEntityTypes 

Function Documentation

LO_RESULT LOEntityApplyTransform ( LOEntityRef  entity,
const LOTransformMatrix2D transform_matrix 
)

Applies a transformation to an entity. This works for all types of entities, regardless of whether or not they have an explicit transformation. It even works on groups, in which case the transformation is applied to everything inside the group.

Returns
LO_RESULT LOEntityGetAxisAlignedBounds ( LOEntityRef  entity,
LOAxisAlignedRect2D bounds 
)

Gets the bounds of an entity in the x and y axis of the page.

Returns
Parameters
[in]entityThe entity object.
[out]boundsThe bounds of the entity.
LO_RESULT LOEntityGetContainingGroup ( LOEntityRef  entity,
LOGroupRef group 
)

Gets the group that an entity belongs to.

Parameters
[in]entityThe entity object.
[out]groupThe group object.
Returns
LO_RESULT LOEntityGetDocument ( LOEntityRef  entity,
LODocumentRef document 
)

Gets the document that an entity belongs to.

Parameters
[in]entityThe entity object.
[out]documentThe document object.
Returns
LO_RESULT LOEntityGetEntityType ( LOEntityRef  entity,
LOEntityType entity_type 
)

Gets the entity type of an entity. This can be used to determine which FromEntity function to use for casting the LOEntityRef object to its specific entity object type.

Parameters
[in]entityThe entity object.
[out]entity_typeThe entity type.
Returns
LO_RESULT LOEntityGetExplicitTransform ( LOEntityRef  entity,
LOTransformMatrix2D transform_matrix 
)

Gets the explicit transformation for an entity. This function is only supported for entities that have an explicit transformation.

Returns
LO_RESULT LOEntityGetLayerInstance ( LOEntityRef  entity,
LOLayerInstanceRef layer_instance 
)

Gets the layer instance that an entity is associated with. Note that groups are never associated with a layer instance.

Parameters
[in]entityThe entity object.
[out]layer_instanceThe layer instance object.
Returns
LO_RESULT LOEntityGetLocked ( LOEntityRef  entity,
bool *  is_locked 
)

Gets whether an entity is locked.

Since
LayOut 2018, API 3.0
Parameters
[in]entityThe entity object.
[out]is_lockedWhether the entity is locked or unlocked.
Returns
LO_RESULT LOEntityGetOrientedBounds ( LOEntityRef  entity,
LOOrientedRect2D bounds 
)

Gets a rectangle that bounds an entity. The rectangle returned by this function may not be aligned with the page axis if the entity has an explicit transformation.

Parameters
[in]entityThe entity object.
[out]boundsThe oriented bounds of the entity.
Returns
LO_RESULT LOEntityGetPage ( LOEntityRef  entity,
LOPageRef page 
)

Gets the page that an entity belongs to. This function will only succeed if the entity is on a non-shared layer.

Parameters
[in]entityThe entity object.
[out]pageThe page object.
Returns
LO_RESULT LOEntityGetStyle ( LOEntityRef  entity,
LOStyleRef  style 
)

Gets the style of an entity.

Parameters
[in]entityThe entity object.
[out]styleThe style object.
Returns
LO_RESULT LOEntityGetUntransformedBounds ( LOEntityRef  entity,
LOAxisAlignedRect2D bounds 
)

Gets the untransformed bounds of an entity. This is the bounds of the entity before its explicit transformation is applied. This function is only supported for entities that have an explicit transformation.

Parameters
[in]entityThe entity object.
[out]boundsThe untransformed bounds.
Returns
LO_RESULT LOEntityHasExplicitTransform ( LOEntityRef  entity,
bool *  has_transform 
)

Gets whether or not an entity has an explicit transformation. The following types of entities will always have an explicit transformation: LOFormattedTextRef, LOImageRef, LORectangleRef, LOSketchUpModelRef and LOEllipseRef.

Parameters
[in]entityThe entity object.
[out]has_transformWhether the entity has an explicit transformation.
Returns
LO_RESULT LOEntityIsInGroup ( LOEntityRef  entity,
bool *  is_in_group 
)

Gets whether or not this entity belongs to a group.

Parameters
[in]entityThe entity object.
[out]is_in_groupWhether the entity is in a group.
Returns
LO_RESULT LOEntityIsOnSharedLayer ( LOEntityRef  entity,
bool *  is_on_shared_layer 
)

Gets whether or not an entity is on a shared layer. This function works for all entity types, including groups. Groups do not belong to a specific layer, but their children are all on either a shared or non-shared layer.

Parameters
[in]entityThe entity object.
[out]is_on_shared_layerWhether the entity is on a shared layer.
Returns
LO_RESULT LOEntityListMoveToLayer ( LOEntityListRef  entities,
LOLayerRef  layer,
LOPageListRef  pages 
)

Moves a list of entities to the given layer. If the layer is non-shared and any entity is on a shared layer, pages must be valid and populated with the pages to move the entities to. In all other cases, pages may be an invalid object. The entities must belong to the same document as the layer and pages.

Parameters
[in]entitiesThe entity object.
[in]layerThe layer definition object.
[in]pagesThe page list object.
Returns
LO_RESULT LOEntityMoveToGroup ( LOEntityRef  entity,
LOGroupRef  group 
)

Moves an entity into a group. If the entity is already in a group, it will be removed from that group prior to being added to the new group. If this action results in the old group containing only one entity, the old group will be collapsed and the remaining entity will be moved to the old group's parent.

Parameters
[in]entityThe entity object.
[in]groupThe group object.
Returns
LO_RESULT LOEntityMoveToLayer ( LOEntityRef  entity,
LOLayerRef  layer,
LOPageListRef  pages 
)

Moves an entity to the given layer. If the layer is non-shared and the entity is is currently on a shared layer, pages must be valid and populated with the pages to move the entity to. In all other cases, pages may be an invalid object. The entity must belong to the same document as the the layer and the pages.

Parameters
[in]entityThe entity object.
[in]layerThe layer definition object.
[in]pagesThe page list object.
Returns
LO_RESULT LOEntitySetLocked ( LOEntityRef  entity,
bool  lock 
)

Sets an entity to be locked or unlocked.

Since
LayOut 2018, API 3.0
Parameters
[in]entityThe entity object.
[in]lockWhether the entity should be locked or unlocked.
Returns
LO_RESULT LOEntitySetStyle ( LOEntityRef  entity,
LOStyleRef  style 
)

Sets the style of an entity.

Parameters
[in]entityThe entity object.
[out]styleThe style object.
Returns
LO_RESULT LOEntitySetUntransformedBounds ( LOEntityRef  entity,
const LOAxisAlignedRect2D bounds 
)

Sets the untransformed bounds of an entity. This is the bounds of the entity before its explicit transformation is applied. This function is only supported for entities that have an explicit transformation.

Parameters
[in]entityThe entity object.
[in]boundsThe untransformed bounds.
Returns