Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

scriptup

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scriptup - npm Package Compare versions

Comparing version
2024.0.5
to
2024.0.6
sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

+117
// Copyright 2014-2022 Trimble Inc. All Rights Reserved.
#ifndef LAYOUT_APPLICATION_APPLICATION_H_
#define LAYOUT_APPLICATION_APPLICATION_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOApplicationRef
@brief Encapsulates a LayOut application.
@since LayOut 2018, API 3.0
*/
DEFINE_SU_TYPE(LOApplicationRef)
#pragma pack(push, 8)
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the application instance.
@since LayOut 2018, API 3.0
@param[out] app The application instance.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NO_DATA if we are not running inside an instance of the LayOut
application
*/
LO_RESULT LOApplicationGetApplication(LOApplicationRef* app);
/**
@brief Gets a reference to the active document.
@since LayOut 2018, API 3.0
@param[in] app The application instance.
@param[out] document The active document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if app is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
*/
LO_RESULT LOApplicationGetActiveDocument(LOApplicationRef app, LODocumentRef* document);
/**
@brief Gets the major/minor version number as a string.
@since LayOut 2018, API 3.0
@param[in] app The application instance.
@param[out] version The current version of the application.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if app is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if version is NULL
*/
LO_RESULT LOApplicationGetVersion(LOApplicationRef app, SUStringRef* version);
/**
@brief Gets the major/minor version number as an unsigned integer.
@since LayOut 2018, API 3.0
@param[in] app The application instance.
@param[out] version The current version of the application.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if app is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if version is NULL
*/
LO_RESULT LOApplicationGetVersionNumber(LOApplicationRef app, unsigned int* version);
/**
@brief Gets whether the application is connected to the internet.
@since LayOut 2018, API 3.0
@param[in] app The application instance.
@param[out] is_online True if the application is connected to the internet.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if app is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_online is NULL
*/
LO_RESULT LOApplicationGetOnline(LOApplicationRef app, bool* is_online);
/**
@brief Opens the LayOut document located at the given file path.
@since LayOut 2018, API 3.0
@param[in] app The application instance.
@param[in] file_path The full file path to the .layout document to open.
@param[out] document A reference to the opened document if successful.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if app is not a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if file_path is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
- \ref SU_ERROR_SERIALIZATION if the document fails to open
*/
LO_RESULT LOApplicationOpenDocument(
LOApplicationRef app, const char* file_path, LODocumentRef* document);
/**
@brief Quits the application.
@since LayOut 2018, API 3.0
@param[in] app The application instance.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if app is not a valid object
*/
LO_RESULT LOApplicationQuit(LOApplicationRef app);
#ifdef __cplusplus
} // extern "C" {
#endif
#pragma pack(pop)
#endif // LAYOUT_APPLICATION_APPLICATION_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_COMMON_H_
#define LAYOUT_COMMON_H_
#define LO_EXPORT
#if (defined WIN32 || defined WIN64) && !defined LO_NO_EXPORTS
#undef LO_EXPORT
#ifdef LAYOUT_API_EXPORTS
#define LO_EXPORT __declspec(dllexport)
#else
#define LO_EXPORT __declspec(dllimport)
#endif // LAYOUT_API_EXPORTS
#endif // WINDOWS
#include <SketchUpAPI/common.h>
#include <SketchUpAPI/unicodestring.h>
#define LO_RESULT LO_EXPORT SUResult
#endif // LAYOUT_COMMON_H_
// Copyright 2015 Trimble Navigation Ltd., All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_GEOMETRY_GEOMETRY_H_
#define LAYOUT_GEOMETRY_GEOMETRY_H_
#include <SketchUpAPI/geometry.h>
#pragma pack(push, 8)
/**
@typedef LOPoint2D
@brief Represents a point in 2-dimensional paper space.
*/
typedef SUPoint2D LOPoint2D;
/**
@typedef LOPoint3D
@brief Represents a point in 3-dimensional model space.
*/
typedef SUPoint3D LOPoint3D;
/**
@typedef LOVector2D
@brief Represents a vector in 2-dimensional paper space.
@since LayOut 2017, API 2.0
*/
typedef SUVector2D LOVector2D;
/**
@struct LOAxisAlignedRect2D
@brief Represents a 2D rectangle that is aligned with the X and Y axis of the
coordinate system.
*/
typedef SUAxisAlignedRect2D LOAxisAlignedRect2D;
/**
@struct LOOrientedRect2D
@brief Represents a 2D rectangle that might be rotated. Each corner of the
rectangle is represented by a separate 2D point.
*/
struct LOOrientedRect2D {
LOPoint2D upper_left;
LOPoint2D upper_right;
LOPoint2D lower_right;
LOPoint2D lower_left;
};
/**
@struct LOTransformMatrix2D
@brief 2x3 matrix for representing 2D transforms on LayOut entities. The matrix
is stored in column-major format:
<pre>
m11 m21 tx
m12 m22 ty
</pre>
*/
typedef SUTransformation2D LOTransformMatrix2D;
/**
@typedef LOPoint2D
@brief Represents a size in 2D space.
*/
typedef LOPoint2D LOSize2D;
/**
@struct LORect2D
@brief Represents a 2D rectangle.
*/
struct LORect2D {
LOPoint2D origin;
LOSize2D size;
};
#pragma pack(pop)
#endif // LAYOUT_GEOMETRY_GEOMETRY_H_
// Copyright 2015 Trimble Navigation Ltd. All Rights Reserved
#ifndef LAYOUT_INITIALIZE_H_
#define LAYOUT_INITIALIZE_H_
#include <LayOutAPI/common.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
@brief Initializes the LayOut C API interface. Must be called before calling any
other API function.
*/
LO_EXPORT void LOInitialize();
/**
@brief Signals termination of use of the LayOut C API interface. Must be called
when done using API functions.
*/
LO_EXPORT void LOTerminate();
/**
@brief Returns the major and minor API version numbers.
@param[out] major The major version number retrieved.
@param[out] minor The minor version number retrieved.
*/
LO_EXPORT void LOGetAPIVersion(size_t* major, size_t* minor);
#ifdef __cplusplus
} // extern "C" {
#endif
#endif // LAYOUT_INITIALIZE_H_
// Copyright 2015-2022 Trimble Inc. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_LAYOUT_H_
#define LAYOUT_LAYOUT_H_
/*
* The purpose of this file is to include all of the files needed to use the
* C API.
*/
#include <LayOutAPI/common.h>
#include <LayOutAPI/initialize.h>
#include <LayOutAPI/application/application.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/angulardimension.h>
#include <LayOutAPI/model/autotextdefinition.h>
#include <LayOutAPI/model/autotextdefinitionlist.h>
#include <LayOutAPI/model/connectionpoint.h>
#include <LayOutAPI/model/defs.h>
#include <LayOutAPI/model/dictionary.h>
#include <LayOutAPI/model/document.h>
#include <LayOutAPI/model/documentexportoptions.h>
#include <LayOutAPI/model/ellipse.h>
#include <LayOutAPI/model/entity.h>
#include <LayOutAPI/model/entityiterator.h>
#include <LayOutAPI/model/entitylist.h>
#include <LayOutAPI/model/formattedtext.h>
#include <LayOutAPI/model/grid.h>
#include <LayOutAPI/model/group.h>
#include <LayOutAPI/model/image.h>
#include <LayOutAPI/model/imagerep.h>
#include <LayOutAPI/model/label.h>
#include <LayOutAPI/model/layer.h>
#include <LayOutAPI/model/layerinstance.h>
#include <LayOutAPI/model/layerlist.h>
#include <LayOutAPI/model/lineardimension.h>
#include <LayOutAPI/model/page.h>
#include <LayOutAPI/model/pageinfo.h>
#include <LayOutAPI/model/pagelist.h>
#include <LayOutAPI/model/path.h>
#include <LayOutAPI/model/rectangle.h>
#include <LayOutAPI/model/referenceentity.h>
#include <LayOutAPI/model/sketchupmodel.h>
#include <LayOutAPI/model/style.h>
#include <LayOutAPI/model/table.h>
#include <LayOutAPI/model/typed_value.h>
#endif // LAYOUT_LAYOUT_H_
// Copyright 2016 Trimble Navigation Ltd. All Rights Reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_ANGULARDIMENSION_H_
#define LAYOUT_MODEL_ANGULARDIMENSION_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOAngularDimensionRef
@brief References an angular dimension entity. An angular dimension is composed
of the following sub-entities:
- two 'extension lines' that extend from the entity being dimensioned.
- a 'dimension line' connecting the ends of the leaders.
(this may be represented by one or two paths depending on appearance.)
- an optional 'leader line' that is used for small dimensions.
- a 'dimension text' that displays the dimension's text.
There are seven points that may be modified for an angular dimension:
- two 'connection points' that define the start and end of the
dimension.
- two 'extent points' that define the start and end of the dimension
line and are the ends of the two extension lines.
- two 'offset points' that define the starting points of the extension
lines.
- one 'arc center point' that defines the center of the dimension, where
the extension lines intersect.
@since LayOut 2017, API 2.0
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@enum LOAngularDimensionLeaderLineType
@brief Defines the different types of leader lines for an angular dimension
entity.
@since LayOut 2017, API 2.0
*/
typedef enum {
LOAngularDimensionLeaderLineType_SingleSegment = 0, ///< Single segment leader line.
LOAngularDimensionLeaderLineType_TwoSegment, ///< Two segment leader line.
LOAngularDimensionLeaderLineType_Bezier, ///< Curved Bezier leader line.
LOAngularDimensionLeaderLineType_Hidden, ///< No visible leader line.
LONumAngularDimensionLeaderLineTypes
} LOAngularDimensionLeaderLineType;
/**
@brief Creates a new disconnected angular dimension object. The arc center point
is defined implicitly by the intersection of the two extension lines, and
the radius is defined implicitly by the distance of the extent points
from the arc center point. If the extent points are not equidistant from
the arc center point, then the end extent point is adjusted
automatically.
@since LayOut 2017, API 2.0
@param[out] dimension The angular dimension object
@param[in] start_point Where the dimension should start
@param[in] end_point Where the dimension should end
@param[in] start_extent_point The extent point where the dimension line should
start
@param[in] end_extent_point The extent point where the dimension line should
end
@param[in] inner_angle Whether or not the dimension should measure the
inner angle. If false, it will measure the outer
angle.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if dimension is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *dimension already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if start_point is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if end_point is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if start_extent_point is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if end_extent_point is NULL
*/
LO_RESULT LOAngularDimensionCreate(
LOAngularDimensionRef* dimension, const LOPoint2D* start_point, const LOPoint2D* end_point,
const LOPoint2D* start_extent_point, const LOPoint2D* end_extent_point, bool inner_angle);
/**
@brief Adds a reference to an angular dimension object.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
*/
LO_RESULT LOAngularDimensionAddReference(LOAngularDimensionRef dimension);
/**
@brief Releases an angular dimension object. The object will be invalidated if
releasing the last reference.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if dimension is NULL
- \ref SU_ERROR_INVALID_INPUT if *dimension does not refer to a valid object
*/
LO_RESULT LOAngularDimensionRelease(LOAngularDimensionRef* dimension);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOAngularDimensionRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOAngularDimensionRef.
@since LayOut 2017, API 2.0
@param[in] entity The entity object.
@return
- The converted \ref LOAngularDimensionRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOAngularDimensionRef LOAngularDimensionFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOAngularDimensionRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@return
- The converted \ref LOEntityRef if dimension is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOAngularDimensionToEntity(LOAngularDimensionRef dimension);
/**
@brief Creates the entities that represent the dimension in its exploded form
and adds them to a \ref LOEntityListRef. It is NOT necessary to
explicitly release these entities, since \ref LOEntityListRef itself
adds a reference to the entities and will release them when they are
removed from the list or when the list is released. Depending on the
appearance of the dimension being exploded, this may return anywhere from
four to six entities. Start extension line, end extension line,
one or two dimension lines, dimension text, optional leader line.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] entity_list The entity list object to add the new entities to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
*/
LO_RESULT LOAngularDimensionGetExplodedEntities(
LOAngularDimensionRef dimension, LOEntityListRef entity_list);
/**
@brief Gets whether or not the dimension text uses custom text. When
true, the dimension text will display a custom string that doesn't
change. When false, the dimension text will display the length
measurement and will update automatically.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] use_custom_text Whether the dimension uses custom text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if use_auto_text is NULL
*/
LO_RESULT LOAngularDimensionGetUsesCustomText(
LOAngularDimensionRef dimension, bool* use_custom_text);
/**
@brief Sets whether or not the dimension text uses custom text. When true, the
dimension text will display a custom string that doesn't change. When
false, the dimension text will display the length measurement and will
update automatically.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] use_custom_text Whether or not the dimension should use custom text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetUsesCustomText(
LOAngularDimensionRef dimension, bool use_custom_text);
/**
@brief Creates a copy of the dimension text's \ref LOFormattedTextRef object.
@note With the addition of auto-text in dimensions for LayOut 2019.2, the
copy of the dimension text incorrectly provided the plain text when
requesting the display text. This has been fixed in LayOut 2020.1, API 5.1.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] text The formatted text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *text already refers to a valid object
*/
LO_RESULT LOAngularDimensionCreateDimensionTextCopy(
LOAngularDimensionRef dimension, LOFormattedTextRef* text);
/**
@brief Sets the text of the dimension from a \ref LOFormattedTextRef object.
The dimension lines may be adjusted if the text has been re-positioned.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] text The formatted text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetDimensionText(
LOAngularDimensionRef dimension, LOFormattedTextRef text);
/**
@brief Gets the type of leader line the angular dimension is using.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] leader_line_type The leader line type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if leader_line_type is NULL
*/
LO_RESULT LOAngularDimensionGetLeaderLineType(
LOAngularDimensionRef dimension, LOAngularDimensionLeaderLineType* leader_line_type);
/**
@brief Sets the type of leader line the angular dimension is using. New control
points will be generated if changing to a two segment or bezier leader
line type. Setting the leader line type to \ref
LOAngularDimensionLeaderLineType_Hidden will not move the dimension text.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] leader_line_type The leader line type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if leader_line_type is not a valid value
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetLeaderLineType(
LOAngularDimensionRef dimension, LOAngularDimensionLeaderLineType leader_line_type);
/**
@brief Gets the page location for the first connection.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] point The position of the first connection point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOAngularDimensionGetStartConnectionPoint(
LOAngularDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the page location for the first connection.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] point The position for the first connection point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetStartConnectionPoint(
LOAngularDimensionRef dimension, const LOPoint2D* point);
/**
@brief Gets the page location for the second connection.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] point The position of the second control point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOAngularDimensionGetEndConnectionPoint(
LOAngularDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the page location for the second connection.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] point The position for the second control point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetEndConnectionPoint(
LOAngularDimensionRef dimension, const LOPoint2D* point);
/**
@brief Gets the page location for the start of the dimension line.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] point The position of the start of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOAngularDimensionGetStartExtentPoint(LOAngularDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the page location for the start of the dimension line. This will
also adjust the end of the dimension line to maintain the correct
dimension line length.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] point The position of the start of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetStartExtentPoint(
LOAngularDimensionRef dimension, const LOPoint2D* point);
/**
@brief Gets the page location for the end of the dimension line.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] point The position of the end of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOAngularDimensionGetEndExtentPoint(LOAngularDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the page location for the end of the dimension line. This will
also adjust the start of the dimension line to maintain the correct
dimension line length.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] point The position of the end of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetEndExtentPoint(
LOAngularDimensionRef dimension, const LOPoint2D* point);
/**
@brief Gets the page location for the start of the first extension line. The
first extension line runs from this offset point to the start extent
point.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] point The position of the start of the extension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOAngularDimensionGetStartOffsetPoint(LOAngularDimensionRef dimension, LOPoint2D* point);
/**
@brief Gets the page location for the start of the second extension line. The
second extension line runs from this offset point to the end extent
point.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] point The position of the end of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOAngularDimensionGetEndOffsetPoint(LOAngularDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the length of the offset from the first connection point to the
start of the first extension line. The connection and extent points will
not move.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] length The length the offset to the extension line should be.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetStartOffsetLength(LOAngularDimensionRef dimension, double length);
/**
@brief Sets the length of the offset from the second connection point to the
start of the second extension line. The connection and extent points
will not move.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] length The length the offset to the extension line should be.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOAngularDimensionSetEndOffsetLength(LOAngularDimensionRef dimension, double length);
/**
@brief Gets the page location for the dimension arc center point.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] point The position of the dimension arc center point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOAngularDimensionGetArcCenterPoint(LOAngularDimensionRef dimension, LOPoint2D* point);
/**
@brief Gets the angular dimension's radius. This is the distance from the arc
center point to the dimension line.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] radius The dimension radius.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if radius is NULL
*/
LO_RESULT LOAngularDimensionGetRadius(LOAngularDimensionRef dimension, double* radius);
/**
@brief Sets the angular dimension's radius. This is the distance from the arc
center point to the dimension line.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[in] radius The dimension radius.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
- \ref SU_ERROR_OUT_OF_RANGE if radius is less than or equal to zero
*/
LO_RESULT LOAngularDimensionSetRadius(LOAngularDimensionRef dimension, double radius);
/**
@brief Gets the angular dimension's angle. The angle is represented in radians.
@since LayOut 2017, API 2.0
@param[in] dimension The angular dimension object.
@param[out] angle The dimension angle.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if angle is NULL
*/
LO_RESULT LOAngularDimensionGetAngle(LOAngularDimensionRef dimension, double* angle);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_ANGULARDIMENSION_H_
// Copyright 2016-2022 Trimble Inc. All Rights Reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_AUTOTEXTDEFINITION_H_
#define LAYOUT_MODEL_AUTOTEXTDEFINITION_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOAutoTextDefinitionRef
@brief References an auto-text definition.
@since LayOut 2017, API 2.0
*/
/**
@enum LOAutoTextDefinitionType
@brief Defines the different types of auto-text.
@since LayOut 2017, API 2.0
*/
typedef enum {
LOAutoTextDefinitionType_File = 0,
LOAutoTextDefinitionType_PageName,
LOAutoTextDefinitionType_PageNumber,
LOAutoTextDefinitionType_CustomText,
LOAutoTextDefinitionType_DateCurrent,
LOAutoTextDefinitionType_DateCreated,
LOAutoTextDefinitionType_DateModified,
LOAutoTextDefinitionType_DatePublished,
// Mandatory types
LOAutoTextDefinitionType_ModelGroupName,
LOAutoTextDefinitionType_ModelComponentInstanceName,
LOAutoTextDefinitionType_ModelComponentDefinitionName,
LOAutoTextDefinitionType_ModelComponentDescription,
LOAutoTextDefinitionType_ModelVolume,
LOAutoTextDefinitionType_ModelFaceArea,
LOAutoTextDefinitionType_ModelEdgeLength,
LOAutoTextDefinitionType_ModelCoordinates,
LOAutoTextDefinitionType_ModelDynamicComponentAttribute,
LOAutoTextDefinitionType_ModelClassifierAttribute,
LOAutoTextDefinitionType_ModelComponentInstanceAttribute,
LOAutoTextDefinitionType_ModelComponentDefinitionAttribute,
// @since LayOut 2022.0, API 7.0
LOAutoTextDefinitionType_ModelSceneName,
LOAutoTextDefinitionType_ModelSceneDescription,
LOAutoTextDefinitionType_ModelScale,
LOAutoTextDefinitionType_ModelSectionName,
LOAutoTextDefinitionType_ModelSectionSymbol,
LOAutoTextDefinitionType_PageCount,
LOAutoTextDefinitionType_Sequence,
LOAutoTextDefinitionType_ModelRatio,
// Must be last to give us a count of the number of types.
LOAutoTextDefinitionType_Count
} LOAutoTextDefinitionType;
/**
@enum LOAutoTextDefinitionNumberingStyle
@brief An enumeration of the different styles of page numbers we support.
@since LayOut 2017, API 2.0
*/
typedef enum {
LOAutoTextDefinitionNumberingStyle_Arabic = 0,
LOAutoTextDefinitionNumberingStyle_ArabicPadded,
LOAutoTextDefinitionNumberingStyle_UCAlpha,
LOAutoTextDefinitionNumberingStyle_LCAlpha,
LOAutoTextDefinitionNumberingStyle_UCRoman,
LOAutoTextDefinitionNumberingStyle_LCRoman,
// Must be last to give us a count of styles.
LOAutoTextDefinitionNumberingStyle_Count
} LOAutoTextDefinitionNumberingStyle;
/**
@enum LOAutoTextDefinitionSequenceType
@brief An enumeration of the different types of auto-text sequencing.
@since LayOut 2023.0, API 8.0
*/
typedef enum {
LOAutoTextDefinitionSequenceType_PerDocument = 0,
LOAutoTextDefinitionSequenceType_PerPage,
// Must be last to give us a count of sequence types.
LOAutoTextDefinitionSequenceType_Count
} LOAutoTextDefinitionSequenceType;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the type of the specified auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] type The auto-text definition type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if type is NULL
*/
LO_RESULT LOAutoTextDefinitionGetType(
LOAutoTextDefinitionRef autotext, LOAutoTextDefinitionType* type);
/**
@brief Gets whether the specified auto-text definition is a mandatory definition.
Mandatory auto-text definitions may not be removed from a document, and
they may not be created through the API, but they may be modified.
@since LayOut 2018, API 3.0
@param[in] autotext The auto-text definition object.
@param[out] is_mandatory Whether it is a mandatory auto-text definition.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_mandatory is NULL
*/
LO_RESULT LOAutoTextDefinitionGetMandatory(LOAutoTextDefinitionRef autotext, bool* is_mandatory);
/**
@brief Returns the document that this auto-text definition belongs to.
@since LayOut 2018, API 3.0
@param[in] autotext The auto-text definition object.
@param[out] document The document object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
*/
LO_RESULT LOAutoTextDefinitionGetDocument(
LOAutoTextDefinitionRef autotext, LODocumentRef* document);
/**
@brief Gets the name of the specified auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] name The auto-text definition name string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
*/
LO_RESULT LOAutoTextDefinitionGetName(LOAutoTextDefinitionRef autotext, SUStringRef* name);
/**
@brief Sets the name of the specified auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] name The auto-text definition name string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if autotext is a mandatory definition
- \ref SU_ERROR_DUPLICATE if name is the name of an existing definition
- \ref SU_ERROR_UNSUPPORTED if name is an empty string
*/
LO_RESULT LOAutoTextDefinitionSetName(LOAutoTextDefinitionRef autotext, const char* name);
/**
@brief Gets the tag string of the specified auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] tag The auto-text definition tag string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if tag is NULL
*/
LO_RESULT LOAutoTextDefinitionGetTag(LOAutoTextDefinitionRef autotext, SUStringRef* tag);
/**
@brief Gets the index of the specified auto-text definition.
@since LayOut 2018, API 3.0
@param[in] autotext The auto-text definition object.
@param[out] index The index of the auto-text definition.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if index is NULL
*/
LO_RESULT LOAutoTextDefinitionGetIndex(LOAutoTextDefinitionRef autotext, size_t* index);
/**
@brief Gets the text string of the specified custom auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] custom_text The auto-text definition custom text string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if custom_text is NULL
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not that of custom text
*/
LO_RESULT LOAutoTextDefinitionGetCustomText(
LOAutoTextDefinitionRef autotext, SUStringRef* custom_text);
/**
@brief Sets the text string of the specified custom auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[in] custom_text The auto-text definition custom text string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not that of custom text
*/
LO_RESULT LOAutoTextDefinitionSetCustomText(
LOAutoTextDefinitionRef autotext, const char* custom_text);
/**
@brief Gets the date format string of the specified date auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] date_format The auto-text definition date format string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if date_format is NULL
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not a date type
*/
LO_RESULT LOAutoTextDefinitionGetDateFormat(
LOAutoTextDefinitionRef autotext, SUStringRef* date_format);
/**
@brief Sets the date format string of the specified date auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[in] date_format The auto-text definition date format string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not a date type
*/
LO_RESULT LOAutoTextDefinitionSetDateFormat(
LOAutoTextDefinitionRef autotext, const char* date_format);
/**
@brief Gets a boolean signifying if the full path is displayed for the specified
file auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[in] is_display_full_path Boolean signifying if the full path is being
displayed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_display_full_path is NULL
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not a file type
*/
LO_RESULT LOAutoTextDefinitionGetDisplayFullPath(
LOAutoTextDefinitionRef autotext, bool* is_display_full_path);
/**
@brief Sets whether the full path is displayed for the specified file auto-text
definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[in] is_display_full_path Boolean signifying if the full path is being
displayed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not a file type
*/
LO_RESULT LOAutoTextDefinitionSetDisplayFullPath(
LOAutoTextDefinitionRef autotext, bool is_display_full_path);
/**
@brief Gets a boolean signifying if the file extension is displayed for the
specified file auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[in] is_display_file_ext Boolean signifying if the full path is being
displayed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_display_file_ext is NULL
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not a file type
*/
LO_RESULT LOAutoTextDefinitionGetDisplayFileExtension(
LOAutoTextDefinitionRef autotext, bool* is_display_file_ext);
/**
@brief Sets whether the file extension is displayed for the specified file auto
text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[in] is_display_file_ext Boolean signifying if the full path is being
displayed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not a file type
*/
LO_RESULT LOAutoTextDefinitionSetDisplayFileExtension(
LOAutoTextDefinitionRef autotext, bool is_display_file_ext);
/**
@brief Gets the numbering style of the specified page number auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] numbering_style The style of numbering.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p numbering_style is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page number
*/
SU_DEPRECATED_FUNCTION("LayOut API 7.0")
LO_RESULT LOAutoTextDefinitionGetPageNumberStyle(
LOAutoTextDefinitionRef autotext, LOAutoTextDefinitionNumberingStyle* numbering_style);
/**
@brief Sets the numbering style of the specified page number auto-text definition.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] numbering_style The style of numbering.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if \p numbering_style is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page number
*/
SU_DEPRECATED_FUNCTION("LayOut API 7.0")
LO_RESULT LOAutoTextDefinitionSetPageNumberStyle(
LOAutoTextDefinitionRef autotext, LOAutoTextDefinitionNumberingStyle numbering_style);
/**
@brief Gets the index at which the auto-text definition starts numbering.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] start_index The starting index.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p start_index is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page number
*/
SU_DEPRECATED_FUNCTION("LayOut API 7.0")
LO_RESULT LOAutoTextDefinitionGetPageNumberStartIndex(
LOAutoTextDefinitionRef autotext, int* start_index);
/**
@brief Sets the value at which to start counting.
@since LayOut 2017, API 2.0
@param[in] autotext The auto-text definition object.
@param[out] value The number at which to start counting.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if \p value is NULL
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not a page number
*/
SU_DEPRECATED_FUNCTION("LayOut API 7.0")
LO_RESULT LOAutoTextDefinitionSetPageNumberStartIndex(LOAutoTextDefinitionRef autotext, int value);
/**
@brief Gets the page that the page number or page count auto-text definition starts numbering on.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@param[out] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p page is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page number, page count, or sequence
*/
LO_RESULT LOAutoTextDefinitionGetStartPage(LOAutoTextDefinitionRef autotext, LOPageRef* page);
/**
@brief Sets the page that the page number or page count auto-text definition starts numbering on.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@param[in] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if \p page does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page number or page count
*/
LO_RESULT LOAutoTextDefinitionSetStartPage(LOAutoTextDefinitionRef autotext, LOPageRef page);
/**
@brief Gets the page the page count auto-text definition stops counting at. page may be returned as
SU_INVALID, which indicates that the auto-text uses the last page in the document.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@param[out] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p page is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page count
*/
LO_RESULT LOAutoTextDefinitionGetEndPage(LOAutoTextDefinitionRef autotext, LOPageRef* page);
/**
@brief Sets the page the page count auto-text definition stops counting at. This page must be after
or the same as start page. If page is SU_INVALID, then the last page in the document will
be used.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@param[in] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if \p page is a page that comes after this definition's start page
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page count
*/
LO_RESULT LOAutoTextDefinitionSetEndPage(LOAutoTextDefinitionRef autotext, LOPageRef page);
/**
@brief Gets the increment value of the specified sequence auto-text definition.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@param[out] increment The amount each sequence object increments by.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p increment is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not a sequence type
*/
LO_RESULT LOAutoTextDefinitionGetIncrement(LOAutoTextDefinitionRef autotext, int* increment);
/**
@brief Sets the increment value of the specified sequence auto-text definition.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@param[in] increment The new amount each sequence object will increment by.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not a sequence type
*/
LO_RESULT LOAutoTextDefinitionSetIncrement(LOAutoTextDefinitionRef autotext, int increment);
/**
@brief Gets the sequence format string of the specified date auto-text definition.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@param[out] sequence_format The auto-text definition sequence format string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p sequence_format is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not a sequence type
*/
LO_RESULT LOAutoTextDefinitionGetSequenceFormat(
LOAutoTextDefinitionRef autotext, SUStringRef* sequence_format);
/**
@brief Sets the format string of the specified sequence auto-text definition. If the string is
empty, the format string will be set to the default of ###.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@param[in] sequence_format The new format string for the sequence.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p sequence_format is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not a sequence type
*/
LO_RESULT LOAutoTextDefinitionSetSequenceFormat(
LOAutoTextDefinitionRef autotext, const char* sequence_format);
/**
@brief Iterates through all uses of the auto-text definition and eliminates gaps and duplicates in
the sequence.
@since LayOut 2022.0, API 7.0
@param[in] autotext The auto-text definition object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not a sequence type
*/
LO_RESULT LOAutoTextDefinitionRenumberSequence(LOAutoTextDefinitionRef autotext);
/**
@brief Gets the numbering style of the specified page number, page count, or sequence auto-text
definition.
@since LayOut 2022.0, API 7.0
@note Use this method instead of the deprecated \p LOAutoTextDefinitionGetPageNumberStyle.
@param[in] autotext The auto-text definition object.
@param[out] numbering_style The style of numbering.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p numbering_style is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page number, page count, or sequence
*/
LO_RESULT LOAutoTextDefinitionGetNumberStyle(
LOAutoTextDefinitionRef autotext, LOAutoTextDefinitionNumberingStyle* numbering_style);
/**
@brief Sets the numbering style of the specified page number, page count, or sequence auto-text
definition.
@since LayOut 2022.0, API 7.0
@note Use this method instead of the deprecated \p LOAutoTextDefinitionSetPageNumberStyle.
@param[in] autotext The auto-text definition object.
@param[in] numbering_style The style of numbering.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page number, page count, or sequence
- \ref SU_ERROR_OUT_OF_RANGE if \p numbering_style is not a valid numbering style
*/
LO_RESULT LOAutoTextDefinitionSetNumberStyle(
LOAutoTextDefinitionRef autotext, LOAutoTextDefinitionNumberingStyle numbering_style);
/**
@brief Gets the index at which the auto-text definition starts numbering.
@since LayOut 2022.0, API 7.0
@note Use this method instead of the deprecated \p LOAutoTextDefinitionGetPageNumberStartIndex.
@param[in] autotext The auto-text definition object.
@param[out] start_index The starting index.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p start_index is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not page number, page count, or sequence
*/
LO_RESULT LOAutoTextDefinitionGetStartIndex(LOAutoTextDefinitionRef autotext, int* start_index);
/**
@brief Sets the value at which to start counting.
@since LayOut 2022.0, API 7.0
@note Use this method instead of the deprecated \p LOAutoTextDefinitionGetPageNumberStartIndex.
@param[in] autotext The auto-text definition object.
@param[in] value The number at which to start counting.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if autotext's type is not a page number, page count, or sequence type
*/
LO_RESULT LOAutoTextDefinitionSetStartIndex(LOAutoTextDefinitionRef autotext, int value);
/**
@brief Gets the sequence type of the specified sequence auto-text definition.
@since LayOut 2023.0, API 8.0
@param[in] autotext The auto-text definition object.
@param[out] sequence_type The sequencing behavior of this definition.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p sequence_type is NULL
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not sequence
*/
LO_RESULT LOAutoTextDefinitionGetSequenceType(
LOAutoTextDefinitionRef autotext, LOAutoTextDefinitionSequenceType* sequence_type);
/**
@brief Sets the sequence type of the specified sequence auto-text definition.
@since LayOut 2023.0, API 8.0
@param[in] autotext The auto-text definition object.
@param[in] sequence_type The sequencing behavior.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if \p autotext's type is not sequence
- \ref SU_ERROR_OUT_OF_RANGE if \p sequence_type is not a valid sequence type
*/
LO_RESULT LOAutoTextDefinitionSetSequenceType(
LOAutoTextDefinitionRef autotext, LOAutoTextDefinitionSequenceType sequence_type);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_AUTOTEXTDEFINITION_H_
// Copyright 2017 Trimble Inc. All Rights Reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_AUTOTEXTDEFINITIONLIST_H_
#define LAYOUT_MODEL_AUTOTEXTDEFINITIONLIST_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOAutoTextDefinitionListRef
@brief References an ordered, indexable list of \ref LOAutoTextDefinitionRef
objects.
@since LayOut 2018, API 3.0
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new empty auto-text definition list object.
@since LayOut 2018, API 3.0
@param[out] auto_text_list An empty auto-text definition list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if auto_text_list is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *auto_text_list already refers to a valid
object
*/
LO_RESULT LOAutoTextDefinitionListCreate(LOAutoTextDefinitionListRef* auto_text_list);
/**
@brief Releases an auto-text definition list object. *auto_text_list will be set
to invalid by this function.
@since LayOut 2018, API 3.0
@param[in] auto_text_list The auto-text definition list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if auto_text_list does not refer to a valid
object
- \ref SU_ERROR_INVALID_INPUT if *auto_text_list does not refer to a valid object
*/
LO_RESULT LOAutoTextDefinitionListRelease(LOAutoTextDefinitionListRef* auto_text_list);
/**
@brief Gets the number of auto-text definitions in this list.
@since LayOut 2018, API 3.0
@param[in] auto_text_list The auto-text definition list object.
@param[out] num_auto_texts The number of auto-text definition objects in the list.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if auto_text_list does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_auto_texts is NULL
*/
LO_RESULT LOAutoTextDefinitionListGetNumberOfAutoTextDefinitions(
LOAutoTextDefinitionListRef auto_text_list, size_t* num_auto_texts);
/**
@brief Gets the auto-text definition at the specified index.
@since LayOut 2018, API 3.0
@param[in] auto_text_list The auto-text definition list object.
@param[in] index The index of the auto-text definition to get.
@param[out] auto_text The auto-text definition object at index in the list.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if auto_text_list does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range for this list
- \ref SU_ERROR_NULL_POINTER_OUTPUT if auto_text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *auto_text already refers to a valid object
*/
LO_RESULT LOAutoTextDefinitionListGetAutoTextDefinitionAtIndex(
LOAutoTextDefinitionListRef auto_text_list, size_t index, LOAutoTextDefinitionRef* auto_text);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_auto_text_list_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_CONNECTIONPOINT_H_
#define LAYOUT_MODEL_CONNECTIONPOINT_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOConnectionPointRef
@brief References a connection point. A connection point defines a target
point to which a label or dimension can connect.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new connection point object for the given entity at the given
2D point.
@param[out] connection_point The connection point object.
@param[in] entity The entity object.
@param[in] point The position of the connection point.
@param[in] aperture The search radius to use when looking for geometry
to connect to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if connection_point is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *connection_point already refers to a valid
object
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if aperture is less than or equal to 0
- \ref SU_ERROR_NULL_POINTER_INPUT if point is NULL
- \ref SU_ERROR_GENERIC if the entity is not in a document
- \ref SU_ERROR_NO_DATA if no connection point could be made
*/
LO_RESULT LOConnectionPointCreate(
LOConnectionPointRef* connection_point, LOEntityRef entity, const LOPoint2D* point,
double aperture);
/**
@brief Creates a new connection point object for the given SketchUp model entity
at the given 3D point in model space. Note that connection points created
via this function will have no persistent ID assigned to them, resulting
in a connection point that does not update when geometry is modified.
@param[out] connection_point The connection point object.
@param[in] model The SketchUp model object.
@param[in] point3d The 3D position of the connection point in model
space.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if connection_point is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *connection_point already refers to a valid
object
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if point3d is NULL
- \ref SU_ERROR_GENERIC if the model is not in a document
*/
LO_RESULT LOConnectionPointCreateFromPoint3D(
LOConnectionPointRef* connection_point, LOSketchUpModelRef model, const LOPoint3D* point3d);
/**
@brief Creates a new connection point object for the given SketchUp model entity
at the given 3D point in model space. Note that connection points created
via this function have a persistent ID assigned to them, resulting in a
connection point that updates when the geometry is modified.
@note Starting in LayOut 2020.1, API 5.1, SU_ERROR_NO_DATA will be returned if
persistent_id isn't valid for the given model.
@since LO 2017, API 2.0
@param[out] connection_point The connection point object.
@param[in] model The SketchUp model object.
@param[in] point3d The 3D position of the connection point in model.
@param[in] persistent_id The PID of the entity.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if connection_point is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *connection_point already refers to a valid
object
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if point3d or persistent_id is NULL
- \ref SU_ERROR_GENERIC if the model is not in a document
- \ref SU_ERROR_NO_DATA if persistent_id does not refer to a valid path
*/
LO_RESULT LOConnectionPointCreateFromPID(
LOConnectionPointRef* connection_point, LOSketchUpModelRef model, const LOPoint3D* point3d,
const char* persistent_id);
/**
@brief Releases a connection point object. The object will be invalidated if
releasing the last reference.
@param[in] connection_point The connection point object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if connection_point is NULL
- \ref SU_ERROR_INVALID_INPUT if *connection_point does not refer to a valid
object
*/
LO_RESULT LOConnectionPointRelease(LOConnectionPointRef* connection_point);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_CONNECTIONPOINT_H_
// Copyright 2017-2022 Trimble Inc. All Rights Reserved.
#ifndef LAYOUT_MODEL_DEFS_H_
#define LAYOUT_MODEL_DEFS_H_
#include <SketchUpAPI/common.h>
#pragma pack(push, 8)
DEFINE_SU_TYPE(LOAngularDimensionRef)
DEFINE_SU_TYPE(LOAutoTextDefinitionRef)
DEFINE_SU_TYPE(LOAutoTextDefinitionListRef)
DEFINE_SU_TYPE(LOConnectionPointRef)
DEFINE_SU_TYPE(LODictionaryRef)
DEFINE_SU_TYPE(LODocumentRef)
DEFINE_SU_TYPE(LOEllipseRef)
DEFINE_SU_TYPE(LOEntityRef)
DEFINE_SU_TYPE(LOEntityIteratorRef)
DEFINE_SU_TYPE(LOEntityListRef)
DEFINE_SU_TYPE(LOFormattedTextRef)
DEFINE_SU_TYPE(LOGridRef)
DEFINE_SU_TYPE(LOGroupRef)
DEFINE_SU_TYPE(LOImageRef)
DEFINE_SU_TYPE(LOImageRepRef)
DEFINE_SU_TYPE(LOLabelRef)
DEFINE_SU_TYPE(LOLayerRef)
DEFINE_SU_TYPE(LOLayerInstanceRef)
DEFINE_SU_TYPE(LOLayerListRef)
DEFINE_SU_TYPE(LOLinearDimensionRef)
DEFINE_SU_TYPE(LOPageRef)
DEFINE_SU_TYPE(LOPageInfoRef)
DEFINE_SU_TYPE(LOPageListRef)
DEFINE_SU_TYPE(LOPathRef)
DEFINE_SU_TYPE(LORectangleRef)
DEFINE_SU_TYPE(LOSketchUpModelRef)
DEFINE_SU_TYPE(LOStyleRef)
DEFINE_SU_TYPE(LOTableRef)
DEFINE_SU_TYPE(LOTypedValueRef)
DEFINE_SU_TYPE(LOReferenceEntityRef)
#pragma pack(pop)
#endif
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_DICTIONARY_H_
#define LAYOUT_MODEL_DICTIONARY_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LODictionaryRef
@brief References a dictionary. A dictionary maps string keys to
\ref LOTypedValueRef values.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
@brief Creates an new empty dictionary object.
@param[out] dictionary The newly created dictionary object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if dictionary is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *dictionary already refers to a valid object
*/
LO_RESULT LODictionaryCreate(LODictionaryRef* dictionary);
/**
@brief Releases a dictionary object. *dictionary will be set to invalid by
this function.
@param[in] dictionary The dictionary object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if dictionary is NULL
- \ref SU_ERROR_INVALID_INPUT if *dictionary references an invalid object
*/
LO_RESULT LODictionaryRelease(LODictionaryRef* dictionary);
/**
@brief Retrieves the value associated with a given key from a dictionary.
@param[in] dictionary The dictionary object.
@param[in] key The key of the key-value pair. Assumed to be UTF-8
encoded.
@param[out] value The value retrieved. Must be a valid object, i.e.
must have been created via \ref LOTypedValueCreate.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dictionary is an invalid object
- \ref SU_ERROR_NULL_POINTER_INPUT if key is NULL
- \ref SU_ERROR_INVALID_OUTPUT if value is an invalid object
- \ref SU_ERROR_NO_DATA if there is no value associated with the given key in
the dictionary
*/
LO_RESULT LODictionaryGetValue(LODictionaryRef dictionary, const char* key, LOTypedValueRef value);
/**
@brief Inserts a key-value pair into a dictionary object.
@param[in] dictionary The dictionary object.
@param[in] key The key of the key-value pair. Assumed to be UTF-8
encoded.
@param[in] value The value of the key-value pair.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dictionary or value is an invalid object
- \ref SU_ERROR_NULL_POINTER_INPUT if key is NULL
*/
LO_RESULT LODictionarySetValue(LODictionaryRef dictionary, const char* key, LOTypedValueRef value);
/**
@brief Removes all of the key-value pairs from a dictionary.
@since LayOut 2018, API 3.0
@param[in] dictionary The dictionary object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dictionary is an invalid object
*/
LO_RESULT LODictionaryClear(LODictionaryRef dictionary);
/**
@brief Gets the number of entries in the dictionary.
@since LayOut 2018, API 3.0
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dictionary does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if out_number_of_keys is NULL
*/
LO_RESULT LODictionaryGetNumberOfKeys(LODictionaryRef dictionary, size_t* out_number_of_keys);
/**
@brief Gets all the keys in the dictionary.
@since LayOut 2018, API 3.0
@return
- \ref SU_ERROR_NONE on success.
- \ref SU_ERROR_INVALID_INPUT if dictionary refers to an invalid reference
- \ref SU_ERROR_OUT_OF_RANGE if key_array_length must be at least 1
- \ref SU_ERROR_NULL_POINTER_OUTPUT if out_key_array or
out_number_of_keys_copied is NULL
- \ref SU_ERROR_INVALID_OUTPUT if keys contains one or more invalid objects
*/
LO_RESULT LODictionaryGetKeys(
LODictionaryRef dictionary, size_t key_array_length, SUStringRef keys[],
size_t* out_number_of_keys_copied);
/**
@brief Remove the entry in the dictionary for the given key.
@since LayOut 2018, API 3.0
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dictionary or key refer to invalid references
- \ref SU_ERROR_NO_DATA if there is no value to delete for the given key
*/
LO_RESULT LODictionaryRemoveEntry(LODictionaryRef dictionary, const char* key);
#ifdef __cplusplus
} // extern "C" {
#endif
#endif // LAYOUT_MODEL_DICTIONARY_H_
// Copyright 2015-2023 Trimble Inc. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_DOCUMENT_H_
#define LAYOUT_MODEL_DOCUMENT_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
#include <LayOutAPI/model/imagerep.h>
#include <LayOutAPI/model/sketchupmodel.h>
#include <time.h>
/**
@struct LODocumentRef
@brief References a LayOut document.
*/
/**
@enum LODocumentVersion
@brief Defines the different versions of the .layout file format that are
supported.
*/
typedef enum {
LODocumentVersion_1 = 1, ///< LayOut 1.0
LODocumentVersion_2 = 2, ///< LayOut 2.0
LODocumentVersion_3 = 3, ///< LayOut 3.0
LODocumentVersion_2013 = 13, ///< LayOut 2013
LODocumentVersion_2014 = 14, ///< LayOut 2014
LODocumentVersion_2015 = 15, ///< LayOut 2015
LODocumentVersion_2016 = 16, ///< LayOut 2016
LODocumentVersion_2017 = 17, ///< LayOut 2017
LODocumentVersion_2018 = 18, ///< LayOut 2018
LODocumentVersion_2019 = 19, ///< LayOut 2019
LODocumentVersion_2020 = 20, ///< LayOut 2020
LODocumentVersion_2021 = 21, ///< LayOut 2021
LODocumentVersion_2022 = 22, ///< LayOut 2022
LODocumentVersion_2023 = 23, ///< LayOut 2023
LODocumentVersion_Current = LODocumentVersion_2023, ///< The most current version supported.
LONumDocumentVersions
} LODocumentVersion;
/**
@enum LODocumentUnits
@brief Defines the different units formats that are available.
*/
typedef enum {
LODocumentUnits_FractionalInches = 0, ///< 6-1/2"
LODocumentUnits_DecimalInches, ///< 6.5"
LODocumentUnits_DecimalFeet, ///< 0.54167'
LODocumentUnits_DecimalMillimeters, ///< 165.1 mm
LODocumentUnits_DecimalCentimeters, ///< 16.51 cm
LODocumentUnits_DecimalMeters, ///< 1.651 m
LODocumentUnits_DecimalPoints, ///< 468 pt
LONumDocumentUnits
} LODocumentUnits;
#ifdef __cplusplus
extern "C" {
#endif
/**
@brief Creates a new empty document object. It will contain one page and one
layer.
@param[out] document The newly created document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *document already refers to a valid object
*/
LO_RESULT LODocumentCreateEmpty(LODocumentRef* document);
/**
@brief Creates a new document object by loading an existing .layout file.
@param[out] document The document created from the .layout file.
@param[in] path The path to the .layout file on disk.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *document already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if path is NULL
- \ref SU_ERROR_NO_DATA if the .layout file could not be found
- \ref SU_ERROR_SERIALIZATION if there was an error reading the .layout file
*/
LO_RESULT LODocumentCreateFromFile(LODocumentRef* document, const char* path);
/**
@brief Creates a new document object using an existing .layout file as a
template. This differs from LODocumentCreateFromFile in that the new
document won't have a path until it is saved for the first time.
@param[out] document The document created using the .layout file as a template.
@param[in] path The path to the layout template file on disk.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *document already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if path is NULL
- \ref SU_ERROR_SERIALIZATION if there was an error reading the template file
- \ref SU_ERROR_NO_DATA if the .layout file could not be found
*/
LO_RESULT LODocumentCreateFromTemplate(LODocumentRef* document, const char* path);
/**
@brief Releases a document object. The object will be invalidated if
releasing the last reference. Note: it is important to call
LODocumentRelease before calling \ref LOTerminate, otherwise
LODocumentRelease may fail unpredictably.
@param[in] document The document object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if document is NULL
- \ref SU_ERROR_INVALID_INPUT if *document does not refer to a valid object
*/
LO_RESULT LODocumentRelease(LODocumentRef* document);
/**
@brief Adds a reference to an document object.
@since LayOut 2018, API 3.0
@param[in] document The document object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
*/
LO_RESULT LODocumentAddReference(LODocumentRef document);
/**
@brief Saves a document to a file at the given path. Passing an empty path
string will save the document at its current path.
@param[in] document The document object.
@param[in] path The file path where the document should be saved.
@param[in] version The file version to save the file as.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if path is NULL
- \ref SU_ERROR_OUT_OF_RANGE if version is not a valid version
- \ref SU_ERROR_SERIALIZATION if there was an error writing the file. This may
be due to the LayOut file being open in the LayOut application
*/
LO_RESULT LODocumentSaveToFile(LODocumentRef document, const char* path, LODocumentVersion version);
/**
@brief Exports the document to a .pdf file at the indicated path. If a valid
options dictionary object is provided, then it can specify additional
PDF export options. The following options (declared in
documentexportoptions.h) may be specified in the options dictionary to
override their default values:
- <b>key: \ref LOExportOption_StartPage, value: Int32</b>\n
Start page index. Defaults to 0.
- <b>key: \ref LOExportOption_EndPage, value: Int32</b>\n
End page index. Defaults to the index of the last page in the document.
- <b>key: \ref LOExportOption_CompressImages, value: Bool</b>\n
If true, images (including raster models) will be compressed using JPEG
compression to reduce PDF file size. Defaults to true.
- <b>key: \ref LOExportOption_ImageCompressionQuality, value: Double</b>\n
Specifies the image compression quality from 0.0 to 1.0, to be used if
the \ref LOExportOption_CompressImages option is set to true. Defaults to
0.5.
@param[in] document The document object.
@param[in] path The file path where the pdf should be exported.
@param[in] options_dict The options dictionary. If the dictionary object is
invalid then default options will be used.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if path is NULL
- \ref SU_ERROR_GENERIC if an option was specified using a value of the wrong
type
- \ref SU_ERROR_OUT_OF_RANGE if the \ref LOExportOption_StartPage option
specifies a start page that is out of range
- \ref SU_ERROR_OUT_OF_RANGE if the \ref LOExportOption_EndPage option
specifies an end page that is out of range
- \ref SU_ERROR_OUT_OF_RANGE if the \ref LOExportOption_ImageCompressionQuality
option specifies a value that is out of range
- \ref SU_ERROR_SERIALIZATION if there was an error writing the file
*/
LO_RESULT LODocumentExportToPDF(
LODocumentRef document, const char* path, LODictionaryRef options_dict);
/**
@brief Exports the document as a series of image files at the indicated path.
For multi-page documents, each page will append its page number to
base_name to use as the file name. If a valid options dictionary object
is provided, then it can specify additional image export options. The
following options (declared in documentexportoptions.h) may be specified
in the options dictionary to override their default values:
- <b>key: \ref LOExportOption_StartPage, value: Int32</b>\n
Start page index. Defaults to 0.
- <b>key: \ref LOExportOption_EndPage, value: Int32</b>\n
End page index. Defaults to the index of the last page in the document.
- <b>key: \ref LOExportOption_DPI, value: Int32</b>\n
Image DPI. This will determine the pixel dimensions of the output images,
in conjunction with the document's page width and height. Defaults to 96.
@param[in] document The document object.
@param[in] export_path The directory path to where the images should be
exported.
@param[in] base_name The base name for the image files.
@param[in] format What file format the images should be exported to.
@param[in] options_dict The options dictionary. If the dictionary object is
invalid then default options will be used.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if export_path is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if base_name is NULL
- \ref SU_ERROR_OUT_OF_RANGE if format is out of range
- \ref SU_ERROR_GENERIC if an option was specified using a value of the wrong
type
- \ref SU_ERROR_OUT_OF_RANGE if the \ref LOExportOption_StartPage option
specifies a start page that is out of range
- \ref SU_ERROR_OUT_OF_RANGE if the \ref LOExportOption_EndPage option
specifies an end page that is out of range
- \ref SU_ERROR_OUT_OF_RANGE if the \ref LOExportOption_DPI option specifies a
DPI that is is less than 1 or greater than 1200
- \ref SU_ERROR_SERIALIZATION if there was an error writing the file(s)
*/
LO_RESULT LODocumentExportToImageSet(
LODocumentRef document, const char* export_path, const char* base_name,
LOImageRepOutputFormat format, LODictionaryRef options_dict);
/**
@brief Gets the full path to a document's .layout file.
@param[in] document The document object.
@param[out] path The path to the document's .layout file.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NO_DATA if document is a new document that does not yet have a
path
- \ref SU_ERROR_NULL_POINTER_OUTPUT if path is NULL
- \ref SU_ERROR_INVALID_OUTPUT if *path does not refer to a valid string
object.
*/
LO_RESULT LODocumentGetFilePath(LODocumentRef document, SUStringRef* path);
/**
@brief Gets the number of layers in a document.
@param[in] document The document object.
@param[out] num_layers The number of layers in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_layers is NULL
*/
LO_RESULT LODocumentGetNumberOfLayers(LODocumentRef document, size_t* num_layers);
/**
@brief Gets a reference to the layer definition at the given index for a
document.
@param[in] document The document object.
@param[in] index The index of the layer to get.
@param[out] layer_definition The layer definition at the given index.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_definition is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *layer_definition already refers to a valid
object
*/
LO_RESULT LODocumentGetLayerAtIndex(
LODocumentRef document, size_t index, LOLayerRef* layer_definition);
/**
@brief Populates a \ref LOLayerListRef with all of the layer definitions in a
document.
@param[in] document The document object.
@param[out] layer_definitions The list to populate with the layer definitions
in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if layer_definitions does not refer to a valid
object
*/
LO_RESULT LODocumentGetLayers(LODocumentRef document, LOLayerListRef layer_definitions);
/**
@brief Gets a reference to the document's active layer definition.
@since LayOut 2018, API 3.0
@param[in] document The document object.
@param[out] layer_definition The active layer definition in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_definition is NULL
*/
LO_RESULT LODocumentGetActiveLayer(LODocumentRef document, LOLayerRef* layer_definition);
/**
@brief Sets the document's active layer definition.
@since LayOut 2018, API 3.0
@param[in] document The document object.
@param[in] layer_definition The layer definition to set as active.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_GENERIC if layer_definition does not belong to document
- \ref SU_ERROR_GENERIC if layer_definition is locked the active page
*/
LO_RESULT LODocumentSetActiveLayer(LODocumentRef document, LOLayerRef layer_definition);
/**
@brief Moves a layer to a different index within a document's list of layers.
This will move the layer such that its new index becomes new_index.
@param[in] document The document object.
@param[in] layer_definition The layer definition object.
@param[in] new_index The index to move the layer to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_GENERIC if layer_definition does not belong to document
- \ref SU_ERROR_OUT_OF_RANGE if new_index is out of range
*/
LO_RESULT LODocumentReorderLayer(
LODocumentRef document, LOLayerRef layer_definition, size_t new_index);
/**
@brief Adds a new layer to the document. The user is not responsible for
releasing the returned layer definition object.
@param[in] document The document object.
@param[in] shared Whether or not the new layer should be a shared
layer.
@param[out] layer_definition The new layer definition object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_definition is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *layer_definition already refers to a valid
object
*/
LO_RESULT LODocumentAddLayer(LODocumentRef document, bool shared, LOLayerRef* layer_definition);
/**
@brief Removes a layer from a document. There must be at least one other
unlocked and visible layer on every page. If this is not the case, then
the next layer will be automatically unlocked and made visible on all
pages as necessary to proceed with the operation. *layer_definition will
be set to invalid by this function.
@param[in] document The document object.
@param[in] layer_definition The layer definition object.
@param[in] delete_entities Whether or not to delete the entities on the layer
that is being removed. If the entities are not
deleted, they will be moved to the next valid
layer. This may cause groups to be split if the
next valid layer does not have the same sharedness
as the layer being removed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if layer_definition is NULL
- \ref SU_ERROR_INVALID_INPUT if *layer_definition does not refer to a valid
object
- \ref SU_ERROR_GENERIC if *layer_definition does not belong to document
- \ref SU_ERROR_GENERIC if *layer_definition could not be removed because it is
the last layer in the document
- \ref SU_ERROR_GENERIC if the layer could not be removed because it would
break the rule that there must be at least one unlocked, visible layer on
each page
*/
LO_RESULT LODocumentRemoveLayer(
LODocumentRef document, LOLayerRef* layer_definition, bool delete_entities);
/**
@brief Gets the page info object for a document.
@param[in] document The document object.
@param[out] page_info The page info object for the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if page_info is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *page_info already refers to a valid object
*/
LO_RESULT LODocumentGetPageInfo(LODocumentRef document, LOPageInfoRef* page_info);
/**
@brief Gets the grid object for a document.
@param[in] document The document object.
@param[out] grid The grid object for the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if grid is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *grid already refers to a valid object
*/
LO_RESULT LODocumentGetGrid(LODocumentRef document, LOGridRef* grid);
/**
@brief Gets the total number of pages in a document.
@param[in] document The document object.
@param[out] num_pages The number of pages.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_pages is NULL
*/
LO_RESULT LODocumentGetNumberOfPages(LODocumentRef document, size_t* num_pages);
/**
@brief Gets the page at a given index in a document.
@param[in] document The document object.
@param[in] index The index of the page to get.
@param[out] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range
- \ref SU_ERROR_NULL_POINTER_OUTPUT if page is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *page already refers to a valid object
*/
LO_RESULT LODocumentGetPageAtIndex(LODocumentRef document, size_t index, LOPageRef* page);
/**
@brief Populates a \ref LOPageListRef object with all the pages in a document.
@param[in] document The document object.
@param[out] pages The list to populate with the pages in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if pages does not refer to a valid object
*/
LO_RESULT LODocumentGetPages(LODocumentRef document, LOPageListRef pages);
/**
@brief Gets a reference to the page that will be shown the next time the
document is opened in LayOut.
@since LayOut 2018, API 3.0
@param[in] document The document object.
@param[out] page The active page in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if page is NULL
*/
LO_RESULT LODocumentGetInitialPage(LODocumentRef document, LOPageRef* page);
/**
@brief Sets the page that will be shown the next time the document is opened in
LayOut.
@since LayOut 2018, API 3.0
@param[in] document The document object.
@param[in] page The page to set as active.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_GENERIC if page does not belong to document
*/
LO_RESULT LODocumentSetInitialPage(LODocumentRef document, LOPageRef page);
/**
@brief Adds a new page to a document. The user is not responsible for releasing
the returned page object.
@param[in] document The document object.
@param[out] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if page is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *page already refers to a valid object
*/
LO_RESULT LODocumentAddPage(LODocumentRef document, LOPageRef* page);
/**
@brief Removes a page from a document. *page will be set to invalid by this
function.
@param[in] document The document object.
@param[in] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if page is NULL
- \ref SU_ERROR_INVALID_INPUT if *page does not refer to a valid object
- \ref SU_ERROR_GENERIC if *page does not belong to document
- \ref SU_ERROR_GENERIC if *page could not be removed because it is the last
page in the document
*/
LO_RESULT LODocumentRemovePage(LODocumentRef document, LOPageRef* page);
/**
@brief Moves a page to a different index within a document's list of pages.
This will move the page such that its new index becomes new_index.
@param[in] document The document object.
@param[in] page The page object.
@param[in] new_index The index the page should be moved to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_GENERIC if page does not belong to document
- \ref SU_ERROR_OUT_OF_RANGE if new_index is out of range
*/
LO_RESULT LODocumentReorderPage(LODocumentRef document, LOPageRef page, size_t new_index);
/**
@brief Adds an entity to a document and place it on the given layer and page.
If the given layer is a shared layer then page may be an invalid object.
The entity must not already belong to a document. If entity is a group,
then the group along with all of its children will be added to the
document.
@param[in] document The document object.
@param[in] entity The entity object.
@param[in] layer_definition The layer definition object.
@param[in] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object and
layer_definition refers to a non-shared layer
- \ref SU_ERROR_GENERIC if page or layer_definition does not belong to document
- \ref SU_ERROR_GENERIC if entity already belongs to a document
*/
LO_RESULT LODocumentAddEntity(
LODocumentRef document, LOEntityRef entity, LOLayerRef layer_definition, LOPageRef page);
/**
@brief Adds an entity to a document and places it on the layer at layer_index
and page at page_index. If the specified layer is a shared layer then
page_index will be ignored. The entity must not already belong to a
document. If entity is a group, then the group along with all of its
children will be added to the document.
@param[in] document The document object.
@param[in] entity The entity object.
@param[in] layer_index The layer definition index.
@param[in] page_index The page index.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if layer_index is not a valid value
- \ref SU_ERROR_OUT_OF_RANGE if page_index is not a valid value and the layer at
layer_index is a non-shared layer
- \ref SU_ERROR_GENERIC if entity already belongs to a document
*/
LO_RESULT LODocumentAddEntityUsingIndexes(
LODocumentRef document, LOEntityRef entity, size_t layer_index, size_t page_index);
/**
@brief Removes an entity from a document. If entity is a group, then the group
and all of its children will be removed from the document.
@param[in] document The document object.
@param[in] entity The entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if entity is NULL
- \ref SU_ERROR_INVALID_INPUT if *entity does not refer to a valid object
- \ref SU_ERROR_GENERIC if entity does not belong to document
*/
LO_RESULT LODocumentRemoveEntity(LODocumentRef document, LOEntityRef* entity);
/**
@brief Gets the number of entities on shared layers at the top of a document's
group hierarchy. This count will include \ref LOGroupRef entities so the
group hierarchy can be traversed.
@param[in] document The document object.
@param[out] num_shared_entities The number of shared entities.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_shared_entities is NULL
*/
LO_RESULT LODocumentGetNumberOfSharedEntities(LODocumentRef document, size_t* num_shared_entities);
/**
@brief Gets the shared entity at the top of a document's group hierarchy at the
specified index.
@param[in] document The document object.
@param[in] index The 0-based entity index for the desired shared entity.
@param[out] entity The entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *entity already refers to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is greater than or equal to the number of
shared entities returned by LODocumentGetNumberOfSharedEntities
*/
LO_RESULT LODocumentGetSharedEntityAtIndex(
LODocumentRef document, size_t index, LOEntityRef* entity);
/**
@brief Populates a \ref LOEntityListRef with the entities on shared layers
at the top of a document's group hierarchy. This will include
\ref LOGroupRef entities so the group hierarchy can be traversed.
@param[in] document The document object.
@param[in] entity_list The entity list to populate.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if entity_list does not refer to a valid object
*/
LO_RESULT LODocumentGetSharedEntities(LODocumentRef document, LOEntityListRef entity_list);
/**
@brief Gets whether or not object snap is enabled in a document.
@param[in] document The document object.
@param[out] object_snap Whether object snap is enabled or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if object_snap is NULL
*/
LO_RESULT LODocumentGetObjectSnap(LODocumentRef document, bool* object_snap);
/**
@brief Sets whether or not object snap is enabled in a document.
@param[in] document The document object.
@param[in] object_snap Whether to enable or disable object snap.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
*/
LO_RESULT LODocumentSetObjectSnap(LODocumentRef document, bool object_snap);
/**
@brief Gets whether or not grid snap is enabled in a document.
@param[in] document The document object.
@param[out] grid_snap Whether grid snap is enabled or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if grid_snap is NULL
*/
LO_RESULT LODocumentGetGridSnap(LODocumentRef document, bool* grid_snap);
/**
@brief Sets whether or not grid snap is enabled in a document.
@param[in] document The document object.
@param[in] grid_snap Whether to enable or disable grid snap.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
*/
LO_RESULT LODocumentSetGridSnap(LODocumentRef document, bool grid_snap);
/**
@brief Returns the time at which a document was created.
@param[in] document The document object.
@param[out] time_created The time when the document was created.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if time_created is NULL
*/
LO_RESULT LODocumentGetTimeCreated(LODocumentRef document, time_t* time_created);
/**
@brief Returns the last time that the document was edited.
@param[in] document The document object.
@param[out] time_modified The last time the document was edited.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if time_modified is NULL
*/
LO_RESULT LODocumentGetTimeModified(LODocumentRef document, time_t* time_modified);
/**
@brief Returns the last time that the document was printed or exported.
@param[in] document The document object.
@param[out] time_published The last time the document was printed or exported.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if time_published is NULL
*/
LO_RESULT LODocumentGetTimePublished(LODocumentRef document, time_t* time_published);
/**
@brief Gets the units and precision for a document.
@param[in] document The document object.
@param[out] units The units setting for the document.
@param[out] precision The units precision. This is expressed as a value in the
current units.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if units is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if precision is NULL
*/
LO_RESULT LODocumentGetUnits(LODocumentRef document, LODocumentUnits* units, double* precision);
/**
@brief Sets the units and precision for a document.
@param[in] document The document object.
@param[in] units The units setting for the document.
@param[in] precision The units precision. This is expressed as a value in the
specified units. LayOut only allows for a finite set of
precision values for each units setting, so it will set
the precision to the closest valid setting for the
specified units. See the "Units" section of LayOut's
"Document Setup" dialog for a reference of the available
precisions for each units setting.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if units is invalid
*/
LO_RESULT LODocumentSetUnits(LODocumentRef document, LODocumentUnits units, double precision);
/**
@brief Gets the number of auto-text definitions in a document.
@since LayOut 2017, API 2.0
@param[in] document The document object.
@param[out] size The amount of auto-text definitions in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if size is NULL
*/
LO_RESULT LODocumentGetNumberOfAutoTextDefinitions(LODocumentRef document, size_t* size);
/**
@brief Gets the auto-text at the specified index.
@since LayOut 2017, API 2.0
@param[in] document The document object.
@param[in] index The index of the auto-text object.
@param[out] autotext The auto-text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if autotext is NULL
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index
*/
LO_RESULT LODocumentGetAutoTextDefinitionAtIndex(
LODocumentRef document, size_t index, LOAutoTextDefinitionRef* autotext);
/**
@brief Gets the auto-text with the specified name.
@since LayOut 2018, API 3.0
@param[in] document The document object.
@param[in] name The name of the auto-text object to get.
@param[out] autotext The auto-text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if name is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if autotext is NULL
- \ref SU_ERROR_NO_DATA if no auto-text definition exists with the given name
*/
LO_RESULT LODocumentGetAutoTextDefinitionByName(
LODocumentRef document, const char* name, LOAutoTextDefinitionRef* autotext);
/**
@brief Populates a \ref LOAutoTextDefinitionListRef object with all the auto-text
in a document.
@since LayOut 2018, API 3.0
@param[in] document The document object.
@param[out] autotexts The list to populate with the auto-texts in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if auto_texts does not refer to a valid object
*/
LO_RESULT LODocumentGetAutoTextDefinitions(
LODocumentRef document, LOAutoTextDefinitionListRef autotexts);
/**
@brief Adds an auto-text definition to a document.
@since LayOut 2017, API 2.0
@param[in] document The document object.
@param[in] type The desired type of the new auto-text.
@param[in] name The desired name of the new auto-text.
@param[out] autotext The autotext definition object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT is autotext does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if index is NULL
- \ref SU_ERROR_OUT_OF_RANGE if type is not a valid type
- \ref SU_ERROR_UNSUPPORTED if type is a mandatory auto-text type
*/
LO_RESULT LODocumentAddAutoTextDefinition(
LODocumentRef document, int type, const char* name, LOAutoTextDefinitionRef* autotext);
/**
@brief Removes an auto-text definition from a document.
@since LayOut 2017, API 2.0
@param[in] document The document object.
@param[in] autotext The auto-text definition object.
@param[in] convert_tags_to_normal_text True if the auto-text being deleted
should retain its tags in normal text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if autotext is NULL
- \ref SU_ERROR_INVALID_INPUT if autotext does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if autotext is a mandatory auto-text definition
- \ref SU_ERROR_INVALID_ARGUMENT if autotext does not belong to this document
*/
LO_RESULT LODocumentRemoveAutoTextDefinition(
LODocumentRef document, LOAutoTextDefinitionRef* autotext, bool convert_tags_to_normal_text);
/**
@brief Gets the length formatter settings from the document. The given length
formatter object must have been constructed using \ref
SULengthFormatterCreate. It must be released using \ref
SULengthFormatterRelease.
@since LayOut 2018, API 3.0
@param[in] document The document object.
@param[out] formatter The formatter to apply the document's settings to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if document is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if formatter is NULL
- \ref SU_ERROR_INVALID_OUTPUT if formatter does not point to a valid \ref
SULengthFormatterRef object
*/
LO_RESULT LODocumentGetLengthFormatter(LODocumentRef document, SULengthFormatterRef* formatter);
/**
@brief Gets the render mode override for export of SketchUp models in the document.
This is used to override the render mode for all \ref LOSketchUpModelRef s in the document when
exporting. To have the output render mode match each \ref LOSketchUpModelRef 's edit render mode,
set this to LOSketchUpModelRenderMode_NoOverride.
@since LayOut 2023.1, API 8.1
@param[in] document The document object.
@param[out] render_mode The render mode of the SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p document is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p render_mode is NULL
*/
LO_RESULT LODocumentGetRenderModeOverride(
LODocumentRef document, LOSketchUpModelRenderMode* render_mode);
/**
@brief Sets the render mode override for export of SketchUp models in the document.
This is used to override the render mode for all raster rendered \ref LOSketchUpModelRef s in the
document when exporting. To have the output render mode match each \ref LOSketchUpModelRef 's edit
render mode, set this to LOSketchUpModelRenderMode_NoOverride.
@since LayOut 2023.1, API 8.1
@param[in] document The document object.
@param[in] render_mode The new render mode for the SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p document is not a valid object
- \ref SU_ERROR_OUT_OF_RANGE if the value of \p render_mode is invalid
- \ref SU_ERROR_INVALID_ARGUMENT if the value of \p render_mode is \ref
LOSketchUpModelRenderMode_Raster
*/
LO_RESULT LODocumentSetRenderModeOverride(
LODocumentRef document, LOSketchUpModelRenderMode render_mode);
#ifdef __cplusplus
} // extern "C" {
#endif
#endif // LAYOUT_MODEL_DOCUMENT_H_
// Copyright 2015-2023 Trimble Inc. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_DOCUMENTEXPORTOPTIONS_H_
#define LAYOUT_MODEL_DOCUMENTEXPORTOPTIONS_H_
/**
@brief Dictionary key to use when specifying the file location for export.
*/
const char* const LOExportOption_FileLocation = "lo_export_file_location";
/**
@brief Dictionary key to use when specifying the start page option for
\ref LODocumentExportToPDF or \ref LODocumentExportToImageSet.
*/
const char* const LOExportOption_StartPage = "start_page";
/**
@brief Dictionary key to use when specifying the end page option for
\ref LODocumentExportToPDF or \ref LODocumentExportToImageSet.
*/
const char* const LOExportOption_EndPage = "end_page";
/**
@brief Dictionary key to use when specifying the page range option for
\ref LODocumentExportToPDF or \ref LODocumentExportToImageSet.
The value stored with this key takes precedent over `"start_page"` and `"end_page"`.
@since LayOut 2024.0, API 9.0
*/
const char* const LOExportOption_PageRange = "page_range";
/**
@brief Dictionary key to use when specifying the output resolution option for
\ref LODocumentExportToPDF.
@deprecated This key is deprecated as of 2023.1. Set the output resolution of
images and viewports through the LOPageInfoSetImageOutputResolution
and LOPageInfoSetOutputResolution respectively.
*/
const char* const LOExportOption_OutputResolution = "output_resolution";
/**
@brief Dictionary key to use when specifying the compress images option for
\ref LODocumentExportToPDF.
*/
const char* const LOExportOption_CompressImages = "compress_images";
/**
@brief Dictionary key to use when specifying the image compression quality
option for \ref LODocumentExportToPDF.
*/
const char* const LOExportOption_ImageCompressionQuality = "compress_quality";
/**
@brief Dictionary key to use when specifying the image DPI option for
\ref LODocumentExportToImageSet.
*/
const char* const LOExportOption_DPI = "dpi";
#endif // #define LAYOUT_MODEL_DOCUMENTEXPORTOPTIONS_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_ELLIPSE_H_
#define LAYOUT_MODEL_ELLIPSE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOEllipseRef
@brief References a simple elliptical shape entity.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new ellipse entity object.
@param[out] ellipse The newly created ellipse.
@param[in] bounds The bounds of the ellipse.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if ellipse is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *ellipse already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds are not greater than (0, 0)
*/
LO_RESULT LOEllipseCreate(LOEllipseRef* ellipse, const LOAxisAlignedRect2D* bounds);
/**
@brief Adds a reference to an ellipse object.
@param[in] ellipse The ellipse object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if ellipse does not refer to a valid object
*/
LO_RESULT LOEllipseAddReference(LOEllipseRef ellipse);
/**
@brief Releases an ellipse object. The object will be invalidated if
releasing the last reference.
@param[in] ellipse The ellipse object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if ellipse is NULL
- \ref SU_ERROR_INVALID_INPUT if *ellipse does not refer to a valid object
*/
LO_RESULT LOEllipseRelease(LOEllipseRef* ellipse);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOEllipseRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOEllipseRef.
@param[in] entity The entity object.
@return
- The converted \ref LOEllipseRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEllipseRef LOEllipseFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOEllipseRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] ellipse The ellipse object.
@return
- The converted \ref LOEntityRef if ellipse is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOEllipseToEntity(LOEllipseRef ellipse);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_ELLIPSE_H_
// Copyright 2015-2022 Trimble Inc. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_ENTITY_H_
#define LAYOUT_MODEL_ENTITY_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@enum LOEntityType
@brief Defines the different types of entities that may exist in a document.
*/
typedef enum {
LOEntityType_FormattedText = 0, ///< 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.
LOEntityType_ReferenceEntity, ///< The entity is a LOReferenceEntityRef.
LONumEntityTypes
} LOEntityType;
/**
@struct LOEntityRef
@brief An entity is an object shown on a page of a LayOut document.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the bounds of an entity in the x and y axis of the page.
@return
@param[in] entity The entity object.
@param[out] bounds The bounds of the entity.
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if bounds is NULL
*/
LO_RESULT LOEntityGetAxisAlignedBounds(LOEntityRef entity, LOAxisAlignedRect2D* bounds);
/**
@brief 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.
@param[in] entity The entity object.
@param[out] bounds The oriented bounds of the entity.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if bounds is NULL
*/
LO_RESULT LOEntityGetOrientedBounds(LOEntityRef entity, LOOrientedRect2D* bounds);
/**
@brief Gets whether or not an entity has an explicit transformation. The
following types of entities will always have an explicit transformation:
\ref LOFormattedTextRef, \ref LOImageRef, \ref LORectangleRef,
\ref LOSketchUpModelRef and \ref LOEllipseRef.
@param[in] entity The entity object.
@param[out] has_transform Whether the entity has an explicit transformation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if has_transform is NULL
*/
LO_RESULT LOEntityHasExplicitTransform(LOEntityRef entity, bool* has_transform);
/**
@brief Gets the explicit transformation for an entity. This function is only
supported for entities that have an explicit transformation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NO_DATA if entity does not have an explicit transformation
- \ref SU_ERROR_NULL_POINTER_OUTPUT if transform_matrix is NULL
*/
LO_RESULT LOEntityGetExplicitTransform(LOEntityRef entity, LOTransformMatrix2D* transform_matrix);
/**
@brief 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.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if entity is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if entity is locked
- \ref SU_ERROR_NULL_POINTER_INPUT if transform_matrix is NULL
*/
LO_RESULT LOEntityApplyTransform(LOEntityRef entity, const LOTransformMatrix2D* transform_matrix);
/**
@brief 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.
@param[in] entity The entity object.
@param[out] bounds The untransformed bounds.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NO_DATA if entity does not have an explicit transformation
- \ref SU_ERROR_NULL_POINTER_OUTPUT if bounds is NULL
*/
LO_RESULT LOEntityGetUntransformedBounds(LOEntityRef entity, LOAxisAlignedRect2D* bounds);
/**
@brief 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.
@param[in] entity The entity object.
@param[in] bounds The untransformed bounds.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_GENERIC if entity does not have an explicit transformation
- \ref SU_ERROR_LAYER_LOCKED if entity is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if entity is locked
- \ref SU_ERROR_NULL_POINTER_OUTPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds is zero sized
*/
LO_RESULT LOEntitySetUntransformedBounds(LOEntityRef entity, const LOAxisAlignedRect2D* bounds);
/**
@brief 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.
@param[in] entity The entity object.
@param[out] entity_type The entity type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity_type is NULL
*/
LO_RESULT LOEntityGetEntityType(LOEntityRef entity, LOEntityType* entity_type);
/**
@brief Gets the document that an entity belongs to.
@param[in] entity The entity object.
@param[out] document The document object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *document already refers to a valid object
- \ref SU_ERROR_NO_DATA if this entity is not in a document
*/
LO_RESULT LOEntityGetDocument(LOEntityRef entity, LODocumentRef* document);
/**
@brief Gets the layer instance that an entity is associated with. Note that
groups are never associated with a layer instance.
@param[in] entity The entity object.
@param[out] layer_instance The layer instance object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NO_DATA if this entity is not associated with a layer or does
not belong to a document
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_instance is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *layer_instance already refers to a valid
object
*/
LO_RESULT LOEntityGetLayerInstance(LOEntityRef entity, LOLayerInstanceRef* layer_instance);
/**
@brief Moves an entity to the given layer.
If the layer is non-shared and the entity 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.
@bug In LayOut versions prior to LayOut 2024.0 this method would fail to move entities from
non-shared layers.
@param[in] entity The entity object.
@param[in] layer The layer definition object.
@param[in] pages The page list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p entity does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if \p layer does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if \p pages does not refer to a valid object and
\p layer is non-shared
- \ref SU_ERROR_INVALID_INPUT if \p pages is empty and \p layer is non-shared
- \ref SU_ERROR_INVALID_INPUT if \p pages contains the same page reference more
than once and \p layer is non-shared
- \ref SU_ERROR_GENERIC if \p entity, \p layer, and \p pages are not all in the same
document
- \ref SU_ERROR_LAYER_LOCKED if \p layer is locked or if \p entity is currently on a
locked layer
- \ref SU_ERROR_ENTITY_LOCKED if \p entity is locked
*/
LO_RESULT LOEntityMoveToLayer(LOEntityRef entity, LOLayerRef layer, LOPageListRef pages);
/**
@brief Gets the page that an entity belongs to. This function will only
succeed if the entity is on a non-shared layer.
@param[in] entity The entity object.
@param[out] page The page object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if page is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *page already refers to a valid object
- \ref SU_ERROR_NO_DATA if this entity is not in a document or is on a shared
layer
*/
LO_RESULT LOEntityGetPage(LOEntityRef entity, LOPageRef* page);
/**
@brief Gets whether or not this entity belongs to a group.
@param[in] entity The entity object.
@param[out] is_in_group Whether the entity is in a group.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_in_group is NULL
*/
LO_RESULT LOEntityIsInGroup(LOEntityRef entity, bool* is_in_group);
/**
@brief Gets the group that an entity belongs to.
@param[in] entity The entity object.
@param[out] group The group object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NO_DATA if entity is not in a group
- \ref SU_ERROR_NULL_POINTER_OUTPUT if group is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *group already refers to a valid object
*/
LO_RESULT LOEntityGetContainingGroup(LOEntityRef entity, LOGroupRef* group);
/**
@brief 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.
@param[in] entity The entity object.
@param[in] group The group object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if entity is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if entity is locked
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_GENERIC if entity and group are not in the same document
- \ref SU_ERROR_GENERIC if entity and group belong to different pages, or if
one is shared and the other is not
*/
LO_RESULT LOEntityMoveToGroup(LOEntityRef entity, LOGroupRef group);
/**
@brief Gets the style of an entity.
@param[in] entity The entity object.
@param[out] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if style does not refer to a valid object
- \ref SU_ERROR_NO_DATA if entity is a group, and thus has no style
*/
LO_RESULT LOEntityGetStyle(LOEntityRef entity, LOStyleRef style);
/**
@brief Sets the style of an entity.
@param[in] entity The entity object.
@param[out] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if entity is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if entity is locked
*/
LO_RESULT LOEntitySetStyle(LOEntityRef entity, LOStyleRef style);
/**
@brief 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.
@param[in] entity The entity object.
@param[out] is_on_shared_layer Whether the entity is on a shared layer.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_on_shared_layer is NULL
- \ref SU_ERROR_NO_DATA if entity does not belong to a document
*/
LO_RESULT LOEntityIsOnSharedLayer(LOEntityRef entity, bool* is_on_shared_layer);
/**
@brief Gets whether an entity is locked.
@since LayOut 2018, API 3.0
@param[in] entity The entity object.
@param[out] is_locked Whether the entity is locked or unlocked.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_locked is NULL
*/
LO_RESULT LOEntityGetLocked(LOEntityRef entity, bool* is_locked);
/**
@brief Sets an entity to be locked or unlocked.
@since LayOut 2018, API 3.0
@param[in] entity The entity object.
@param[in] lock Whether the entity should be locked or unlocked.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
*/
LO_RESULT LOEntitySetLocked(LOEntityRef entity, bool lock);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_ENTITY_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_ENTITYITERATOR_H_
#define LAYOUT_MODEL_ENTITYITERATOR_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOEntityIteratorRef
@brief References an iterator for \ref LOEntityRef objects.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Releases an entity iterator object. *entity_iterator will be set to
invalid by this function.
@param[in] entity_iterator The entity iterator object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if entity_iterator is NULL
- \ref SU_ERROR_INVALID_INPUT if *entity_iterator does not refer to a valid
object
*/
LO_RESULT LOEntityIteratorRelease(LOEntityIteratorRef* entity_iterator);
/**
@brief Gets a reference to the current entity and increment the iterator.
entity will be set to an invalid object upon reaching the end of the
iterator.
@param[in] entity_iterator The entity iterator object.
@param[out] entity The entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity_iterator does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity does not refer to a valid object
*/
LO_RESULT LOEntityIteratorNext(LOEntityIteratorRef entity_iterator, LOEntityRef* entity);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_ENTITYITERATOR_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_ENTITY_LIST_H_
#define LAYOUT_MODEL_ENTITY_LIST_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOEntityListRef
@brief References an ordered, indexable list of \ref LOEntityRef objects.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new entity list object.
@param[out] entity_list The entity list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity_list is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *entity_list already refers to a valid
object
*/
LO_RESULT LOEntityListCreate(LOEntityListRef* entity_list);
/**
@brief Releases an entity list object. *entity_list will be set to invalid by
this function.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if entity_list is NULL
- \ref SU_ERROR_INVALID_INPUT if *entity_list does not refer to a valid object
*/
LO_RESULT LOEntityListRelease(LOEntityListRef* entity_list);
/**
@brief Adds an entity to an entity list object.
@param[in] entity_list The entity list object.
@param[in] entity The entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
*/
LO_RESULT LOEntityListAddEntity(LOEntityListRef entity_list, LOEntityRef entity);
/**
@brief Gets the number of entities in an entity list object.
@param[in] entity_list The entity list object.
@param[out] num_entities The number of entities in this list.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_entities is NULL
*/
LO_RESULT LOEntityListGetNumberOfEntities(LOEntityListRef entity_list, size_t* num_entities);
/**
@brief Gets the entity at the specified index in an entity list object.
@param[in] entity_list The entity list object.
@param[in] index The index of the entity to get.
@param[out] entity The entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range for this list
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *entity already refers to a valid object
*/
LO_RESULT LOEntityListGetEntityAtIndex(
LOEntityListRef entity_list, size_t index, LOEntityRef* entity);
/**
@brief 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.
@bug In LayOut versions prior to LayOut 2024.0 this method would fail to move entities from
non-shared layers.
@param[in] entity_list The entity list object.
@param[in] layer The layer definition object.
@param[in] pages The page list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p entity_list does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if \p entity_list is empty
- \ref SU_ERROR_INVALID_INPUT if \p entity_list contains the same entity reference more
than once
- \ref SU_ERROR_INVALID_INPUT if \p layer does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if \p pages does not refer to a valid object and
\p layer is non-shared
- \ref SU_ERROR_INVALID_INPUT if \p pages is empty and \p layer is non-shared
- \ref SU_ERROR_INVALID_INPUT if \p pages contains the same page reference more
than once and \p layer is non-shared
- \ref SU_ERROR_GENERIC if any entity, \p layer, and \p pages are not all in the
same document
- \ref SU_ERROR_LAYER_LOCKED if \p layer is locked or if any entity is currently
on a locked layer
*/
LO_RESULT LOEntityListMoveToLayer(
LOEntityListRef entity_list, LOLayerRef layer, LOPageListRef pages);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_ENTITY_LIST_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_FORMATTED_TEXT_H_
#define LAYOUT_MODEL_FORMATTED_TEXT_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOFormattedTextRef
@brief References a formatted text entity.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@enum LOFormattedTextGrowMode
@brief Defines the different grow modes that are available for formatted text
entities.
*/
typedef enum {
LOFormattedTextGrowMode_Unbounded =
0, ///< The text bounds will automatically adjust itself to the size of the current text, and
///< lines will not wrap.
LOFormattedTextGrowMode_Bounded, ///< The text bounds is set explicitly. Lines that go beyond the
///< right side of the bounds will wrap, and may not be visible
///< if wrapping causes the text to go beyond the bottom of the
///< bounds.
LONumFormattedTextGrowModes
} LOFormattedTextGrowMode;
/**
@enum LOFormattedTextAnchorType
@brief Defines the different anchor types for a formatted text entity. The
anchor type determines the point on a text entity's bounds that an
anchor point refers to.
*/
typedef enum {
LOFormattedTextAnchorType_TopLeft, ///< Top-left corner of the text.
LOFormattedTextAnchorType_CenterLeft, ///< Center-left side of the text.
LOFormattedTextAnchorType_BottomLeft, ///< Bottom-left corner of the text.
LOFormattedTextAnchorType_TopRight, ///< Top-right corner of the text.
LOFormattedTextAnchorType_CenterRight, ///< Center-right side of the text.
LOFormattedTextAnchorType_BottomRight, ///< Bottom-right corner of the text.
LOFormattedTextAnchorType_TopCenter, ///< Top-centered text.
LOFormattedTextAnchorType_CenterCenter, ///< Centered text.
LOFormattedTextAnchorType_BottomCenter, ///< Bottom-centered text.
LONumFormattedTextAnchorTypes
} LOFormattedTextAnchorType;
/**
@brief Creates a new unbounded text object at the given position.
@param[out] text The formatted text object.
@param[in] anchor_point The anchor point for the text object's position.
@param[in] anchor_type Defines which point of the text object is set by
anchor_point.
@param[in] plain_text The plain text to use for the formatted text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *text already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if anchor_point is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if plain_text is NULL
- \ref SU_ERROR_OUT_OF_RANGE if anchor_type is not a valid value
- \ref SU_ERROR_GENERIC if plain_text is an empty string
*/
LO_RESULT LOFormattedTextCreateAtPoint(
LOFormattedTextRef* text, const LOPoint2D* anchor_point, LOFormattedTextAnchorType anchor_type,
const char* plain_text);
/**
@brief Creates a new bounded text object with the given bounds.
@param[out] text The formatted text object.
@param[in] bounds The text bounds.
@param[in] plain_text The plain text to use for the formatted text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *text already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if plain_text is NULL
- \ref SU_ERROR_GENERIC if plain_text is an empty string
- \ref SU_ERROR_OUT_OF_RANGE if bounds is zero sized
*/
LO_RESULT LOFormattedTextCreateWithBounds(
LOFormattedTextRef* text, const LOAxisAlignedRect2D* bounds, const char* plain_text);
/**
@brief Creates a new unbounded text object at the given position whose contents
are linked to the plain text or RTF file at the given path.
@param[out] text The formatted text object.
@param[in] anchor_point The anchor point for the text object's position.
@param[in] anchor_type Defines which point of the text object is set by
anchor_point.
@param[in] path The path to the plain text or RTF file.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *text already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if path is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if anchor_point is NULL
- \ref SU_ERROR_OUT_OF_RANGE if anchor_type is not a valid value
- \ref SU_ERROR_GENERIC if the file referred to by path is empty
- \ref SU_ERROR_NO_DATA if the text file could not be found
*/
LO_RESULT LOFormattedTextCreateAtPointFromFile(
LOFormattedTextRef* text, const LOPoint2D* anchor_point, LOFormattedTextAnchorType anchor_type,
const char* path);
/**
@brief Creates a new bounded text object with the given bounds whose
contents are linked to the plain text or RTF file at the given path.
@param[out] text The formatted text object.
@param[in] path The path to the file containing the text to use.
@param[in] bounds The text bounds.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *text already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if path is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds is zero sized
- \ref SU_ERROR_GENERIC if the text file is empty
- \ref SU_ERROR_NO_DATA if the text file could not be found
*/
LO_RESULT LOFormattedTextCreateWithBoundsFromFile(
LOFormattedTextRef* text, const char* path, const LOAxisAlignedRect2D* bounds);
/**
@brief Adds a reference to a formatted text object.
@param[in] text The formatted text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
*/
LO_RESULT LOFormattedTextAddReference(LOFormattedTextRef text);
/*
@brief Releases a formatted text object. The object will be invalidated if
releasing the last reference.
@param[in] text The formatted text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if text is NULL
- \ref SU_ERROR_INVALID_INPUT if *text does not refer to a valid object
*/
LO_RESULT LOFormattedTextRelease(LOFormattedTextRef* text);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOFormattedTextRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOFormattedTextRef.
@param[in] entity The entity object.
@return
- The converted \ref LOFormattedTextRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOFormattedTextRef LOFormattedTextFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOFormattedTextRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] text The formatted text object.
@return
- The converted \ref LOEntityRef if model is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOFormattedTextToEntity(LOFormattedTextRef text);
/**
@brief Gets the raw RTF representation of a formatted text object.
NOTE: Passing an invalid page will prevent an auto-text tag from being
substituted with its display representation.
@param[in] text The formatted text object.
@param[out] rtf_text The RTF text string.
@param[in] page_for_autotext The page that is currently being imported, exported,
or displayed. This must be a valid object if
auto-text tags should be substituted with their
display representations in the string that is
returned. Otherwise, this object may be invalid.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if rtf_text is NULL
- \ref SU_ERROR_INVALID_OUTPUT if *rtf_text does not refer to a valid object
- \ref SU_ERROR_GENERIC if page_for_autotext refers to a page in a different
document from rtf_text.
*/
LO_RESULT LOFormattedTextGetRTF(
LOFormattedTextRef text, SUStringRef* rtf_text, LOPageRef page_for_autotext);
/**
@brief Sets the raw RTF representation of a formatted text object.
@param[in] text The formatted text object.
@param[in] rtf_text The RTF text string.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if text is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if text is locked
- \ref SU_ERROR_NULL_POINTER_INPUT if rtf_text is NULL
- \ref SU_ERROR_GENERIC if rtf_text is an empty string
*/
LO_RESULT LOFormattedTextSetRTF(LOFormattedTextRef text, const char* rtf_text);
/**
@brief Gets the display text representation of a formatted text object.
NOTE: Passing an invalid page will prevent an auto-text tag from being
substituted with its display representation.
@since LayOut 2018, API 3.0
@param[in] text The formatted text object.
@param[out] display_text The plain text representation.
@param[in] page_for_autotext The page that is currently being imported, exported,
or displayed. This must be a valid object if
auto-text tags should be substituted with their
display representations in the string that is
returned. Otherwise, this object may be invalid.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if display_text is NULL
- \ref SU_ERROR_INVALID_OUTPUT if *display_text does not refer to a valid object
- \ref SU_ERROR_GENERIC if page_for_autotext refers to a page in a different
document from display_text.
*/
LO_RESULT LOFormattedTextGetDisplayText(
LOFormattedTextRef text, SUStringRef* display_text, LOPageRef page_for_autotext);
/**
@brief Gets the length of a formatted text object's plain text representation.
@param[in] text The formatted text object.
@param[out] length The length of the plain text representation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if length is NULL
*/
LO_RESULT LOFormattedTextGetPlainTextLength(LOFormattedTextRef text, size_t* length);
/**
@brief Gets the plain text representation of a formatted text object.
@param[in] text The formatted text object.
@param[out] plain_text The plain text representation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if plain_text is NULL
- \ref SU_ERROR_INVALID_OUTPUT if *plain_text does not refer to a valid object
*/
LO_RESULT LOFormattedTextGetPlainText(LOFormattedTextRef text, SUStringRef* plain_text);
/**
@brief Sets the plain text representation of a formatted text object.
@param[in] text The formatted text object.
@param[in] plain_text The plain text representation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if text is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if text is locked
- \ref SU_ERROR_NULL_POINTER_INPUT if plain_text is NULL
- \ref SU_ERROR_GENERIC if plain_text is an empty string
*/
LO_RESULT LOFormattedTextSetPlainText(LOFormattedTextRef text, const char* plain_text);
/**
@brief Sets the plain text representation of a formatted text object and apply
the given style to the text.
@param[in] text The formatted text object.
@param[in] plain_text The plain text representation.
@param[in] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if text is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if text is locked
- \ref SU_ERROR_NULL_POINTER_INPUT if plain_text is NULL
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_GENERIC if plain_text is an empty string
*/
LO_RESULT LOFormattedTextSetTextWithStyle(
LOFormattedTextRef text, const char* plain_text, LOStyleRef style);
/**
@brief Appends the specified plain text to a formatted text object and apply
the given style to the appended text.
@note This method does not support more than two different style runs in a single text string.
@param[in] text The formatted text object.
@param[in] plain_text The plain text to append.
@param[in] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if text is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if text is locked
- \ref SU_ERROR_NULL_POINTER_INPUT if plain_text is NULL
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOFormattedTextAppendTextWithStyle(
LOFormattedTextRef text, const char* plain_text, LOStyleRef style);
/**
@brief Gets the style of a formatted text object at the specified plain text
character index.
@param[in] text The formatted text object.
@param[in] index The index of the character position to get the style of. Must
be greater than or equal to 0, and less than the length
returned by \ref LOFormattedTextGetPlainTextLength.
@param[out] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range of the plain text length
*/
LO_RESULT LOFormattedTextGetStyleAtCharacter(
LOFormattedTextRef text, size_t index, LOStyleRef style);
/**
@brief Gets the style starting at the specified plain text character index, and
running through length characters.
@param[in] text The formatted text object.
@param[in] index The index of the character position to get the style of. Must
be greater than or equal to 0, and less than the length
returned by \ref LOFormattedTextGetPlainTextLength.
@param[in] length The number of characters to get the style of.
index + length must be less than or equal to the
length returned by \ref LOFormattedTextGetPlainTextLength.
@param[out] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range of the plain
text length
- \ref SU_ERROR_OUT_OF_RANGE if the range specified by range_begin and
range_length is invalid for this text.
*/
LO_RESULT LOFormattedTextGetStyleRunAtCharacter(
LOFormattedTextRef text, size_t index, size_t length, LOStyleRef style);
/**
@brief Sets the style for a range of characters.
@param[in] text The formatted text object.
@param[in] style The style object.
@param[in] range_begin The index of the first character to change the style
of. Must be greater than or equal to 0, and less than
the length returned by
\ref LOFormattedTextGetPlainTextLength.
@param[in] range_length The number of characters to apply the style to.
range_begin + range_length must be less than or equal
to the length returned by \ref
LOFormattedTextGetPlainTextLength.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if text is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if text is locked
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if the range specified by range_begin and
range_length is invalid for this text.
*/
LO_RESULT LOFormattedTextSetStyleForRange(
LOFormattedTextRef text, LOStyleRef style, size_t range_begin, size_t range_length);
/**
@brief Gets the mode for how the text box sizes itself.
@param[in] text The formatted text object.
@param[in] mode The mode value.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if mode is NULL
*/
LO_RESULT LOFormattedTextGetGrowMode(LOFormattedTextRef text, LOFormattedTextGrowMode* mode);
/**
@brief Sets the mode for how the text box sizes itself.
@param[in] text The formatted text object.
@param[in] mode The mode value.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if text is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if text is locked
- \ref SU_ERROR_OUT_OF_RANGE if the value of mode is invalid
*/
LO_RESULT LOFormattedTextSetGrowMode(LOFormattedTextRef text, LOFormattedTextGrowMode mode);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_FORMATTED_TEXT_H_
// Copyright 2015-2020 Trimble Inc. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_GRID_H_
#define LAYOUT_MODEL_GRID_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
#include <SketchUpAPI/color.h>
/**
@struct LOGridRef
@brief References a document's grid settings.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the major space size of the grid.
@param[in] grid The grid object.
@param[out] spacing The spacing of the major divisions of the grid.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if spacing is NULL
*/
LO_RESULT LOGridGetMajorSpacing(LOGridRef grid, double* spacing);
/**
@brief Sets the gap between major grid lines for the grid.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] spacing The number of minor grid lines to have between major
grid lines. Must be positive.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if divisions is less than zero
*/
LO_RESULT LOGridSetMajorSpacing(LOGridRef grid, double spacing);
/**
@brief Gets the number of minor divisions of the grid.
@param[in] grid The grid object.
@param[out] divisions The minor division count.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if divisions is NULL
*/
LO_RESULT LOGridGetMinorDivisions(LOGridRef grid, int* divisions);
/**
@brief Sets the number of minor divisions for the grid.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] divisions The number of minor grid lines to have between major
grid lines. Must not be negative.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if divisions is less than zero
*/
LO_RESULT LOGridSetMinorDivisions(LOGridRef grid, int divisions);
/**
@brief Gets the color for the major grid lines.
@param[in] grid The grid object.
@param[out] color The color of the major grid lines.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if color is NULL
*/
LO_RESULT LOGridGetMajorColor(LOGridRef grid, SUColor* color);
/**
@brief Sets the color for the major grid lines.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] color The new color for the major grid lines.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
*/
LO_RESULT LOGridSetMajorColor(LOGridRef grid, SUColor color);
/**
@brief Gets the color for the minor grid lines.
@param[in] grid The grid object.
@param[out] color The color of the minor grid lines.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if color is NULL
*/
LO_RESULT LOGridGetMinorColor(LOGridRef grid, SUColor* color);
/**
@brief Sets the color for the minor grid lines.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] color The new color for the minor grid lines.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
*/
LO_RESULT LOGridSetMinorColor(LOGridRef grid, SUColor color);
/**
@brief Gets whether or not the grid is visible.
@param[in] grid The grid object.
@param[out] show Whether or not the grid is visible.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if show is NULL
*/
LO_RESULT LOGridGetShow(LOGridRef grid, bool* show);
/**
@brief Sets whether or not the grid is visible.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] show Whether or not the grid is visible.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
*/
LO_RESULT LOGridSetShow(LOGridRef grid, bool show);
/**
@brief Gets whether or not the major grid lines are visible.
@param[in] grid The grid object.
@param[out] show Whether or not the major grid lines are visible.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if show is NULL
*/
LO_RESULT LOGridGetShowMajor(LOGridRef grid, bool* show);
/**
@brief Sets whether or not the major grid lines are visible.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] show Whether or not the major grid lines are visible.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
*/
LO_RESULT LOGridSetShowMajor(LOGridRef grid, bool show);
/**
@brief Gets whether or not the minor grid lines are visible.
@param[in] grid The grid object.
@param[out] show Whether or not the minor grid lines are visible.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if show is NULL
*/
LO_RESULT LOGridGetShowMinor(LOGridRef grid, bool* show);
/**
@brief Sets whether or not the minor grid lines are visible.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] show Whether or not the minor grid lines are visible.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
*/
LO_RESULT LOGridSetShowMinor(LOGridRef grid, bool show);
/**
@brief Gets whether or not the grid will be printed.
@param[in] grid The grid object.
@param[out] print Whether or not the grid will be printed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if print is NULL
*/
LO_RESULT LOGridGetPrint(LOGridRef grid, bool* print);
/**
@brief Sets whether or not the grid is will be printed.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] print Whether or not the grid will be printed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
*/
LO_RESULT LOGridSetPrint(LOGridRef grid, bool print);
/**
@brief Gets whether or not the grid is drawn on top of entities.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[out] in_front Whether or not the grid is on top of entities.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if in_front is NULL
*/
LO_RESULT LOGridGetInFront(LOGridRef grid, bool* in_front);
/**
@brief Sets whether or not the grid is drawn on top of entities.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] in_front Whether or not the grid is on top of entities.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
*/
LO_RESULT LOGridSetInFront(LOGridRef grid, bool in_front);
/**
@brief Gets whether or not the grid is clipped to the paper margins.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[out] clip Whether or not the grid is on top of entities.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if clipped is NULL
*/
LO_RESULT LOGridGetClipToMargins(LOGridRef grid, bool* clip);
/**
@brief Sets whether or not the grid is clipped to the paper margins.
@since LayOut 2020.1, API 5.1
@param[in] grid The grid object.
@param[in] clip Whether or not the grid is clipped to the paper margins.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if grid does not refer to a valid object
*/
LO_RESULT LOGridSetClipToMargins(LOGridRef grid, bool clip);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // LAYOUT_MODEL_GRID_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_GROUP_H_
#define LAYOUT_MODEL_GROUP_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
#include <LayOutAPI/model/document.h>
/**
@struct LOGroupRef
@brief References a group entity. A group is a special type of entity that
does not belong to a layer and contains other entities as children. A
group's children may include other groups, allowing for a hierarchical
tree structure of entities. A group must contain at least one child
and will be automatically collapsed if an operation is performed that
results in the group being empty.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@enum LOGroupResizeBehaviorType
@brief Defines the different types of resize behavior when scale is changed.
*/
typedef enum {
LOGroupResizeBehaviorType_None = 0, /// Group is not resized.
LOGroupResizeBehaviorType_Bounds, /// Entity bounds are resized.
LOGroupResizeBehaviorType_BoundsAndFonts /// Bounds and fonts are resized.
} LOGroupResizeBehaviorType;
/**
@brief Creates a new group object, populating it with the entities in the given
\ref LOEntityListRef. It is possible to create a group from entities
that are already in a document, as well as from entities that are not
yet in a document. For entities that are already in a document, they can
only be grouped if they all belong to shared layers, or all belong to
non-shared layers on the same page. If the entities are in a document,
then the new group will be added to the document at the top of the group
hierarchy.
@param[out] group The group object.
@param[in] entity_list The list of entities to add to the group.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if group is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *group already refers to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
- \ref SU_ERROR_GENERIC if entity_list is empty
- \ref SU_ERROR_GENERIC if entity_list contains entities that belong to
different documents
- \ref SU_ERROR_GENERIC if entity_list contains a mix of entities that belong
to a document and entities that don't belong to a document
- \ref SU_ERROR_GENERIC if entity_list contains entities on both shared
and non-shared layers, or on non-shared layers belonging to different pages.
- \ref SU_ERROR_GENERIC if entity_list contains the same entity more than
once.
*/
LO_RESULT LOGroupCreate(LOGroupRef* group, LOEntityListRef entity_list);
/**
@brief Adds a reference to a group object.
@param[in] group The group object.
@return
SU_ERROR_NONE on success
SU_ERROR_INVALID_INPUT if group does not refer to a valid object
*/
LO_RESULT LOGroupAddReference(LOGroupRef group);
/**
@brief Releases a group object. The object will be invalidated if
releasing the last reference.
@param[in] group The group object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if group is NULL
- \ref SU_ERROR_INVALID_INPUT if *group does not refer to a valid object
*/
LO_RESULT LOGroupRelease(LOGroupRef* group);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOGroupRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOGroupRef.
@param[in] entity The entity object.
@return
- The converted \ref LOGroupRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOGroupRef LOGroupFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOGroupRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] group The group object.
@return
- The converted \ref LOEntityRef if group is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOGroupToEntity(LOGroupRef group);
/**
@brief Removes all the entities from a group and removes the empty group. The
entities will become children of the group's parent. *group will be set
to invalid by this function.
@param[in] group The group object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if group is NULL
- \ref SU_ERROR_INVALID_INPUT if *group does not refer to a valid object
- \ref SU_ERROR_ENTITY_LOCKED if group is locked
*/
LO_RESULT LOGroupUngroup(LOGroupRef* group);
/**
@brief Populates a \ref LOEntityListRef object with all the children of a group.
@param[in] group The group object.
@param[in] entity_list The entity list object to populate with the group's
children.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
*/
LO_RESULT LOGroupGetEntities(LOGroupRef group, LOEntityListRef entity_list);
/**
@brief Gets the number of children within a group.
@param[in] group The group object.
@param[out] num_entities The number of children in the group.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_entities is NULL
*/
LO_RESULT LOGroupGetNumberOfEntities(LOGroupRef group, size_t* num_entities);
/**
@brief Gets the child at the given index from within a group.
@param[in] group The group object.
@param[in] index The index of the child entity to get.
@param[out] child_entity The child entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if child_entity is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *child_entity already refers to a valid
object
*/
LO_RESULT LOGroupGetEntityAtIndex(LOGroupRef group, size_t index, LOEntityRef* child_entity);
/**
@brief Gets the scale factor set on a group.
@since LayOut 2018, API 3.0
@param[in] group The group object.
@param[out] scale_factor The scale factor of the group.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if scale_context is NULL
- \ref SU_ERROR_NO_DATA if group does not have a scale factor set.
*/
LO_RESULT LOGroupGetScaleFactor(LOGroupRef group, double* scale_factor);
/**
@brief Sets the scale factor on a group.
@since LayOut 2018, API 3.0
@param[in] group The group object.
@param[in] scale_factor The scale factor to set.
@param[in] units The units format to use.
@param[in] resize_behavior How entities in the group should adjust
to the new scale.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_UNSUPPORTED if group already effectively has a scale from
a parent or sub-group.
- \ref SU_ERROR_LAYER_LOCKED if group is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if group is locked
*/
LO_RESULT LOGroupSetScaleFactor(
LOGroupRef group, double scale_factor, LODocumentUnits units,
LOGroupResizeBehaviorType resize_behavior);
/**
@brief Returns the scale units for a group.
@since LayOut 2018, API 3.0
@param[in] group The group object.
@param[out] units The unit format for the group.
@param[out] precision The units precision. This is expressed as a value in the
current units.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if units is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if precision is NULL
- \ref SU_ERROR_NO_DATA if this specific group does not have a scale factor set.
*/
LO_RESULT LOGroupGetScaleUnits(LOGroupRef group, LODocumentUnits* units, double* precision);
/**
@brief Sets the units format on a group.
@since LayOut 2018, API 3.0
@param[in] group The group object.
@param[in] units The units format to use.
@param[in] precision The units precision. This is expressed as a value in the
specified units. LayOut only allows for a finite set of
precision values for each units setting, so it will set
the precision to the closest valid setting for the
specified units. See the "Units" section of LayOut's
"Document Setup" dialog for a reference of the available
precisions for each units setting.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if group is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if group is locked
- \ref SU_ERROR_UNSUPPORTED if group does not have a scale factor set.
*/
LO_RESULT LOGroupSetScaleUnits(LOGroupRef group, LODocumentUnits units, double precision);
/**
@brief Removes the scale factor of a group.
@since LayOut 2018, API 3.0
@param[in] group The group object.
@param[in] resize_behavior How entities in the group should adjust
to the new scale.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if group does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if group is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if group is locked
- \ref SU_ERROR_UNSUPPORTED if group does not have a scale factor set.
*/
LO_RESULT LOGroupRemoveScaleFactor(LOGroupRef group, LOGroupResizeBehaviorType resize_behavior);
#ifdef __cplusplus
} // end extern C
#endif // __cplusplus
#endif // LAYOUT_MODEL_GROUP_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_IMAGE_H_
#define LAYOUT_MODEL_IMAGE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOImageRef
@brief References a raster image entity.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new image object from an image file on disk.
@param[out] image The image object.
@param[in] bounds The bounding box for the image.
@param[in] file_path The file path to the image on disk.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if image is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *image already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if file_path is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
- \ref SU_ERROR_SERIALIZATION if there was an error reading the image file or
allocating the memory for the image
- \ref SU_ERROR_NO_DATA if the image file could not be found
*/
LO_RESULT LOImageCreateFromFile(
LOImageRef* image, const LOAxisAlignedRect2D* bounds, const char* file_path);
/**
@brief Adds a reference to an image object.
@param[in] image The image object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if image does not refer to a valid object
*/
LO_RESULT LOImageAddReference(LOImageRef image);
/**
@brief Releases an image object. The object will be invalidated if
releasing the last reference.
@param[in] image The image object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if image is NULL
- \ref SU_ERROR_INVALID_INPUT if *image does not refer to a valid object
*/
LO_RESULT LOImageRelease(LOImageRef* image);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOImageRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOImageRef.
@param[in] entity The entity object.
@return
- The converted \ref LOImageRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOImageRef LOImageFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOImageRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] image The image object.
@return
- The converted \ref LOEntityRef if image is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOImageToEntity(LOImageRef image);
/**
@brief Gets an image object's image representation.
@param[in] image The image object.
@param[out] imagerep The image representation object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if image does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if imagerep is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *imagerep already refers to a valid object
*/
LO_RESULT LOImageGetImageRep(LOImageRef image, LOImageRepRef* imagerep);
/**
@brief Gets an image object's image representation in the document's output resolution.
This should be used by exporters to retrieve the image data at the quality set by \ref
LOPageInfoSetImageOutputResolution.
@since LayOut 2023.1, API 8.1
@param[in] image The image object.
@param[out] imagerep The image representation object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p image does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p imagerep is NULL
- \ref SU_ERROR_OVERWRITE_VALID if \p imagerep already refers to a valid object
*/
LO_RESULT LOImageGetOutputImageRep(LOImageRef image, LOImageRepRef* imagerep);
/**
@brief Returns any clip mask assigned to the image.
@param[in] image The image object.
@param[out] clip_mask The clip mask of the image.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if image does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if clip_mask is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *clip_mask already refers to a valid object
- \ref SU_ERROR_NO_DATA if the image is not being clipped by a clip mask
*/
LO_RESULT LOImageGetClipMask(LOImageRef image, LOEntityRef* clip_mask);
/**
@brief Sets the clip mask of the image. A clip mask defines a region
of the entity that is visible. This allows you to crop with arbitrary
shapes. This operation will replace any clip mask that is already
assigned to this image. The entity being used must not be already part
of a document or group. The clip mask entity must be either a
rectangle, ellipse or a path.
@note Starting in LayOut 2020.1, API 5.1, clip_mask may be SU_INVALID, which
will remove the existing clip mask, if any.
@since LayOut 2017, API 2.0
@param[in] image The image object.
@param[in] clip_mask The new clip mask for the image.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if image does not refer to a valid object
- \ref SU_ERROR_INVALID_ARGUMENT if clip_mask is already in a document or group
- \ref SU_ERROR_UNSUPPORTED if clip_mask is not a rectangle, ellipse, or path
- \ref SU_ERROR_LAYER_LOCKED if image is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if image is locked
*/
LO_RESULT LOImageSetClipMask(LOImageRef image, LOEntityRef clip_mask);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_IMAGE_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_IMAGEREP_H_
#define LAYOUT_MODEL_IMAGEREP_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
#include <SketchUpAPI/color.h>
/**
@enum LOImageRepOutputFormat
@brief Represents the file formats that an image representation can be saved as
when saving to a file.
*/
typedef enum {
LOImageRepOutputFormat_PNG = 0, ///< PNG file format.
LOImageRepOutputFormat_JPG, ///< JPG file format.
LONumImageRepOutputFormats
} LOImageRepOutputFormat;
/**
@struct LOImageRepRef
@brief References the bitmap representation for a raster image.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the dimensions in pixels of an image representation.
@param[in] imagerep The image representation object.
@param[out] width The width of the image.
@param[out] height The height of the image.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if imagerep does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if width is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if height is NULL
*/
LO_RESULT LOImageRepGetPixelDimensions(LOImageRepRef imagerep, size_t* width, size_t* height);
/**
@brief Gets the DPI of an image representation.
@since LayOut 2018, API 3.0
@param[in] imagerep The image representation object.
@param[out] x_dpi The DPI in horizontal direction.
@param[out] y_dpi The DPI in vertical direction.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if imagerep does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if x_dpi is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if y_dpi is NULL
*/
LO_RESULT LOImageRepGetDPI(LOImageRepRef imagerep, double* x_dpi, double* y_dpi);
/**
@brief Returns the total size and bits-per-pixel value of an image
representation. This function is useful to determine the size of the
buffer necessary to be passed into \ref LOImageRepGetData. The returned
data can be used along with the returned bits-per-pixel value and the
image dimensions to compute RGBA values at individual pixels of the
image.
@param[in] imagerep The image representation object.
@param[out] data_size The total size of the image data in bytes.
@param[out] bits_per_pixel The number of bits per pixel of the image data.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if imagerep is an invalid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if data_size or bits_per_pixel is NULL
*/
LO_RESULT LOImageRepGetDataSize(LOImageRepRef imagerep, size_t* data_size, size_t* bits_per_pixel);
/**
@brief Returns the pixel data for an image representation. The given array
must be large enough to hold the image representation's data. This size
can be obtained by calling \ref LOImageRepGetDataSize.
@param[in] imagerep The image representation object.
@param[in] data_size The size of the byte array.
@param[out] pixel_data The image data retrieved.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if imagerep is an invalid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if pixel_data is NULL
- \ref SU_ERROR_INSUFFICIENT_SIZE if data_size is insufficient for the image
data
*/
LO_RESULT LOImageRepGetData(LOImageRepRef imagerep, size_t data_size, SUByte pixel_data[]);
/**
@brief Saves the image representation to the file at the indicated path.
@param[in] imagerep The image representation object.
@param[in] filename The file path to where the image should go on disk.
@param[in] format What format to save the image as.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if imagerep is invalid
- \ref SU_ERROR_NULL_POINTER_INPUT if filename is NULL
- \ref SU_ERROR_SERIALIZATION if there was an error writing the image file
*/
LO_RESULT LOImageRepSaveAs(
LOImageRepRef imagerep, const char* filename, LOImageRepOutputFormat format);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_IMAGEREP_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_LABEL_H_
#define LAYOUT_MODEL_LABEL_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
#include <LayOutAPI/model/formattedtext.h>
/**
@struct LOLabelRef
@brief References a label entity. A label consists of the label text (formatted
text entity) and the label leader (path entity). A label may be
connected to another entity via a \ref LOConnectionPointRef object.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@enum LOLabelLeaderLineType
@brief Defines the different types of leader lines for a label entity.
*/
typedef enum {
LOLabelLeaderLineType_SingleSegment = 0, ///< Single segment leader line.
LOLabelLeaderLineType_TwoSegment, ///< Two segment leader line.
LOLabelLeaderLineType_Bezier, ///< Curved Bezier leader line.
LOLabelLeaderLineType_Unknown, ///< Custom leader line.
LONumLabelLeaderLineTypes
} LOLabelLeaderLineType;
/**
@enum LOLabelTextConnectionType
@brief Defines the different types of label text connections for a label entity.
*/
typedef enum {
LOLabelTextConnectionType_NoConnection = 0, ///< Label text behaves disconnected.
LOLabelTextConnectionType_Automatic, ///< Automatically choses one of the other types based on
///< current label geometry.
LOLabelTextConnectionType_ReverseAutomatic, ///< Automatically choose the OPPOSITE of the type
///< indicated by
///< LOLabelTextConnectionType_Automatic.
LOLabelTextConnectionType_TopLeft, ///< Top-left corner of text.
LOLabelTextConnectionType_CenterLeft, ///< Vertical center of left side of text.
LOLabelTextConnectionType_BottomLeft, ///< Bottom-left corner of text.
LOLabelTextConnectionType_TopRight, ///< Top-right corner of text.
LOLabelTextConnectionType_CenterRight, ///< Vertical center of right side of text.
LOLabelTextConnectionType_BottomRight, ///< Bottom-right corner of text.
LONumLabelTextConnectionTypes
} LOLabelTextConnectionType;
/**
@brief Creates a new disconnected label object whose text is unbounded.
@param[out] label The label object.
@param[in] anchor_point The anchor point for the label text's position.
@param[in] anchor_type Defines which point of the label text is set by
anchor_point.
@param[in] plain_text The plain text to use for the label text.
@param[in] leader_line_type The type of leader line this label will have.
@param[in] target_point Where the label leader should point to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if label is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *label already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if anchor_point is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if plain_text is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if target_point is NULL
- \ref SU_ERROR_OUT_OF_RANGE if anchor_type is not a valid value
- \ref SU_ERROR_OUT_OF_RANGE if leader_line_type is not a valid value
- \ref SU_ERROR_GENERIC if plain_text is an empty string
*/
LO_RESULT LOLabelCreateAtPoint(
LOLabelRef* label, const LOPoint2D* anchor_point, LOFormattedTextAnchorType anchor_type,
const char* plain_text, LOLabelLeaderLineType leader_line_type, const LOPoint2D* target_point);
/**
@brief Creates a new disconnected label object whose text is bounded.
@param[out] label The label object.
@param[in] bounds The label text bounds.
@param[in] plain_text The plain text to use as the label text.
@param[in] leader_line_type The type of leader line this label will have.
@param[in] target_point Where the label leader should point to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if label is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *label already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if plain_text is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if target_point is NULL
- \ref SU_ERROR_GENERIC if plain_text is an empty string
- \ref SU_ERROR_OUT_OF_RANGE if bounds is zero sized
- \ref SU_ERROR_OUT_OF_RANGE if leader_line_type is not a valid value
*/
LO_RESULT LOLabelCreateWithBounds(
LOLabelRef* label, const LOAxisAlignedRect2D* bounds, const char* plain_text,
LOLabelLeaderLineType leader_line_type, const LOPoint2D* target_point);
/**
@brief Adds a reference to a label object.
@param[in] label The label object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
*/
LO_RESULT LOLabelAddReference(LOLabelRef label);
/**
@brief Releases a label object. The object will be invalidated if
releasing the last reference.
@param[in] label The label object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if label is NULL
- \ref SU_ERROR_INVALID_INPUT if *label does not refer to a valid object
*/
LO_RESULT LOLabelRelease(LOLabelRef* label);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOLabelRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOLabelRef.
@param[in] entity The entity object.
@return
- The converted \ref LOLabelRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOLabelRef LOLabelFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOLabelRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] label The label object.
@return
- The converted \ref LOEntityRef if label is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOLabelToEntity(LOLabelRef label);
/**
@brief Creates the entities that represent the label in its exploded form and
adds them to a \ref LOEntityListRef. It is NOT necessary to explicitly
release these entities, since \ref LOEntityListRef itself adds a
reference to the entities and will release them when they are removed
from the list or when the list is released.
@param[in] label The label object.
@param[in] entity_list The entity list object to add the new entities to.
@param[in] page_for_autotext The page that is currently being imported, exported,
or displayed. This must be a valid object if
auto-text tags should be substituted with their
display representations in the text that is
returned. Otherwise, this object may be invalid.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
- \ref SU_ERROR_GENERIC if page_for_autotext is a valid object and does not
belong to the same document as label.
*/
LO_RESULT LOLabelGetExplodedEntities(
LOLabelRef label, LOEntityListRef entity_list, LOPageRef page_for_autotext);
/**
@brief Connects the label to the given connection point. The leader line will
be adjusted to point at the connection point. The label must be in the
same document as the connection point. If both the label and the
connection point's entity are on non-shared layers, they must be on the
same page.
@param[in] label The label object.
@param[in] connection_point The connection point object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if connection_point does not refer to a valid
object
- \ref SU_ERROR_LAYER_LOCKED if label is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if label is locked
- \ref SU_ERROR_GENERIC if the label was unable to connect to the connection
point
*/
LO_RESULT LOLabelConnectTo(LOLabelRef label, LOConnectionPointRef connection_point);
/**
@brief Disconnects the label from its connection point. The leader line will
not be adjusted by disconnecting from a connection point.
@param[in] label The label object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if label is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if label is locked
*/
LO_RESULT LOLabelDisconnect(LOLabelRef label);
/**
@brief Creates a copy of the label text's \ref LOFormattedTextRef object.
@param[in] label The label object.
@param[out] text A copy of the formatted text object representing the label
text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *text already refers to a valid object
*/
LO_RESULT LOLabelCreateLabelTextCopy(LOLabelRef label, LOFormattedTextRef* text);
/**
@brief Creates a copy of the label text's \ref LOFormattedTextRef object. This
copy will have all auto-text tags substituted with the display text. A
valid page object must be provided for page name/number auto-text to
be correctly substituted.
@param[in] label The label object.
@param[in] page The page object.
@param[out] text A copy of the formatted text object representing the label
display text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_GENERIC if page and label don't belong to the same document
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *text already refers to a valid object
*/
LO_RESULT LOLabelCreateLabelDisplayTextCopy(
LOLabelRef label, LOPageRef page, LOFormattedTextRef* text);
/**
@brief Sets the text of a label from a \ref LOFormattedTextRef object. The
leader line will be adjusted to connect to the new label text if its
bounds are different.
@param[in] label The label object.
@param[in] text The formatted text object representing the label text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if label is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if label is locked
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
*/
LO_RESULT LOLabelSetLabelText(LOLabelRef label, LOFormattedTextRef text);
/**
@brief Creates a copy of the label leader's \ref LOPathRef object.
@param[in] label The label object.
@param[out] path A copy of the path object representing the label leader.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if path is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *path already refers to a valid object
*/
LO_RESULT LOLabelCreateLeaderLineCopy(LOLabelRef label, LOPathRef* path);
/**
@brief Sets the leader line of a label from a \ref LOPathRef object. The label
text position will change to remain connected to the end point of the
leader line. The leader line type may change based on number and types
of points in the path.
@param[in] label The label object.
@param[in] path The path object representing the label leader.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_GENERIC if path contains less than two points
- \ref SU_ERROR_LAYER_LOCKED if label is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if label is locked
*/
LO_RESULT LOLabelSetLeaderLine(LOLabelRef label, LOPathRef path);
/**
@brief Gets the type of leader line the label is using. If the leader line has
been customized, the type may be unknown.
@param[in] label The label object.
@param[out] leader_line_type The leader line type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if leader_line_type is NULL
*/
LO_RESULT LOLabelGetLeaderLineType(LOLabelRef label, LOLabelLeaderLineType* leader_line_type);
/**
@brief Sets the type of leader line the label is using. New control points will
be generated if changing to a two segment or bezier leader line type.
@param[in] label The label object.
@param[in] leader_line_type The leader line type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if leader_line_type is
LOLabelLeaderLineType_Unknown or not a valid leader line type
- \ref SU_ERROR_LAYER_LOCKED if label is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if label is locked
*/
LO_RESULT LOLabelSetLeaderLineType(LOLabelRef label, LOLabelLeaderLineType leader_line_type);
/**
@brief Gets the type of connection between the label text and leader line.
@param[in] label The label object.
@param[out] text_connection_type The text connection type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text_connection_type is NULL
*/
LO_RESULT LOLabelGetTextConnectionType(
LOLabelRef label, LOLabelTextConnectionType* text_connection_type);
/**
@brief Sets the type of connection between the label text and leader line. The
text position will change to account for a change in text connection
type.
@param[in] label The label object.
@param[in] text_connection_type The text connection type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if label does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if label is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED
- \ref SU_ERROR_OUT_OF_RANGE if text_connection_type is not a valid value
*/
LO_RESULT LOLabelSetTextConnectionType(
LOLabelRef label, LOLabelTextConnectionType text_connection_type);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // LAYOUT_MODEL_LABEL_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_LAYER_H_
#define LAYOUT_MODEL_LAYER_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOLayerRef
@brief References a layer definition. A layer definition specifies the
document-wide information about a layer. To access the entities on a
layer for a given page, use \ref LOLayerInstanceRef.
*/
/**
@enum LOShareLayerAction
@brief Defines the different ways to manage entities when sharing a layer.
*/
typedef enum {
LOShareLayerAction_Clear, ///< Delete all entities on the layer
LOShareLayerAction_KeepOnePage, ///< Keep the entities on the specified page
LOShareLayerAction_MergeAllPages, ///< Merge the entities from all pages
LONumShareLayerActions
} LOShareLayerAction;
/**
@enum LOUnshareLayerAction
@brief Defines the different ways to manage entities when making a layer
non-shared.
*/
typedef enum {
LOUnshareLayerAction_Clear, ///< Delete all entities on the layer
LOUnshareLayerAction_CopyToOnePage, ///< Copy entities to the specified page
LOUnshareLayerAction_CopyToAllPages, ///< Copy entities to all pages
LONumUnshareLayerActions
} LOUnshareLayerAction;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the name of a layer.
@param[in] layer_definition The layer definition object.
@param[out] name The name of the layer.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
- \ref SU_ERROR_INVALID_OUTPUT if name does not refer to a valid object
*/
LO_RESULT LOLayerGetName(LOLayerRef layer_definition, SUStringRef* name);
/**
@brief Sets the name of a layer.
@param[in] layer_definition The layer definition object.
@param[in] name The new name for the layer.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_INPUT if name is NULL
- \ref SU_ERROR_UNSUPPORTED if name is an empty string
*/
LO_RESULT LOLayerSetName(LOLayerRef layer_definition, const char* name);
/**
@brief Gets whether or not a layer is locked.
@param[in] layer_definition The layer definition object.
@param[out] is_locked Whether the layer is locked or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_locked is NULL
*/
LO_RESULT LOLayerGetLocked(LOLayerRef layer_definition, bool* is_locked);
/**
@brief Sets whether or not a layer is locked. When setting a layer to locked,
there must be at least one other unlocked and visible layer on every
page. If this is not the case, then the next layer will be automatically
unlocked and made visible on all pages as necessary to proceed with the
operation.
@param[in] layer_definition The layer definition object.
@param[in] is_locked Whether the layer should be locked or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_GENERIC if the layer could not be locked because it would
break the rule that there must be at least one unlocked, visible layer on
each page
*/
LO_RESULT LOLayerSetLocked(LOLayerRef layer_definition, bool is_locked);
/**
@brief Gets whether or not a layer is a shared layer.
@param[in] layer_definition The layer definition object.
@param[in] is_shared Whether the layer is shared or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_shared is NULL
*/
LO_RESULT LOLayerGetShared(LOLayerRef layer_definition, bool* is_shared);
/**
@brief Shares a layer. If action is \ref LOShareLayerAction_Clear or
\ref LOShareLayerAction_MergeAllPages, then page may be an invalid
object.
@param[in] layer_definition The layer definition object.
@param[in] page The the page to use when action is \ref
LOShareLayerAction_KeepOnePage.
@param[in] action The action to apply to existing entities on the
layer that is being shared.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_LAYER_LOCKED if layer_definition is a locked layer
- \ref SU_ERROR_GENERIC if page does not refer to a valid object and the
desired action requires a page
- \ref SU_ERROR_GENERIC if an error occured attempting to share the layer
- \ref SU_ERROR_OUT_OF_RANGE if action is not a valid value
*/
LO_RESULT LOLayerSetShared(LOLayerRef layer_definition, LOPageRef page, LOShareLayerAction action);
/**
@brief Unshares a layer. If action is \ref LOUnshareLayerAction_Clear or
\ref LOUnshareLayerAction_CopyToAllPages, then page may be an invalid
object.
@param[in] layer_definition The layer definition object.
@param[in] page The the page to use when action is
\ref LOUnshareLayerAction_CopyToOnePage.
@param[in] action The action to apply to existing entities on the
layer that is being unshared.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_LAYER_LOCKED if layer_definition is a locked layer
- \ref SU_ERROR_GENERIC if page does not refer to a valid object and the
desired action requires a page
- \ref SU_ERROR_GENERIC if an error occured attempting to unshare the layer
- \ref SU_ERROR_OUT_OF_RANGE if action is not a valid value
*/
LO_RESULT LOLayerSetNonShared(
LOLayerRef layer_definition, LOPageRef page, LOUnshareLayerAction action);
/**
@brief Gets the layer instance for the given layer definition on a given page.
If layer_definition specifies a shared layer, page may be an invalid
object.
@param[in] layer_definition The layer definition object.
@param[in] page The page object.
@param[out] layer_instance The layer instance object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object and
layer_definition is not a shared layer
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_instance is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *layer_instance already refers to a valid object
- \ref SU_ERROR_GENERIC if an error occurred attempting to get the layer
instance
*/
LO_RESULT LOLayerGetLayerInstance(
LOLayerRef layer_definition, LOPageRef page, LOLayerInstanceRef* layer_instance);
/**
@brief Returns the index of this layer in the document.
@param[in] layer_definition The layer definition object.
@param[out] index The index of the layer in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if index is NULL
*/
LO_RESULT LOLayerGetLayerIndex(LOLayerRef layer_definition, size_t* index);
/**
@brief Returns the document that this layer belongs to.
@since LayOut 2018, API 3.0
@param[in] layer_definition The layer definition object.
@param[out] document The document object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
*/
LO_RESULT LOLayerGetDocument(LOLayerRef layer_definition, LODocumentRef* document);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_LAYER_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_LAYER_INSTANCE_H_
#define LAYOUT_MODEL_LAYER_INSTANCE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOLayerInstanceRef
@brief References a layer instance. A layer instance provides access to the
entities that are drawn on a given layer, as well as the draw order of
those entities. Groups are not included in the list of entities
associated with a layer instance, since the group hierarchy has no
effect on entity draw order. Each page has one layer instance for each
layer in the document. Non-shared layer instances are unique per page,
while shared layer instances are shared across all pages of the
document.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the number of entities associated with a layer instance.
@param[in] layer_instance The layer instance object.
@param[out] number_of_entities The number of entities associated with the layer
instance.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_instance does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if number_of_entities is NULL
*/
LO_RESULT LOLayerInstanceGetNumberOfEntities(
LOLayerInstanceRef layer_instance, size_t* number_of_entities);
/**
@brief Gets the entity at the given index of a layer instance's draw order.
@param[in] layer_instance The layer instance object.
@param[in] index The index of the entity to get.
@param[out] entity The entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_instance does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index out of range
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *entity already refers to a valid object
*/
LO_RESULT LOLayerInstanceGetEntityAtIndex(
LOLayerInstanceRef layer_instance, size_t index, LOEntityRef* entity);
/**
@brief Gets the index of the given entity on the layer instance.
@since LayOut 2018, API 3.0
@param[in] layer_instance The layer instance object.
@param[in] entity The entity object.
@param[out] index The index of the entity.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_instance does not refer to a valid object
- \ref SU_ERROR_INVALID_ARGUMENT if entity is not on layer_instance
- \ref SU_ERROR_NULL_POINTER_OUTPUT if index is NULL
*/
LO_RESULT LOLayerInstanceGetIndexOfEntity(
LOLayerInstanceRef layer_instance, LOEntityRef entity, size_t* index);
/**
@brief Populates a \ref LOEntityListRef with all the entities associated with a
layer instance, ordered by their draw order.
@param[in] layer_instance The layer instance object.
@param[out] entity_list The entity list to populate.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_instance does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
*/
LO_RESULT LOLayerInstanceGetEntities(
LOLayerInstanceRef layer_instance, LOEntityListRef entity_list);
/**
@brief Moves the entity to the specified index within a layer instance's draw
order. The entity must already belong to the layer instance that is
passed in.
@param[in] layer_instance The layer instance object.
@param[in] entity The entity object.
@param[in] index The index to move the entity to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_instance does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity does not belong to the given layer
instance
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range
*/
LO_RESULT LOLayerInstanceReorderEntity(
LOLayerInstanceRef layer_instance, LOEntityRef entity, size_t index);
/**
@brief Gets the layer definition that a layer instance is associated with.
@param[in] layer_instance The layer instance object.
@param[out] layer_definition The layer definition object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_instance does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_definition is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *layer_definition already refers to a valid object
*/
LO_RESULT LOLayerInstanceGetLayerDefinition(
LOLayerInstanceRef layer_instance, LOLayerRef* layer_definition);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_LAYER_INSTANCE_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_LAYER_LIST_H_
#define LAYOUT_MODEL_LAYER_LIST_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOLayerListRef
@brief References an ordered, indexable list of \ref LOLayerRef objects.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new empty layer list object.
@param[out] layer_list The layer definition list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_list is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *layer_list already refers to a valid object
*/
LO_RESULT LOLayerListCreate(LOLayerListRef* layer_list);
/**
@brief Releases a layer list object. *layer_list will be set to invalid by this
function.
@param[in] layer_list The layer definition list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if layer_list is NULL
- \ref SU_ERROR_INVALID_INPUT if *layer_list does not refer to a valid object
*/
LO_RESULT LOLayerListRelease(LOLayerListRef* layer_list);
/**
@brief Gets the number of layer definitions in the list.
@param[in] layer_list The layer definition list object.
@param[out] num_layers The number of layer definitions in the list.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_list does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_layers is NULL
*/
LO_RESULT LOLayerListGetNumberOfLayers(LOLayerListRef layer_list, size_t* num_layers);
/**
@brief Gets the layer definition at the specified index.
@param[in] layer_list The layer definition list object.
@param[in] index The index of the layer definition object to get.
@param[out] layer The layer definition object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if layer_list does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range for this list
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *layer already refers to a valid object
*/
LO_RESULT LOLayerListGetLayerAtIndex(LOLayerListRef layer_list, size_t index, LOLayerRef* layer);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_LAYER_LIST_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_LINEARDIMENSION_H_
#define LAYOUT_MODEL_LINEARDIMENSION_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOLinearDimensionRef
@brief References a linear dimension entity. A linear dimension is composed of
the following sub-entities:
- two 'extension lines' that connect to the entity being dimensioned.
- a 'dimension line' connecting the ends of the leaders.
(this may be represented by one or two paths depending on appearance.)
- an optional 'leader line' that is used for small dimensions.
- a 'dimension text' that displays the dimension's text.
There are six points that may be modified for a linear dimension:
- two 'connection points' that define the start and end of the
dimension.
- two 'extent points' that define the start and end of the dimension
line and are the ends of the two extension lines.
- two 'offset points' that define the starting points of the extension
lines.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@enum LOLinearDimensionLeaderLineType
@brief Defines the different types of leader lines for a linear dimension entity.
*/
typedef enum {
LOLinearDimensionLeaderLineType_SingleSegment = 0, ///< Single segment leader line.
LOLinearDimensionLeaderLineType_TwoSegment, ///< Two segment leader line.
LOLinearDimensionLeaderLineType_Bezier, ///< Curved Bezier leader line.
LOLinearDimensionLeaderLineType_Hidden, ///< No visible leader line.
LONumLinearDimensionLeaderLineTypes
} LOLinearDimensionLeaderLineType;
/**
@brief Creates a new disconnected linear dimension object.
@param[out] dimension The linear dimension object
@param[in] start_point Where the dimension should start
@param[in] end_point Where the dimension should end
@param[in] height Distance from the start and end points to the dimension
line
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if dimension is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *dimension already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if start_point is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if end_point is NULL
*/
LO_RESULT LOLinearDimensionCreate(
LOLinearDimensionRef* dimension, const LOPoint2D* start_point, const LOPoint2D* end_point,
double height);
/**
@brief Adds a reference to a linear dimension object.
@param[in] dimension The linear dimension object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
*/
LO_RESULT LOLinearDimensionAddReference(LOLinearDimensionRef dimension);
/**
@brief Releases a linear dimension object. The object will be invalidated if
releasing the last reference.
@param[in] dimension The linear dimension object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if dimension is NULL
- \ref SU_ERROR_INVALID_INPUT if *dimension does not refer to a valid object
*/
LO_RESULT LOLinearDimensionRelease(LOLinearDimensionRef* dimension);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOLinearDimensionRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOLinearDimensionRef.
@param[in] entity The entity object.
@return
- The converted \ref LOLinearDimensionRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOLinearDimensionRef LOLinearDimensionFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOLinearDimensionRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] dimension The linear dimension object.
@return
- The converted \ref LOEntityRef if dimension is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOLinearDimensionToEntity(LOLinearDimensionRef dimension);
/**
@brief Creates the entities that represent the dimension in its exploded form
and adds them to a \ref LOEntityListRef. It is NOT necessary to
explicitly release these entities, since \ref LOEntityListRef itself
adds a reference to the entities and will release them when they are
removed from the list or when the list is released. Depending on the
appearance of the dimension being exploded, this may return anywhere from
four to six entities. Start extension line, end extension line,
one or two dimension lines, dimension text, optional leader line.
@param[in] dimension The linear dimension object.
@param[in] entity_list The entity list object to add the new entities to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
*/
LO_RESULT LOLinearDimensionGetExplodedEntities(
LOLinearDimensionRef dimension, LOEntityListRef entity_list);
/**
@brief Gets whether or not the dimension text uses custom text. When
true, the dimension text will display a custom string that doesn't
change. When false, the dimension text will display the length
measurement and will update automatically.
@param[in] dimension The linear dimension object.
@param[out] use_custom_text Whether the dimension uses custom text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if use_auto_text is NULL
*/
LO_RESULT LOLinearDimensionGetUsesCustomText(LOLinearDimensionRef dimension, bool* use_custom_text);
/**
@brief Sets whether or not the dimension text uses custom text. When true, the
dimension text will display a custom string that doesn't change. When
false, the dimension text will display the length measurement and will
update automatically.
@param[in] dimension The linear dimension object.
@param[in] use_custom_text Whether or not the dimension should use custom text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetUsesCustomText(LOLinearDimensionRef dimension, bool use_custom_text);
/**
@brief Creates a copy of the dimension text's \ref LOFormattedTextRef object.
@note With the addition of auto-text in dimensions for LayOut 2019.2, the
copy of the dimension text incorrectly provided the plain text when
requesting the display text. This has been fixed in LayOut 2020.1, API 5.1.
@param[in] dimension The linear dimension object.
@param[out] text The formatted text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if text is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *text already refers to a valid object
*/
LO_RESULT LOLinearDimensionCreateDimensionTextCopy(
LOLinearDimensionRef dimension, LOFormattedTextRef* text);
/**
@brief Sets the text of the dimension from a \ref LOFormattedTextRef object.
The dimension lines may be adjusted if the text has been re-positioned.
@param[in] dimension The linear dimension object.
@param[in] text The formatted text object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if text does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetDimensionText(
LOLinearDimensionRef dimension, LOFormattedTextRef text);
/**
@brief Gets the type of leader line the linear dimension is using.
@param[in] dimension The linear dimension object.
@param[out] leader_line_type The leader line type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if leader_line_type is NULL
*/
LO_RESULT LOLinearDimensionGetLeaderLineType(
LOLinearDimensionRef dimension, LOLinearDimensionLeaderLineType* leader_line_type);
/**
@brief Sets the type of leader line the linear dimension is using. New control
points will be generated if changing to a two segment or bezier leader
line type. Setting the leader line type to \ref
LOLinearDimensionLeaderLineType_Hidden will not move the dimension text.
@param[in] dimension The linear dimension object.
@param[in] leader_line_type The leader line type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if leader_line_type is not a valid value
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetLeaderLineType(
LOLinearDimensionRef dimension, LOLinearDimensionLeaderLineType leader_line_type);
/**
@brief Gets whether or not the scale for the dimension length text is set
automatically.
@param[in] dimension The linear dimension object.
@param[out] use_auto_scale Whether the dimension is using auto scale or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if use_auto_scale is NULL
*/
LO_RESULT LOLinearDimensionGetUsesAutoScale(LOLinearDimensionRef dimension, bool* use_auto_scale);
/**
@brief Sets whether or not the scale for the dimension length text is set
automatically.
@param[in] dimension The linear dimension object.
@param[in] use_auto_scale Whether the dimension should use auto scale or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
*/
LO_RESULT LOLinearDimensionSetUsesAutoScale(LOLinearDimensionRef dimension, bool use_auto_scale);
/**
@brief Gets the scale being used for the dimension length text.
@param[in] dimension The linear dimension object.
@param[out] scale The dimension text scale.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if scale is NULL
*/
LO_RESULT LOLinearDimensionGetScale(LOLinearDimensionRef dimension, double* scale);
/**
@brief Sets the scale being used for the dimension length text. This will also
make the scale not use auto-scale.
@param[in] dimension The linear dimension object.
@param[in] scale The new scale to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if scale is not positive or scale is greater than 1
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetScale(LOLinearDimensionRef dimension, double scale);
/**
@brief Gets the page location for the first connection.
@param[in] dimension The linear dimension object.
@param[out] point The position of the first connection point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOLinearDimensionGetStartConnectionPoint(
LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the page location for the first connection. This will cause the
dimension to become disconnected. To make a connected dimension, call
LOLinearDimensionConnectTo.
@param[in] dimension The linear dimension object.
@param[in] point The position for the first connection point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetStartConnectionPoint(
LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Gets the page location for the second connection. This will cause the
dimension to become disconnected. To make a connected dimension, call
LOLinearDimensionConnectTo.
@param[in] dimension The linear dimension object.
@param[out] point The position of the second control point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOLinearDimensionGetEndConnectionPoint(LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the page location for the second connection.
@param[in] dimension The linear dimension object.
@param[in] point The position for the second control point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetEndConnectionPoint(LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Gets the page location for the start of the dimension line.
@param[in] dimension The linear dimension object.
@param[out] point The position of the start of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOLinearDimensionGetStartExtentPoint(LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the page location for the start of the dimension line. This will
also adjust the end of the dimension line to maintain the correct
dimension line length.
@param[in] dimension The linear dimension object.
@param[in] point The position of the start of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetStartExtentPoint(LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Gets the page location for the end of the dimension line.
@param[in] dimension The linear dimension object.
@param[out] point The position of the end of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOLinearDimensionGetEndExtentPoint(LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the page location for the end of the dimension line. This will
also adjust the start of the dimension line to maintain the correct
dimension line length.
@param[in] dimension The linear dimension object.
@param[in] point The position of the end of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetEndExtentPoint(LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Gets the page location for the start of the first extension line. The
first extension line runs from this offset point to the start extent
point.
@param[in] dimension The linear dimension object.
@param[out] point The position of the start of the extension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOLinearDimensionGetStartOffsetPoint(LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Gets the page location for the start of the second extension line. The
second extension line runs from this offset point to the end extent
point.
@param[in] dimension The linear dimension object.
@param[out] point The position of the end of the dimension line.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOLinearDimensionGetEndOffsetPoint(LOLinearDimensionRef dimension, LOPoint2D* point);
/**
@brief Sets the length of the offset from the first connection point to the
start of the first extension line. The connection and extent points will
not move.
@param[in] dimension The linear dimension object.
@param[in] length The length the offset to the extension line should be.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetStartOffsetLength(LOLinearDimensionRef dimension, double length);
/**
@brief Sets the length of the offset from the second connection point to the
start of the second extension line. The connection and extent points
will not move.
@param[in] dimension The linear dimension object.
@param[in] length The length the offset to the extension line should be.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionSetEndOffsetLength(LOLinearDimensionRef dimension, double length);
/**
@brief Connects the linear dimension to the given connection points. If both
the linear dimension and the connection point's entities are on
non-shared layers, they must be on the same page.
@param[in] dimension The linear dimension object.
@param[in] start_point The first connection point object.
@param[in] end_point The second connection point object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if start_point does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if end_point does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
- \ref SU_ERROR_GENERIC if the linear dimension was unable to connect to the
connection points
*/
LO_RESULT LOLinearDimensionConnectTo(
LOLinearDimensionRef dimension, LOConnectionPointRef start_point,
LOConnectionPointRef end_point);
/**
@brief Disconnects the linear dimension from its connection points. The
dimension will not be adjusted by disconnecting from its connection
points.
@param[in] dimension The linear dimension object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if dimension does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if dimension is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if dimension is locked
*/
LO_RESULT LOLinearDimensionDisconnect(LOLinearDimensionRef dimension);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_LINEARDIMENSION_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_PAGE_H_
#define LAYOUT_MODEL_PAGE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@enum LOPageEntityIteratorFlags
@brief Defines the options that are available when creating a \ref
LOEntityIteratorRef for iterating the entities on a page.
*/
typedef enum {
LOPageEntityIteratorFlags_None = 0x0, ///< Default iterator behavior. Does not skip any entities.
LOPageEntityIteratorFlags_SkipHidden = 0x1, ///< Skip entities on hidden layers
LOPageEntityIteratorFlags_SkipLocked = 0x2, ///< Skip entities on locked layers
LOPageEntityIteratorFlags_SkipHiddenOrLocked = 0x3 ///< Skip entities on hidden or locked layers
} LOPageEntityIteratorFlags;
/**
@struct LOPageRef
@brief References a single page in a document.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the name of a page.
@param[in] page The page object.
@param[out] name The name of the page.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
- \ref SU_ERROR_INVALID_OUTPUT if name does not refer to a valid object
*/
LO_RESULT LOPageGetName(LOPageRef page, SUStringRef* name);
/**
@brief Sets the name of a page.
@param[in] page The page object.
@param[in] name The new name of the page.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if name is NULL
- \ref SU_ERROR_UNSUPPORTED if name is an empty string
*/
LO_RESULT LOPageSetName(LOPageRef page, const char* name);
/**
@brief Gets whether or not a page is included in presentations.
@param[in] page The page object.
@param[out] in_presentation Whether the page will be in a presentation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if in_presentation is NULL
*/
LO_RESULT LOPageGetInPresentation(LOPageRef page, bool* in_presentation);
/**
@brief Sets whether or not a page is included in presentations.
@param[in] page The page object.
@param[in] in_presentation Whether the page should be in a presentation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
*/
LO_RESULT LOPageSetInPresentation(LOPageRef page, bool in_presentation);
/**
@brief Gets whether or not a layer is visible on a page. Layers in LayOut exist
on every page in a document. Each page specifies the visibility of each
layer for that page.
@param[in] page The page object.
@param[in] layer_definition The layer definition object.
@param[out] visible Whether or not the layer is visible.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if visible is NULL
- \ref SU_ERROR_GENERIC if page and layer_definition don't belong to the same
document
*/
LO_RESULT LOPageGetLayerVisible(LOPageRef page, LOLayerRef layer_definition, bool* visible);
/**
@brief Sets whether or not a layer is visible on a page. Layers in LayOut
exist on every page in a document. Each page specifies the visibility of
each layer for that page.
@param[in] page The page object.
@param[in] layer_definition The layer definition object.
@param[in] visible Whether or not the layer should be visible.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if layer_definition does not refer to a valid
object
- \ref SU_ERROR_GENERIC if page and layer_definition don't belong to the same
document
- \ref SU_ERROR_GENERIC if the layer could not be hidden because it would
break the rule that there must be at least one unlocked, visible layer on
each page
*/
LO_RESULT LOPageSetLayerVisible(LOPageRef page, LOLayerRef layer_definition, bool visible);
/**
@brief Gets references to all the layer instances for a page. The layer
instances are in the same order that the layer definitions exist in the
document. Use \ref LODocumentGetNumberOfLayers to determine how many
layer instances will be returned by this function.
@param[in] page The page object.
@param[in] array_size The size of the array to copy into.
@param[out] layer_instances The layer instances.
@param[out] number_copied The number of layer instances copied.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_instances is NULL
- \ref SU_ERROR_OVERWRITE_VALID if one or more of the objects in the
layer_instances array are not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if number_copied is NULL
*/
LO_RESULT LOPageGetLayerInstances(
LOPageRef page, size_t array_size, LOLayerInstanceRef layer_instances[], size_t* number_copied);
/**
@brief Gets a reference to the layer instance at the given index for this
page. The layer instances are in the same order that the layer
definitions exist in the document. Use \ref LODocumentGetNumberOfLayers
to determine how many layer definitions exist in the document.
@param[in] page The page object.
@param[in] index The index of the layer instance to get.
@param[out] layer_instance The layer instance object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range
- \ref SU_ERROR_NULL_POINTER_OUTPUT if layer_instance is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *layer_instance already refers to a valid object
*/
LO_RESULT LOPageGetLayerInstanceAtIndex(
LOPageRef page, size_t index, LOLayerInstanceRef* layer_instance);
/**
@brief Gets the index of this page in the document.
@param[in] page The page object.
@param[out] index The index of the page in the document.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if index is NULL
- \ref SU_ERROR_GENERIC if page doesn't belong to a document
*/
LO_RESULT LOPageGetPageIndex(LOPageRef page, size_t* index);
/**
@brief Gets the number of entities at the top of the group hierarchy, on
non-shared layers for the given page. This count will include
\ref LOGroupRef entities so the group hierarchy can be traversed.
@param[in] page The page object.
@param[out] num_nonshared_entities The number of non-shared entities.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_nonshared_entities is NULL
*/
LO_RESULT LOPageGetNumberOfNonSharedEntities(LOPageRef page, size_t* num_nonshared_entities);
/**
@brief Gets the non-shared entity at the top of the group hierarchy at the
specified index for the given page.
@param[in] page The page object.
@param[in] index The 0-based entity index for the desired non-shared entity.
@param[out] entity The entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *entity already refers to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is greater than or equal to the number of
non-shared entities returned by LOPageGetNumberOfNonSharedEntities
*/
LO_RESULT LOPageGetNonSharedEntityAtIndex(LOPageRef page, size_t index, LOEntityRef* entity);
/**
@brief Populates a \ref LOEntityListRef with the entities at the top of the
group hierarchy, on non-shared layers for the given page. This will
include \ref LOGroupRef entities so the group hierarchy can be
traversed.
@param[in] page The page object.
@param[out] entity_list The entity list to populate.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if entity_list does not refer to a valid object
*/
LO_RESULT LOPageGetNonSharedEntities(LOPageRef page, LOEntityListRef entity_list);
/**
@brief Creates a new entity iterator for the given page. See \ref
LOPageEntityIteratorFlags for valid options for flags. This iterator
will visit all entities on the page in exactly the same order they are
drawn, including entities on shared layers. Entity group hierarchy is
ignored with this iterator, so groups are skipped. This is the
recommended method for entity iteration when drawing or exporting.
@param[in] page The page object.
@param[in] flags Flags indicating what entities to include.
@param[out] entity_iterator The entity iterator object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity_iterator is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *entity_iterator already refers to a valid object
*/
LO_RESULT LOPageCreateEntityIterator(
LOPageRef page, LOPageEntityIteratorFlags flags, LOEntityIteratorRef* entity_iterator);
/**
@brief Creates a new reverse entity iterator for the given page. See \ref
LOPageEntityIteratorFlags for valid options for flags. This iterator
will visit all entities on the page in the reverse order they are drawn,
including entities on shared layers. Entity group hierarchy is ignored
with this iterator, so groups are skipped. This is the recommended
method for entity iteration when picking.
@param[in] page The page object.
@param[in] flags Flags indicating what entities to include.
@param[out] entity_iterator The entity iterator object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity_iterator is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *entity_iterator already refers to a valid object
*/
LO_RESULT LOPageCreateReverseEntityIterator(
LOPageRef page, LOPageEntityIteratorFlags flags, LOEntityIteratorRef* entity_iterator);
/**
@brief Returns the document that this page belongs to.
@since LayOut 2018, API 3.0
@param[in] page The page object.
@param[out] document The document object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if document is NULL
*/
LO_RESULT LOPageGetDocument(LOPageRef page, LODocumentRef* document);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_PAGE_H_
// Copyright 2015-2023 Trimble Inc. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_PAGEINFO_H_
#define LAYOUT_MODEL_PAGEINFO_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
#include <SketchUpAPI/color.h>
/**
@struct LOPageInfoRef
@brief References the page information for a document. This specifies the
physical page dimensions and other page-related settings for a document.
*/
/**
@enum LOImageResolution
@brief Defines the different settings available for image resolution.
*/
typedef enum {
LOImageResolution_Low = 0, ///< Low resolution, high efficiency.
LOImageResolution_Medium, ///< Medium resolution, medium efficiency.
LOImageResolution_High, ///< High resolution, low efficiency.
LONumImageResolutions
} LOImageResolution;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Gets the page width.
@param[in] pageinfo The page info object.
@param[out] width The page width.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p width is NULL
*/
LO_RESULT LOPageInfoGetWidth(LOPageInfoRef pageinfo, double* width);
/**
@brief Sets the page width.
@param[in] pageinfo The page info object.
@param[in] width The new page width to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if \p width is less than 1 or greater than 200
*/
LO_RESULT LOPageInfoSetWidth(LOPageInfoRef pageinfo, double width);
/**
@brief Gets the page height.
@param[in] pageinfo The page info object.
@param[out] height The page height.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p height is NULL
*/
LO_RESULT LOPageInfoGetHeight(LOPageInfoRef pageinfo, double* height);
/**
@brief Sets the page height.
@param[in] pageinfo The page info object.
@param[in] height The new page height to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if \p height is less than 1 or greater than 200
*/
LO_RESULT LOPageInfoSetHeight(LOPageInfoRef pageinfo, double height);
/**
@brief Gets the left page margin.
@param[in] pageinfo The page info object.
@param[out] margin The left page margin.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p margin is NULL
*/
LO_RESULT LOPageInfoGetLeftMargin(LOPageInfoRef pageinfo, double* margin);
/**
@brief Gets the right page margin.
@param[in] pageinfo The page info object.
@param[out] margin The right page margin.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p margin is NULL
*/
LO_RESULT LOPageInfoGetRightMargin(LOPageInfoRef pageinfo, double* margin);
/**
@brief Gets the top page margin.
@param[in] pageinfo The page info object.
@param[out] margin The top page margin.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p margin is NULL
*/
LO_RESULT LOPageInfoGetTopMargin(LOPageInfoRef pageinfo, double* margin);
/**
@brief Gets the bottom page margin.
@param[in] pageinfo The page info object.
@param[out] margin The bottom page margin.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p margin is NULL
*/
LO_RESULT LOPageInfoGetBottomMargin(LOPageInfoRef pageinfo, double* margin);
/**
@brief Sets the left page margin.
@param[in] pageinfo The page info object.
@param[in] margin The new left margin to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if \p margin is less than 0 or greater than the page
width
*/
LO_RESULT LOPageInfoSetLeftMargin(LOPageInfoRef pageinfo, double margin);
/**
@brief Sets the right page margin.
@param[in] pageinfo The page info object.
@param[in] margin The new right margin to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if \p margin is less than 0 or greater than the page
width
*/
LO_RESULT LOPageInfoSetRightMargin(LOPageInfoRef pageinfo, double margin);
/**
@brief Sets the top page margin.
@param[in] pageinfo The page info object.
@param[in] margin The new top margin to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if \p margin is less than 0 or greater than the page
height
*/
LO_RESULT LOPageInfoSetTopMargin(LOPageInfoRef pageinfo, double margin);
/**
@brief Sets the bottom page margin.
@param[in] pageinfo The page info object.
@param[in] margin The new bottom margin to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if \p margin is less than 0 or greater than the page
height
*/
LO_RESULT LOPageInfoSetBottomMargin(LOPageInfoRef pageinfo, double margin);
/**
@brief Gets the page color.
@param[in] pageinfo The page info object.
@param[out] color The page color.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p color is NULL
*/
LO_RESULT LOPageInfoGetPaperColor(LOPageInfoRef pageinfo, SUColor* color);
/**
@brief Sets the page color.
@param[in] pageinfo The page info object.
@param[in] color The new page color.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if \p color is NULL
*/
LO_RESULT LOPageInfoSetPaperColor(LOPageInfoRef pageinfo, const SUColor* color);
/**
@brief Gets whether or not the page color should be printed.
@param[in] pageinfo The page info object.
@param[out] print_paper_color Whether or not the page color should be printed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p print_paper_color is NULL
*/
LO_RESULT LOPageInfoGetPrintPaperColor(LOPageInfoRef pageinfo, bool* print_paper_color);
/**
@brief Sets whether or not the page color should be printed.
@param[in] pageinfo The page info object.
@param[in] print_paper_color Whether or not the page color should be printed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
*/
LO_RESULT LOPageInfoSetPrintPaperColor(LOPageInfoRef pageinfo, bool print_paper_color);
/**
@brief Gets the color of the margins.
@param[in] pageinfo The page info object.
@param[out] color The margin color.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p color is NULL
*/
LO_RESULT LOPageInfoGetMarginColor(LOPageInfoRef pageinfo, SUColor* color);
/**
@brief Sets the color of the margins.
@param[in] pageinfo The page info object.
@param[in] color The new margin color to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
*/
LO_RESULT LOPageInfoSetMarginColor(LOPageInfoRef pageinfo, SUColor color);
/**
@brief Gets whether or not the margins are shown.
@param[in] pageinfo The page info object.
@param[out] show_margins Whether the margins are shown or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p show_margins is NULL
*/
LO_RESULT LOPageInfoGetShowMargins(LOPageInfoRef pageinfo, bool* show_margins);
/**
@brief Sets whether or not the margins are shown.
@param[in] pageinfo The page info object.
@param[in] show_margins Whether the margins should be shown or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
*/
LO_RESULT LOPageInfoSetShowMargins(LOPageInfoRef pageinfo, bool show_margins);
/**
@brief Gets whether or not the margins should be printed.
@param[in] pageinfo The page info object.
@param[out] print_margins Whether the margins are printed or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p print_margins is NULL
*/
LO_RESULT LOPageInfoGetPrintMargins(LOPageInfoRef pageinfo, bool* print_margins);
/**
@brief Sets whether or not the margins should be printed.
@param[in] pageinfo The page info object.
@param[in] print_margins Whether the margins should be printed or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
*/
LO_RESULT LOPageInfoSetPrintMargins(LOPageInfoRef pageinfo, bool print_margins);
/**
@brief Gets the value of the document's display resolution for images and raster
models.
@param[in] pageinfo The page info object.
@param[out] resolution The resolution.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p resolution is NULL
*/
LO_RESULT LOPageInfoGetDisplayResolution(LOPageInfoRef pageinfo, LOImageResolution* resolution);
/**
@brief Sets the value of the document's display resolution for raster rendered SketchUp models.
@param[in] pageinfo The page info object.
@param[in] resolution The new resolution to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if the value of \p resolution is invalid
*/
LO_RESULT LOPageInfoSetDisplayResolution(LOPageInfoRef pageinfo, LOImageResolution resolution);
/**
@brief Gets the value of the document's output resolution for raster rendered SketchUp models.
@param[in] pageinfo The page info object.
@param[out] resolution The resolution.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p resolution is NULL
*/
LO_RESULT LOPageInfoGetOutputResolution(LOPageInfoRef pageinfo, LOImageResolution* resolution);
/**
@brief Sets the value of the document's output resolution for raster rendered SketchUp models.
@param[in] pageinfo The page info object.
@param[in] resolution The new resolution to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if the value of \p resolution is invalid
*/
LO_RESULT LOPageInfoSetOutputResolution(LOPageInfoRef pageinfo, LOImageResolution resolution);
/**
@brief Gets the value of the document's display resolution for images.
@since LayOut 2023.1, API 8.1
@param[in] pageinfo The page info object.
@param[out] resolution The resolution.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p resolution is NULL
*/
LO_RESULT LOPageInfoGetImageDisplayResolution(
LOPageInfoRef pageinfo, LOImageResolution* resolution);
/**
@brief Sets the value of the document's display resolution for images.
@since LayOut 2023.1, API 8.1
@param[in] pageinfo The page info object.
@param[in] resolution The new resolution to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if the value of \p resolution is invalid
*/
LO_RESULT LOPageInfoSetImageDisplayResolution(LOPageInfoRef pageinfo, LOImageResolution resolution);
/**
@brief Gets the value of the document's output resolution for images.
@since LayOut 2023.1, API 8.1
@param[in] pageinfo The page info object.
@param[out] resolution The resolution.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if \p resolution is NULL
*/
LO_RESULT LOPageInfoGetImageOutputResolution(LOPageInfoRef pageinfo, LOImageResolution* resolution);
/**
@brief Sets the value of the document's output resolution for images.
@since LayOut 2023.1, API 8.1
@param[in] pageinfo The page info object.
@param[in] resolution The new resolution to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p pageinfo does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if the value of \p resolution is invalid
*/
LO_RESULT LOPageInfoSetImageOutputResolution(LOPageInfoRef pageinfo, LOImageResolution resolution);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // LAYOUT_MODEL_PAGEINFO_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_PAGE_LIST_H_
#define LAYOUT_MODEL_PAGE_LIST_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOPageListRef
@brief References an ordered, indexable list of \ref LOPageRef objects.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new empty page list object.
@param[out] page_list An empty page list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if page_list is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *page_list already refers to a valid object
*/
LO_RESULT LOPageListCreate(LOPageListRef* page_list);
/**
@brief Releases a page list object. *page_list will be set to invalid by this
function.
@param[in] page_list The page list object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if page_list does not refer to a valid
object
- \ref SU_ERROR_INVALID_INPUT if *page_list does not refer to a valid object
*/
LO_RESULT LOPageListRelease(LOPageListRef* page_list);
/**
@brief Gets the number of pages in this list.
@param[in] page_list The page list object.
@param[out] num_pages The number of page objects in the list.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page_list does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_pages is NULL
*/
LO_RESULT LOPageListGetNumberOfPages(LOPageListRef page_list, size_t* num_pages);
/**
@brief Gets the page at the specified index.
@param[in] page_list The page list object.
@param[in] index The index of the page to get.
@param[out] page The page object at index in the list.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page_list does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is out of range for this list
- \ref SU_ERROR_NULL_POINTER_OUTPUT if page is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *page already refers to a valid object
*/
LO_RESULT LOPageListGetPageAtIndex(LOPageListRef page_list, size_t index, LOPageRef* page);
/**
@brief Adds a page at the end of the list.
@param[in] page_list The page list object.
@param[in] page The page object to add.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if page_list does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if page does not refer to a valid object
*/
LO_RESULT LOPageListAddPage(LOPageListRef page_list, LOPageRef page);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_PAGE_LIST_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_PATH_H_
#define LAYOUT_MODEL_PATH_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOPathRef
@brief References a path entity. A path entity represents a continuous,
multi-segment polyline or Bezier curve.
*/
/**
@enum LOPathPointType
@brief Defines how a point is to be interpreted in a path entity.
*/
typedef enum {
LOPathPointType_MoveTo = 0, ///< Reserved for the first point in a path.
LOPathPointType_LineTo, ///< Straight line segment to a given point.
LOPathPointType_BezierTo, ///< Bezier line segment to a given point.
LOPathPointType_ArcCenter, ///< Control point that defines the center of an arc.
LOPathPointType_BezierControl, ///< Control point that defines Bezier curvature.
LOPathPointType_Close, ///< Close the path with a straight line segment back to the first point.
LONumPathPointTypes
} LOPathPointType;
/**
@enum LOPathWindingType
@brief Defines the winding direction of the path.
@since LayOut 2019, API 4.0
*/
typedef enum {
LOPathWindingType_None = 0,
LOPathWindingType_Clockwise,
LOPathWindingType_CounterClockwise,
LONumPathWindingTypes
} LOPathWindingType;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new path object with a straight line between start_point and
end_point.
@param[out] path The path object.
@param[in] start_point The starting point of the path.
@param[in] end_point The ending point of the path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if path is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *path already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if start_point is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if end_point is NULL
- \ref SU_ERROR_GENERIC if the path would be zero length
*/
LO_RESULT LOPathCreate(LOPathRef* path, const LOPoint2D* start_point, const LOPoint2D* end_point);
/**
@brief Creates a new path object with a Bezier curve between start_point and
end_point.
@param[out] path The path object.
@param[in] start_point The starting point of the path.
@param[in] control_point_1 The first control point.
@param[in] control_point_2 The second control point.
@param[in] end_point The ending point of the path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if path is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *path already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if start_point is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if control_point_1 is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if control_point_2 is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if end_point is NULL
- \ref SU_ERROR_GENERIC if the path would be zero length
*/
LO_RESULT LOPathCreateBezier(
LOPathRef* path, const LOPoint2D* start_point, const LOPoint2D* control_point_1,
const LOPoint2D* control_point_2, const LOPoint2D* end_point);
/**
@brief Creates a new path object representing the same shape as a rectangle
object.
@param[out] path The path object.
@param[in] rectangle The rectangle object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if path is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *path already refers to a valid object
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
*/
LO_RESULT LOPathCreateFromRectangle(LOPathRef* path, LORectangleRef rectangle);
/**
@brief Creates a new path object representing the same shape as an ellipse
object.
@param[out] path The path object.
@param[in] ellipse The ellipse object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if path is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *path already refers to a valid object
- \ref SU_ERROR_INVALID_INPUT if ellipse does not refer to a valid object
*/
LO_RESULT LOPathCreateFromEllipse(LOPathRef* path, LOEllipseRef ellipse);
/**
@brief Creates a new path object representing an arc.
@since LayOut 2017, API 2.0
@param[out] path The path object.
@param[in] center_point The center point of the arc.
@param[in] radius The radius of the arc.
@param[in] start_angle The start angle of the arc.
@param[in] end_angle The end angle of the arc.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if path is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *path already refers to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if radius is less than or equal to zero
- \ref SU_ERROR_OUT_OF_RANGE if start_angle is equal to end_angle
*/
LO_RESULT LOPathCreateArc(
LOPathRef* path, const LOPoint2D* center_point, double radius, double start_angle,
double end_angle);
/**
@brief Adds a reference to a path object.
@param[in] path The path object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
*/
LO_RESULT LOPathAddReference(LOPathRef path);
/**
@brief Releases a path object. The object will be invalidated if releasing the
last reference.
@param[in] path The path object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if path is NULL
- \ref SU_ERROR_INVALID_INPUT if *path does not refer to a valid object
*/
LO_RESULT LOPathRelease(LOPathRef* path);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOPathRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOPathRef.
@param[in] entity The entity object.
@return
- The converted \ref LOPathRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOPathRef LOPathFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOPathRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] path The path object.
@return
- The converted \ref LOEntityRef if path is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOPathToEntity(LOPathRef path);
/**
@brief Gets the number of points in the path.
@param[in] path The path object.
@param[out] size The number of points in the path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if size is NULL
*/
LO_RESULT LOPathGetNumberOfPoints(LOPathRef path, size_t* size);
/**
@brief Gets the points in the path.
@param[in] path The path object.
@param[in] points_size The maximum number of points to copy.
@param[out] points The array that the points will be copied to.
@param[out] number_of_points_copied The number of points actually copied.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if points_size is less than 1
- \ref SU_ERROR_NULL_POINTER_OUTPUT if points is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if points_copied is NULL
*/
LO_RESULT LOPathGetPoints(
LOPathRef path, size_t points_size, LOPoint2D points[], size_t* number_of_points_copied);
/**
@brief Gets the point in the path at the given index.
@param[in] path The path object.
@param[in] point_index The index of the point to get.
@param[out] point The point at the given index.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if point_index is out of range
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOPathGetPointAtIndex(LOPathRef path, size_t point_index, LOPoint2D* point);
/**
@brief Gets the type of each point in the path.
@param[in] path The path object.
@param[in] pointtypes_size The maximum number of point types to
copy.
@param[out] pointtypes The array that the point types will be
copied to.
@param[out] number_of_pointtypes_copied The number of point types actually
copied.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if pointtypes_size is less than 1
- \ref SU_ERROR_NULL_POINTER_OUTPUT if pointtypes is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if number_of_pointtypes_copied is NULL
*/
LO_RESULT LOPathGetPointTypes(
LOPathRef path, size_t pointtypes_size, LOPathPointType pointtypes[],
size_t* number_of_pointtypes_copied);
/**
@brief Gets the type of the specified point in the path.
@param[in] path The path object.
@param[in] point_index The index of the point to get type information of.
@param[out] pointtype The point type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if pointtype is NULL
*/
LO_RESULT LOPathGetPointTypeAtIndex(LOPathRef path, size_t point_index, LOPathPointType* pointtype);
/**
@brief Gets the start point for the path.
@param[in] path The path object.
@param[out] point The start point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOPathGetStartPoint(LOPathRef path, LOPoint2D* point);
/**
@brief Gets the end point for the path.
@param[in] path The path object.
@param[out] point The end point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LOPathGetEndPoint(LOPathRef path, LOPoint2D* point);
/**
@brief Creates a new path object in the shape of the start arrow of the given
path.
@param[out] arrow_path The start arrow as a path.
@param[in] path The path object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if arrow_path is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *arrow_path already refers to a valid object
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NO_DATA if path does not have a start arrow
*/
LO_RESULT LOPathCreateFromStartArrow(LOPathRef* arrow_path, LOPathRef path);
/**
@brief Creates a new path object in the shape of the end arrow of the given
path.
@param[out] arrow_path The end arrow as a path.
@param[in] path The path object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if arrow_path is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *arrow_path already refers to a valid object
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NO_DATA if path does not have an end arrow
*/
LO_RESULT LOPathCreateFromEndArrow(LOPathRef* arrow_path, LOPathRef path);
/**
@brief Gets whether or not the path is a closed loop.
@param[in] path The path object.
@param[out] is_closed Whether the path is closed or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_closed is NULL
*/
LO_RESULT LOPathGetClosed(LOPathRef path, bool* is_closed);
/**
@brief Gets the length of the path.
@param[in] path The path object.
@param[out] parametric_length The length of the path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if parametric_length is NULL
*/
LO_RESULT LOPathGetParametricLength(LOPathRef path, double* parametric_length);
/**
@brief Gets the point at the given distance along the path.
@param[in] path The path object.
@param[in] parametric_value The distance along the path to get the point.
@param[out] point The point at the given distance along the path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
- \ref SU_ERROR_OUT_OF_RANGE if parametric_value is less than 0 or greater than
the path's parametric length
*/
LO_RESULT LOPathGetPointAtParameter(LOPathRef path, double parametric_value, LOPoint2D* point);
/**
@brief Gets the tangent at the given distance along the path.
@param[in] path The path object.
@param[in] parametric_value The distance along the path to get the tangent.
@param[out] tangent The tangent at the given distane along the path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if tangent is NULL
- \ref SU_ERROR_OUT_OF_RANGE if parametric_value is less than 0 or greater than
the path's parametric length
*/
LO_RESULT LOPathGetTangentAtParameter(LOPathRef path, double parametric_value, LOVector2D* tangent);
/**
@brief Gets whether or not the path represents a circle, and if so, gets the
geometric representation of the circle.
@since LayOut 2017, API 2.0
@param[in] path The path object.
@param[out] is_circle Whether or not the path is a circle.
@param[out] center Center point of the circle. Will only be set if is_circle
returns true.
@param[out] radius Radius of the circle. Will only be set if is_circle
returns true.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_circle is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if center is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if radius is NULL
*/
LO_RESULT LOPathGetCircle(LOPathRef path, bool* is_circle, LOPoint2D* center, double* radius);
/**
@brief Gets whether or not the path represents an arc, and if so, gets the
geometric representation of the arc.
@since LayOut 2017, API 2.0
@param[in] path The path object.
@param[out] is_arc Whether or not the path is an arc.
@param[out] center Center point of the arc. Will only be set if is_arc
returns true.
@param[out] radius Radius of the arc. Will only be set if is_arc returns
true.
@param[out] start_angle Start angle of the arc. Will only be set if is_arc
returns true.
@param[out] end_angle End angle of the arc. Will only be set if is_arc
returns true.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_arc is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if center is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if radius is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if start_angle is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if end_angle is NULL
*/
LO_RESULT LOPathGetArc(
LOPathRef path, bool* is_arc, LOPoint2D* center, double* radius, double* start_angle,
double* end_angle);
/**
@brief Adds a point to the end of the path.
@param[in] path The path object.
@param[in] point The point to append.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if point is NULL
- \ref SU_ERROR_LAYER_LOCKED if path is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if path is locked
*/
LO_RESULT LOPathAppendLineTo(LOPathRef path, const LOPoint2D* point);
/**
@brief Adds a Bezier point to the end of the path.
@param[in] path The path object.
@param[in] control_point_1 The first control point.
@param[in] control_point_2 The second control point.
@param[in] point The point to append.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if control_point_1 is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if control_point_2 is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if point is NULL
- \ref SU_ERROR_LAYER_LOCKED if path is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if path is locked
*/
LO_RESULT LOPathAppendBezierTo(
LOPathRef path, const LOPoint2D* control_point_1, const LOPoint2D* control_point_2,
const LOPoint2D* point);
/**
@brief Appends two paths. This will duplicate other_path and append it to the path.
Note that path may be reversed as a result of this operation.
@since LayOut 2018, API 3.0
@param[in] path The path object.
@param[in] other_path The path to append to path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path or other_path do not refer to valid objects
- \ref SU_ERROR_LAYER_LOCKED if path is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if path is locked
- \ref SU_ERROR_INVALID_ARGUMENT if path and other_path are the same object
- \ref SU_ERROR_UNSUPPORTED if path and other_path do not share a common endpoint
*/
LO_RESULT LOPathAppendPathTo(LOPathRef path, LOPathRef other_path);
/**
@brief Finishes the path loop if the path is not closed.
@param[in] path The path object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_GENERIC if path has already been closed.
- \ref SU_ERROR_LAYER_LOCKED if path is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if path is locked
*/
LO_RESULT LOPathClose(LOPathRef path);
/**
@brief Returns the winding type of the path.
@since LayOut 2019, API 4.0
@param[in] path The path object.
@param[out] winding The winding type of the path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if path does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if winding is NULL
*/
LO_RESULT LOPathGetWindingType(LOPathRef path, LOPathWindingType* winding);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_PATH_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_RECTANGLE_H_
#define LAYOUT_MODEL_RECTANGLE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LORectangleRef
@brief References a simple rectangular shape entity.
*/
/**
@enum LORectangleType
@brief Defines the shape of the rectangle within its boundaries.
*/
typedef enum {
LORectangleType_Normal = 0, ///< Normal rectangle with 90 degree corners.
LORectangleType_Rounded, ///< Rectangle with rounded corners and a specified radius.
LORectangleType_Lozenge, ///< Rectangle with rounded corners and a radius equal to half the
///< smaller of width or height.
LORectangleType_Bulged, ///< Rectangle whose left and right sides are arcs with a specified
///< radius.
LONumRectangleTypes
} LORectangleType;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a 'normal' rectangle with 90 degree corners.
@param[out] rectangle The rectangle object.
@param[in] bounds The starting dimensions of the rectangle.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if rectangle is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *rectangle already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
*/
LO_RESULT LORectangleCreate(LORectangleRef* rectangle, const LOAxisAlignedRect2D* bounds);
/**
@brief Creates a 'rounded' rectangle with arcs in each corner.
@param[out] rectangle The rectangle object.
@param[in] bounds The starting dimensions of the rectangle.
@param[in] corner_radius The radius of the circles in the corners in inches.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if rectangle is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *rectangle already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
- \ref SU_ERROR_OUT_OF_RANGE if corner_radius is negative
*/
LO_RESULT LORectangleCreateRounded(
LORectangleRef* rectangle, const LOAxisAlignedRect2D* bounds, double corner_radius);
/**
@brief Creates a 'Lozenge' rectangle with the shorter side curved.
@param[out] rectangle The rectangle object.
@param[in] bounds The starting dimensions of the rectangle.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if rectangle is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *rectangle already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
*/
LO_RESULT LORectangleCreateLozenge(LORectangleRef* rectangle, const LOAxisAlignedRect2D* bounds);
/**
@brief Creates a 'bulged' rectangle with the vertical sides curved.
@param[out] rectangle The rectangle object.
@param[in] bounds The starting dimensions of the rectangle.
@param[in] bulge_distance The size of the bulge, from the outer edge of the
rectangle in.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if rectangle is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *rectangle already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
- \ref SU_ERROR_OUT_OF_RANGE if bulge_distance is negative
*/
LO_RESULT LORectangleCreateBulged(
LORectangleRef* rectangle, const LOAxisAlignedRect2D* bounds, double bulge_distance);
/**
@brief Adds a reference to a rectangle object.
@param[in] rectangle The rectangle object.
@return
SU_ERROR_NONE on success
SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
*/
LO_RESULT LORectangleAddReference(LORectangleRef rectangle);
/**
@brief Releases a rectangle object. The object will be invalidated if releasing
the last reference.
@param[in] rectangle The rectangle object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if rectangle is NULL
- \ref SU_ERROR_INVALID_INPUT if *rectangle does not refer to a valid object
*/
LO_RESULT LORectangleRelease(LORectangleRef* rectangle);
/**
@brief Converts from a \ref LOEntityRef to a \ref LORectangleRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LORectangleRef.
@param[in] entity The entity object.
@return
- The converted \ref LORectangleRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LORectangleRef LORectangleFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LORectangleRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] rectangle The rectangle object.
@return
- The converted \ref LOEntityRef if rectangle is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LORectangleToEntity(LORectangleRef rectangle);
/**
@brief Gets the point that was originally defined as the upper left point.
Transforms to this object may have moved it so that it is no longer the
top left point geometrically on the page.
@param[in] rectangle The rectangle object.
@param[out] point The position of the original top left point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LORectangleGetTopLeftPoint(LORectangleRef rectangle, LOPoint2D* point);
/**
@brief Gets the point that was originally defined as the upper right point.
Transforms to this object may have moved it so that it is no longer the
top right point geometrically on the page.
@param[in] rectangle The rectangle object.
@param[out] point The position of the original top right point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LORectangleGetTopRightPoint(LORectangleRef rectangle, LOPoint2D* point);
/**
@brief Gets the point that was originally defined as the bottom left point.
Transforms to this object may have moved it so that it is no longer the
bottom left point geometrically on the page.
@param[in] rectangle The rectangle object.
@param[out] point The position of the original bottom left point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LORectangleGetBottomLeftPoint(LORectangleRef rectangle, LOPoint2D* point);
/**
@brief Gets the point that was originally defined as the bottom right point.
Transforms to this object may have moved it so that it is no longer the
bottom right point geometrically on the page.
@param[in] rectangle The rectangle object.
@param[out] point The position of the original bottom right point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if point is NULL
*/
LO_RESULT LORectangleGetBottomRightPoint(LORectangleRef rectangle, LOPoint2D* point);
/**
@brief Gets the type of a rectangle.
@param[in] rectangle The rectangle object.
@param[out] type The type of the rectangle.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if type is NULL
*/
LO_RESULT LORectangleGetRectangleType(LORectangleRef rectangle, LORectangleType* type);
/**
@brief Gets the type of a rectangle.
@param[in] rectangle The rectangle object.
@param[in] type The type of the rectangle.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if rectangle is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if rectangle is locked
- \ref SU_ERROR_GENERIC if type is not a valid rectangle type
*/
LO_RESULT LORectangleSetRectangleType(LORectangleRef rectangle, LORectangleType type);
/**
@brief Returns the radius that defines the shape of a bulged or rounded
rectangle.
@param[in] rectangle The rectangle object.
@param[out] radius The radius for bulged and rounded rectangles.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if radius is NULL
- \ref SU_ERROR_NO_DATA if the rectangle is not of type \ref
LORectangleType_Bulged or \ref LORectangleType_Rounded
*/
LO_RESULT LORectangleGetRadius(LORectangleRef rectangle, double* radius);
/**
@brief Sets the radius that defines the shape of a bulged or rounded rectangle.
@param[in] rectangle The rectangle object.
@param[out] radius The radius for bulged and rounded rectangles.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
- \ref SU_ERROR_NO_DATA if the rectangle is not of type \ref
LORectangleType_Bulged or \ref LORectangleType_Rounded
- \ref SU_ERROR_OUT_OF_RANGE if radius is negative
- \ref SU_ERROR_LAYER_LOCKED if rectangle is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if rectangle is locked
*/
LO_RESULT LORectangleSetRadius(LORectangleRef rectangle, double radius);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_RECTANGLE_H_
// Copyright 2022 Trimble Inc. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_REFERENCEENTITY_H_
#define LAYOUT_MODEL_REFERENCEENTITY_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOReferenceEntityRef
@brief References an entity containing the contents of an imported file.
@since LayOut 2023, API 8.0
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Adds a reference to a reference entity object.
@since LayOut 2023, API 8.0
@param[in] reference_entity The reference entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if reference_entity does not refer to a valid object
*/
LO_RESULT LOReferenceEntityAddReference(LOReferenceEntityRef reference_entity);
/**
@brief Releases a reference entity object. The object will be invalidated if releasing the last
reference.
@since LayOut 2023, API 8.0
@param[in] reference_entity The reference entity object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if reference_entity is NULL
- \ref SU_ERROR_INVALID_INPUT if *reference_entity does not refer to a valid object
*/
LO_RESULT LOReferenceEntityRelease(LOReferenceEntityRef* reference_entity);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOReferenceEntityRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOReferenceEntityRef.
@since LayOut 2023, API 8.0
@param[in] entity The entity object.
@return
- The converted \ref LOReferenceEntityRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOReferenceEntityRef LOReferenceEntityFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOReferenceEntityRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@since LayOut 2023, API 8.0
@param[in] reference_entity The reference entity object.
@return
- The converted \ref LOEntityRef if reference_entity is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOReferenceEntityToEntity(LOReferenceEntityRef reference_entity);
/**
@brief Returns any clip mask assigned to the reference entity.
@since LayOut 2023, API 8.0
@param[in] reference_entity The reference entity object.
@param[out] clip_mask The clip mask of the reference entity.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if reference_entity does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if clip_mask is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *clip_mask already refers to a valid object
- \ref SU_ERROR_NO_DATA if the reference entity is not being clipped by a clip mask
*/
LO_RESULT LOReferenceEntityGetClipMask(
LOReferenceEntityRef reference_entity, LOEntityRef* clip_mask);
/**
@brief Sets the clip mask of the reference entity. A clip mask defines a region of the entity that
is visible. This allows you to crop with arbitrary shapes. This operation will replace any clip mask
that is already assigned to this reference entity. The entity being used must not be already part of
a document or group. The clip mask entity must be either a rectangle, ellipse or a path, or may be
SU_INVALID, which will remove the existing clip mask, if any.
@since LayOut 2023, API 8.0
@param[in] reference_entity The reference entity object.
@param[in] clip_mask The new clip mask for the reference entity.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if reference_entity does not refer to a valid object
- \ref SU_ERROR_INVALID_ARGUMENT if clip_mask is already in a document or group
- \ref SU_ERROR_UNSUPPORTED if clip_mask is not a rectangle, ellipse, or path
- \ref SU_ERROR_LAYER_LOCKED if reference_entity is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if reference_entity is locked
*/
LO_RESULT LOReferenceEntitySetClipMask(
LOReferenceEntityRef reference_entity, LOEntityRef clip_mask);
/**
@brief Creates the entities that represent the reference entity in its exploded form and adds them
to a \ref LOEntityListRef. It is NOT necessary to explicitly release these entities, since \ref
LOEntityListRef itself adds a reference to the entities and will release them when they are
removed from the list or when the list is released.
@since LayOut 2023, API 8.0
@param[in] reference_entity The reference entity object.
@param[in] entity_list The entity list object to add the new entities to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if reference_entity does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
*/
LO_RESULT LOReferenceEntityGetExplodedEntities(
LOReferenceEntityRef reference_entity, LOEntityListRef entity_list);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_REFERENCEENTITY_H_
// Copyright 2015-2023 Trimble Inc. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_SKETCHUPMODEL_H_
#define LAYOUT_MODEL_SKETCHUPMODEL_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
#include <SketchUpAPI/model/defs.h>
/**
@struct LOSketchUpModelRef
@brief References a SketchUp model viewport entity.
*/
/**
@enum LOSketchUpModelRenderMode
@brief Defines the different rendering modes available for a SketchUp model.
@note New for LayOut 2023.1, API 8.1 is the value LOSketchUpModelRenderMode_NoOverride.
The value is only used for the document render mode override, to indicate that
the output render mode should match the edit render mode, which is set per LOSketchUpModelRef.
*/
typedef enum {
LOSketchUpModelRenderMode_NoOverride = -1, ///< Output render mode matches edit render mode.
LOSketchUpModelRenderMode_Raster = 0, ///< Raster rendering.
LOSketchUpModelRenderMode_Hybrid, ///< Hybrid rendering.
LOSketchUpModelRenderMode_Vector, ///< Vector rendering.
LONumSketchUpModelRenderModes
} LOSketchUpModelRenderMode;
/**
@enum LOSketchUpModelStandardView
@brief Defines the standard views available for a SketchUp model. Relative views
are not necessarily aligned to the corresponding axes like regular views,
but rather they maintain the alignment from the previous position of the
camera.
*/
typedef enum {
LOSketchUpModelStandardView_Top = 0, ///< Top. This view is aligned with the X and Y axes.
LOSketchUpModelStandardView_RelativeTop, ///< Top (Relative). This top view is oriented relative
///< to the previous camera position.
LOSketchUpModelStandardView_Bottom, ///< Bottom. This view is aligned with the X and Y axes.
LOSketchUpModelStandardView_RelativeBottom, ///< Bottom (Relative). This bottom view is oriented
///< relative to the previous camera position.
LOSketchUpModelStandardView_Front, ///< Front. This view is aligned with the X and Z axes.
LOSketchUpModelStandardView_Back, ///< Back. This view is aligned with the X and Z axes.
LOSketchUpModelStandardView_Left, ///< Left. This view is aligned with the Y and Z axes.
LOSketchUpModelStandardView_Right, ///< Right. This view is aligned with the Y and Z axes.
LOSketchUpModelStandardView_Iso, ///< Iso. This is aligned with the nearest isometric axes to the
///< current view.
LONumSketchUpModelStandardViews
} LOSketchUpModelStandardView;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new SketchUp model object with the specified bounds that
references the specified SketchUp file.
@param[out] model The SketchUp model object.
@param[in] path The path to the SketchUp file.
@param[in] bounds The starting dimensions of the SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if model is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *model already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if path is NULL
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
- \ref SU_ERROR_SERIALIZATION if the .skp file could not be loaded
- \ref SU_ERROR_NO_DATA if the .skp file could not be found
*/
LO_RESULT LOSketchUpModelCreate(
LOSketchUpModelRef* model, const char* path, const LOAxisAlignedRect2D* bounds);
/**
@brief Adds a reference to a SketchUp model object.
@param[in] model The SketchUp model object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
*/
LO_RESULT LOSketchUpModelAddReference(LOSketchUpModelRef model);
/**
@brief Releases a SketchUp model object. The object will be invalidated if
releasing the last reference.
@param[in] model The SketchUp model object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT model is NULL
- \ref SU_ERROR_INVALID_INPUT *model does not refer to a valid object
*/
LO_RESULT LOSketchUpModelRelease(LOSketchUpModelRef* model);
/**
@brief Converts from a \ref LOEntityRef to a \ref LOSketchUpModelRef.
This is essentially a downcast operation so the given \ref LOEntityRef
must be convertible to a \ref LOSketchUpModelRef.
@param[in] entity The entity object.
@return
- The converted \ref LOSketchUpModelRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOSketchUpModelRef LOSketchUpModelFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOSketchUpModelRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@param[in] model The SketchUp model object.
@return
- The converted \ref LOEntityRef if model is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOSketchUpModelToEntity(LOSketchUpModelRef model);
/**
@brief Gets the SUModelRef representation of the SketchUp model.
@since LayOut 2017, API 2.0
@param[in] model The SketchUp model object.
@param[out] sumodel The model reference object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if sumodel is NULL
*/
LO_RESULT LOSketchUpModelGetModel(LOSketchUpModelRef model, SUModelRef* sumodel);
/**
@brief Gets the render mode of the SketchUp model.
@param[in] model The SketchUp model object.
@param[out] render_mode The render mode of the SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if render_mode is NULL
*/
LO_RESULT LOSketchUpModelGetRenderMode(
LOSketchUpModelRef model, LOSketchUpModelRenderMode* render_mode);
/**
@brief Sets the render mode of the SketchUp model.
@param[in] model The SketchUp model object.
@param[in] render_mode The new render mode for the SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if the value of render_mode is invalid
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetRenderMode(
LOSketchUpModelRef model, LOSketchUpModelRenderMode render_mode);
/**
@brief Renders the SketchUp model. If the model belongs to a
\ref LODocumentRef, then the render will be performed at the
resolution set in document.page_info (see \ref LODocumentRef and
\ref LOPageInfoRef). Otherwise, the render will be performed at Low
resolution.
@param[in] model The SketchUp model object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelRender(LOSketchUpModelRef model);
/**
@brief Gets the status indicating whether the SketchUp model needs to be
rendered.
@param[in] model The SketchUp model object.
@param[out] render_needed True if the SketchUp model needs to be rendered.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if render_needed is NULL
*/
LO_RESULT LOSketchUpModelIsRenderNeeded(LOSketchUpModelRef model, bool* render_needed);
/**
@brief Gets the number of scenes that are available for a SketchUp model. Use
this to determine the size of the array that should be passed to \ref
LOSketchUpModelGetAvailableScenes.
@param[in] model The SketchUp model object.
@param[out] number_of_scenes The number of scenes.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model is an invalid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if number_of_scenes is NULL
*/
LO_RESULT LOSketchUpModelGetNumberOfAvailableScenes(
LOSketchUpModelRef model, size_t* number_of_scenes);
/**
@brief Gets the array of scenes that are available for a SketchUp model. The
first scene returned will always be the default scene, called
"Last saved SketchUp View".
@param[in] model The SketchUp model object.
@param[in] len The maximum number of scenes to retrieve.
@param[out] scenes The names of the scenes retrieved.
@param[out] count The number of scenes retrieved.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model is an invalid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if scenes or count is NULL
*/
LO_RESULT LOSketchUpModelGetAvailableScenes(
LOSketchUpModelRef model, size_t len, SUStringRef scenes[], size_t* count);
/**
@brief Gets the most recently selected scene of the SketchUp model.
@param[in] model The SketchUp model object.
@param[out] scene_index The index of the SketchUp model's scene. This is an
index into the list of available scenes returned by
\ref LOSketchUpModelGetAvailableScenes.
@param[out] scene_modified Indicates whether or not the scene has been modified
in LayOut.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if scene_index or scene_modified is NULL
- \ref SU_ERROR_NO_DATA if the most recently selected scene no longer exists
*/
LO_RESULT LOSketchUpModelGetCurrentScene(
LOSketchUpModelRef model, size_t* scene_index, bool* scene_modified);
/**
@brief Sets the scene of the SketchUp model.
@param[in] model The SketchUp model object.
@param[in] scene_index The index of the scene. This is an index into the list
of available scenes returned by \ref
LOSketchUpModelGetAvailableScenes.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if scene_index is greater than or equal to the
number of available scenes.
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetCurrentScene(LOSketchUpModelRef model, size_t scene_index);
/**
@brief Gets whether the SketchUp model's camera has been modified.
@param[in] model The SketchUp model object.
@param[out] modified Indicates whether or not the camera has been modified
in LayOut.
@since LayOut 2020.1, API 5.1
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if modified is NULL
*/
LO_RESULT LOSketchUpModelGetCameraModified(LOSketchUpModelRef model, bool* modified);
/**
@brief Resets the SketchUp model's camera to the scene's setting.
@param[in] model The SketchUp model object.
@since LayOut 2020.1, API 5.1
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelResetCamera(LOSketchUpModelRef model);
/**
@brief Gets whether the SketchUp model's shadow or fog effects have been modified.
@param[in] model The SketchUp model object.
@param[out] modified Indicates whether or not the shadow or fog effects have
been modified in LayOut.
@since LayOut 2020.1, API 5.1
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if modified is NULL
*/
LO_RESULT LOSketchUpModelGetEffectsModified(LOSketchUpModelRef model, bool* modified);
/**
@brief Resets the SketchUp model's shadow and fog effects to the scene's settings.
@param[in] model The SketchUp model object.
@since LayOut 2020.1, API 5.1
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelResetEffects(LOSketchUpModelRef model);
/**
@brief Gets whether the SketchUp model's style has been modified.
@param[in] model The SketchUp model object.
@param[out] modified Indicates whether or not the style has been modified in
LayOut.
@since LayOut 2020.1, API 5.1
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if modified is NULL
*/
LO_RESULT LOSketchUpModelGetStyleModified(LOSketchUpModelRef model, bool* modified);
/**
@brief Resets the SketchUp model's style to the scene's setting.
@param[in] model The SketchUp model object.
@since LayOut 2020.1, API 5.1
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelResetStyle(LOSketchUpModelRef model);
/**
@brief Gets whether the SketchUp model's layers have been modified.
@note In SketchUp 2020, SketchUp "layers" were renamed to "tags". For
consistency with the SketchUp API, this will continue to refer to "tags"
as "layers".
@since LayOut 2020.1, API 5.1
@param[in] model The SketchUp model object.
@param[out] modified Indicates whether or not the tag have been modified in
LayOut.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if modified is NULL
*/
LO_RESULT LOSketchUpModelGetLayersModified(LOSketchUpModelRef model, bool* modified);
/**
@brief Resets the SketchUp model's layers to the scene's setting.
@note In SketchUp 2020, SketchUp "layers" were renamed to "tags". For
consistency with the SketchUp API, this will continue to refer to "tags"
as "layers".
@since LayOut 2020.1, API 5.1
@param[in] model The SketchUp model object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelResetLayers(LOSketchUpModelRef model);
/**
@brief Gets the status of whether or not the background is displayed for the
SketchUp model. This setting only applies when the render mode is
\ref LOSketchUpModelRenderMode_Vector.
@param[in] model The SketchUp model object.
@param[out] display_background True if the background is displayed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if display_background is NULL
*/
LO_RESULT LOSketchUpModelGetDisplayBackground(LOSketchUpModelRef model, bool* display_background);
/**
@brief Sets the status of whether or not the background is displayed for the
SketchUp model. This setting only applies when the render mode is
\ref LOSketchUpModelRenderMode_Vector.
@param[in] model The SketchUp model object.
@param[in] display_background True if the background should be displayed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetDisplayBackground(LOSketchUpModelRef model, bool display_background);
/**
@brief Gets the line weight in points for the SketchUp model.
@param[in] model The SketchUp model object.
@param[out] line_weight Line weight in points.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if line_weight is NULL
*/
LO_RESULT LOSketchUpModelGetLineWeight(LOSketchUpModelRef model, double* line_weight);
/**
@brief Sets the line weight in points for the SketchUp model.
@param[in] model The SketchUp model object.
@param[in] line_weight Line weight in points.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if line_weight is less than 0.01
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetLineWeight(LOSketchUpModelRef model, double line_weight);
/**
@brief Gets the scale for dashes in the SketchUp model. A scale value of 0.0
means the dashes are scaled based on the line weight.
@since LayOut 2019, API 4.0
@param[in] model The SketchUp model object.
@param[out] dash_scale Dash scale. Will be in the range [0, 10].
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if dash_scale is NULL
*/
LO_RESULT LOSketchUpModelGetDashScale(LOSketchUpModelRef model, double* dash_scale);
/**
@brief Sets the scale for dashes in the SketchUp model. A scale value of 0.0 or
lower will "auto" scale the dashes based on the line weight.
@since LayOut 2019, API 4.0
@param[in] model The SketchUp model object.
@param[in] dash_scale Dash scale. A value less than zero will be set to 0.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetDashScale(LOSketchUpModelRef model, double dash_scale);
/**
@brief Gets whether or not the view is rendered in perspective mode.
@param[in] model The SketchUp model object.
@param[out] perspective Whether or not the view is rendered in perspective mode.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if perspective is NULL
*/
LO_RESULT LOSketchUpModelGetPerspective(LOSketchUpModelRef model, bool* perspective);
/**
@brief Sets whether or not the view is rendered in perspective mode.
@param[in] model The SketchUp model object.
@param[in] perspective Whether or not the view should be rendered in
perspective mode.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetPerspective(LOSketchUpModelRef model, bool perspective);
/**
@brief Gets the standard view that a SketchUp model is currently set to.
@param[in] model The SketchUp model object.
@param[out] view The standard view that the SketchUp model is currently set to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if view is NULL
- \ref SU_ERROR_NO_DATA if the SketchUp model is not currently set to a
standard view
*/
LO_RESULT LOSketchUpModelGetStandardView(
LOSketchUpModelRef model, LOSketchUpModelStandardView* view);
/**
@brief Sets a SketchUp model to use a standard view.
@param[in] model The SketchUp model object.
@param[in] view The standard view to use.
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
- \ref SU_ERROR_OUT_OF_RANGE if view specifies an invalid value
*/
LO_RESULT LOSketchUpModelSetStandardView(
LOSketchUpModelRef model, LOSketchUpModelStandardView view);
/**
@brief Gets the scale of a SketchUp model. This is only valid to call for
models that are rendered in orthographic (non-perspective) mode.
@param[in] model The SketchUp model object.
@param[out] scale The SketchUp model's scale.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if scale is NULL
- \ref SU_ERROR_NO_DATA if model is currently rendered in perspective mode.
*/
LO_RESULT LOSketchUpModelGetScale(LOSketchUpModelRef model, double* scale);
/**
@brief Sets the scale of a SketchUp model. This is only valid to call for
models that are rendered in orthographic (non-perspective) mode.
@param[in] model The SketchUp model object.
@param[in] scale The new scale for the SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_GENERIC if model is rendered in perspective mode
- \ref SU_ERROR_OUT_OF_RANGE if scale is less than 0.0000001
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetScale(LOSketchUpModelRef model, double scale);
/**
@brief Gets whether or not the scale is preserved when the SketchUp model is
resized.
@param[in] model The SketchUp model object.
@param[out] preserve_scale True if the scale is preserved on resize.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if preserve_scale is NULL
*/
LO_RESULT LOSketchUpModelGetPreserveScaleOnResize(LOSketchUpModelRef model, bool* preserve_scale);
/**
@brief Sets whether or not the scale is preserved when the SketchUp model is
resized.
@param[in] model The SketchUp model object.
@param[in] preserve_scale True if the scale should be preserved on resize.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetPreserveScaleOnResize(LOSketchUpModelRef model, bool preserve_scale);
/**
@brief Converts a 3D model space point in the SketchUp model to a 2D paper
space point on the page.
@param[in] model The SketchUp model object.
@param[in] model_point The 3D model space point.
@param[out] paper_point The 2D paper space point.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if model_point is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if paper_point is NULL
*/
LO_RESULT LOSketchUpModelConvertModelPointToPaperPoint(
LOSketchUpModelRef model, const LOPoint3D* model_point, LOPoint2D* paper_point);
/**
@brief Returns any clip mask assigned to the SketchUp model.
@since LayOut 2017, API 2.0
@param[in] model The SketchUp model object.
@param[out] clip_mask The clip mask of the SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if clip_mask is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *clip_mask already refers to a valid object
- \ref SU_ERROR_NO_DATA if the model is not being clipped by a clip mask
*/
LO_RESULT LOSketchUpModelGetClipMask(LOSketchUpModelRef model, LOEntityRef* clip_mask);
/**
@brief Sets the clip mask of the SketchUp model. A clip mask defines a region
of the entity that is visible. This allows you to crop with arbitrary
shapes. This operation will replace any clip mask that is already
assigned to this model. The entity being used must not be already part
of a document or group. The clip mask entity must be either a rectangle,
ellipse or a path.
@note Starting in LayOut 2020.1, API 5.1, clip_mask may be SU_INVALID, which
will remove the existing clip mask, if any.
@since LayOut 2017, API 2.0
@param[in] model The SketchUp model object.
@param[in] clip_mask The new clip mask for the SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_GENERIC if clip_mask is already in a document or group
- \ref SU_ERROR_UNSUPPORTED if clip_mask is not a rectangle, ellipse, or path
- \ref SU_ERROR_LAYER_LOCKED if model is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if model is locked
*/
LO_RESULT LOSketchUpModelSetClipMask(LOSketchUpModelRef model, LOEntityRef clip_mask);
/**
@brief Creates the entities that represent the SketchUp model in its exploded
form and adds them to a \ref LOEntityListRef. It is NOT necessary to
explicitly release these entities, since \ref LOEntityListRef itself
adds a reference to the entities and will release them when they are
removed from the list or when the list is released.
@note Starting in LayOut 2018 M0, API 3.0 - an exploded raster-rendered model
will now wrap the \ref LOImageRef in a \ref LOGroupRef.
@param[in] model The SketchUp model object.
@param[in] entity_list The entity list object to add the new entities to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
*/
LO_RESULT LOSketchUpModelGetExplodedEntities(LOSketchUpModelRef model, LOEntityListRef entity_list);
/**
@brief Creates the entities that represent the SketchUp model using its output settings and adds
them to a \ref LOEntityListRef.
This will use the document's output render mode override setting for SketchUp model viewports, and
the raster output image quality set by \ref LOPageInfoSetOutputResolution. It is NOT necessary to
explicitly release these entities, since \ref LOEntityListRef itself adds a reference to the
entities and will release them when they are removed from the list or when the list is released.
@since Layout 2023.1, API 8.1
@param[in] model The SketchUp model object.
@param[in] entity_list The entity list object to add the new entities to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if \p model does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if \p entity_list does not refer to a valid object
*/
LO_RESULT LOSketchUpModelGetOutputEntities(LOSketchUpModelRef model, LOEntityListRef entity_list);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_SKETCHUPMODEL_H_
// Copyright 2017 Trimble Inc., All rights reserved.
#ifndef LAYOUT_MODEL_SKPFILEREFERENCE_H_
#define LAYOUT_MODEL_SKPFILEREFERENCE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
#include <SketchUpAPI/model/defs.h>
/**
@struct LOSkpFileRef
@since LayOut 2018, API 3.0
@brief References a SketchUp file reference object.
*/
DEFINE_SU_TYPE(LOSkpFileRef)
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a SketchUp file reference object with a Skp model.
This function takes ownership of the given model. Upon success, user
should not release the model, or create another LOSkpFileRef with
the same model. The model is valid and mutable till the LOSkpFileRef is
released.
Do not use a model obtained by a 'Get' function such as the
\ref LOSketchUpModelGetModel() as the ownership cannot be transfered
to the file_ref.
@since LayOut 2018, API 3.0
@param[out] file_ref The file reference object to be created.
@param[in] model The SketchUp model.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if file_ref is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *file_ref refers to a valid object
- \ref SU_ERROR_INVALID_INPUT if model does not refer to a valid object
*/
LO_RESULT LOSkpFileReferenceCreate(LOSkpFileRef* file_ref, SUModelRef model);
/**
@brief Releases a SketchUp file reference object.
@since LayOut 2018, API 3.0
@param[in] file_ref The SketchUp file reference object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if file_ref is NULL
- \ref SU_ERROR_INVALID_INPUT if *file_ref does not refer to a valid object
*/
LO_RESULT LOSkpFileReferenceRelease(LOSkpFileRef* file_ref);
/**
@brief Creates a new SketchUp model object with the specified bounds and
file reference.
This function increases reference count on the given file reference.
@since LayOut 2018, API 3.0
@param[out] model The model entity to be created.
@param[in] file_ref The SketchUp file reference object.
@param[in] bounds The starting dimensions of the model entity.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if model is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *model already refers to a valid object
- \ref SU_ERROR_INVALID_INPUT if file_ref is invalid
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
*/
LO_RESULT LOSketchUpModelCreateWithSkpFileRef(
LOSketchUpModelRef* model, LOSkpFileRef file_ref, const LOAxisAlignedRect2D* bounds);
/**
@brief Applies a clip mask to all entities inside a group. Entities outside
the clip mask will be removed from the document. Entities that cross
the clip mask boundary will be removed but may be replaced by new
entities. The clip_mask entity must be a \ref LORectangleRef,
\ref LOEllipseRef, or \ref LOPathRef.
@since LayOut 2018, API 3.0
@param[in] group The group to apply the clipmask to.
@param[in] clip_mask The entity to use as a clip mask.
@return
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_ENTITY_LOCKED if group is locked
- \ref SU_ERROR_LAYER_LOCKED if group contains entities on locked layers
- \ref SU_ERROR_GENERIC if clipping algorithm fails
*/
LO_RESULT LOGroupClipChildren(LOGroupRef group, LOEntityRef clip_mask);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_SKPFILEREFERENCE_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_STYLE_H_
#define LAYOUT_MODEL_STYLE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOStyleRef
@brief References a collection of style attributes that determine the
visual appearance of entities. Style attributes are those attributes
which the user can manipulate in LayOut's inspector windows. For
example, shape style attributes that define stroke and fill, or text
style attributes that define the font for formatted text. The document
maintains a default style for various types of entities, and it is
possible to apply the style of one entity to another. \ref LOStyleRef
objects are transient and do not belong to a document.
*/
/**
@enum LOStrokeJoinStyle
@brief Defines how to draw the connection between two segments of a path's
stroke.
*/
typedef enum {
LOStrokeJoinStyle_Miter = 0, ///< The corner between two segments will be pointed.
LOStrokeJoinStyle_Round, ///< The corner between two segments will be rounded.
LOStrokeJoinStyle_Bevel, ///< The corner between two segments will be flat.
LONumStrokeJoinStyles
} LOStrokeJoinStyle;
/**
@enum LOStrokeCapStyle
@brief Defines how to draw the end-caps of a path's stroke.
*/
typedef enum {
LOStrokeCapStyle_Flat = 0, ///< The end caps will be flat.
LOStrokeCapStyle_Round, ///< The end caps will be round.
LOStrokeCapStyle_Square, ///< The end caps will be square.
LONumStrokeCapStyles
} LOStrokeCapStyle;
/**
@enum LOStrokePattern
@brief Defines the stippling pattern of a path's stroke.
*/
typedef enum {
LOStrokePattern_Solid = 0, ///< Solid pattern.
LOStrokePattern_Dash, ///< Dashed pattern.
LOStrokePattern_Dot, ///< Dotted pattern.
LOStrokePattern_DashDot, ///< Repeating dash-dot pattern.
LOStrokePattern_DashDotDot, ///< Repeating dash-dot-dot pattern.
LOStrokePattern_DashSpace, ///< Deprecated in 2020.2. Use LOStrokePattern_Dash instead.
LOStrokePattern_DashDotDotDot, ///< Repeating dash-dot-dot-dot pattern.
LOStrokePattern_DashDashDot, ///< Repeating dash-dash-dot pattern.
LOStrokePattern_DashDashDotDot, ///< Repeating dash-dash-dot-dot pattern.
LOStrokePattern_DashDashDotDotDot, ///< Repeating dash-dash-dot-dot-dot pattern.
LOStrokePattern_Center, ///< Repeating center line type pattern.
LOStrokePattern_Phantom, ///< Repeating phantom line type pattern.
LOStrokePattern_ShortDash, ///< Repeating short dash pattern.
LONumStrokePatterns
} LOStrokePattern;
/**
@enum LOTextUnderline
@brief Defines underline styles for formatted text.
*/
typedef enum {
LOTextUnderline_None = 0, ///< No underline.
LOTextUnderline_Single, ///< Single underline.
LOTextUnderline_Double, ///< Double underline.
LONumTextUnderlines
} LOTextUnderline;
/**
@enum LOTextElevation
@brief Defines super/subscript options for formatted text.
*/
typedef enum {
LOTextElevation_Normal = 0, ///< Normal text.
LOTextElevation_Superscript, ///< Superscript text.
LOTextElevation_Subscript, ///< Subscript text.
LONumTextElevations
} LOTextElevation;
/**
@enum LOTextAlignment
@brief Defines left/right/center text alignment for formatted text.
*/
typedef enum {
LOTextAlignment_Left = 0, ///< Left-aligned text.
LOTextAlignment_Right, ///< Right-aligned text.
LOTextAlignment_Center, ///< Center-aligned text.
LONumTextAlignments
} LOTextAlignment;
/**
@enum LOTextAnchor
@brief Defines top/center/bottom text anchoring for formatted text.
*/
typedef enum {
LOTextAnchor_Top = 0, ///< Top-anchored text.
LOTextAnchor_Center, ///< Center-anchored text.
LOTextAnchor_Bottom, ///< Bottom-anchored text.
LONumTextAnchors
} LOTextAnchor;
/**
@enum LODimensionRotationAlignment
@brief Represents how the dimension text is oriented on the page.
*/
typedef enum {
LODimensionRotationAlignment_Horizontal = 0, ///< Align the text horizontally.
LODimensionRotationAlignment_Vertical, ///< Align the text vertically.
LODimensionRotationAlignment_Align, ///< Align the text parallel to the dimension line.
LODimensionRotationAlignment_Perpendicular, ///< Align the text perpendicular to the dimension
///< line.
LONumDimensionRotationAlignments
} LODimensionRotationAlignment;
/**
@enum LODimensionVerticalAlignment
@brief Represents how the dimension text is positioned. The position is
relative to the dimension line. \ref LODimensionVerticalAlignment_Offset
indicates that the text box position is based on a custom offset.
*/
typedef enum {
LODimensionVerticalAlignment_Above = 0, ///< Position the text above the dimension line.
LODimensionVerticalAlignment_Center, ///< Position the text on top of the dimension line.
LODimensionVerticalAlignment_Below, ///< Position the text under the dimension line.
LODimensionVerticalAlignment_Offset, ///< Position the text in an arbitrary location.
LONumDimensionVerticalAlignments
} LODimensionVerticalAlignment;
/**
@enum LODimensionUnits
@brief Defines the different units formats that are available for linear and
angular dimensions.
*/
typedef enum {
// Linear dimension units
LODimensionUnits_FractionalInches = 0, ///< 60"
LODimensionUnits_ArchitecturalInches, ///< 6-1/2"
LODimensionUnits_EngineeringFeet, ///< 7.250'
LODimensionUnits_DecimalInches, ///< 6.5"
LODimensionUnits_DecimalFeet, ///< 0.54167'
LODimensionUnits_DecimalMillimeters, ///< 165.1 mm
LODimensionUnits_DecimalCentimeters, ///< 16.51 cm
LODimensionUnits_DecimalMeters, ///< 1.651 m
LODimensionUnits_DecimalPoints, ///< 468 pt
// Angular dimension units
LODimensionUnits_Degrees, ///< 21°
LODimensionUnits_Radians, ///< 0.36 r
LONumDimensionUnits
} LODimensionUnits;
/**
@enum LOArrowType
@brief Defines the arrowhead types available for a path entity.
*/
typedef enum {
LOArrowType_None = 0, ///< No arrowhead.
LOArrowType_FilledTriangle, ///< Filled triangle arrowhead.
LOArrowType_OpenTriangle, ///< Non-filled triangle arrowhead.
LOArrowType_FilledSkinnyTriangle, ///< Filled skinny triangle arrowhead.
LOArrowType_OpenSkinnyTriangle, ///< Non-filled skinny triangle arrowhead.
LOArrowType_OpenArrow90, ///< 90 degree open-sided arrowhead.
LOArrowType_OpenArrow120, ///< 120 degree open-sided arrowhead.
LOArrowType_FilledCircle, ///< Filled circle arrowhead.
LOArrowType_OpenCircle, ///< Non-filled circle arrowhead.
LOArrowType_FilledSquare, ///< Filled square arrowhead.
LOArrowType_OpenSquare, ///< Non-filled square arrowhead.
LOArrowType_FilledDiamond, ///< Filled diamond arrowhead.
LOArrowType_OpenDiamond, ///< Non-filled diamond arrowhead.
LOArrowType_Star, ///< Star-shaped arrowhead.
LOArrowType_T, ///< T-shaped arrowhead.
LOArrowType_SlashRight, ///< Right slash arrowhead.
LOArrowType_SlashLeft, ///< Left slash arrowhead.
LOArrowType_Underrun, ///< Underrun arrowhead.
LOArrowType_Overrun, ///< Overrun arrowhead.
LONumArrowTypes
} LOArrowType;
/**
@enum LOSubEntityType
@brief Defines the types of sub entity that may have style attributes applied
directly to them.
*/
typedef enum {
LOSubEntityType_LabelLeaderLine = 0, ///< A label's leader line object.
LOSubEntityType_LabelText, ///< A label's text object.
LOSubEntityType_DimensionStartExtensionLine, ///< A dimension's start extension line object.
LOSubEntityType_DimensionEndExtensionLine, ///< A dimension's end extension line object.
LOSubEntityType_DimensionDimensionLine, ///< A dimension's dimension line object.
LOSubEntityType_DimensionLeaderLine, ///< A dimension's leader line object.
LOSubEntityType_DimensionText, ///< A dimension's text object.
LONumSubEntityTypes
} LOSubEntityType;
#include "entity.h"
#include <SketchUpAPI/color.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@brief Creates a new empty style object.
@param[out] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if style is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *style already refers to a valid object
*/
LO_RESULT LOStyleCreate(LOStyleRef* style);
/**
@brief Releases a style object. *style will be set to invalid by this function.
@param[in] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if style is NULL
- \ref SU_ERROR_INVALID_INPUT if *style does not refer to a valid object
*/
LO_RESULT LOStyleRelease(LOStyleRef* style);
/**
@brief Copies the style attributes from one style object to another.
@param[in] src_style The source style object.
@param[out] dst_style The destination style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if src_style does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if dst_style does not refer to a valid object
*/
LO_RESULT LOStyleCopy(LOStyleRef src_style, LOStyleRef dst_style);
/**
@brief Gets whether or not a style has a stroke.
@param[in] style The style object.
@param[out] is_stroked Whether there is a stroke or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_stroked is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetStroked(LOStyleRef style, bool* is_stroked);
/**
@brief Sets whether or not a style has a stroke.
@param[in] style The style object.
@param[in] is_stroked Whether there should be a stroke or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetStroked(LOStyleRef style, bool is_stroked);
/**
@brief Gets the stroke width of a style.
@param[in] style The style object.
@param[out] stroke_width The stroke width.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if stroke_width is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetStrokeWidth(LOStyleRef style, double* stroke_width);
/**
@brief Sets the stroke width of a style.
@param[in] style The style object.
@param[in] stroke_width The stroke width.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if stroke_width is less than 0.0
*/
LO_RESULT LOStyleSetStrokeWidth(LOStyleRef style, double stroke_width);
/**
@brief Gets the stroke color of a style.
@param[in] style The style object.
@param[out] stroke_color The stroke color.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if stroke_color is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetStrokeColor(LOStyleRef style, SUColor* stroke_color);
/**
@brief Sets the stroke color of a style.
@param[in] style The style object.
@param[in] stroke_color The stroke color.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetStrokeColor(LOStyleRef style, SUColor stroke_color);
/**
@brief Gets the stroke join style of a style.
@param[in] style The style object.
@param[out] join_type The join style.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if join_type is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetStrokeJoinStyle(LOStyleRef style, LOStrokeJoinStyle* join_type);
/**
@brief Sets the stroke join style of a style.
@param[in] style The style object.
@param[in] join_type The join style.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if join_type is invalid
*/
LO_RESULT LOStyleSetStrokeJoinStyle(LOStyleRef style, LOStrokeJoinStyle join_type);
/**
@brief Gets the stroke cap style of a style.
@param[in] style The style object.
@param[out] cap_type The cap style.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if cap_type is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetStrokeCapStyle(LOStyleRef style, LOStrokeCapStyle* cap_type);
/**
@brief Sets the stroke cap style of a style.
@param[in] style The style object.
@param[in] cap_type The cap style.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if cap_type is invalid
*/
LO_RESULT LOStyleSetStrokeCapStyle(LOStyleRef style, LOStrokeCapStyle cap_type);
/**
@brief Gets the stroke pattern of a style.
@param[in] style The style object.
@param[out] stroke_pattern The stroke pattern.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if stroke_pattern is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetStrokePattern(LOStyleRef style, LOStrokePattern* stroke_pattern);
/**
@brief Sets the stroke pattern of a style.
@param[in] style The style object.
@param[in] stroke_pattern The stroke pattern.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if stroke_pattern is invalid
*/
LO_RESULT LOStyleSetStrokePattern(LOStyleRef style, LOStrokePattern stroke_pattern);
/**
@brief Gets the stroke pattern scale of a style.
@param[in] style The style object.
@param[out] pattern_scale The stroke pattern scale.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if pattern_scale is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetStrokePatternScale(LOStyleRef style, double* pattern_scale);
/**
@brief Sets the stroke pattern scale of a style.
@param[in] style The style object.
@param[in] pattern_scale The stroke pattern scale.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if pattern_scale is less than 0.001 or greater than
9999.0
*/
LO_RESULT LOStyleSetStrokePatternScale(LOStyleRef style, double pattern_scale);
/**
@brief Gets whether or not a style has a solid color fill.
@param[in] style The style object.
@param[out] solid_filled Whether there is a solid color fill or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if solid_filled is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetSolidFilled(LOStyleRef style, bool* solid_filled);
/**
@brief Sets whether or not a style has a solid color fill.
@param[in] style The style object.
@param[in] solid_filled Whether there should be a solid color fill or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetSolidFilled(LOStyleRef style, bool solid_filled);
/**
@brief Gets the solid fill color of a style.
@param[in] style The style object.
@param[out] fill_color The solid fill color.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if fill_color is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetSolidFillColor(LOStyleRef style, SUColor* fill_color);
/**
@brief Sets the solid fill color of a style.
@param[in] style The style object.
@param[in] fill_color The solid fill color.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetSolidFillColor(LOStyleRef style, SUColor fill_color);
/**
@brief Gets whether there is a pattern fill or not of a style.
@param[in] style The style object.
@param[out] pattern_filled Whether there is a pattern fill or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if pattern_filled is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetPatternFilled(LOStyleRef style, bool* pattern_filled);
/**
@brief Sets whether or not a style has a pattern fill.
@param[in] style The style object.
@param[in] pattern_filled Whether there should be a pattern fill or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetPatternFilled(LOStyleRef style, bool pattern_filled);
/**
@brief Gets the pattern fill image path of a style. This is the file path for
the pattern fill image file reference.
@param[in] style The style object.
@param[out] image_path The pattern fill image path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if image_path is NULL
- \ref SU_ERROR_INVALID_OUTPUT if *image_path does not refer to a valid string
object
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetPatternFillImagePath(LOStyleRef style, SUStringRef* image_path);
/**
@brief Sets the pattern fill image path of a style. This is the file path for
the pattern fill image file reference.
@param[in] style The style object.
@param[in] image_path The pattern fill image path.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if image_path is NULL
- \ref SU_ERROR_SERIALIZATION if the image file could not be loaded
*/
LO_RESULT LOStyleSetPatternFillImagePath(LOStyleRef style, const char* image_path);
/**
@brief Gets the rotation angle applied to the pattern fill of a style.
@param[in] style The style object.
@param[out] rotation The rotation angle applied to the pattern fill, in degrees.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if rotation is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetPatternFillRotation(LOStyleRef style, double* rotation);
/**
@brief Sets the rotation angle applied to the pattern fill of a style.
@param[in] style The style object.
@param[out] rotation The rotation angle to apply to the pattern fill, in degrees.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
attribute
*/
LO_RESULT LOStyleSetPatternFillRotation(LOStyleRef style, double rotation);
/**
@brief Gets the scale applied to the pattern fill of a style.
@param[in] style The style object.
@param[out] scale The scale applied to the pattern fill.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if scale is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetPatternFillScale(LOStyleRef style, double* scale);
/**
@brief Sets the scale applied to the pattern fill of a style.
@param[in] style The style object.
@param[out] scale The scale to apply to the pattern fill.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
attribute
- \ref SU_ERROR_OUT_OF_RANGE if scale is less than 0.001 or greater than
9999.0
*/
LO_RESULT LOStyleSetPatternFillScale(LOStyleRef style, double scale);
/**
@brief Gets the origin for the pattern fill of a style.
@param[in] style The style object.
@param[out] origin The paper space origin for the pattern fill.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if origin is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetPatternFillOrigin(LOStyleRef style, LOPoint2D* origin);
/**
@brief Sets the origin for the pattern fill of a style.
@param[in] style The style object.
@param[out] origin The paper space origin for the pattern fill.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if origin is NULL
*/
LO_RESULT LOStyleSetPatternFillOrigin(LOStyleRef style, const LOPoint2D* origin);
/**
@brief Gets the text font name of a style.
@param[in] style The style object.
@param[out] family The name of the font.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if family is NULL
- \ref SU_ERROR_INVALID_OUTPUT if family does not refer to a valid object
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetTextFontFamily(LOStyleRef style, SUStringRef* family);
/**
@brief Sets the text font name of a style.
@param[in] style The style object.
@param[in] family The name of the new font to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if family is NULL
*/
LO_RESULT LOStyleSetTextFontFamily(LOStyleRef style, const char* family);
/**
@brief Gets whether or not text should be bold for a style.
@param[in] style The style object.
@param[out] is_bold Whether text will be bolded or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_bold is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetTextBold(LOStyleRef style, bool* is_bold);
/**
@brief Sets whether or not text should be bold for a style.
@param[in] style The style object.
@param[out] is_bold Whether text should be bolded or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetTextBold(LOStyleRef style, bool is_bold);
/**
@brief Gets whether or not text should be italicized for a style.
@param[in] style The style object.
@param[out] is_italic Whether text will be italic or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_italic is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetTextItalic(LOStyleRef style, bool* is_italic);
/**
@brief Sets whether or not text should be italicized for a style.
@param[in] style The style object.
@param[out] is_italic Whether text should be italic or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetTextItalic(LOStyleRef style, bool is_italic);
/**
@brief Gets the font size of a style.
@param[in] style The style object.
@param[out] size_in_points The font size in points.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if size_in_points is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetFontSize(LOStyleRef style, double* size_in_points);
/**
@brief Sets the font size of a style. On Windows only, this font size will be
truncated to an integer value.
@param[in] style The style object.
@param[in] size_in_points The font size in points.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if size_in_points is less than 1.0
*/
LO_RESULT LOStyleSetFontSize(LOStyleRef style, double size_in_points);
/**
@brief Gets the text color of a style.
@param[in] style The style object.
@param[out] color The color of the text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if color is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetTextColor(LOStyleRef style, SUColor* color);
/**
@brief Sets the text color of a style.
@param[in] style The style object.
@param[in] color The new text color to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetTextColor(LOStyleRef style, SUColor color);
/**
@brief Gets the text underline type of a style.
@param[in] style The style object.
@param[out] underline_type The type of underline for text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if underline_type is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetTextUnderline(LOStyleRef style, LOTextUnderline* underline_type);
/**
@brief Sets the text underline type of a style.
@param[in] style The style object.
@param[out] underline_type The type of underline to use for text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if underline_type is invalid
*/
LO_RESULT LOStyleSetTextUnderline(LOStyleRef style, LOTextUnderline underline_type);
/**
@brief Gets the text elevation type (normal, superscript, or subscript) of a
style.
@param[in] style The style object.
@param[out] elevation_type The text elevation type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if elevation_type is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetTextElevation(LOStyleRef style, LOTextElevation* elevation_type);
/**
@brief Sets the text elevation type of a style.
@param[in] style The style object.
@param[in] elevation_type The new text elevation type to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if elevation_type is invalid
*/
LO_RESULT LOStyleSetTextElevation(LOStyleRef style, LOTextElevation elevation_type);
/**
@brief Gets the text alignment type of a style.
@param[in] style The style object.
@param[out] alignment_type The alignment type for text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if alignment_type is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetTextAlignment(LOStyleRef style, LOTextAlignment* alignment_type);
/**
@brief Sets the text alignment type of a style.
@param[in] style The style object.
@param[in] alignment_type The new text alignment type to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if alignment_type is invalid
*/
LO_RESULT LOStyleSetTextAlignment(LOStyleRef style, LOTextAlignment alignment_type);
/**
@brief Gets the text alignment type of a style.
@param[in] style The style object.
@param[out] anchor_type The anchor type for text.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if anchor_type is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetTextAnchor(LOStyleRef style, LOTextAnchor* anchor_type);
/**
@brief Sets the text alignment type of a style.
@param[in] style The style object.
@param[in] anchor_type The new text anchor type to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if anchor_type is invalid
*/
LO_RESULT LOStyleSetTextAnchor(LOStyleRef style, LOTextAnchor anchor_type);
/**
@brief Gets the dimension rotation alignment type of a style.
@param[in] style The style object.
@param[out] alignment The alignment.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if alignment is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetDimensionRotationAlignment(
LOStyleRef style, LODimensionRotationAlignment* alignment);
/**
@brief Sets the dimension rotation alignment type of a style.
@param[in] style The style object.
@param[in] alignment The new alignment to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if alignment is not a valid value
*/
LO_RESULT LOStyleSetDimensionRotationAlignment(
LOStyleRef style, LODimensionRotationAlignment alignment);
/**
@brief Gets the dimension vertical alignment setting of a style.
@param[in] style The style object.
@param[out] alignment The alignment.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if alignment is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetDimensionVerticalAlignment(
LOStyleRef style, LODimensionVerticalAlignment* alignment);
/**
@brief Sets the dimension vertical alignment setting of a style. You can not
set the alignment to \ref LODimensionVerticalAlignment_Offset because it
requires a relative vector for the position.
@param[in] style The style object.
@param[in] alignment The new alignment to use.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if alignment is not a valid value
*/
LO_RESULT LOStyleSetDimensionVerticalAlignment(
LOStyleRef style, LODimensionVerticalAlignment alignment);
/**
@brief Gets the dimension units and precision of a style.
@param[in] style The style object.
@param[out] units The units setting.
@param[out] precision The units precision. This is expressed as a value in the
current units.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if units is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if precision is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetDimensionUnits(LOStyleRef style, LODimensionUnits* units, double* precision);
/**
@brief Sets the dimension units and precision of a style.
@param[in] style The style object.
@param[out] units The units setting for the document.
@param[out] precision The units precision. This is expressed as a value in the
specified units. LayOut only allows for a finite set of
precision values for each units setting, so it will set
the precision to the closest valid setting for the
specified units. See the "Dimension Inspector" for a
reference of the available precisions for each units
setting.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if units is invalid
*/
LO_RESULT LOStyleSetDimensionUnits(LOStyleRef style, LODimensionUnits units, double precision);
/**
@brief Gets the dimension shall sppress unit display attribute of a style.
@param[in] style The style object.
@param[out] is_suppressed Is the dimension suppressing unit display.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if is_suppressed is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
attribute
*/
LO_RESULT LOStyleGetSuppressDimensionUnits(LOStyleRef style, bool* is_suppressed);
/**
@brief Sets the dimension shall sppress unit display attribute of a style.
@param[in] style The style object.
@param[in] is_suppressed Is the dimension suppressing unit display.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
*/
LO_RESULT LOStyleSetSuppressDimensionUnits(LOStyleRef style, bool is_suppressed);
/**
@brief Gets the maximum number of widths that may be returned by
LOStrokePatternGetWidths. Use this to determine the size of the array to
pass to LOStrokePatternGetWidths.
@param[out] num_widths The maximum number of widths.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_widths is NULL
*/
LO_RESULT LOStrokePatternGetMaximumNumberOfWidths(size_t* num_widths);
/**
@brief Gets the widths of the alternating dashes and gaps for the given stroke
pattern. These widths are expressed in paper space inches, and may be
scaled (see \ref LOStyleGetStrokePatternScale). Use \ref
LOStrokePatternGetMaximumNumberOfWidths to determine an adequate length
for the widths array.
@param[in] stroke_pattern The stroke pattern.
@param[in] len The maximum number of widths to return.
@param[out] widths The widths for the stroke pattern.
@param[out] num_widths The number of widths returned.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_OUT_OF_RANGE if stroke_pattern is invalid
- \ref SU_ERROR_NULL_POINTER_OUTPUT if widths is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if num_widths is NULL
*/
LO_RESULT LOStrokePatternGetWidths(
LOStrokePattern stroke_pattern, size_t len, double widths[], size_t* num_widths);
/**
@brief Gets the the start arrow type of a style.
@param[in] style The style object.
@param[out] type The arrow type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if type is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
*/
LO_RESULT LOStyleGetStartArrowType(LOStyleRef style, LOArrowType* type);
/**
@brief Sets the the start arrow type of a style.
@param[in] style The style object.
@param[in] type The arrow type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if type is invalid
*/
LO_RESULT LOStyleSetStartArrowType(LOStyleRef style, LOArrowType type);
/**
@brief Gets the the start arrow size of a style.
@param[in] style The style object.
@param[out] size The arrow size.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if size is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
*/
LO_RESULT LOStyleGetStartArrowSize(LOStyleRef style, double* size);
/**
@brief Sets the the start arrow size of a style.
@param[in] style The style object.
@param[in] size The arrow size.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if size is less than 0.25
*/
LO_RESULT LOStyleSetStartArrowSize(LOStyleRef style, double size);
/**
@brief Gets the end arrow type of a style.
@param[in] style The style object.
@param[out] type The arrow type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if type is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
*/
LO_RESULT LOStyleGetEndArrowType(LOStyleRef style, LOArrowType* type);
/**
@brief Sets the end arrow type of a style.
@param[in] style The style object.
@param[in] type The arrow type.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if type is invalid
*/
LO_RESULT LOStyleSetEndArrowType(LOStyleRef style, LOArrowType type);
/**
@brief Gets the end arrow size of a style.
@param[in] style The style object.
@param[out] size The arrow size.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if size is NULL
- \ref SU_ERROR_NO_DATA if style doesn't specify a value for this style
*/
LO_RESULT LOStyleGetEndArrowSize(LOStyleRef style, double* size);
/**
@brief Sets the end arrow size of a style.
@param[in] style The style object.
@param[in] size The arrow size.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if size is less than 0.25
*/
LO_RESULT LOStyleSetEndArrowSize(LOStyleRef style, double size);
/**
@brief Gets whether or not an arrow type is filled in.
@param[in] type The arrow type.
@param[out] filled Whether the arrow type is filled in or not.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if filled is NULL
- \ref SU_ERROR_OUT_OF_RANGE if type is invalid
*/
LO_RESULT LOStyleIsArrowTypeFilled(LOArrowType type, bool* filled);
/**
@brief Adds a style to apply to an entity's sub-entity. This would be used to
set the arrow head type for extension lines of a dimension, for example.
@param[in] style The style to contain the sub entity style.
@param[in] type The type of sub entity the sub style is for.
@param[in] sub_style The style to set as a sub entity style.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if sub_style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if type is invalid
*/
LO_RESULT LOStyleSetSubEntityStyle(LOStyleRef style, LOSubEntityType type, LOStyleRef sub_style);
/**
@brief Gets the style settings for a sub entity from a style. This would be used
to get the current style of a dimension's text, for example.
@param[in] style The style containing the sub entity style.
@param[in] type The type of sub entity the sub style is for.
@param[in] sub_style The sub entity style.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if sub_style is NULL
- \ref SU_ERROR_INVALID_OUTPUT if sub_style does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if type is invalid
*/
LO_RESULT LOStyleGetSubEntityStyle(LOStyleRef style, LOSubEntityType type, LOStyleRef* sub_style);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_STYLE_H_
// Copyright 2016 Trimble Navigation Ltd., All rights reserved.
#ifndef LAYOUT_MODEL_TABLE_H_
#define LAYOUT_MODEL_TABLE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOTableRef
@brief References a table. A table is a series of rows and columns that holds data.
@since LayOut 2017, API 2.0
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@enum LOTableCellRotation
@brief Defines the rotation angle for table cells.
@since LayOut 2017, API 2.0
*/
typedef enum {
LOTableCellRotation_0 = 0, ///< No rotation.
LOTableCellRotation_90, ///< Rotated 90 degrees counter-clockwise.
LOTableCellRotation_180, ///< Rotated 180 degrees (upside-down).
LOTableCellRotation_270 ///< Rotated 270 degrees counter-clockwise.
} LOTableCellRotation;
/**
@brief Creates a table with a specified size, and a specified number of rows and
columns.
@since LayOut 2017, API 2.0
@param[out] table The table object.
@param[in] bounds The starting dimensions of the table.
@param[in] rows The number of rows.
@param[in] columns The number of columns.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if table is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *table already refers to a valid object
- \ref SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
- \ref SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
- \ref SU_ERROR_OUT_OF_RANGE if rows is less than 1
- \ref SU_ERROR_OUT_OF_RANGE if columns is less than 1
*/
LO_RESULT LOTableCreate(
LOTableRef* table, const LOAxisAlignedRect2D* bounds, size_t rows, size_t columns);
/**
@brief Gets a table from a given entity.
@since LayOut 2017, API 2.0
@param[in] entity The entity object.
@return
- The converted \ref LOTableRef if the downcast operation succeeds
- If not, the returned reference will be invalid
*/
LO_EXPORT LOTableRef LOTableFromEntity(LOEntityRef entity);
/**
@brief Converts from a \ref LOTableRef to a \ref LOEntityRef.
This is essentially an upcast operation.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@return
- The converted \ref LOEntityRef if table is a valid object
- If not, the returned reference will be invalid
*/
LO_EXPORT LOEntityRef LOTableToEntity(LOTableRef table);
/**
@brief Creates the entities that represent the tabel in its exploded form and
adds them to a \ref LOEntityListRef. It is NOT necessary to explicitly
release these entities, since \ref LOEntityListRef itself adds a
reference to the entities and will release them when they are removed
from the list or when the list is released.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] entity_list The entity list object to add the new entities to.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if entity_list does not refer to a valid object
*/
LO_RESULT LOTableGetExplodedEntities(LOTableRef table, LOEntityListRef entity_list);
/**
@brief Releases a table object. The object will be invalidated if releasing the
last reference.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if table is NULL
- \ref SU_ERROR_INVALID_INPUT if *table does not refer to a valid object
*/
LO_RESULT LOTableRelease(LOTableRef* table);
/**
@brief Adds a reference to a table object.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
*/
LO_RESULT LOTableAddReference(LOTableRef table);
/**
@brief Gets the number of rows and columns in a table.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[out] rows The number of rows.
@param[out] columns The number of columns.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if rows or columns are NULL
*/
LO_RESULT LOTableGetDimensions(LOTableRef table, size_t* rows, size_t* columns);
/**
@brief Gets the height of a row, specified by index, in a table.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] index The index of the row.
@param[out] height The height of the row.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if height is NULL
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index for table
*/
LO_RESULT LOTableGetRowHeight(LOTableRef table, size_t index, double* height);
/**
@brief Sets the height of a row, specified by index, in a table. There is a
minimum allowable row height specified by kMinimumRowHeight.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] index The index of the row.
@param[out] height The height of the row.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if height is not a valid row height
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index for table
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableSetRowHeight(LOTableRef table, size_t index, double height);
/**
@brief Gets the width of a column, specified by index, in a table.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] index The index of the row.
@param[out] width The height of the row.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if width is NULL
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index for table
*/
LO_RESULT LOTableGetColumnWidth(LOTableRef table, size_t index, double* width);
/**
@brief Sets the width of a column, specified by index, in a table. There is a
minimum allowable column width specified by kMinimumColumnWidth.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] index The index of the column.
@param[out] width The width of the column.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if width is is not a valid column width
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index for table
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableSetColumnWidth(LOTableRef table, size_t index, double width);
/**
@brief Inserts a row at the specified index.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] index The index of the row to be inserted at.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index for table
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableInsertRow(LOTableRef table, size_t index);
/**
@brief Removes a row at the specified index.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] index The index of the row to be removed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index for table
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableRemoveRow(LOTableRef table, size_t index);
/**
@brief Inserts a column at the specified index.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] index The index of the column to be inserted at.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index for table
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableInsertColumn(LOTableRef table, size_t index);
/**
@brief Removes a column at the specified index.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] index The index of the column to be removed.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if index is not a valid index for table
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableRemoveColumn(LOTableRef table, size_t index);
/**
@brief Creates a copy of the formatted text entity for a table cell at the
specified row and column. Currently, this will always succeed. However,
future versions of LayOut may support other types of entities for table
cells, so you should not assume that this will succeed. If the specified
row and column is within a merged cell, then a copy of the merged cell's
text entity will be created.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] row The cell's row.
@param[in] column The cell's column.
@param[out] text A copy of the cell's text entity.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if row or column are out of range for the table
- \ref SU_ERROR_NULL_POINTER_OUTPUT if entity is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *entity already refers to a valid object
- \ref SU_ERROR_NO_DATA if the cell entity is not a formatted text entity
*/
LO_RESULT LOTableCreateCellTextCopy(
LOTableRef table, size_t row, size_t column, LOFormattedTextRef* text);
/**
@brief Sets the text entity of a table cell from a \ref LOFormattedTextRef
object. Only the text content and fill style settings will be kept. The
bounds and other style settings are controlled by the table. If the
specified row and column is within a merged cell, then the merged cell
itself will be affected.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] row The cell's row.
@param[in] column The cell's column.
@param[in] text The text object representing the table cell.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if row or column are out of range for the table
- \ref SU_ERROR_INVALID_INPUT if entity does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableSetCellText(LOTableRef table, size_t row, size_t column, LOFormattedTextRef text);
/**
@brief Gets the style of a table's border.
@since LayOut 2018, API 3.0
@param[in] table The table object.
@param[out] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_INVALID_OUTPUT if style does not refer to a valid object
*/
LO_RESULT LOTableGetBorderStyle(LOTableRef table, LOStyleRef style);
/**
@brief Sets the style of a table's border. Only the stroke style setting can be
set via this method. Other style settings are controlled by the table.
@since LayOut 2018, API 3.0
@param[in] table The table object.
@param[in] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableSetBorderStyle(LOTableRef table, LOStyleRef style);
/**
@brief Gets the style of a table's inner row edge. The specified row must be
in the range of 0 to the number of rows minus two.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] row The row whose edge style to get.
@param[out] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if row is out of range for the table
- \ref SU_ERROR_INVALID_OUTPUT if style does not refer to a valid object
*/
LO_RESULT LOTableGetRowEdgeStyle(LOTableRef table, size_t row, LOStyleRef style);
/**
@brief Sets the style of a table's inner row edge. The specified row must be
in the range of 0 to the number of rows minus two. Only the stroke style
setting can be set via this method. Other style settings are controlled
by the table.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] row The row whose edge style to set.
@param[in] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if row is out of range for the table
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableSetRowEdgeStyle(LOTableRef table, size_t row, LOStyleRef style);
/**
@brief Gets the style of a table's inner column edge. The specified column must
be in the range of 0 to the number of columns minus two.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] column The column whose edge style to get.
@param[out] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if column is out of range for the table
- \ref SU_ERROR_INVALID_OUTPUT if style does not refer to a valid object
*/
LO_RESULT LOTableGetColumnEdgeStyle(LOTableRef table, size_t column, LOStyleRef style);
/**
@brief Sets the style of a table's inner column edge. The specified column must
be in the range of 0 to the number of rows minus two. Only the stroke
style setting can be set via this method. Other style settings are
controlled by the table.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] column The column whose edge style to set.
@param[in] style The style object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if column is out of range for the table
- \ref SU_ERROR_INVALID_INPUT if style does not refer to a valid object
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
*/
LO_RESULT LOTableSetColumnEdgeStyle(LOTableRef table, size_t column, LOStyleRef style);
/**
@brief Gets the row and column span of a table cell. If the values returned by
both row_span and column_span are equal to 1, then it is a normal,
non-merged cell. If either of these values are greater than 1, then it
is a merged cell. If these values are both 0, then it is an unused cell
that resides within the inner portion of another merged cell.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] row The row index.
@param[in] column The column index.
@param[out] row_span The number of rows that this cell spans.
@param[out] column_span The number of columns that this cell spans.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if row is out of range for the table
- \ref SU_ERROR_OUT_OF_RANGE if column is out of range for the table
- \ref SU_ERROR_NULL_POINTER_OUTPUT if row_span is NULL
- \ref SU_ERROR_NULL_POINTER_OUTPUT if column_span is NULL
*/
LO_RESULT LOTableGetCellSpan(
LOTableRef table, size_t row, size_t column, size_t* row_span, size_t* column_span);
/**
@brief Merge a range of cells within a table. Only cells which are not already
merged can be merged.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] start_row The start row index.
@param[in] start_column The start column index.
@param[out] end_row The end row index.
@param[out] end_column The end column index.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if any of the row or column indices are out of
range for the table
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
- \ref SU_ERROR_UNSUPPORTED if the specified range of cells only spans a single
cell
- \ref SU_ERROR_UNSUPPORTED if the specified range of cells contains a cell that
is already merged
*/
LO_RESULT LOTableMergeCells(
LOTableRef table, size_t start_row, size_t start_column, size_t end_row, size_t end_column);
/**
@brief Gets the rotation of a table cell.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] row The cell's row.
@param[in] column The cell's column.
@param[out] rotation The cell's rotation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if row is out of range for the table
- \ref SU_ERROR_OUT_OF_RANGE if column is out of range for the table
- \ref SU_ERROR_NULL_POINTER_OUTPUT if rotation is NULL
- \ref SU_ERROR_NO_DATA if the specific cell is invalid due to residing within
a merged cell
*/
LO_RESULT LOTableGetCellRotation(
LOTableRef table, size_t row, size_t column, LOTableCellRotation* rotation);
/**
@brief Sets the rotation of a table cell.
@since LayOut 2017, API 2.0
@param[in] table The table object.
@param[in] row The cell's row.
@param[in] column The cell's column.
@param[out] rotation The cell's rotation.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if table does not refer to a valid object
- \ref SU_ERROR_OUT_OF_RANGE if row is out of range for the table
- \ref SU_ERROR_OUT_OF_RANGE if column is out of range for the table
- \ref SU_ERROR_OUT_OF_RANGE if rotation is invalid
- \ref SU_ERROR_LAYER_LOCKED if the table is on a locked layer
- \ref SU_ERROR_ENTITY_LOCKED if table is locked
- \ref SU_ERROR_UNSUPPORTED if the specific cell is invalid due to residing
within a merged cell
*/
LO_RESULT LOTableSetCellRotation(
LOTableRef table, size_t row, size_t column, LOTableCellRotation rotation);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_TABLE_H_
// Copyright 2015 Trimble Navigation Ltd. All rights reserved.
// This file is intended for public distribution.
#ifndef LAYOUT_MODEL_TYPED_VALUE_H_
#define LAYOUT_MODEL_TYPED_VALUE_H_
#include <LayOutAPI/common.h>
#include <LayOutAPI/model/defs.h>
/**
@struct LOTypedValueRef
@brief References a variant object used to represent a value of an arbitrary
type.
*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
@enum LOTypedValueType
@brief Defines the set of types that a \ref LOTypedValueRef can represent.
*/
typedef enum {
LOTypedValueType_Empty = 0,
LOTypedValueType_Bool,
LOTypedValueType_Int32,
LOTypedValueType_Double,
LOTypedValueType_String,
LONumTypedValueTypes
} LOTypedValueType;
/**
@brief Creates a new typed value object.
@param[out] typed_value The created typed value object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_OUTPUT if typed_value is NULL
- \ref SU_ERROR_OVERWRITE_VALID if *typed_value already refers to a valid object
*/
LO_RESULT LOTypedValueCreate(LOTypedValueRef* typed_value);
/**
@brief Releases a typed value object. *typed_value will be set to invalid by
this function.
@param[in] typed_value The typed value object.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if typed_value is NULL
- \ref SU_ERROR_INVALID_INPUT if *typed_value references an invalid object
*/
LO_RESULT LOTypedValueRelease(LOTypedValueRef* typed_value);
/**
@brief Gets the type of value stored by a typed value object.
@param[in] typed_value The typed value object.
@param[out] type The type of value stored by typed_value.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if type_value is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if type is NULL
*/
LO_RESULT LOTypedValueGetType(LOTypedValueRef typed_value, LOTypedValueType* type);
/**
@brief Gets the boolean value of a typed value object.
@param[in] typed_value The typed value object.
@param[out] bool_value The boolean value.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if typed_value is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if bool_value is NULL
- \ref SU_ERROR_NO_DATA if typed_value is not of the requested type
*/
LO_RESULT LOTypedValueGetBool(LOTypedValueRef typed_value, bool* bool_value);
/**
@brief Sets the boolean value of a typed value object.
@param[in] typed_value The typed value object.
@param[in] bool_value The boolean value to set.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if typed_value is not a valid object
*/
LO_RESULT LOTypedValueSetBool(LOTypedValueRef typed_value, bool bool_value);
/**
@brief Gets the int32 value of a typed value object.
@param[in] typed_value The typed value object.
@param[out] int32_value The int32 value.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if typed_value is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if int32_value is NULL
- \ref SU_ERROR_NO_DATA if typed_value is not of the requested type
*/
LO_RESULT LOTypedValueGetInt32(LOTypedValueRef typed_value, int32_t* int32_value);
/**
@brief Sets the int32 value of a typed value object.
@param[in] typed_value The typed value object.
@param[in] int32_value The int32 value to set.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if typed_value is not a valid object
*/
LO_RESULT LOTypedValueSetInt32(LOTypedValueRef typed_value, int32_t int32_value);
/**
@brief Gets the double value of a typed value object.
@param[in] typed_value The typed value object.
@param[out] double_value The double value.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if typed_value is not a valid object
- \ref SU_ERROR_NULL_POINTER_OUTPUT if double_value is NULL
- \ref SU_ERROR_NO_DATA if typed_value is not of the requested type
*/
LO_RESULT LOTypedValueGetDouble(LOTypedValueRef typed_value, double* double_value);
/**
@brief Sets the double value of a typed value object.
@param[in] typed_value The typed value object.
@param[in] double_value The double value to set.
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if typed_value is not a valid object
*/
LO_RESULT LOTypedValueSetDouble(LOTypedValueRef typed_value, double double_value);
/**
@brief Gets a string value from the typed value object.
@since LayOut 2018, API 3.0
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_INVALID_INPUT if typed_value does not refer to a valid object
- \ref SU_ERROR_NO_DATA if the typed value does not contain a string.
- \ref SU_ERROR_NULL_POINTER_OUTPUT if out_string is NULL
- \ref SU_ERROR_INVALID_OUTPUT if out_string does not refer to a valid object
*/
LO_RESULT LOTypedValueGetString(LOTypedValueRef typed_value, SUStringRef* out_string);
/**
@brief Sets the value of typed_value to the given string.
@since LayOut 2018, API 3.0
@return
- \ref SU_ERROR_NONE on success
- \ref SU_ERROR_NULL_POINTER_INPUT if string is NULL
*/
LO_RESULT LOTypedValueSetString(LOTypedValueRef typed_value, const char* string);
#ifdef __cplusplus
} // end extern "C"
#endif // __cplusplus
#endif // LAYOUT_MODEL_TYPED_VALUE_H_
+1
-1

