/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _ODTV_MODEL_H_INCLUDED_ #define _ODTV_MODEL_H_INCLUDED_ #include "Tv.h" #include "TvModelId.h" #include "TvBlock.h" #include "TvIObject.h" #include "TvLight.h" #include "TvUserData.h" #include "UInt64Array.h" #include "TvStatistics.h" #include "TvEntity.h" #include "TvSelection.h" #include "TvCommonDataAccessTree.h" class OdTvGsViewId; /** \details A data type that represents an array of OdTvVisualStyleId objects. */ typedef OdArray OdTvVisualStyleIdsArray; /** \details The base interface class for getting access to Visualize SDK model objects. \sa */ class ODTV_EXPORT OdTvModel : public OdTvHandledIObject { public: /** \details Enumerates the model rendering types. */ enum Type { kBackgroundZ = -1, // The model is drawn before the main scene, using the Z-buffer. kMain = 0, // The model is included in the main scene. kDirect = 1 // The model is drawn over the main scene, skipping the Z-buffer. }; /** \details Appends an entity object to the model and returns the identifier of the appended entity. \param name [in] A name of the entity. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the appended entity if it is successfully added, otherwise returns a null identifier. \remarks If the rc parameter is not null and the entity is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvEntityId appendEntity(OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Appends a view-dependent entity object to the model and returns the identifier of the appended entity. \param viewId [in] View in which this entity will be drawn. \param name [in] A name of the entity. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier of the appended entity. \remarks If the rc parameter is not null and the entity is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvEntityId appendViewDependentEntity(const OdTvGsViewId& viewId, OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Appends an insert entity object to the model and returns the identifier of the appended insert entity. \param blockId [in] An identifier of the block that should contain the appended insert object. \param name [in] A name of the insert object. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the appended insert entity if it is successfully added, otherwise returns a null identifier. \remarks If the rc parameter is not null and the insert entity is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvEntityId appendInsert(const OdTvBlockId& blockId, OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Appends an insert entity object to the model and returns the identifier of the appended insert entity. \param viewId [in] View in which this insert will be drawn. \param blockId [in] An identifier of the block that should contain the appended insert object. \param name [in] A name of the insert object. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the appended insert entity if it is successfully added, otherwise returns a null identifier. \remarks If the rc parameter is not null and the insert entity is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvEntityId appendViewDependentInsert(const OdTvGsViewId& viewId, const OdTvBlockId& blockId, OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Appends a light object to the model and returns the identifier of the appended light object. \param name [in] A name of the light object. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the appended light object if it is successfully added, otherwise returns a null identifier. \remarks If the rc parameter is not null and the light object is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvEntityId appendLight(OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Appends a camera object to the model and returns the identifier of the appended camera object. \param name [in] A name of the camera object. \param bNeedSaveInFile [in] A flag that indicates whether camera object should be saved in file. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the appended camera object if it is successfully added, otherwise returns a null identifier. \remarks If the rc parameter is not null and the camera object is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvEntityId appendCamera( OdString name = OdString::kEmpty, bool bNeedSaveInFile = true, OdTvResult* rc = NULL ) = 0; /** \details Appends a group object to the model and returns the identifier of the appended camera object. \param name [in] A name of the group object. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the appended group object if it is successfully added, otherwise returns a null identifier. \remarks If the rc parameter is not null and the group object is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvEntityId appendGroup(OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Removes an entity object, specified by its identifier, from the model. \param id [in] An identifier of the entity object. \returns A value of the type that contains the result of the operation. \remarks If the entity specified by its identifier is found and removed from the model, the method returns the tvOk, otherwise it returns an appropriate error code. */ virtual OdTvResult removeEntity(const OdTvEntityId& id) = 0; /** \details Removes all entities that the model contains. \returns A value of the type that contains the result of the operation. \remarks If all entities are successfully removed from the model, the method returns the tvOk, otherwise it returns an appropriate error code. */ virtual OdTvResult clearEntities() = 0; /** \details Sets the name of the model. \param sName [in] A string that contains the model's name. \returns A value of the type that contains the result of the operation. \remarks If the model's name is successfully set, the method returns the tvOk, otherwise it returns an appropriate error code. The name is an arbitrary non-empty string that can contain letters, digits, blank spaces, underscores, and some special characters, but cannot contain inadmissible letters ("<", ">", "\", "/", ":", ";", "?", ",", "*", "|", "=", "'", quotation marks and some special characters created with Unicode fonts). Also there are 3 forbidden names: "*Model_Space", "*Paper_Space", "*Paper_Space0", which can not be used as model names. */ virtual OdTvResult setName(const OdString& sName) = 0; /** \details Retrieves the name of the model. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The current model's name. \remarks If the rc parameter is not null and the model's name is successfully returned, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdString getName(OdTvResult* rc = NULL) = 0; /** \details Sets new extents for the model. \param ext [in] An object of the class that represents new extents for the model. \param bNeedSaveInFile [in] A flag that indicates whether extents should be saved in file. \returns A value of the type that contains the result of the operation. \remarks If the new extents are successfully set, the method returns tvOk, otherwise it returns an appropriate error code. */ virtual OdTvResult setExtents(const OdTvExtents3d& ext, bool bNeedSaveInFile = false) = 0; /** \details Retrieves the current extents of the specified type for the model (not included Units matrix and fast model transformtaion if such exists). \param ext [out] A placeholder for the extents object. \param eType [in] A type of extents to retrieve. \returns A value of the type that contains the result of the operation. \remarks If the extents are successfully returned, the method returns tvOk, otherwise it returns an appropriate error code. */ virtual OdTvResult getExtents(OdTvExtents3d& ext, OdTv::ExtentsType eType = OdTv::kPreferred) const = 0; /** \details Retrieves a smart pointer to the entity iterator. The entity iterator provides sequential access to entities that the model contains. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns A smart pointer to the entity iterator. If the model contains no entities, the method returns a null smart pointer. \remarks If the rc parameter is not null and the smart pointer to the entity iterator is successfully returned, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvEntitiesIteratorPtr getEntitiesIterator(OdTvResult* rc = NULL) const = 0; /** \details Searches for an entity using an entity handle. \param h [in] An entity handle. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier of the found entity. \remarks If the rc parameter is not null and the entity is found, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. If the entity is not found, the method returns a null identifier (i.e. the isNull() method of the identifier returns true). */ virtual OdTvEntityId findEntity(const OdUInt64 h, OdTvResult* rc = NULL) = 0; /** \details Searches for an entity using an entity original database handle. \param originalDatabaseHandle [in] An entity original database handle. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier of the found entity. \remarks First call could be slow because of entities caching. If the rc parameter is not null and the entity is found, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. If the entity is not found, the method returns a null identifier (i.e. the isNull() method of the identifier returns true). */ virtual OdTvEntityId findEntityByOriginalID(OdUInt64 originalDatabaseHandle, OdTvResult* rc = NULL) = 0; /** \details Retrieves the current value of the save flag. The save flag determines whether the model should be saved in a file. If the model data should be saved in a file, the flag value is equal to true, otherwise the flag value is false. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The current value of the save flag. \remarks If the rc parameter is not null and the save flag value is successfully retrieved, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual bool getNeedSaveInFile(OdTvResult* rc = NULL) const = 0; /** \details Isolates a specified entity in the model. \param entityId [in] An entity identifier. \param bPerSession [in] A flag that determines whether the entity should be isolated in the model only during the current session (if true) or until the method unisolate() is called (if false). \returns A value of the type that contains the result of the operation. \remarks If the entity is successfully isolated in the model, the method returns tvOk, otherwise it returns an appropriate error code. \sa */ virtual OdTvResult isolate(const OdTvEntityId& entityId, bool bPerSession = true) = 0; /** \details Hides a specified entity in the model. \param entityId [in] An entity identifier. \param bPerSession [in] A flag that determines whether the entity should be hidden in the model only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \remarks If the entity is successfully hidden in the model, the method returns tvOk, otherwise it returns an appropriate error code. \sa */ virtual OdTvResult hide(const OdTvEntityId& entityId, bool bPerSession = true) = 0; /** \details Unhides a specified entity in the model. \param entityId [in] An entity identifier. \param bApplyToChilds [in] A flag that determines whether the descendants of the entity should be unhidden regardless of whether the entity itself was hidden. \param bPerSession [in] A flag that determines whether the entity should be unhidden in the model only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \remarks If the entity is successfully unhidden in the model, the method returns tvOk, otherwise it returns an appropriate error code. \sa */ virtual OdTvResult unHide(const OdTvEntityId& entityId, bool bApplyToChilds = true, bool bPerSession = true) = 0; /** \details Isolates specified geometry (or a sub-entity) in the model. \param geometryId [in] An identifier of the geometry. \param bPerSession [in] A flag that determines whether the geometry should be isolated in the descendants of the model only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \remarks If the geometry or sub-entity is successfully isolated, the method returns tvOk, otherwise it returns an appropriate error code. \sa */ virtual OdTvResult isolate(const OdTvGeometryDataId& geometryId, bool bPerSession = true) = 0; /** \details Hides specified geometry (or a sub-entity) in descendants of the model. \param geometryId [in] An identifier of the geometry. \param bPerSession [in] A flag that determines whether the geometry should be hidden in the descendants of the model only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \remarks If the geometry or sub-entity is successfully hidden, the method returns tvOk, otherwise it returns an appropriate error code. \sa */ virtual OdTvResult hide(const OdTvGeometryDataId& geometryId, bool bPerSession = true) = 0; /** \details Unhides specified geometry (or a sub-entity) in descendants of the model. \param geometryId [in] An identifier of the geometry. \param bApplyToChilds [in] A flag that determines whether the descendants of the geometry should be unhidden regardless of whether the geometry itself was hidden. \param bPerSession [in] A flag that determines whether the geometry should be unhidden in the descendants of the model only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \remarks If the geometry or sub-entity is successfully unhidden, the method returns tvOk, otherwise it returns an appropriate error code. \sa */ virtual OdTvResult unHide(const OdTvGeometryDataId& geometryId, bool bApplyToChilds = true, bool bPerSession = true) = 0; /** \details Isolates objects in a selection set of the model. \param selectionSetPtr [in] A selection set with selected objects for isolation. \param bPerSession [in] A flag that determines whether objects should be isolated in the descendants of the model only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \sa */ virtual OdTvResult isolate(const OdTvSelectionSetPtr& selectionSetPtr, bool bPerSession = true) = 0; /** \details Hides objects in a selection set of descendants of the model. \param selectionSetPtr [in] A selection set with selected objects for hiding. \param bPerSession [in] A flag that determines whether objects should be hidden in the descendants of the model only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \sa */ virtual OdTvResult hide(const OdTvSelectionSetPtr& selectionSetPtr, bool bPerSession = true) = 0; /** \details Unhides objects in a selection set of descendants of the model. \param selectionSetPtr [in] A selection set with selected objects for unhiding. \param bApplyToChilds [in] A flag that determines whether the descendants should be unhidden regardless of whether the selection set item itself was hidden \param bPerSession [in] A flag that determines which objects should be unhidden in the descendants of the model: which were hided only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \sa */ virtual OdTvResult unHide(const OdTvSelectionSetPtr&, bool bApplyToChilds = true, bool bPerSession = true) = 0; /** \details Unisolates objects in the model. \param bPerSession [in] A flag that determines which objects should be unhidden in the descendants of the model: which were hided only during the current session (if true) or not (if false). \returns A value of the type that contains the result of the operation. \remarks If objects were successfully unisolated, the method returns tvOk, otherwise it returns an appropriate error code. \sa */ virtual OdTvResult unIsolate(bool bPerSession = true) = 0; /** \details Sets the selectability property value for the model. \param selectability [in] A new selectability property value. \param bRecursive [in] If true, the same selectability will be set for all blocks that has references in this model. \returns A value of the type that contains the result of the operation. \remarks If the new selectability property value is successfully set, the method returns tvOk, otherwise it returns an appropriate error code. \sa */ virtual OdTvResult setSelectability(const OdTvSelectabilityDef& selectability, bool bRecursive = true) = 0; /** \details Retrieves the current selectability property value for the model. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The current value of the selectability property. \remarks If the rc parameter is not null and the selectability property value has been successfully retrieved, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. \sa */ virtual OdTvSelectabilityDef getSelectability(OdTvResult* rc = NULL) const = 0; /** \details Sets a new value of the content selectable property for all insert objects in the model. \param bSelectable [in] A new value of the content selectable property to be set. \returns A value of the type that contains the result of the operation. \remarks OBSOLETE. Insert's content is always selectable and all depends from the 'kBlocksCache' option of the device and from the selection level. */ virtual OdTvResult setInsertsContentsSelectable(bool bSelectable) = 0; /** \details Sets a new transformation matrix that can rotate, translate (move) and scale the whole model. \param matrix [in] A transformation matrix object. \param bFastMode [in] If true, the fast transformation mode will be used. \returns A value of the type that contains the result of the operation. \remarks If the transformation matrix is successfully set, the method returns tvOk; otherwise it returns an appropriate error code. The fast transformation mode is provided mainly for the temporary transformations which can be used in different tools. */ virtual OdTvResult setModelingMatrix(const OdTvMatrix& matrix, bool bFastMode = false) = 0; /** \details Applies fast transform to the entity. \param id [in] An entity ID that should be transformed. \param transform [in] A transformation matrix. \param bDoIt [in] A flag value that determines whether fast transform is enabled (if true) or disabled (if false). \returns A value of the type that contains the result of the fast transform operation. \remarks If the fast transform operation was successful, the method returns the tvOk value; otherwise it returns an appropriate error code. Result of fast transform operation only for real-time and doesn't save. */ virtual OdTvResult setModelingMatrix(const OdTvEntityId& id, const OdTvMatrix& transform, bool bDoIt = true) = 0; /** \details Applies fast transform to the entity. \param pSSet [in] A selection set with the entity that should be transformed. \param transform [in] A transformation matrix. \param bDoIt [in] A flag value that determines whether fast transform should be applied (if true) or disabled (if false). \returns A value of the type that contains the result of the fast transform operation. \remarks If the fast transform operation was successful, the method returns the tvOk value; otherwise it returns an appropriate error code. Result of fast transform operation only for real-time and doesn't save. */ virtual OdTvResult setModelingMatrix(const OdTvSelectionSetPtr& pSSet, const OdTvMatrix& transform, bool bDoIt = true) = 0; /** \details Retrieves the current transformation matrix for the model. A transformation matrix can rotate, translate (move) and scale the whole model. \param bFastMode [out] Flag indicating that the fast mode is used. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The transformation matrix represented as an instance of the class. \remarks If the rc parameter is not null and the transformation matrix is successfully returned, the rc parameter accepts the tvOk value; otherwise it contains an appropriate error code. If the transformation matrix is identity, the bFastMode will be always false. */ virtual OdTvMatrix getModelingMatrix(bool* bFastMode = NULL, OdTvResult* rc = NULL) const = 0; /** \details Retrieves the current fast transformation matrix for the entity. \param id [in] An entity id, for which need to get the matrix . \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The fast transformation matrix represented as an instance of the class. \remarks If the rc parameter is not null and the fast transformation matrix is successfully returned, the rc parameter accepts the tvOk value; otherwise it contains an appropriate error code. */ virtual OdTvMatrix getModelingMatrix(const OdTvEntityId& id, OdTvResult* rc = NULL) const = 0; /** \details Retrieves the statistics for the model. \param bool bIncludeNesting [in] flag which indicates that is it need to take into account the contents of inserts too \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The statistics object for the model. \remarks If the rc parameter is not null and the statistics object is successfully retrieved, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvGeometryStatistic getStatistic(bool bIncludeNesting = false, OdTvResult* rc = NULL) = 0; /** \details Calculates and adds partial view indexes to the model. \param bUpdateExisting [in] A flag that indicates whether partial view indexes already exist in the model; the method updates them (if the value is equal to true). \param bExtendedMode [in] A flag that indicates whether partial index should be in extended mode. \returns A value of the type that contains the result of the operation. \remarks If partial view indexes are successfully calculated and added to the model, the method returns tvOk; otherwise it returns an appropriate error code. Extended partial index also indexes sub-entities (not only entities), which gives a better visual result in request-based partial viewing. \sa */ virtual OdTvResult addPartialViewIndex(bool bUpdateExisting = true, bool bExtendedMode = false ) = 0; /** \details Extents model partial view indexes. \param id [in] Instance of OdTvEntityId that should be added to partial index. \returns A value of the type that contains the result of the operation. \sa */ virtual OdTvResult extendPartialViewIndex( const OdTvEntityId& id ) = 0; /** \details Returns true if the model has a partial view index. \param bCheckExtents [in] If true, the method also checks that the index has valid extents. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns A flag that indicates whether the model has a partial view index. \sa */ virtual bool hasPartialViewIndex( bool bCheckExtents = false, OdTvResult* rc = NULL) = 0; /** \details Returns the number of partially indexed items. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The number of partially indexed items. */ virtual OdUInt32 getPartialIndexedItemsCount( OdTvResult* rc = NULL ) const = 0; /** \details Returns the partial index extents. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The partial index extents. */ virtual OdTvExtents3d getPartialIndexExtents( OdTvResult* rc = NULL ) const = 0; /** \details Sets the CDA (Common Data Access) tree storage for this model. \param treeStorageId [in] An identifier of the CDA tree storage. \returns A value of the type that contains the result of the operation. \remarks If the tree is successfully set, the method returns tvOk, otherwise it returns an appropriate error code. */ virtual OdTvResult setCDATreeStorage(const OdTvCDATreeStorageId& treeStorageId) = 0; /** \details Returns the CDA (Common Data Access) tree storage for this model. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier of the CDA (Common Data Access ) tree storage. \remarks If the rc parameter is not null and the CDA tree storage ID has been successfully retrieved, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTvCDATreeStorageId getCDATreeStorage(OdTvResult* rc = NULL) = 0; /** \details Removes the CDA (Common Data Access) tree storage for this model. \returns A value of the type that contains the result of the operation. \remarks If the CDA tree is successfully removed, the method returns tvOk, otherwise it returns an appropriate error code. */ virtual OdTvResult removeCDATreeStorage() = 0; /** \details Sets the sectionable property to the model. This property defines whether all entities and geometry in this model can be cut via a cutting plane. \param bVal [in] A flag that specifies whether sectionable is enabled. \returns A value of the type that contains the result of the operation (tvOk if the property was changed successfully). \remarks If the sectionable property value is successfully changed, the method returns tvOk; otherwise it returns an appropriate error code. \sa */ virtual OdTvResult setSectionable(bool bVal) = 0; /** \details Retrieves the current value of the sectionable property for the model. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The current sectionable property. \remarks If the rc parameter is not null and the sectionable property was returned successfully, the rc parameter accepts the tvOk value; otherwise it contains an appropriate error code. \sa */ virtual bool getSectionable(OdTvResult* rc = NULL) const = 0; /** \details Copies all the model's data to a specified model (attributes, entities, etc.). All current data in the target model is deleted or overwritten. \param targetModelId [in] A target . The data is copied to the model referred to by the identifier. \returns A value of the type that contains the result of the operation. \remarks If the operation is successfully performed, the method returns tvOk; otherwise it returns an appropriate error code. This function is designed for copying models within the same database. If the source and destination models belong to different databases, default OdTvAttributeResolver is created and used. Using copyTo(OdTvModelId& targetModelId, OdTvAttributeResolverPtr pResolver) is better. */ virtual OdTvResult copyTo(OdTvModelId& targetModelId) const = 0; /** \details Copies all the model's data to a specified model (attributes, entities, etc.). All current data in the target model is deleted or overwritten. \param targetModelId [in] A target . The data is copied to the model referred to by the identifier. \param pResolver [in] A smart pointer to the instance of OdTvAttributeResolver. \returns A value of the type that contains the result of the operation. \remarks If the operation is successfully performed, the method returns tvOk; otherwise it returns an appropriate error code. This function is designed for copying models from different databases. If the source and destination models belong to the same database, using copyTo(OdTvModelId& targetModelId) is better. */ virtual OdTvResult copyTo(OdTvModelId& targetModelId, OdTvAttributeResolverPtr pResolver) const = 0; /** \details Inserts an entity object to the model after 'prevEntityId' and returns the identifier of the inserted entity. \param prevEntityId [in] Identifier of the entity after which to insert a new entity. \param name [in] A name of the entity. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the inserted entity if it is successfully inserted, otherwise returns a null identifier. \remarks If the 'rc' parameter is not null and the entity is created and inserted to the model, the 'rc' parameter accepts the tvOk value, otherwise it contains an appropriate error code. Such method can be used when the draw order is important. In other cases it is better to use the 'appendEntity' method. */ virtual OdTvEntityId insertEntityAt(const OdTvEntityId& prevEntityId, OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Moves the specified object that belongs to the model to the end of the entity list. \param entityId [in] Object to be moved. \returns A value of the type that contains the result of the operation. \remarks The position in the entity list defines the draw order of objects. Objects must be the top-level object of this model. */ virtual OdTvResult moveToFront( const OdTvEntityId& entityId ) = 0; /** \details Moves the specified object that belongs to the model to the beginning of the entity list. \param entityId [in] Object to be moved. \returns A value of the type that contains the result of the operation. \remarks The position in the entity list defines the draw order of objects. Objects must be the top-level object of this model. */ virtual OdTvResult moveToBottom( const OdTvEntityId& entityId ) = 0; /** \details Moves the specified object that belongs to the model after the prevEntityId in the entity list. \param entityId [in] Object to be moved. \param prevEntityId [in] Identifier of the entity after which to move a new entity. \returns A value of the type that contains the result of the operation. \remarks The position in the entity list defines the draw order of objects. Objects must be the top-level object of this model. */ virtual OdTvResult moveAfter( const OdTvEntityId& entityId, const OdTvEntityId& prevEntityId ) = 0; /** \details Inserts a view-dependent entity object to the model after the prevEntityId and returns the identifier of the inserted entity. \param prevEntityId [in] Identifier of the entity after which to insert a new entity. \param viewId [in] View in which to draw the appended entity. \param name [in] A name of the entity. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier of the inserted entity. \remarks If the rc parameter is not null and the entity is created and inserted to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. This method is used when the draw order is important, but in other cases, it is better to use the appendViewDependentEntity method. */ virtual OdTvEntityId insertViewDependentEntityAt(const OdTvEntityId& prevEntityId, const OdTvGsViewId& viewId, OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Adds an insert entity object to the model after the prevEntityId and returns the identifier of the inserted entity. \param prevEntityId [in] Identifier of the entity after which to add a new insert entity. \param blockId [in] An identifier of the block that should contain the appended insert object. \param name [in] A name of the insert object. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the added insert entity if it is successfully added, otherwise returns a null identifier. \remarks If the rc parameter is not null and the insert entity is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. This method is used when the draw order is important, but in other cases, it is better to use the appendInsert method. */ virtual OdTvEntityId addInsertAt(const OdTvEntityId& prevEntityId, const OdTvBlockId& blockId, OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Adds a view-dependent insert entity object to the model after the prevEntityId and returns the identifier of the inserted entity. \param prevEntityId [in] Identifier of the entity after which to add a new insert entity. \param viewId [in] View in which this insert will be drawn. \param blockId [in] An identifier of the block that should contain the appended insert object. \param name [in] A name of the insert object. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns An identifier for the added insert entity if it is successfully added, otherwise returns a null identifier. \remarks If the rc parameter is not null and the insert entity is created and added to the model, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. This method is used when the draw order is important, but in other cases, it is better to use the appendViewDependentInsert method. */ virtual OdTvEntityId addViewDependentInsertAt(const OdTvEntityId& prevEntityId, const OdTvGsViewId& viewId, const OdTvBlockId& blockId, OdString name = OdString::kEmpty, OdTvResult* rc = NULL) = 0; /** \details Sets the measuring units for this model. \param units [in] Measuring units to set. \param userDefCoefToMeters [in] User defined coefficient to meters transform. Actual only for 'kUserDefined' units. \returns A value of the type that contains the result of the operation. \remarks If the operation was successfully performed, the method returns tvOk; otherwise it returns an appropriate error code. */ virtual OdTvResult setUnits(OdTv::Units units, double userDefCoefToMeters = 1.) = 0; /** \details Returns the measuring units set for this model. \param userDefCoefToMeters[out] User defined coefficient to meters transform. Only for kUserDefined units. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns Measuring units set for this model. \remarks If the rc parameter is not null and the units was successfully returned, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. */ virtual OdTv::Units getUnits(double* userDefCoefToMeters = NULL, OdTvResult* rc = NULL) const = 0; /** \details Retrieves the units transformation matrix for the model. This matrix is present when the database drawing units is not equal to the model's units. This transformation matrix scales the whole model. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The units transformation matrix represented as an instance of the class. \remarks If the rc parameter is not null and the units transformation matrix is successfully returned, the rc parameter accepts the tvOk value; otherwise it contains an appropriate error code. */ virtual OdTvMatrix getUnitsMatrix(OdTvResult* rc = NULL) const = 0; /** \details Retrieves the type of the model. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The type of the model. */ virtual OdTvModel::Type getModelType( OdTvResult* rc = NULL ) const = 0; /** \details Specifies whether this model's geometry should ignore the view's front and back clipping planes (if any) and viewport 3D clipping (if set). If the method's input value is false, the view's clipping planes and viewport 3D clipping are allowed by this model object. \param bIgnore [in] Flag that specifies whether the model ignores the view's clipping planes and viewport 3D clipping. \returns A value of the type that contains the result of the operation. */ virtual OdTvResult setIgnore3DClipping(bool bIgnore = false) = 0; /** \details Checks whether view clipping override is enabled for this model object. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns true if the view clipping override is enabled for this model object, false otherwise. */ virtual bool getIgnore3DClipping(OdTvResult* rc = NULL) const = 0; /** \details Checks whether the entities in the model have visual styles set on them. \param pVisualStyles [out] Receives an array of IDs of visual styles set on entities in the model. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns true if the model contains entities on which the visual styles are set (including entities in the blocks). */ virtual bool hasVisualStylesAtEntities(OdTvVisualStyleIdsArray* pVisualStyles = NULL, OdTvResult* rc = NULL) const = 0; }; /** \details A data type that represents a smart pointer to an object. */ typedef OdTvSmartPtr OdTvModelPtr; /** \details The base interface class for the iterator of Visualize SDK models. An iterator object provides sequential access to a collection of model objects. */ class ODTV_EXPORT OdTvModelsIterator : public OdTvIterator, public OdTvIObject { public: /** \details Retrieves the model that is currently referenced by the iterator object. \param rc [out] A pointer to a value of the type that contains the result of the operation. \returns The model identifier if the iterator refers to a model, otherwise returns an identifier with a null value. \remarks If the rc parameter is not null and the model identifier is successfully returned, the rc parameter accepts the tvOk value, otherwise it contains an appropriate error code. If the iterator refers to a model, the identifier that the method returns is not null (i.e., the result of the isNull() method of the identifier is equal to false). */ virtual OdTvModelId getModel(OdTvResult* rc = NULL) const = 0; /** \details Searches for a model defined by its identifier and moves the iterator to this model if found. \param modelId [in] A model identifier. \returns A value of the type that contains the result of the operation. \remarks If the model specified by its identifier is found, the method returns tvOk, otherwise it returns an appropriate error code. */ virtual OdTvResult seek(const OdTvModelId& modelId) = 0; }; /** \details A data type that represents a smart pointer to an object. */ typedef OdTvSmartPtr OdTvModelsIteratorPtr; #endif //_ODTV_MODEL_H_INCLUDED_