AcDbGeoMap.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #pragma once
  11. #include "dbents.h"
  12. #include "imgvars.h"
  13. #include "imgent.h"
  14. #include "AcDbGeoTypes.h"
  15. #pragma pack (push, 8)
  16. #pragma warning(push)
  17. #pragma warning(disable : 4275) // warning C4275: non dll-interface class 'AcDbRasterImage' used as base for dll-interface class 'AcDbGeoMap'
  18. class GeoMapImp;
  19. #ifdef ACGEOLOCATIONOBJ_API
  20. # define ACGEOLOCATIONOBJ_PORT __declspec(dllexport)
  21. #else
  22. # define ACGEOLOCATIONOBJ_PORT
  23. #endif
  24. /// <summary>
  25. /// the AcDbGeoMap class represents an embedded raster image which is captured from a portion of LiveMap
  26. /// </summary>
  27. ///
  28. class ACGEOLOCATIONOBJ_PORT AcDbGeoMap : public AcDbRasterImage
  29. {
  30. public:
  31. ACRX_DECLARE_MEMBERS(AcDbGeoMap);
  32. /// <summary> Default constructor. For internal use only. </summary>
  33. ///
  34. AcDbGeoMap();
  35. AcDbGeoMap(AcGeoMapType mapType, AcGeoMapResolution resolution, unsigned int levelOfDetail);
  36. AcDbGeoMap(AcDbObjectId viewportId, bool isViewportSpecific);
  37. /// <summary> Destructor. </summary>
  38. ///
  39. virtual ~AcDbGeoMap();
  40. public:
  41. // AcDbGeoMap protocol
  42. /// <summary> Returns the bottom left corner point of the image frame. </summary>
  43. ///
  44. AcGePoint3d bottomLeftPt() const;
  45. /// <summary> Returns the height of the image frame. </summary>
  46. ///
  47. double height() const;
  48. /// <summary> Returns the width of the image frame. </summary>
  49. ///
  50. double width() const;
  51. /// <summary> Returns the bottom left corner of the embeded image. </summary>
  52. ///
  53. AcGePoint3d imageBottomLeftPt() const;
  54. /// <summary> Returns the height of the embeded image. </summary>
  55. ///
  56. double imageHeight() const;
  57. /// <summary> Returns the width of the embeded image. </summary>
  58. ///
  59. double imageWidth() const;
  60. /// <summary>
  61. /// The resolution of the image that apply on top of LOD.
  62. /// </summary>
  63. ///
  64. /// <returns> Returns the current resolution of the map image, an enumerated value. </returns>
  65. ///
  66. AcGeoMapResolution resolution() const;
  67. /// <summary>
  68. /// Sets the resolution for this map image.
  69. /// </summary>
  70. ///
  71. /// <param name="resolution">
  72. /// An enumerated value as resolution
  73. /// </param>
  74. ///
  75. /// <returns> Returns Acad::eOk if a valid resolution is passed in. </returns>
  76. ///
  77. Acad::ErrorStatus setResolution(AcGeoMapResolution resolution);
  78. /// <summary>
  79. /// Map Level Of Details (Zoom level) at the point of captured. Update will reset this value.
  80. /// </summary>
  81. ///
  82. /// <returns> Returns an unsigned integer number for the level of details. </returns>
  83. ///
  84. unsigned int LOD() const; //
  85. /// <summary> The map type of the map image. </summary>
  86. ///
  87. ///
  88. /// <returns> Returns the current map type of the map image, an enumerated value. </returns>
  89. ///
  90. AcGeoMapType mapType() const;
  91. /// <summary>
  92. /// Sets the map type for this map image.
  93. /// </summary>
  94. ///
  95. /// <param name="mapType">
  96. /// An enumerated value as map type
  97. /// </param>
  98. ///
  99. /// <returns> Returns Acad::eOk if a valid map type is passed in. </returns>
  100. ///
  101. Acad::ErrorStatus setMapType(AcGeoMapType mapType);
  102. /// <summary>
  103. /// A flag to indicate whether the image is up to date.
  104. /// </summary>
  105. ///
  106. /// <returns> Returns true if the last update failed. </returns>
  107. ///
  108. ///
  109. Adesk::Boolean isOutOfDate() const;
  110. /// <summary>
  111. /// Update the embeded image by re-capturing the live map
  112. /// Returns true if the last update failed
  113. /// </summary>
  114. ///
  115. /// <param name="bReset">
  116. /// Input Boolean to indicate whether to recapture the image in optimal resolution to the screen.
  117. /// If true, the LOD will be recalculated and resolution will be reset to optimal
  118. /// </param>
  119. /// <returns>Returns true if successful.</returns>
  120. ///
  121. Adesk::Boolean updateMapImage(Adesk::Boolean bReset = Adesk::kFalse);
  122. // AcDbObject protocol
  123. Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler) override;
  124. Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const override;
  125. Acad::ErrorStatus dxfInFields(AcDbDxfFiler* pFiler) override;
  126. Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const override;
  127. Acad::ErrorStatus subErase(Adesk::Boolean erasing) override;
  128. virtual Acad::ErrorStatus applyPartialUndo(
  129. AcDbDwgFiler* undoFiler,
  130. AcRxClass* classObj
  131. ) override;
  132. // AcDbEntity protocol
  133. Acad::ErrorStatus subGetOsnapPoints(
  134. AcDb::OsnapMode osnapMode,
  135. INT_PTR gsSelectionMark,
  136. const AcGePoint3d& pickPoint,
  137. const AcGePoint3d& lastPoint,
  138. const AcGeMatrix3d& viewXform,
  139. AcGePoint3dArray& snapPoints,
  140. AcDbIntArray& geomIds
  141. ) const override;
  142. Acad::ErrorStatus subGetGripPoints(
  143. AcDbGripDataPtrArray& grips,
  144. const double curViewUnitSize,
  145. const int gripSize,
  146. const AcGeVector3d& curViewDir,
  147. const int bitflags
  148. ) const override;
  149. Acad::ErrorStatus subGetGripPoints(
  150. AcGePoint3dArray& gripPoints,
  151. AcDbIntArray& osnapModes,
  152. AcDbIntArray& geomIds
  153. ) const override;
  154. Acad::ErrorStatus subMoveGripPointsAt(
  155. const AcDbVoidPtrArray& gripAppData,
  156. const AcGeVector3d& offset,
  157. const int bitflags
  158. ) override;
  159. Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform) override;
  160. Acad::ErrorStatus subIntersectWith(
  161. const AcDbEntity* ent,
  162. AcDb::Intersect intType,
  163. AcGePoint3dArray& points,
  164. Adesk::GsMarker thisGsMarker = 0,
  165. Adesk::GsMarker otherGsMarker = 0
  166. ) const override;
  167. Acad::ErrorStatus subMoveGripPointsAt(
  168. const AcDbIntArray & indices,
  169. const AcGeVector3d& offset
  170. ) override;
  171. Acad::ErrorStatus subIntersectWith(
  172. const AcDbEntity* ent,
  173. AcDb::Intersect intType,
  174. const AcGePlane& projPlane,
  175. AcGePoint3dArray& points,
  176. Adesk::GsMarker thisGsMarker = 0,
  177. Adesk::GsMarker otherGsMarker = 0
  178. ) const override;
  179. // AcDbImage protocol
  180. AcGiSentScanLines* getScanLines(const AcGiRequestScanLines& req) const override;
  181. Adesk::Boolean freeScanLines(AcGiSentScanLines* pSSL) const override;
  182. // AcDbRasterImage protocol
  183. AcDbObjectId imageDefId() const override;
  184. /// <summary>
  185. /// Given an empty array, this function adds the image frame vertices to represent the four corners of the image.
  186. /// </summary>
  187. ///
  188. /// <param name="verts"> Returns a 3D point array of 4 corners </param>
  189. ///
  190. Acad::ErrorStatus getVertices(AcGePoint3dArray& verts) const override;
  191. // bGetCachedValue is required by override but has no effect
  192. AcGeVector2d imageSize(Adesk::Boolean bGetCachedValue = Adesk::kFalse) const override;
  193. const AcGePoint2dArray& clipBoundary() const override;
  194. /// <summary>
  195. /// Given an empty array, this function adds the embeded image vertices to represent the four corners of the image.
  196. /// </summary>
  197. ///
  198. /// <param name="verts"> Returns a 3D point array of 4 corners </param>
  199. ///
  200. Acad::ErrorStatus getImageVertices(AcGePoint3dArray& verts) const;
  201. Acad::ErrorStatus setBrightness( Adesk::Int8 value ) override;
  202. /// <summary> Returns the current brightness value of the image. </summary>
  203. ///
  204. Adesk::Int8 brightness() const override;
  205. Acad::ErrorStatus setContrast( Adesk::Int8 value ) override;
  206. /// <summary> Returns the current contrast value of the image. </summary>
  207. ///
  208. Adesk::Int8 contrast() const override;
  209. Acad::ErrorStatus setFade( Adesk::Int8 value ) override;
  210. /// <summary> Returns the current fade value of the image. </summary>
  211. ///
  212. Adesk::Int8 fade() const override;
  213. void getOrientation(
  214. AcGePoint3d& origin,
  215. AcGeVector3d& u,
  216. AcGeVector3d& v
  217. ) const override;
  218. protected:
  219. // AcDbObject protocol
  220. Adesk::UInt32 subSetAttributes(AcGiDrawableTraits* pTraits) override;
  221. Adesk::Boolean subWorldDraw(AcGiWorldDraw* pWorldDraw) override;
  222. void subViewportDraw(AcGiViewportDraw* pViewportDraw) override;
  223. virtual void subList() const override;
  224. // AcDbEntity protocol
  225. Acad::ErrorStatus subGetGeomExtents(AcDbExtents& extents) const override;
  226. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const override;
  227. private:
  228. GeoMapImp* m_pImp;
  229. friend class AcDbGeoMapSystemInternals;
  230. // These are here because otherwise dllexport tries to export the
  231. // private methods of AcDbRasterImage.
  232. // error C2248: 'AcDbRasterImage::operator delete[]' : cannot access private member declared in class 'AcDbRasterImage'
  233. #ifdef MEM_DEBUG
  234. #undef new
  235. #undef delete
  236. #endif
  237. void *operator new[](size_t nSize) { return (void*)0;}
  238. void operator delete[](void *p) {};
  239. void *operator new[](size_t nSize, const char *file, int line) { return (void*)0;}
  240. #ifdef MEM_DEBUG
  241. #define new DEBUG_NEW
  242. #define delete DEBUG_DELETE
  243. #endif
  244. #ifdef _ADESK_MAC_
  245. private:
  246. typedef AcDbRasterImage __super;
  247. #endif
  248. };
  249. #pragma warning(pop)
  250. #pragma pack (pop)