@@ -33,3 +33,3 @@ #include <stdbool.h>

SUModelGetNumAttributeDictionaries(model, &count);
return INT2NUM(count);
return ULL2NUM(count);
}

@@ -36,0 +36,0 @@

@@ -44,3 +44,3 @@ #include <stdbool.h>

SUStringRef* names = malloc(count * sizeof(SUStringRef));
for (int i = 0; i < count; i++)
for (size_t i = 0; i < count; i++)
{

@@ -52,3 +52,3 @@ names[i].ptr = 0;

VALUE ary = rb_ary_new2(count);
for (int i = 0; i < count; i++)
for (size_t i = 0; i < count; i++)
{

@@ -59,3 +59,3 @@ VALUE name;

}
for (int i = 0; i < count; i++)
for (size_t i = 0; i < count; i++)
{

@@ -62,0 +62,0 @@ SUStringRelease(&names[i]);

@@ -64,3 +64,3 @@ #include <stdbool.h>

SUComponentDefinitionGetNumInstances(definition, &count);
return INT2NUM(count);
return ULL2NUM(count);
}

@@ -73,3 +73,3 @@

SUComponentDefinitionGetNumUsedInstances(definition, &count);
return INT2NUM(count);
return ULL2NUM(count);
}

@@ -76,0 +76,0 @@

