
#ifndef __EDGESYM_H
#define __EDGESYM_H
//
//  (C) Copyright 1993-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.
//

#ifndef __SYMBOL_H
#error Include "symbol.h" before including this file
#endif

class AmdtCEdge;
class AmdtCEdgeImp;
class AcmSymbolStd;

class DllImpExp AmdtEdgeStd : public AcmSymbolStd
{
  friend class AcmSymbbInternals;
  friend class AcmStandardImp;
  friend class AmdtEdgeStdImp;
public:
  ACRX_DECLARE_MEMBERS(AmdtEdgeStd);
  virtual ~AmdtEdgeStd();

  Adesk::Boolean majorityAllowed() const;
  void setMajorityAllowed(Adesk::Boolean val);

  Adesk::Boolean fullList() const;
  void setFullList(Adesk::Boolean v);

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

  virtual Acm::ErrorStatus checkVisibility(AmdtCEdge* pData) const;
  virtual Acm::ErrorStatus setSuggested(AmdtCEdge *pSubSym) const;

  virtual Acm::ErrorStatus initFields(AmdtCEdge *pSubSym) const;
  virtual Acm::ErrorStatus validityFields(AmdtCEdge *pSubSym,
                                          bool setBoundary = false,
                                          int dlgIndex = -1);

  virtual void getSubEnts(const AmdtCEdge* pSymb,
                          AcmCAuxEntArray& subents,
                          bool corrSymbOnRightSide = false) const;

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

  enum Variable {
    kBracketAllowed = 0,
    kFullList    
  };

  virtual Acm::Visibility variableStatus(AmdtEdgeStd::Variable var) const;
  virtual void setVariableStatus(AmdtEdgeStd::Variable var, Acm::Visibility status);

  virtual void getHeights(const AmdtCEdge*, AcGeDoubleArray&) const;
  
  Adesk::Boolean allAroundAllowed() const;
  void setAllAroundAllowed(Adesk::Boolean val);

  Adesk::Boolean stdNumAllowed() const;
  void setStdNumAllowed(Adesk::Boolean val);

  // get the suggested list
  virtual Acm::ErrorStatus getSuggestedList(CStringList& strList) const;

  // Add a new virtual method to AmdtEdgeStd that returns a bool flag to identify bitmap type to be used.
  // For DIN 6784 - 1982,the flag returns true,the icon will be updated to reflect the symbol representation for the revision.
  // Else the flag will return false.
  virtual bool isSymAboveLanding() const;

protected:
  AmdtEdgeStd();
  virtual void getMajoritySymbol(const AmdtCEdge* pSubSym,
                                 AcmCAuxEntArray& subents) const;
  virtual void getLeaderSymbol(const AmdtCEdge* pSubSym,
                               AcmCAuxEntArray& subents) const;
  
  virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;

private:
  AmdtEdgeStdImp* mpImp;
};
DBREF_DECLARE(AmdtEdgeStd)

class AmdtCEdge : public AcmCSubSymbol
{
public:
  virtual Adesk::Boolean isMajority() const = 0;
  virtual Acm::Direction leaderDirection(Acm::Direction singularity = Acm::kToTop, 
                                         AcGePoint3d peak = AcGePoint3d::kOrigin) const = 0;
  
  virtual Adesk::Boolean isAllAround() const = 0;
  virtual Acm::ErrorStatus setAllAround(Adesk::Boolean flag) = 0;
  virtual void setNewSymbolRev(Adesk::Boolean newRev = Adesk::kTrue) = 0;  
  virtual Adesk::Boolean newSymbolRev() const = 0;

  virtual Adesk::Boolean isStdNum() const = 0;
  virtual Acm::ErrorStatus setStdNum(Adesk::Boolean flag) = 0;
  //Undefined size
  virtual bool isUndefinedSize() const = 0;
  virtual Acm::ErrorStatus setUndefinedSize(bool flag) = 0;

  // Defined the direction of bur
  virtual bool isDefinedDirect() const = 0;
  virtual Acm::ErrorStatus setDefinedDirect(bool flag) = 0;  

  //undefined direction of burr
  virtual Acm::EdgeUndefinedDirection undefineDirection() const = 0;
  virtual Acm::ErrorStatus setUndefinedDirection(Acm::EdgeUndefinedDirection direct) = 0;
};

class DllImpExp AmdtEdge : public AcmSymbol  
{
friend class CLeaderPage;
public:
  ACRX_DECLARE_MEMBERS(AmdtEdge);

  AmdtEdge();
  virtual ~AmdtEdge();

  AmdtCEdge* 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);

  virtual Acm::ErrorStatus setSymbolDefaults(AcDbDatabase *pPropertiesDb = NULL);
  virtual AmdtCEdge* newSubEdge() const;

  Adesk::Boolean isMajority() const;
  Acm::ErrorStatus setMajority(const Adesk::Boolean);

  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* filer);
  virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* filer) const;
  virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* filer);
  virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* filer) const;

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

  Adesk::Boolean getAdditionalEnts(AcmCAuxEntArray& subents) const;
  virtual Acm::ErrorStatus removeLeader(Adesk::UInt16 index);
  
  Adesk::Boolean isAllAround() const;
  Acm::ErrorStatus setAllAround(Adesk::Boolean flag);

  virtual void setNewSymbolRev(Adesk::Boolean newRev = Adesk::kTrue);
  virtual Adesk::Boolean newSymbolRev() const;

  Adesk::Boolean isStdNum() const;
  Acm::ErrorStatus setStdNum(Adesk::Boolean flag);

  // Undefined size
  bool isUndefinedSize() const;
  Acm::ErrorStatus setUndefinedSize(bool flag);

  // Defined the direction of bur
  bool isDefinedDirect() const;
  Acm::ErrorStatus setDefinedDirect(bool flag);

  //Undefine size direction
  Acm::EdgeUndefinedDirection undefineDirection() const;
  Acm::ErrorStatus setUndefinedDirection(Acm::EdgeUndefinedDirection direct);

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

  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&,const AcGeVector3d&); 

  virtual Acad::ErrorStatus subExplode(AcDbVoidPtrArray& entitySet) const;
  virtual Acad::ErrorStatus subGetGeomExtents(AcDbExtents& extents) const;
  virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
  
  virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;

private:
  AmdtCEdgeImp *mpSubSymbol;
};
DBREF_DECLARE(AmdtEdge)

#endif // __EDGESYM_H
