
#ifndef __TAPERSYM_H
#define __TAPERSYM_H
//
//  (C) Copyright 2005-2008 by Autodesk, Inc.  All rights reserved.
//
// 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.
//

class AcmSymbolStd;
class AcmCTaper;
class AcmCTaperImp;
class AcmTaperStdImp;

class DllImpExp AcmTaperStd : public AcmSymbolStd
{
  friend class AcmSymbbInternals;
public:
  ACRX_DECLARE_MEMBERS(AcmTaperStd);

  virtual ~AcmTaperStd();

  void getOfferedSymbols(AcDbIntArray& array) const;

  void getDimensionType(Acm::TaperDimensionType& dimType, Acm::TaperRatioFormat& fract, ACHAR*& separator);
  void setDimensionType(const Acm::TaperDimensionType dimType, const Acm::TaperRatioFormat fract, const ACHAR* separator);

  virtual Adesk::Boolean setFactoryDefaults();
  virtual void setDefaultSubSymbol(AcmCTaper* pData) const;

  virtual Acm::ErrorStatus getDescription(CString& desc,
    CBitmap*& pBmpLoaded,
    CBitmap*& pBmpReg,
    Adesk::Boolean& enablePref) const;

  virtual Adesk::Boolean getSymbolList(AcmCObjArray<AcmCTaperSymbolDesc>& list,
    const AcmCTaper* pSubSym =NULL) const;

  virtual void getSubEnts(const AcmCTaper* pSymb,
    AcmCAuxEntArray& subents) const;

  virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* filer);
  virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* filer) const;
  
  virtual void setDefaultOfferedSymbols();
enum OfferedSymType
{
  kAllType,
  kTaperType,
  kSlopeType
};
  virtual void getDefaultOfferedSymbols(AcDbIntArray& symbols,const AcmTaperStd::OfferedSymType type = AcmTaperStd::kAllType) const;

protected:
  AcmTaperStd();

  virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;

  void setOfferedSymbols(const AcDbIntArray& array);
private:
  AcmTaperStdImp* mpImp;
};
MAKE_ACDBOPENOBJECT_FUNCTION(AcmTaperStd);
DBREF_DECLARE(AcmTaperStd)

class AcmCTaper : public AcmCSubSymbol
{
public:

  virtual double subSymAngle() const = 0;
  virtual Acm::ErrorStatus setSubSymAngle(double angle) = 0;

  virtual Acm::TaperType subType() const = 0;
  virtual Acm::ErrorStatus setSubType(Acm::TaperType type) = 0;

  virtual Acm::Orientation orientation() const = 0;
  virtual Acm::ErrorStatus setOrientation(Acm::Orientation dir) = 0;

  virtual Adesk::Boolean isInspect() const = 0;
  virtual Acm::ErrorStatus setInspect(Adesk::Boolean val) = 0;

  virtual Adesk::Boolean symAboveCurve() const = 0;
  virtual Acm::ErrorStatus setSymAboveCurve(const Adesk::Boolean lay) = 0;

  virtual Adesk::Boolean hasLeader() const = 0;
};

class DllImpExp AcmTaper: public AcmSymbol
{
public:
  ACRX_DECLARE_MEMBERS(AcmTaper);

  enum dragType {
    // type of dragging of grip required
    kDefault = 0,
    kAlongCurve,
    kTranslateOnly,
    kRotateOnly
  };

  AcmTaper();
  virtual ~AcmTaper();

  AcmCTaper* subSymbol() const;

  LPCTSTR value(Acm::Variable var) const;
  Acm::ErrorStatus setValue(Acm::Variable var, LPCTSTR value);

  Acm::Visibility  variableStatus(Acm::Variable var) const;
  Acm::ErrorStatus setVariableStatus(Acm::Variable var, Acm::Visibility status);

  Acm::ErrorStatus getVarDlgInfo(Acm::Variable var,CVarDlgInfo& v) const;
  Acm::ErrorStatus setVarDlgInfo(Acm::Variable var,const CVarDlgInfo& v);

  AcGeVector3d subSymbolNormal() const;

  double subSymAngle() const;
  Acm::ErrorStatus setSubSymAngle(double angle);

  Acm::TaperType subType() const;
  Acm::ErrorStatus setSubType(Acm::TaperType flag);

  Acm::Orientation orientation() const;
  Acm::ErrorStatus setOrientation(Acm::Orientation type);

  Adesk::Boolean isInspect() const;
  Acm::ErrorStatus setInspect(Adesk::Boolean val);

  Adesk::Boolean symAboveCurve() const;
  Acm::ErrorStatus setSymAboveCurve(Adesk::Boolean val);
  Acm::ErrorStatus adjustRefline(double angle);

  virtual Acad::ErrorStatus autoAdjust();
  virtual Acm::ErrorStatus setSymbolDefaults(AcDbDatabase* pDb = NULL);
  virtual void setOrigin(const AcGePoint3d &origin);

  virtual Acm::ErrorStatus addLeader(const AcGePoint3dArray &ptrArray);
  virtual Acm::ErrorStatus removeLeader(Adesk::UInt16 index);

  virtual void regen();

  virtual void leaderTipPointChanged(const AcGeVector3d& offset,
    const AcmCLeader* leader);

  using AcmSymbol::transformBy;
  virtual Acad::ErrorStatus transformBy(const AcGeMatrix3d& xform,
                                        double symbolScale); 

  virtual void mirrorCoordSys(const AcGeMatrix3d& xMirrorForm,
                              AcGeVector3d& XAxis,
                              AcGeVector3d& YAxis,
                              AcGeVector3d& normal) const;

  virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler*);
  virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
  virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler*);
  virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;

  // This method makes a copy of the database resident symbol
  // to be used for jigging.
  virtual Adesk::Boolean copyTaperSymProp(const AcmTaper* pSrcSym);

  Acm::TaperSlopeSymType subSymType() const;
  Acm::ErrorStatus setSubSymType(Acm::TaperSlopeSymType flag);

protected:
  virtual Adesk::Boolean    subWorldDraw(AcGiWorldDraw*);

  virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray&,
    AcDbIntArray&,
    AcDbIntArray&) const;

  virtual Acad::ErrorStatus   subGetGripPoints(AcDbGripDataPtrArray& grips,
    const double curViewUnitSize, 
    const int gripSize, 
    const AcGeVector3d& curViewDir,
    const int bitflags) const;

  virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
    const AcGeVector3d& offset); 

  virtual Acad::ErrorStatus subExplode(AcDbVoidPtrArray& entitySet) const;
  virtual Acad::ErrorStatus subGetGeomExtents(AcDbExtents&) const;
  virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform); 

  virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;

private:
  double getRefLineLength(bool ignoreFixedLen = false) const;

  AcmCTaperImp *mpSubSymbol;
}
MAKE_ACDBOPENOBJECT_FUNCTION(AcmTaper);
DBREF_DECLARE(AcmTaper)

#endif // __TAPERSYM_H