@@ -31,3 +31,3 @@ #include <stdbool.h>

SUModelGetNumGroupDefinitions(model, &gd_count);
return INT2NUM(cd_count + gd_count);
return ULL2NUM(cd_count + gd_count);
}

@@ -34,0 +34,0 @@

@@ -114,9 +114,9 @@ #include <stdbool.h>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
static VALUE Sketchup_Entity_add_observer(VALUE self, VALUE observer)
{
VALUE observers = Qnil;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
if (RTEST(rb_ivar_defined(self, rb_intern("@observers"))))
#pragma clang diagnostic pop
{

@@ -133,2 +133,3 @@ observers = rb_iv_get(self, "@observers");

}
#pragma clang diagnostic pop

@@ -135,0 +136,0 @@ void Sketchup_Entity_attribute_dictionaries_Iterator(SUAttributeDictionaryRef dictionary, VALUE* ary)

#include <stdbool.h>
#include <material.h>
#include <SketchUpAPI/sketchup.h>
#include <SketchUpAPI/model/material.h>
#include <utils.h>

@@ -28,7 +29,2 @@

static void dealloc(SUColor* ptr)
{
free(ptr);
}
static VALUE VALUE2COLOR(VALUE obj)

@@ -58,3 +54,3 @@ {

static VALUE VALUE2COLORIZATION(VALUE obj)
static enum SUMaterialColorizeType VALUE2COLORIZATION(VALUE obj)
{

@@ -135,3 +131,4 @@ int colorization = NUM2INT(obj);

SUMaterialRef material = {DATA_PTR(self)};
VALUE valueColor = VALUE2COLOR(color);
VALUE2COLOR(color);
SUMaterialSetColor(material, DATA_PTR(VALUE2COLOR(color)));
return color;

@@ -138,0 +135,0 @@ }

@@ -42,3 +42,3 @@ #include <ruby.h>

SUGet(ref, num, array, &num); \
for( int i = 0; i < num; i++) \
for(size_t i = 0; i < num; i++) \
callback(array[i], userdata); \

@@ -52,3 +52,3 @@ free(array); \

SURef* array = malloc(num * sizeof(SURef)); \
for (int i = 0; i < num; i++) \
for (size_t i = 0; i < num; i++) \
{ \

@@ -59,5 +59,5 @@ array[i].ptr = 0; \

SUGet(ref, num, array, &num); \
for (int i = 0; i < num; i++) \
for (size_t i = 0; i < num; i++) \
callback(array[i], userdata); \
for (int i = 0; i < num; i++) \
for (size_t i = 0; i < num; i++) \
SUStringRelease(&array[i]); \

@@ -64,0 +64,0 @@ free(array); \