/////////////////////////////////////////////////////////////////////////////// // 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 _DbBlock2PtParameter_h_Included #define _DbBlock2PtParameter_h_Included #include "DbBlockParameter.h" class OdDbBlockAction; /** \details Base class for the block parameters with two base points, like linear, polar etc. Parameter treats differently it's "first" and "second" points. First is later called "Base", second is called "End". The difference is established when the parameter is created. If only one grip point is displayed for the parameter (cf. setNumberOfGrips) then this grip point affects the "End" point. If there are 2 grip points then they correspond to the first 2 members of the OdDbBlockParameter::ParameterComponent (All 4 grips are used by the OdDbBlockXYParameter) */ class DYNBLOCKS_EXPORT OdDbBlock2PtParameter : public OdDbBlockParameter { public: ODDB_EVAL_DECLARE_MEMBERS(OdDbBlock2PtParameter); /** \details * Enum used by some block actions to interpret grip editing (see values description) */ enum ParameterBaseLocation { start = 0, //< when dragging by the end grip, base point stays fixed mid = 1 //< when dragging by the end grip, middle point stays fixed }; /** \details Returns the current base point for this parameter (actual position in the representation block) */ OdGePoint3d basePoint() const; /** \details Sets the current base point for this parameter (actual position in the representation block) */ void setBasePoint(const OdGePoint3d&); /** \details Returns the current end point for this parameter (actual position in the representation block) */ OdGePoint3d endPoint() const; /** \details Sets the current end point for this parameter (actual position in the representation block) */ void setEndPoint(const OdGePoint3d&); /** \details Returns the current distance between the base and end points (in the representation block) */ double distance() const; /** \details Returns the current angle between the (base, end) vector and the X-axis (in the representation block) */ double angle() const; /** \details Returns the base location flag for this parameter. (see *ParameterBaseLocation* enum for details) */ ParameterBaseLocation baseLocation() const; /** \details Sets the base location flag for this parameter. (see *ParameterBaseLocation* enum for details) */ void setBaseLocation(ParameterBaseLocation); /** \details Returns the definition base point for this parameter (initial position in the original block) */ OdGePoint3d definitionBasePoint() const; /** \details Sets the definition base point for this parameter (initial position in the original block) */ void setDefinitionBasePoint(const OdGePoint3d&); /** \details Returns the definition end point for this parameter (initial position in the original block) */ OdGePoint3d definitionEndPoint() const; /** \details Sets the definition end point for this parameter (initial position in the original block) */ void setDefinitionEndPoint(const OdGePoint3d&); /** \details Returns the distance between the base and end points (in the original block) */ double definitionDistance() const; /** \details Returns the angle between the (base, end) vector and the X-axis (in the original block) */ double definitionAngle() const; /** \details Returns the updated base point for this parameter (actual position in the runtime block) */ OdGePoint3d updatedBasePoint() const; /** \details Sets the updated base point for this parameter (actual position in the runtime block) */ void setUpdatedBasePoint(const OdGePoint3d&); /** \details Returns the updated end point for this parameter (actual position in the runtime block) */ OdGePoint3d updatedEndPoint() const; /** \details Sets the updated end point for this parameter (actual position in the runtime block) */ void setUpdatedEndPoint(const OdGePoint3d&); /** \details Returns the distance between the base and end points (in the runtime block) */ double updatedDistance() const; /** \details Returns the current angle between the (base, end) vector and the X-axis (in the runtime block) */ double updatedAngle() const; /** \details Returns the normal of this parameter (used to calculate angles) */ OdGeVector3d normal() const; /** \details Returns the grip point associated with a given parameter or a nullptr if there is none \param pc [in] component for which the grip is returned (see *OdDbBlockParameter::ParameterComponent*) */ OdDbBlockGripPtr getAssociatedGrip(OdDbBlockParameter::ParameterComponent pc, OdDb::OpenMode mode = OdDb::kForRead); /** \details Notification function called whenever the Graph object has been traversed. \param nodeIsActive [in] True if and only if this Node object has been activated. \remarks Called by OdDbEvalGraph::evaluate(). In this function current points are set to updated points at the end of graph evaluation. */ void graphEvalEnd(bool nodeIsActive) override; /** \details Check if the parameter has an action for a given component \param pc [in] component for which the action is searched \param action [in, optional] Optional action to check for */ bool parameterComponentHasAction(OdDbBlockParameter::ParameterComponent pc, const OdDbBlockAction* action = nullptr); }; typedef OdSmartPtrOdDbBlock2PtParameterPtr; #endif //_DbBlock2PtParameter_h_Included