dbwipe.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. //
  2. //
  3. //////////////////////////////////////////////////////////////////////////////
  4. //
  5. // Copyright 2015 Autodesk, Inc. All rights reserved.
  6. //
  7. // Use of this software is subject to the terms of the Autodesk license
  8. // agreement provided at the time of installation or download, or which
  9. // otherwise accompanies this software in either electronic or hard copy form.
  10. //
  11. //////////////////////////////////////////////////////////////////////////////
  12. //
  13. #ifndef __DBWIPE_H__
  14. #define __DBWIPE_H__
  15. #ifdef _DBWIPEOBJ_
  16. #define DLLIMPEXP __declspec(dllexport)
  17. #else
  18. #define DLLIMPEXP
  19. #endif
  20. #include "windows.h"
  21. #include "imgdef.h"
  22. #include "imgent.h"
  23. namespace Atil
  24. {
  25. class Image;
  26. };
  27. #define WIPEOUTOBJSERVICE /*NOXLATE*/ACRX_T("WipeOut")
  28. /////////////////////////////////////////////////////////////////////////////
  29. // AcDbWipeout class
  30. //
  31. #pragma warning(push)
  32. #pragma warning( disable : 4275 )
  33. class DLLIMPEXP AcDbWipeout : public AcDbRasterImage
  34. {
  35. public:
  36. ACRX_DECLARE_MEMBERS(AcDbWipeout);
  37. AcDbWipeout();
  38. // AcDbEntity overrides
  39. //
  40. virtual AcRxObject* clone() const;
  41. // AcDbRasterImage overwritten methods.
  42. virtual AcGeVector2d imageSize(Adesk::Boolean bGetCachedValue = Adesk::kFalse) const;
  43. AcGiSentScanLines* getScanLines(const AcGiRequestScanLines& req) const;
  44. Adesk::Boolean isClipped() const;
  45. virtual void setDisplayOpt(
  46. ImageDisplayOpt option,
  47. Adesk::Boolean bValue
  48. );
  49. virtual Adesk::Boolean isSetDisplayOpt(ImageDisplayOpt option) const;
  50. virtual Acad::ErrorStatus setBrightness( Adesk::Int8 value );
  51. virtual Adesk::Int8 brightness() const;
  52. virtual Acad::ErrorStatus setContrast( Adesk::Int8 value );
  53. virtual Adesk::Int8 contrast() const;
  54. virtual Acad::ErrorStatus setFade( Adesk::Int8 value );
  55. virtual Adesk::Int8 fade() const;
  56. virtual AcGeVector2d scale() const;
  57. // Wipeout specific functions
  58. Acad::ErrorStatus append(AcDbObjectId& id);
  59. static Acad::ErrorStatus createImageDefinition();
  60. static Acad::ErrorStatus fitPointsToImage(
  61. AcGePoint2dArray& pointArray,
  62. AcGePoint2d& minPoint,
  63. double& scale,
  64. Adesk::Boolean bFlipY = Adesk::kFalse);
  65. Adesk::Boolean frame() const;
  66. protected:
  67. virtual Adesk::Boolean subWorldDraw(AcGiWorldDraw* mode);
  68. virtual void subViewportDraw(AcGiViewportDraw* mode);
  69. virtual void subList() const;
  70. virtual Acad::ErrorStatus subMoveGripPointsAt(
  71. const AcDbVoidPtrArray& gripAppData,
  72. const AcGeVector3d& offset,
  73. const int bitflags);
  74. virtual Acad::ErrorStatus subMoveGripPointsAt(
  75. const AcDbIntArray& indices,
  76. const AcGeVector3d& offset);
  77. virtual Acad::ErrorStatus subTransformBy(
  78. const AcGeMatrix3d& xform);
  79. virtual Acad::ErrorStatus subGetTransformedCopy(
  80. const AcGeMatrix3d& xform,
  81. AcDbEntity*& ent
  82. ) const;
  83. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
  84. virtual Adesk::UInt32 subSetAttributes (AcGiDrawableTraits * traits) ADESK_OVERRIDE;
  85. private:
  86. Adesk::Boolean isHighlighted() const;
  87. void getPlane(AcGeBoundedPlane& boundedPlane) const;
  88. AcGeMatrix2d fastMatrixInvert(const AcGeMatrix2d& m) const;
  89. void drawFrame(
  90. AcGiViewportDraw* mode,
  91. const AcGePoint3dArray& verts) const;
  92. Acad::ErrorStatus setDcToScreen(
  93. const AcGePoint2d& lowerLeft,
  94. const AcGePoint2d& upperRight,
  95. int width,
  96. int height,
  97. AcGeMatrix2d& dcToScreen) const;
  98. void setFrameExtents(
  99. AcGiWorldDraw* mode,
  100. const AcGePoint3dArray& verts) const;
  101. bool drawFilledPloygon( AcGiViewportDraw* mode,
  102. const AcGePoint3dArray& verts) const;
  103. bool IsSelfIntersecting( const AcGePoint3dArray& verts) const;
  104. Adesk::Boolean isFrameVisible(Adesk::Boolean bPlotting = Adesk::kFalse) const;
  105. public:
  106. static long mImageData;
  107. private:
  108. Adesk::Boolean mHighlight;
  109. // These are here because otherwise dllexport tries to export the
  110. // private methods of AcDbObject. They're private in AcDbObject
  111. // because vc5 does not properly support array new and delete.
  112. // It tends to call the wrong delete operator and to not call
  113. // the dtors on all elements in the array. So we make them
  114. // private in order to prevent usage of them.
  115. //
  116. #ifdef MEM_DEBUG
  117. #undef new
  118. #undef delete
  119. #endif
  120. void *operator new[](size_t nSize) throw() { return 0;}
  121. void operator delete[](void *p) {};
  122. void *operator new[](size_t nSize, const char *file, int line) throw() { return 0;}
  123. #ifdef MEM_DEBUG
  124. #define new DEBUG_NEW
  125. #define delete DEBUG_DELETE
  126. #endif
  127. };
  128. #pragma warning(pop)
  129. #endif //__DBWIPE_H__