//////////////////////////////////////////////////////////////////////////////
//
//  Copyright 2025 Autodesk, Inc.  All rights reserved.
//
//  Use of this software is subject to the terms of the Autodesk license 
//  agreement provided at the time of installation or download, or which 
//  otherwise accompanies this software in either electronic or hard copy form.   
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#if AMGUTIL_CRX_BUILD
#define AMGUTIL_CRX_DLLSHARE __declspec(dllexport)
#else
#define AMGUTIL_CRX_DLLSHARE 
#endif

class GenPmScaleArea;
///<summary>This class provides the functions to edit the scale area.</summary>
class AMGUTIL_CRX_DLLSHARE AcMgScaleArea
{
  friend class AcMgScaleAreaMgr;

public:
  ///<summary>The enumerations of the AcMgScaleArea class are listed here.</summary>
  enum ScaleType
  {
    ///<summary>Defined for text scaling. </summary>
    kScalePf = 2,                 //scale was defined to be text scaling
  ///<summary>Defined for length scaling. </summary>
    kScaleDf = 4,                 //scale was defined to be length scaling
  };
  virtual ~AcMgScaleArea();

  ///<summary>Gets the object id of the defining object, which is the closed curve for the border.</summary>
  const AcDbObjectId& getAttachId() const;

  ///<summary>Returns the text scaling factor of the scale area.</summary>
  double textScalingFactor() const;

  ///<summary>Sets the text scaling factor of the scale area.</summary>
  ///<param name="pf">New scale factor. </param>
  bool setTextScalingFactor(double pf);

  ///<summary>Returns the drawing scalelength scaling factor of the scale area.</summary>
  double lengthScalingFactor() const;

  ///<summary>Sets the drawing scalelength scaling factor of the scale area.</summary>
  ///<param name="df">New length scaling factor. </param>
  bool setLengthScalingFactor(double df);     

  ///<summary>Returns the scale type of the scale area.</summary>
  ScaleType scaleType() const;

  ///<summary>Sets the type of scale to be text scaling or length scaling.</summary>
  bool setScaleType(ScaleType type);        
  
  ///<summary>Sets text scaling factor as the model scale.</summary>
  bool setBasicScale();

  ///<summary>Performs rescaling of specified objects.</summary>
  ///<param name="objIds">Array of objectd ids to be rescaled. </param>
  bool rescaleObjects(AcDbObjectIdArray& objIds);

  ///<summary>Creates viewport on specified layout.</summary>
  ///<param name="layoutName ">Name of the layout</param>
  ///<param name="viewPosition ">Position to place the viewport in the layout. </param>
  bool createViewPort(const ACHAR* layoutName, AcGePoint3d viewPosition);

  ///<summary>Delete viewport for the scale area.</summary>
  bool deleteViewPort();

  ///<summary>Moves the border of the scale area.</summary>
  ///<param name="pTarget ">Target position in WCS coordinates. </param>
  bool moveBorder(AcGePoint3d* pTarget);

  ///<summary>Gets object ids of all viewports that are attached to the scale area.</summary>
  ///<param name="viewportIds">Return array of viewport Ids. </param>
  bool getAttachedViewportIds(AcDbObjectIdArray& viewportIds);

private:
  AcMgScaleArea();

  void setImp(GenPmScaleArea* pSDF);

private:
  GenPmScaleArea* m_pSDF;
};