
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 2008-2009 by Autodesk, Inc. 
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted, 
// provided that the above copyright notice appears in all copies and 
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting 
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC. 
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to 
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
// CREATED BY: Jiri Kripac                         June 2008
//
// DESCRIPTION:
//
// AcDbAssocDimDependencyBody derived class.
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "AcDbAssocDimDependencyBodyBase.h"


/// <summary>
/// AcDbAssocDimDependencyBody manages an AcDbDimension entity that serves 
/// as the graphical representation of a dimensional constaint. It inherits
/// common functionality from the AcDbAssocDimDependencyBodyBase class and 
/// overrides the base-class pure virtual methods in which it implements the
/// AcDbDimension-specific functionality.
/// </summary>
///
class ACDB_PORT AcDbAssocDimDependencyBody : public AcDbAssocDimDependencyBodyBase
{
public:
    ACRX_DECLARE_MEMBERS(AcDbAssocDimDependencyBody);

    /// <summary> Default constructor.</summary>
    AcDbAssocDimDependencyBody();

    /// <summary> Destructor. </summary>
    virtual ~AcDbAssocDimDependencyBody();

    // Implementation of pure virtual methods in the AcDbAssocDimDependencyBodyBase 
    // class. They deal with the controlled entity that is assumed to be an 
    /// AcDbDimension

    /// <summary> Returns the text of the controlled AcDimension. </summary>
    /// <returns> AcDbDimension text. </returns>
    ///
    virtual AcString getEntityTextOverride() const;

    /// <summary> Sets the text property in the controlled AcDbDimension. </summary>
    /// <param  name="newText"> New text to set in the AcDbDimension.</param>
    /// <returns> Acad::eOk if successful. </returns>
    ///
    virtual Acad::ErrorStatus setEntityTextOverride(const AcString& newText);

    /// <summary> Gets the measurement from the controlled AcDbDimension. </summary>
    /// <returns> AcDbDimension measurement. </returns>
    ///
    virtual double getEntityMeasurementOverride() const;

    /// <summary> Returns true iff the attachment of the controlled AcDbDimension
    /// changed, such as the AcDbDimension has been repositioned. </summary>
    /// <returns> Returns true if attachment changed. </returns>
    ///
    virtual bool isEntityAttachmentChangedOverride() const;

    // Overridden method from the AcDbAssocDependencyBody base class

    /// <summary> Updates position, size and orientation of the controlled AcDbDimension.
    /// </summary>
    /// <returns> Acad::eOk if successful. </returns>
    ///
    virtual Acad::ErrorStatus updateDependentOnObjectOverride();

    /// <summary>
    /// "Pseudo constructor". Creates a new AcDbAssocDependency object owning 
    /// a new AcDbAssocDimDependencyBody object and makes the dependent-on object
    /// of the new dependency to be the provided AcDbDimension. Posts both objects 
    /// to the database of the AcDbDimension.
    /// </summary>
    /// <param name="dimId"> AcDbObjectId of the AcDbDimension. </param>
    /// <param name="dimDepId"> AcDbObjectId of the created AcDbAssocDependency. </param>
    /// <param name="dimDepBodyId"> AcDbObjectId of the created AcDbAssocDimDependencyBody. </param>
    /// <returns> Acad::eOk if successful. </returns>
    ///
    static Acad::ErrorStatus
                createAndPostToDatabase(const AcDbObjectId& dimId,
                                        AcDbObjectId&       dimDepId,
                                        AcDbObjectId&       dimDepBodyId);
};

