HDrawingObject.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /***********************************************************
  2. * File generated by the HALCON-Compiler hcomp version 20.11
  3. * Usage: Interface to C++
  4. *
  5. * Software by: MVTec Software GmbH, www.mvtec.com
  6. ***********************************************************/
  7. #ifndef HCPP_HDRAWINGOBJECT
  8. #define HCPP_HDRAWINGOBJECT
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a drawing object.
  12. class LIntExport HDrawingObject : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HDrawingObject():HHandle() {}
  17. // Copy constructor
  18. HDrawingObject(const HDrawingObject& source) : HHandle(source) {}
  19. // Copy constructor
  20. HDrawingObject(const HHandle& handle);
  21. // Create HDrawingObject from handle, taking ownership
  22. explicit HDrawingObject(Hlong handle);
  23. bool operator==(const HHandle& obj) const
  24. {
  25. return HHandleBase::operator==(obj);
  26. }
  27. bool operator!=(const HHandle& obj) const
  28. {
  29. return HHandleBase::operator!=(obj);
  30. }
  31. protected:
  32. // Verify matching semantic type ('drawing_object')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // create_drawing_object_circle: Create a circle which can be modified interactively.
  39. explicit HDrawingObject(double Row, double Column, double Radius);
  40. // create_drawing_object_rectangle2: Create a rectangle of any orientation which can be modified interactively.
  41. explicit HDrawingObject(double Row, double Column, double Phi, double Length1, double Length2);
  42. // create_drawing_object_rectangle1: Create a rectangle parallel to the coordinate axis which can be modified interactively.
  43. explicit HDrawingObject(double Row1, double Column1, double Row2, double Column2);
  44. /***************************************************************************
  45. * Operators *
  46. ***************************************************************************/
  47. // Add a callback function to a drawing object.
  48. void SetDrawingObjectCallback(const HTuple& DrawObjectEvent, const HTuple& CallbackFunction) const;
  49. // Add a callback function to a drawing object.
  50. void SetDrawingObjectCallback(const HString& DrawObjectEvent, void* CallbackFunction) const;
  51. // Add a callback function to a drawing object.
  52. void SetDrawingObjectCallback(const char* DrawObjectEvent, void* CallbackFunction) const;
  53. #ifdef _WIN32
  54. // Add a callback function to a drawing object.
  55. void SetDrawingObjectCallback(const wchar_t* DrawObjectEvent, void* CallbackFunction) const;
  56. #endif
  57. // Detach the background image from a HALCON window.
  58. static void DetachBackgroundFromWindow(const HWindow& WindowHandle);
  59. // Attach a background image to a HALCON window.
  60. static void AttachBackgroundToWindow(const HImage& Image, const HWindow& WindowHandle);
  61. // Create a text object which can be moved interactively.
  62. void CreateDrawingObjectText(Hlong Row, Hlong Column, const HString& String);
  63. // Create a text object which can be moved interactively.
  64. void CreateDrawingObjectText(Hlong Row, Hlong Column, const char* String);
  65. #ifdef _WIN32
  66. // Create a text object which can be moved interactively.
  67. void CreateDrawingObjectText(Hlong Row, Hlong Column, const wchar_t* String);
  68. #endif
  69. // Return the iconic object of a drawing object.
  70. HObject GetDrawingObjectIconic() const;
  71. // Delete drawing object.
  72. void ClearDrawingObject() const;
  73. // Set the parameters of a drawing object.
  74. void SetDrawingObjectParams(const HTuple& GenParamName, const HTuple& GenParamValue) const;
  75. // Set the parameters of a drawing object.
  76. void SetDrawingObjectParams(const HString& GenParamName, double GenParamValue) const;
  77. // Set the parameters of a drawing object.
  78. void SetDrawingObjectParams(const char* GenParamName, double GenParamValue) const;
  79. #ifdef _WIN32
  80. // Set the parameters of a drawing object.
  81. void SetDrawingObjectParams(const wchar_t* GenParamName, double GenParamValue) const;
  82. #endif
  83. // Get the parameters of a drawing object.
  84. HTuple GetDrawingObjectParams(const HTuple& GenParamName) const;
  85. // Get the parameters of a drawing object.
  86. HTuple GetDrawingObjectParams(const HString& GenParamName) const;
  87. // Get the parameters of a drawing object.
  88. HTuple GetDrawingObjectParams(const char* GenParamName) const;
  89. #ifdef _WIN32
  90. // Get the parameters of a drawing object.
  91. HTuple GetDrawingObjectParams(const wchar_t* GenParamName) const;
  92. #endif
  93. // Set the contour of an interactive draw XLD.
  94. void SetDrawingObjectXld(const HXLDCont& Contour) const;
  95. // Create a XLD contour which can be modified interactively.
  96. void CreateDrawingObjectXld(const HTuple& Row, const HTuple& Column);
  97. // Create a circle sector which can be modified interactively.
  98. void CreateDrawingObjectCircleSector(double Row, double Column, double Radius, double StartAngle, double EndAngle);
  99. // Create an elliptic sector which can be modified interactively.
  100. void CreateDrawingObjectEllipseSector(double Row, double Column, double Phi, double Radius1, double Radius2, double StartAngle, double EndAngle);
  101. // Create a line which can be modified interactively.
  102. void CreateDrawingObjectLine(double Row1, double Column1, double Row2, double Column2);
  103. // Create a circle which can be modified interactively.
  104. void CreateDrawingObjectCircle(double Row, double Column, double Radius);
  105. // Create an ellipse which can be modified interactively.
  106. void CreateDrawingObjectEllipse(double Row, double Column, double Phi, double Radius1, double Radius2);
  107. // Create a rectangle of any orientation which can be modified interactively.
  108. void CreateDrawingObjectRectangle2(double Row, double Column, double Phi, double Length1, double Length2);
  109. // Create a rectangle parallel to the coordinate axis which can be modified interactively.
  110. void CreateDrawingObjectRectangle1(double Row1, double Column1, double Row2, double Column2);
  111. // Send an event to a buffer window signaling a mouse double click event.
  112. static HString SendMouseDoubleClickEvent(const HWindow& WindowHandle, const HTuple& Row, const HTuple& Column, Hlong Button);
  113. // Send an event to a buffer window signaling a mouse double click event.
  114. static HString SendMouseDoubleClickEvent(const HWindow& WindowHandle, Hlong Row, Hlong Column, Hlong Button);
  115. // Send an event to a window buffer signaling a mouse down event.
  116. static HString SendMouseDownEvent(const HWindow& WindowHandle, const HTuple& Row, const HTuple& Column, Hlong Button);
  117. // Send an event to a window buffer signaling a mouse down event.
  118. static HString SendMouseDownEvent(const HWindow& WindowHandle, Hlong Row, Hlong Column, Hlong Button);
  119. // Send an event to a buffer window signaling a mouse drag event.
  120. static HString SendMouseDragEvent(const HWindow& WindowHandle, const HTuple& Row, const HTuple& Column, Hlong Button);
  121. // Send an event to a buffer window signaling a mouse drag event.
  122. static HString SendMouseDragEvent(const HWindow& WindowHandle, Hlong Row, Hlong Column, Hlong Button);
  123. // Send an event to a buffer window signaling a mouse up event.
  124. static HString SendMouseUpEvent(const HWindow& WindowHandle, const HTuple& Row, const HTuple& Column, Hlong Button);
  125. // Send an event to a buffer window signaling a mouse up event.
  126. static HString SendMouseUpEvent(const HWindow& WindowHandle, Hlong Row, Hlong Column, Hlong Button);
  127. };
  128. // forward declarations and types for internal array implementation
  129. template<class T> class HSmartPtr;
  130. template<class T> class HHandleBaseArrayRef;
  131. typedef HHandleBaseArrayRef<HDrawingObject> HDrawingObjectArrayRef;
  132. typedef HSmartPtr< HDrawingObjectArrayRef > HDrawingObjectArrayPtr;
  133. // Represents multiple tool instances
  134. class LIntExport HDrawingObjectArray : public HHandleBaseArray
  135. {
  136. public:
  137. // Create empty array
  138. HDrawingObjectArray();
  139. // Create array from native array of tool instances
  140. HDrawingObjectArray(HDrawingObject* classes, Hlong length);
  141. // Copy constructor
  142. HDrawingObjectArray(const HDrawingObjectArray &tool_array);
  143. // Destructor
  144. virtual ~HDrawingObjectArray();
  145. // Assignment operator
  146. HDrawingObjectArray &operator=(const HDrawingObjectArray &tool_array);
  147. // Clears array and all tool instances
  148. virtual void Clear();
  149. // Get array of native tool instances
  150. const HDrawingObject* Tools() const;
  151. // Get number of tools
  152. virtual Hlong Length() const;
  153. // Create tool array from tuple of handles
  154. virtual void SetFromTuple(const HTuple& handles);
  155. // Get tuple of handles for tool array
  156. virtual HTuple ConvertToTuple() const;
  157. protected:
  158. // Smart pointer to internal data container
  159. HDrawingObjectArrayPtr *mArrayPtr;
  160. };
  161. }
  162. #endif