sprk_ops.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 #ifndef SPRK_STD_OPERATORS_H
11 #define SPRK_STD_OPERATORS_H
12 #include "sprk.h"
13 
14 #include <list>
15 #include <stack>
16 #include <unordered_map>
17 #include <set>
18 #include <mutex>
19 
20 namespace std
21 {
22  template<>
23  struct hash<HPS::RGBColor>
24  {
25  size_t operator()(HPS::RGBColor const & x) const
26  {
27  return (
28  (51 + std::hash<float>()(x.red)) * 51 + std::hash<float>()(x.green) * 51 + std::hash<float>()(x.blue));
29  }
30  };
31 }
32 
33 #ifdef _MSC_VER
34 #ifndef STATIC_APP
35 # ifdef SPRK_OPS
36 # define SPRK_OPS_API __declspec (dllexport)
37 # else
38 # define SPRK_OPS_API __declspec (dllimport)
39 # endif
40 #endif
41 #else
42 # include <stddef.h>
43 # if defined(LINUX_SYSTEM) && defined(SPRK_OPS)
44 # ifndef STATIC_APP
45 # define SPRK_OPS_API __attribute__ ((visibility ("default")))
46 # endif
47 # endif
48 #endif
49 
50 #ifndef SPRK_OPS_API
51 # define SPRK_OPS_API
52 #endif
53 
54 
55 namespace HPS
56 {
57 
69 class SPRK_OPS_API PanOrbitZoomOperator : public Operator
70 {
71 public:
72  PanOrbitZoomOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
74  virtual HPS::UTF8 GetName() const { return "HPS_PanOrbitZoomOperator"; }
75 
80  virtual bool OnMouseDown(MouseState const & in_state);
85  virtual bool OnMouseUp(MouseState const & in_state);
90  virtual bool OnMouseMove(MouseState const & in_state);
91 
96  virtual bool OnTouchDown(TouchState const & in_state);
101  virtual bool OnTouchUp(TouchState const & in_state);
106  virtual bool OnTouchMove(TouchState const & in_state);
107 
108 private:
109  HPS::WorldPoint start;
110 
111  HPS::WindowPoint start_point, new_point;
112  HPS::Vector start_sphere_pos, new_sphere_pos;
113 
114  bool operator_active;
115  float zoom_limit;
116  float focal_length;
117  HPS::WindowPoint last_zoom;
118  HPS::Vector last_relative;
119  float zoom_start_field_width;
120  float zoom_start_field_height;
121  HPS::Vector zoom_start_camera_look;
122  size_t current_touches;
123 
124  void ZoomStart();
125  void UpdateZoom(float zoom_factor);
126  void UpdateZoomLimit();
127  void UpdatePan(HPS::WorldPoint const & newLocation);
128  void UpdateRoll(HPS::Vector const & relative);
129 };
130 
138 class SPRK_OPS_API PanOperator : public Operator
139 {
140 public:
141  PanOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
143  virtual HPS::UTF8 GetName() const { return "HPS_PanOperator"; }
144 
149  virtual bool OnMouseDown(MouseState const & in_state);
154  virtual bool OnMouseUp(MouseState const & in_state);
159  virtual bool OnMouseMove(MouseState const & in_state);
160 
165  virtual bool OnTouchDown(TouchState const & in_state);
170  virtual bool OnTouchUp(TouchState const & in_state);
175  virtual bool OnTouchMove(TouchState const & in_state);
176 
177 private:
178  bool PanCommon(HPS::WindowPoint const & in_loc, HPS::KeyPath const & in_key_path);
179 
180  bool operator_active;
181  HPS::TouchID tracked_touch_ID;
182  HPS::WorldPoint start;
183 };
184 
192 class SPRK_OPS_API OrbitOperator : public Operator
193 {
194 public:
195  OrbitOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
197  virtual HPS::UTF8 GetName() const { return "HPS_OrbitOperator"; }
198 
203  virtual bool OnMouseDown(MouseState const & in_state);
208  virtual bool OnMouseUp(MouseState const & in_state);
213  virtual bool OnMouseMove(MouseState const & in_state);
214 
219  virtual bool OnTouchDown(TouchState const & in_state);
224  virtual bool OnTouchUp(TouchState const & in_state);
229  virtual bool OnTouchMove(TouchState const & in_state);
230 
231 private:
232  bool OrbitCommon(HPS::WindowPoint const & in_loc);
233 
234  bool operator_active;
235  HPS::TouchID tracked_touch_ID;
236  HPS::WindowPoint start_point, new_point;
237  HPS::Vector start_sphere_pos, new_sphere_pos;
238 };
239 
240 
241 class SPRK_OPS_API RelativeOrbitOperator : public Operator
242 {
243 
244 public:
251  RelativeOrbitOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonMiddle(), ModifierKeys in_modifier_trigger = ModifierKeys());
252  virtual HPS::UTF8 GetName() const { return "HPS_RelativeOrbitOperator"; }
253 
254  virtual bool OnMouseDown(MouseState const & in_state);
255  virtual bool OnMouseUp(MouseState const & in_state);
256  virtual bool OnMouseMove(MouseState const & in_state);
257 
258  virtual bool OnTouchDown(TouchState const & in_state);
259  virtual bool OnTouchUp(TouchState const & in_state);
260  virtual bool OnTouchMove(TouchState const & in_state);
261 
262  bool ShowCenterOfRotation(HPS::Point & out_point) const;
263 
264 private:
265  bool OrbitCommon(HPS::WindowPoint const & in_loc, HPS::CameraKit & out_camera);
266  bool RelativeOrbitCommon(HPS::WindowPoint const & in_loc, HPS::KeyPath & in_event_path);
267  void CalculateTarget(KeyArray const & in_event_path);
268 
269  HPS::Point center_of_rotation;
270  bool operator_active;
271  HPS::TouchID tracked_touch_ID;
272  HPS::Vector start_sphere_pos, new_sphere_pos;
273  HPS::WindowPoint start_point, new_point;
274  HPS::SelectionOptionsKit selection_options;
275 };
276 
284 class SPRK_OPS_API ZoomOperator : public Operator
285 {
286 public:
287  ZoomOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
289  virtual HPS::UTF8 GetName() const { return "HPS_ZoomOperator"; }
290 
295  virtual bool OnMouseDown(MouseState const & in_state);
300  virtual bool OnMouseUp(MouseState const & in_state);
305  virtual bool OnMouseMove(MouseState const & in_state);
306 
311  virtual bool OnTouchDown(TouchState const & in_state);
316  virtual bool OnTouchMove(TouchState const & in_state);
317 
318 private:
319  bool operator_active;
320  HPS::TouchID tracked_touch_ID;
321  HPS::WindowPoint start_point;
322  float zoom_limit;
323  float focal_length;
324  HPS::WindowPoint last_zoom;
325  HPS::Vector last_relative;
326  float zoom_start_field_width;
327  float zoom_start_field_height;
328  HPS::Vector zoom_start_camera_look;
329  HPS::Point zoom_start_camera_target;
330 
331  void ZoomStart();
332  void UpdateZoom(float zoom_factor);
333  void UpdateZoomLimit();
334 };
335 
336 
337 class SPRK_OPS_API ConstructRectangleOperator : public Operator
338 {
339 public:
340  ConstructRectangleOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys(), bool draw_faces = false);
341  virtual HPS::UTF8 GetName() const { return "HPS_ConstructRectangleOperator"; }
342 
343  virtual void OnViewAttached(HPS::View const & in_attached_view);
344 
345  virtual bool OnMouseDown(MouseState const & in_state);
346  virtual bool OnMouseUp(MouseState const & in_state);
347  virtual bool OnMouseMove(MouseState const & in_state);
348 
349  virtual bool OnTouchDown(TouchState const & in_state);
350  virtual bool OnTouchUp(TouchState const & in_state);
351  virtual bool OnTouchMove(TouchState const & in_state);
352 
353  bool IsRectangleValid() const { return is_rect_valid; }
354 
359  HPS::Rectangle GetWindowRectangle() const { return window_rect; }
364  HPS::Rectangle GetInnerWindowRectangle() const { return inner_window_rect; }
365 
366 private:
367  bool ConstructRectCommon(WindowPoint const & in_loc);
368  void SetupConstructionSegment();
369 
370  bool draw_faces;
371  bool use_center_marker;
372  bool is_rect_valid;
373  bool operator_active;
374  HPS::WindowPoint window_start_point;
375  HPS::WindowPoint inner_window_start_point;
376  HPS::SegmentKey scratch_seg;
377  HPS::Rectangle window_rect;
378  HPS::Rectangle inner_window_rect;
379  HPS::LineKey temp_line_key;
380  HPS::PolygonKey temp_polygon_key;
381  HPS::MarkerKey temp_marker_key;
382  HPS::TouchID tracked_touch_ID;
383 };
384 
385 class SPRK_OPS_API ZoomBoxOperator : public ConstructRectangleOperator
386 {
387 public:
388  ZoomBoxOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
389  virtual HPS::UTF8 GetName() const { return "HPS_ZoomBoxOperator"; }
390 
391  virtual bool OnMouseUp(MouseState const & in_state);
392  virtual bool OnTouchUp(TouchState const & in_state);
393 
394 private:
395  bool ZoomCommon(HPS::WindowKey const & in_window, HPS::KeyPath const & in_event_path);
396 
397 };
398 
409 {
410 public:
423  SelectAreaOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
424 
425  virtual HPS::UTF8 GetName() const { return "HPS_SelectAreaOperator"; }
426 
427  virtual void OnViewAttached(HPS::View const & in_attached_view);
428 
429  virtual bool OnMouseUp(MouseState const & in_state);
430  virtual bool OnTouchUp(TouchState const & in_state);
431 
436  HPS::SelectionResults GetActiveSelection() const;
437 
443  void SetSelectionOptions(HPS::SelectionOptionsKit const & in_options) { selection_options = in_options; }
444 
448  HPS::SelectionOptionsKit GetSelectionOptions() const { return selection_options; }
449 
450 private:
451  bool SelectCommon(HPS::WindowKey & in_window, HPS::ModifierKeys in_modifiers = HPS::ModifierKeys());
452 
453  HPS::SelectionResults active_selection;
454  HPS::SelectionOptionsKit selection_options;
455 };
456 
457 
458 class SPRK_OPS_API HighlightAreaOperator : public SelectAreaOperator
459 {
460 public:
467  HighlightAreaOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
468 
469  virtual HPS::UTF8 GetName() const { return "HPS_HighlightAreaOperator"; }
470 
471  virtual void OnViewAttached(HPS::View const & in_attached_view);
472 
473  virtual bool OnMouseUp(MouseState const & in_state);
474  virtual bool OnTouchUp(TouchState const & in_state);
475 
481  void SetHighlightOptions(HPS::HighlightOptionsKit const & in_options) { highlight_options = in_options; }
482 
486  HPS::HighlightOptionsKit GetHighlightOptions() const { return highlight_options; }
487 
488 private:
489  bool HighlightCommon(WindowKey & in_window, ModifierKeys in_modifiers);
490 
491  HPS::HighlightOptionsKit highlight_options;
492 
493 };
494 
495 
505 class SPRK_OPS_API SelectOperator : public Operator
506 {
507 public:
520  SelectOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
521 
522  virtual HPS::UTF8 GetName() const { return "HPS_SelectOperator"; }
523 
524  virtual bool OnMouseDown(MouseState const & in_state);
525  virtual bool OnTouchDown(TouchState const & in_state);
526 
531  HPS::SelectionResults GetActiveSelection() const;
532 
536  void SetSelectionOptions(HPS::SelectionOptionsKit const & in_options) { selection_options = in_options; }
537 
541  HPS::SelectionOptionsKit GetSelectionOptions() const { return selection_options; }
542 
543 protected:
544  HPS::SelectionResults active_selection;
545 
546 private:
547  bool SelectCommon(HPS::Point const & in_loc, HPS::WindowKey & in_window, HPS::ModifierKeys in_modifiers = HPS::ModifierKeys());
548 
549  HPS::SelectionOptionsKit selection_options;
550 };
551 
552 
553 class SPRK_OPS_API HighlightOperator : public SelectOperator
554 {
555 public:
560  HighlightOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
561 
562  virtual HPS::UTF8 GetName() const { return "HPS_HighlightOperator"; }
563 
564  virtual bool OnMouseDown(MouseState const & in_state);
565  virtual bool OnTouchDown(TouchState const & in_state);
566 
570  void SetHighlightOptions(HPS::HighlightOptionsKit const & in_options) { highlight_options = in_options; }
571 
575  HPS::HighlightOptionsKit GetHighlightOptions() const { return highlight_options; }
576 
577 private:
578  bool HighlightCommon(HPS::WindowKey & in_window, HPS::ModifierKeys in_modifiers);
579 
580  HPS::HighlightOptionsKit highlight_options;
581 };
582 
583 class SPRK_OPS_API MouseWheelOperator : public Operator
584 {
585 public:
586  enum class ZoomType
587  {
588  Fast,
589  Accurate,
590  };
591 
596  MouseWheelOperator(ZoomType in_default_type = ZoomType::Accurate, HPS::ModifierKeys in_alternate_type_modifiers = HPS::ModifierKeys::KeyControl());
597 
598  virtual HPS::UTF8 GetName() const { return "HPS_MouseWheelOperator"; }
599 
601  void UpdateZoomLimit();
602 
603  virtual bool OnMouseWheel(HPS::MouseState const & in_state);
604 
605  virtual void OnModelAttached();
606 
607  virtual void OnViewAttached(HPS::View const & in_attached_view);
608 
609 private:
610  float zoom_limit;
611  ZoomType zoom_type;
612  HPS::ModifierKeys zoom_modifier;
613 };
614 
626 class SPRK_OPS_API TurntableOperator : public Operator
627 {
628 public:
629  TurntableOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
631  virtual HPS::UTF8 GetName() const { return "HPS_TurntableOperator"; }
632 
638  virtual bool OnMouseDown(MouseState const & in_state);
643  virtual bool OnMouseUp(MouseState const & in_state);
648  virtual bool OnMouseMove(MouseState const & in_state);
653  virtual bool OnMouseWheel(MouseState const & in_state);
654 
660  virtual bool OnTouchDown(TouchState const & in_state);
665  virtual bool OnTouchUp(TouchState const & in_state);
671  virtual bool OnTouchMove(TouchState const & in_state);
672 
673 private:
674  void TurntableCommon(HPS::WindowPoint const & delta, HPS::Vector const & rotation_axis);
675  void CalculateCenterPoint(HPS::WindowKey const & window, HPS::Point const & location);
676 
677  bool operator_active;
678  bool center_point_set;
679  HPS::WorldPoint center_point;
680  HPS::TouchID tracked_touch_ID;
681  HPS::WindowPoint start_point;
682  HPS::SelectionOptionsKit selection_options;
683 };
684 
690 class SPRK_OPS_API ZoomFitTouchOperator : public Operator
691 {
692 public:
695  virtual HPS::UTF8 GetName() const { return "HPS_ZoomFitTouchOperator"; }
696 
701  virtual bool OnTouchDown(TouchState const & in_state);
706  virtual bool OnTouchUp(TouchState const & in_state);
707 
708 private:
709  HPS::TouchID tracked_touch_ID;
710 };
711 
734 class SPRK_OPS_API FlyOperator : public Operator
735 {
736 public:
737  FlyOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonRight(), ModifierKeys in_modifier_trigger = ModifierKeys());
739  virtual HPS::UTF8 GetName() const { return "HPS_FlyOperator"; }
740 
755  virtual bool OnKeyDown(KeyboardState const & in_state);
759  virtual bool OnKeyUp(KeyboardState const & in_state);
760 
765  virtual bool OnMouseDown(MouseState const & in_state);
769  virtual bool OnMouseUp(MouseState const & in_state);
774  virtual bool OnMouseMove(MouseState const & in_state);
780  virtual bool OnMouseWheel(MouseState const & in_state);
781 
786  virtual bool OnTouchDown(TouchState const & in_state);
790  virtual bool OnTouchUp(TouchState const & in_state);
795  virtual bool OnTouchMove(TouchState const & in_state);
796 
801  virtual bool OnTimerTick(HPS::TimerTickEvent const & in_event);
802 
805  virtual void OnModelAttached();
806 
808  virtual void OnViewAttached(HPS::View const & in_attached_view);
809 
811  virtual void OnViewDetached(HPS::View const & in_detached_view);
812 
813  /* getters/setters for inverting the X and Y axis */
814  void InvertXAxis() { invert_x_axis = !invert_x_axis;}
815  void InvertYAxis() { invert_y_axis = !invert_y_axis;}
816  bool IsXAxisInverted() const { return invert_x_axis; }
817  bool IsYAxisInverted() const { return invert_y_axis; }
818 
819  /* getters/setters for sensitivity */
820  /* Keyboard sensitivity affects the speed of movement of action triggered from the keyboard, such as walking forward by pressing W */
821  float GetKeyboardSensitivity() const { return keyboard_sensitivity; }
822  void SetKeyboardSensitivity(float in_keyboard_sensitivity) { keyboard_sensitivity = in_keyboard_sensitivity; }
823 
824  /* Mouse sensitivity affects the speed of movement of action triggered from the mouse, such as rotating */
825  float GetMouseSensitivity() const { return mouse_sensitivity; }
826  void SetMouseSensitivity(float in_mouse_sensitivity) { mouse_sensitivity = in_mouse_sensitivity; }
827 
828  /* Left Joystick sensitivity affects the speed of movement of action triggered from the left joystick on touch devices */
829  float GetLeftJoystickSensitivity() const { return left_joystick_sensitivity; }
830  void SetLeftJoystickSensitivity(float in_left_joystick_sensitivity) { left_joystick_sensitivity = in_left_joystick_sensitivity; }
831 
832  /* Right Joystick sensitivity affects the speed of movement of action triggered from the right joystick on touch devices */
833  float GetRightJoystickSensitivity() const { return right_joystick_sensitivity; }
834  void SetRightJoystickSensitivity(float in_right_joystick_sensitivity) { right_joystick_sensitivity = in_right_joystick_sensitivity; }
835 
836  /* getters/setters for joystick dead zone
837  The dead zone is an area around the initial touch down position where the user can move its finger
838  without triggering any movement.
839  The default value is 0.07. */
840  float GetJoystickDeadZone() const { return joystick_dead_zone; }
841  void SetJoystickDeadZone(float in_dead_zone) { joystick_dead_zone = in_dead_zone; }
842 
843  float GetSceneExtents() const { return scene_extents; }
844 
845 protected:
846 
847  enum MovementFlags
848  {
849  no_movement = 0x0000,
850  moving_forward = 0x0001,
851  moving_back = 0x0002,
852  moving_left = 0x0004,
853  moving_right = 0x0008,
854  moving_up = 0x0010,
855  moving_down = 0x0020,
856  roll_left = 0x0040,
857  roll_right = 0x0080,
858  rotating = 0x0100,
859  move_with_touch = 0x0200,
860  rotate_with_touch = 0x0400
861  };
862 
863  unsigned int movement_flags;
864 
865  //movement functions
866  void MoveLeft(HPS::Point & position, HPS::Point & target, HPS::Vector & up);
867  void MoveRight(HPS::Point & position, HPS::Point & target, HPS::Vector & up);
868  void MoveUp(HPS::Point & position, HPS::Point & target, HPS::Vector & up);
869  void MoveDown(HPS::Point & position, HPS::Point & target, HPS::Vector & up);
870  void MoveForward(HPS::Point & position, HPS::Point & target, HPS::Vector const & direction);
871  void MoveBack(HPS::Point & position, HPS::Point & target, HPS::Vector const & direction);
872  bool MoveWithTouch(HPS::Point & position, HPS::Point & target, HPS::Vector & up, HPS::Vector const & walking_direction);
873  bool RotateScene(HPS::Point & position, HPS::Point & target);
874  bool RotateWithTouch(HPS::Point & position, HPS::Point & target);
875  void RotateCommon(HPS::Point const & delta, HPS::Point & position, HPS::Point & target);
876 
877 private:
878 
879  enum class TouchPosition
880  {
881  Left,
882  Right,
883  None
884  };
885 
886  //touch IDs tracked by the operator
887  HPS::TouchID left_side_touch;
888  HPS::TouchID right_side_touch;
889  HPS::TouchID second_right_touch;
890 
891  //current and start location for touch operations
892  HPS::WindowPoint start_point;
893  HPS::WindowPoint left_start_point;
894  HPS::WindowPoint right_start_point;
895  HPS::WindowPoint current_right_touch_position;
896  HPS::WindowPoint second_right_start_point;
897  HPS::WindowPoint current_second_right_touch_position;
898  HPS::WindowPoint start_mid_point;
899 
900  //virtual joystick information
901  HPS::SegmentKey left_joystick_segment;
902  HPS::SegmentKey right_joystick_segment;
903  float joystick_dead_zone;
904 
905  //step length for left touch, right touch, and desktop operation
906  float keyboard_sensitivity;
907  float old_keyboard_sensitivity;
908  float left_joystick_sensitivity;
909  float old_left_joystick_sensitivity;
910  float right_joystick_sensitivity;
911  float old_right_joystick_sensitivity;
912  float mouse_sensitivity;
913  float scene_extents;
914 
915  //operator state flags
916  bool two_right_fingers_down;
917  bool invert_x_axis;
918  bool invert_y_axis;
919  Drawing::Handedness world_handedness;
920  bool shift_pressed;
921  bool ctrl_pressed;
922  HPS::KeyPath event_path;
923  HPS::WindowPoint rotation_location;
924  HPS::WindowPoint moving_position;
925 
926  //utility functions
927  void UpdateKeyboardState(KeyboardState const & in_state);
928  float CalculateSceneExtents();
929  void ComputeReasonableStepLength();
930  void CreateJoystick(HPS::TouchState const & in_state, TouchPosition touch_position);
931 };
932 
967 class SPRK_OPS_API WalkOperator : public FlyOperator
968 {
969 public:
970  WalkOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonRight(), ModifierKeys in_modifier_trigger = ModifierKeys());
971 
973  virtual HPS::UTF8 GetName() const { return "HPS_WalkOperator"; }
974 
977  virtual void OnModelAttached();
978 
980  virtual void OnViewAttached(HPS::View const & in_attached_view);
981 
986  virtual bool OnTimerTick(HPS::TimerTickEvent const & in_event);
987 
988  /* Getters / Setters for the plane the operator walks on. */
989  void SetGroundPlane(HPS::Plane const & in_plane) { ground = in_plane; }
990  HPS::Plane GetGroundPlane() const { return ground; }
991 
992  /* Getters / Setters for camera vertical offset from the ground plane */
993  void SetWalkerHeight(float height) { height_off_ground = height; }
994  float GetWalkerHeight() const { return height_off_ground; }
995 
996  /* An enumeration for the direction of a vector. */
997  enum class Axis { X, Y, Z, Negative_X, Negative_Y, Negative_Z };
998  static Axis GetPrimaryAxis(HPS::Vector const & v);
999 
1000  /* Returns the primary direction of the camera Up vector. */
1001  Axis GetPrimaryUpAxis() const { return primary_up_axis; }
1002 
1003  Axis UpdatePrimaryUpAxis(HPS::Vector const & v);
1004 
1005 private:
1006  HPS::Plane ground;
1007  HPS::Vector walking_direction;
1008  float height_off_ground;
1009 
1010  Axis primary_up_axis;
1011 
1012  void CalculateGroundPlane();
1013  void SnapToPlane();
1014  void AdjustWalkingDirection(HPS::Vector const & camera_direction, HPS::Vector const & camera_up);
1015 };
1016 
1041 class SPRK_OPS_API SimpleWalkOperator : public WalkOperator
1042 {
1043 public:
1044  SimpleWalkOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
1045 
1047  virtual HPS::UTF8 GetName() const { return "HPS_SimpleWalkOperator"; }
1048 
1051  virtual void OnModelAttached();
1052 
1054  virtual void OnViewAttached(HPS::View const & in_attached_view);
1055 
1059  virtual bool OnKeyDown(KeyboardState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1063  virtual bool OnKeyUp(KeyboardState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1067  virtual bool OnMouseWheel(MouseState const & in_state);
1068 
1073  virtual bool OnMouseDown(MouseState const & in_state);
1078  virtual bool OnMouseMove(MouseState const & in_state);
1082  virtual bool OnMouseUp(MouseState const & in_state);
1086  virtual bool OnMouseEnter(MouseState const & in_state);
1090  virtual bool OnMouseLeave(MouseState const & in_state);
1091 
1095  virtual bool OnTouchDown(TouchState const & in_state);
1099  virtual bool OnTouchMove(TouchState const & in_state);
1102  virtual bool OnTouchUp(TouchState const & in_state);
1103 
1108  virtual bool OnTimerTick(HPS::TimerTickEvent const & in_event);
1109 
1114  void SetKeyboardShiftKey(bool in_state);
1115 
1120  void SetKeyboardControlKey(bool in_state);
1121 
1126  void SetEnableMiddleMouseButtonDolly(bool in_enable);
1127 
1132  bool GetEnableMiddleMouseButtonDolly() const;
1133 
1137  bool IsMouseTriggered(MouseState const & in_state);
1138 
1139 private:
1140  class ScaleFactor
1141  {
1142  public:
1143  float time;
1144  float forward, horizontal, vertical;
1145  float roll, pitch, yaw;
1146  ScaleFactor(float time) : time(time),
1147  forward(1), horizontal(1), vertical(1),
1148  roll(1), pitch(1), yaw(1) {}
1149 
1150  void SetTime(float t) { time = t; }
1151  void SetForward(float f) { forward=f; }
1152  void SetHorizontal(float h) { horizontal = h; }
1153  void SetVertical(float v) { vertical = v; }
1154  void SetRoll(float r) { roll = r; }
1155  void SetPitch(float p) { pitch = p; }
1156  void SetYaw(float y) { yaw = y; }
1157 
1158  float GetTime() const { return time; }
1159  float GetForward() const { return forward; }
1160  float GetHorizontal() const { return horizontal; }
1161  float GetVertical() const { return vertical; }
1162  float GetRoll() const { return roll; }
1163  float GetPitch() const { return pitch; }
1164  float GetYaw() const { return yaw; }
1165 
1166  float Forward() const { return forward*time; }
1167  float Horizontal() const { return horizontal*time; }
1168  float Vertical() const { return vertical*time; }
1169  float Roll() const { return roll*time; }
1170  float Pitch() const { return pitch*time; }
1171  float Yaw() const { return yaw*time; }
1172  };
1173 
1174  void Pan(float in_theta, float in_phi);
1175  void Dolly(float in_right, float in_up, float in_forward);
1176  void ResetCamera(HPS::CameraKit & camera) const;
1177  float CalculatePitch(HPS::CameraKit & camera) const;
1178  bool NotableCameraDifference(HPS::CameraKit const & camera1, HPS::CameraKit const & camera2);
1179 
1180  int DirectionForward() const { return 0x1; }
1181  int DirectionHorizontal() const { return 0x2; }
1182  int DirectionVertical() const { return 0x4; }
1183  int DirectionRoll() const { return 0x8; }
1184  int DirectionPitch() const { return 0x10; }
1185  int DirectionYaw() const { return 0x20; }
1186 
1187  bool Move(HPS::Point const & start, HPS::Point const & current, int directions, HPS::CameraKit & camera, ScaleFactor const & scale);
1188 
1189  void Init();
1190 
1191  HPS::WindowPoint mouse_current_point;
1192  HPS::WindowPoint mouse_start_point;
1193  bool mouse_operator_started;
1194  bool mouse_moving;
1195  bool middle_mouse_button_active;
1196 
1197  HPS::WindowPoint touch_current_point;
1198  HPS::WindowPoint touch_start_point;
1199  bool touch_operator_started;
1200  bool touch_moving;
1201  bool double_touch_active;
1202  HPS::Touch touch1, touch2;
1203 
1204  bool keybrd_control;
1205  bool keybrd_shift;
1206  bool enable_middle_button_dolly;
1207  HPS::UpdateNotifier last_notifier;
1208  bool pending_camera_valid;
1209  HPS::CameraKit pending_camera;
1210  HPS::CameraKit last_camera;
1211 };
1212 
1213 
1271 class SPRK_OPS_API CuttingSectionOperator : public SelectOperator
1272 {
1273 private:
1274  enum class OpState
1275  {
1276  Uninitialized,
1277  Initialized,
1278  Translating,
1279  FacePicking,
1280  };
1281 
1282 public:
1283  CuttingSectionOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
1284 
1286  virtual HPS::UTF8 GetName() const { return "HPS_CuttingSectionOperator"; }
1287 
1288  virtual void OnViewAttached(HPS::View const & in_attached_view);
1289  virtual void OnViewDetached(HPS::View const & in_detached_view);
1290 
1295  void SetPlanes(PlaneArray const & in_planes);
1296 
1299  PlaneArray GetPlanes();
1300 
1306  virtual bool OnMouseDown(MouseState const & in_state);
1307 
1311  virtual bool OnMouseUp(MouseState const & in_state);
1312 
1318  virtual bool OnMouseMove(MouseState const & in_state);
1319 
1325  virtual bool OnTouchDown(TouchState const & in_state);
1326 
1330  virtual bool OnTouchUp(TouchState const & in_state);
1331 
1336  virtual bool OnTouchMove(TouchState const & in_state);
1337 
1342  virtual bool OnTimerTick(TimerTickEvent const & in_event);
1343 
1346  float GetIndicatorScale() const { return indicator_scale; }
1347 
1350  void SetIndicatorScale(float in_scale) { indicator_scale = in_scale; }
1351 
1354  MaterialMappingKit GetPlaneMaterial() const { return plane_material; }
1355 
1358  void SetPlaneMaterial(MaterialMappingKit const & in_plane_material);
1359 
1362  HighlightOptionsKit GetPlaneHighlightOptions() const { return highlight_options; }
1363 
1366  void SetPlaneHighlightOptions(HighlightOptionsKit const & in_highlight_options) { highlight_options = in_highlight_options; }
1367 
1370  bool GetMouseOverHighlighting() const { return enable_mouse_over_highlighting; }
1371 
1374  void SetMouseOverHighlighting(bool in_enable_mouse_over_highlighting) { enable_mouse_over_highlighting = in_enable_mouse_over_highlighting; }
1375 
1379  void SetSectioning(bool in_sectioning);
1380 
1383  bool GetSectioning() { return sectioning; }
1384 
1388  void SetIndicatorVisibility(bool in_use_indicator);
1389 
1392  bool GetIndicatorVisibility() { return (op_state == OpState::Uninitialized || op_state == OpState::FacePicking) ? true : false; }
1393 
1397  void SetPlaneVisibility(bool in_visibility);
1398 
1401  bool GetPlaneVisibility();
1402 
1403  /* The operator needs to know the model bounding in order to display cutting sections of the appropriate size.
1404  * The bounding is calculated automatically the first time a section is inserted, and when the operator detects that a Component
1405  * has been Shown, Hidden, Isolated or its Visibility has been Reset.
1406  * If changes are made to the scene outside of the ones listed above, which should warrant the model bounding to be recalculated for
1407  * purposes of displaying cutting sections, the operator can be asked to do so by calling this function. */
1408  void RecalculateModelBounding();
1409 
1410 private:
1411 
1412  class ShowHideIsolateResetHandler : public HPS::EventHandler
1413  {
1414  public:
1415  ShowHideIsolateResetHandler()
1416  : EventHandler()
1417  { }
1418 
1419  virtual ~ShowHideIsolateResetHandler()
1420  {
1421  Shutdown();
1422  }
1423 
1424  virtual HandleResult Handle(Event const * /*in_event*/)
1425  {
1426  op->model_bounding.Invalidate();
1427  if (!op->sections.empty())
1428  op->ResizeCuttingPlanes();
1429  return HandleResult::Handled;
1430  }
1431 
1432  void SetOperator(CuttingSectionOperator * in_operator) { op = in_operator; }
1433 
1434  private:
1435  CuttingSectionOperator * op;
1436  };
1437 
1438  void SetupOperatorSegment();
1439  void InsertNormalIndicator(float scale);
1440  ShellKey InsertCuttingPlaneGeometry();
1441  void MouseOverHighlighting(MouseState const & in_state);
1442  void TranslateCuttingPlane(KeyPath const & in_event_path, WindowPoint const & in_event_location);
1443  bool HandleMouseAndTouchDown(WindowKey const & in_event_source, size_t in_number_of_clicks,
1444  KeyPath const & in_event_path, WindowPoint const & in_event_location);
1445  void ViewAlignSectionPlanes(HPS::PlaneArray & in_out_planes) const;
1446  void ResizeCuttingPlanes();
1447 
1448  struct SectionInfo
1449  {
1450  SectionInfo()
1451  {}
1452 
1453  SectionInfo(CuttingSectionKey const & in_cutting_section, ShellKeyArray const & in_shell_keys)
1454  : cutting_section_key(in_cutting_section)
1455  , shell_key_array(in_shell_keys)
1456  {}
1457 
1458  CuttingSectionKey cutting_section_key;
1459  ShellKeyArray shell_key_array;
1460  };
1461 
1462  typedef std::vector<SectionInfo> SectionArray;
1463  SectionArray sections;
1464 
1465  SegmentKey operator_root_segment;
1466  SegmentKey cutting_sections_segment;
1467  SegmentKey plane_representation_segment;
1468  bool sectioning;
1469 
1470  CuttingSectionKey translating_section;
1471  size_t translating_plane_offset;
1472  ShellKey translating_plane_representation;
1473 
1474  TouchID tracked_touch_ID;
1475  MaterialMappingKit plane_material;
1476  SegmentKey indicator_seg;
1477  OpState op_state;
1478  WorldPoint start_world_point;
1479  SelectionOptionsKit selection_options;
1480  SelectionOptionsKit mouse_over_selection_options;
1481  float indicator_scale;
1482  Vector plane_normal;
1483  bool plane_normal_valid;
1484  WorldPoint anchor_point;
1485  SimpleCuboid model_bounding;
1486 
1487  UpdateNotifier last_highlight_notifier;
1488  bool last_skipped_highlight_state_valid;
1489  MouseState last_skipped_highlight_state;
1490  bool is_plane_highlighted;
1491  PortfolioKey portfolio;
1492  SegmentKey style_segment;
1493  HighlightOptionsKit highlight_options;
1494  bool enable_mouse_over_highlighting;
1495  bool skip_mouse_overs;
1496 
1497  View attached_view;
1498  KeyArray navigation_keys;
1499 
1500  ShowHideIsolateResetHandler handler;
1501 };
1502 
1538 class SPRK_OPS_API MarkupOperator : public Operator
1539 {
1540 public:
1541  enum class MarkupType
1542  {
1543  Freehand,
1544  Text,
1545  Circle,
1546  Rectangle,
1547  };
1548 
1549  MarkupOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
1550 
1552  virtual HPS::UTF8 GetName() const override { return "HPS_MarkupOperator"; }
1553 
1554  virtual void OnViewAttached(HPS::View const & in_attached_view) override;
1555  virtual void OnViewDetached(HPS::View const & in_detached_view) override;
1556 
1561  virtual bool OnMouseDown(MouseState const & in_state) override;
1562 
1566  virtual bool OnMouseUp(MouseState const & in_state) override;
1567 
1574  virtual bool OnMouseMove(MouseState const & in_state) override;
1575 
1576 
1581  virtual bool OnTouchDown(TouchState const & in_state) override;
1582 
1586  virtual bool OnTouchUp(TouchState const & in_state) override;
1587 
1594  virtual bool OnTouchMove(TouchState const & in_state) override;
1595 
1601  virtual bool OnKeyDown(KeyboardState const & in_state) override;
1602 
1608  virtual bool OnTextInput(HPS::UTF8 const & in_text) override;
1609 
1611  MarkupType GetMarkupType() { return markup_type; }
1612 
1614  void SetMarkupType(MarkupType in_markup_type) { markup_type = in_markup_type; }
1615 
1618  RGBColor GetColor() { return current_attributes.color; }
1619 
1621  void SetColor(RGBColor const & in_color) { current_attributes.color = in_color; }
1622 
1625  TextAttributeKit GetTextAttributes() { return current_attributes.text_attributes; }
1626 
1628  void SetTextAttribute(TextAttributeKit const & in_text_attributes) { current_attributes.text_attributes = in_text_attributes; }
1629 
1632  LineAttributeKit GetLineAttributes() { return current_attributes.line_attributes; }
1633 
1635  void SetLineAttribute(LineAttributeKit const & in_line_attributes) {current_attributes.line_attributes = in_line_attributes; }
1636 
1640  SegmentKey GetSegmentKey() { return markup_segment; }
1641 
1643  void DeleteMarkups();
1644 
1647  bool IsMarkupActive() { return operator_active; }
1648 
1649  class SPRK_OPS_API MarkupInsertedEvent : public HPS::Event
1650  {
1651  public:
1654  {
1655  channel = GetClassID();
1656  consumable = false;
1657  }
1658 
1659  MarkupInsertedEvent(HPS::Key const & in_markup_key, HPS::View const & in_view) : Event()
1660  {
1661  channel = GetClassID();
1662  consumable = false;
1663  markup_key = in_markup_key;
1664  view = in_view;
1665  }
1666 
1669  MarkupInsertedEvent(Event const & in_event) : Event(in_event)
1670  {
1671  if (in_event.GetChannel() == Object::ClassID<MarkupInsertedEvent>())
1672  {
1673  auto that = static_cast<MarkupInsertedEvent const &>(in_event);
1674  markup_key = that.markup_key;
1675  view = that.view;
1676  }
1677  else
1678  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
1679  }
1680 
1682 
1685  Event * Clone() const
1686  {
1687  MarkupInsertedEvent * new_event = new MarkupInsertedEvent(*this);
1688  return new_event;
1689  }
1690 
1691  Key markup_key;
1692  View view;
1693  };
1694 
1695 private:
1696  struct Attributes
1697  {
1698  RGBColor color;
1699  LineAttributeKit line_attributes;
1700  TextAttributeKit text_attributes;
1701  };
1702 
1703  class KeyboardHiddenEventHandler : public EventHandler
1704  {
1705  public:
1706  KeyboardHiddenEventHandler()
1707  : EventHandler()
1708  { }
1709 
1710  virtual ~KeyboardHiddenEventHandler()
1711  { Shutdown(); }
1712 
1713  virtual HandleResult Handle(Event const * /*in_event*/)
1714  {
1715  markup_operator->keyboard_active = false;
1716 
1717  markup_operator->ResetCameras();
1718  return HandleResult::Handled;
1719  }
1720 
1721  void SetOperator(MarkupOperator * in_operator) { markup_operator = in_operator; }
1722 
1723  private:
1724  MarkupOperator * markup_operator;
1725  };
1726 
1727  std::unordered_multimap<RGBColor, SegmentKey> attribute_map;
1728 
1729  MouseButtons mouse_trigger;
1730  ModifierKeys modifier_trigger;
1731 
1732  MarkupType markup_type;
1733  SegmentKey markup_segment;
1734  SegmentKey current_segment;
1735  Attributes current_attributes;
1736 
1737  static const RGBColor default_color;
1738  static const TextAttributeKit default_text_attributes;
1739  static const LineAttributeKit default_line_attributes;
1740 
1741  Point start_point;
1742  bool start_new_line;
1743  LineKey current_line;
1744  size_t current_line_size;
1745  CircleKey current_circle;
1746  LineKey current_circle_line;
1747  LineKey current_rectangle;
1748  View last_attached_view;
1749 
1750  bool start_new_note;
1751  bool keyboard_active;
1752  TextKey default_text;
1753  TextKey current_text;
1754  SizeTArray text_columns;
1755  size_t current_text_row;
1756 
1757  bool operator_active;
1758  TouchID tracked_touch_id;
1759  TouchID second_tracked_touch_id;
1760 
1761  CameraKit original_camera;
1762  CameraKit original_markup_camera;
1763 
1764  KeyboardHiddenEventHandler handler;
1765 
1766  bool SetupConstructionSegments();
1767  void LookupSegment();
1768  void CreateNewMarkupSegment();
1769  void DrawFreehand(Point const & location);
1770  void DrawText();
1771  void DrawCircle(Point const & location);
1772  void DrawCircleFromTwoPoints(Point const & point_one, Point const & point_two);
1773  void DrawRectangleFromTwoPoints(Point const & point_one, Point const & point_two);
1774  void DrawRectangle(Point const & location);
1775  void CenterCameras(Point const & main_camera_center, Point const & markup_camera_center);
1776  void ResetCameras();
1777  void EndTextNote();
1778 };
1779 
1797 class SPRK_OPS_API AnnotationOperator : public Operator
1798 {
1799 public:
1800  AnnotationOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
1801 
1803  virtual HPS::UTF8 GetName() const override { return "HPS_AnnotationOperator"; }
1804 
1805  virtual void OnViewAttached(HPS::View const & in_attached_view) override;
1806  virtual void OnViewDetached(HPS::View const & in_detached_view) override;
1807 
1815  virtual bool OnMouseDown(MouseState const & in_state) override;
1816 
1822  virtual bool OnMouseMove(MouseState const & in_state) override;
1823 
1824 
1832  virtual bool OnTouchDown(TouchState const & in_state) override;
1833 
1837  virtual bool OnTouchUp(TouchState const & in_state) override;
1838 
1843  virtual bool OnTouchMove(TouchState const & in_state) override;
1844 
1845 
1850  virtual bool OnKeyDown(KeyboardState const & in_state) override;
1851 
1856  virtual bool OnTextInput(HPS::UTF8 const & in_text) override;
1857 
1865  void SetBackgroundShape(const char * in_shape);
1866 
1870  UTF8 GetBackgroundShape() const;
1871 
1875  class SPRK_OPS_API AnnotationInsertedEvent : public HPS::Event
1876  {
1877  public:
1880  {
1881  channel = GetClassID();
1882  consumable = false;
1883  }
1884 
1885  AnnotationInsertedEvent(HPS::SegmentKey const & in_text_key, HPS::View const & in_view) : Event()
1886  {
1887  channel = GetClassID();
1888  consumable = false;
1889  text_key = in_text_key;
1890  view = in_view;
1891  }
1892 
1895  AnnotationInsertedEvent(Event const & in_event) : Event(in_event)
1896  {
1897  if (in_event.GetChannel() == Object::ClassID<AnnotationInsertedEvent>())
1898  {
1899  auto that = static_cast<AnnotationInsertedEvent const &>(in_event);
1900  text_key = that.text_key;
1901  view = that.view;
1902  }
1903  else
1904  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
1905  }
1906 
1908 
1911  Event * Clone() const
1912  {
1913  AnnotationInsertedEvent * new_event = new AnnotationInsertedEvent(*this);
1914  return new_event;
1915  }
1916 
1917  SegmentKey text_key; //the key of the segment containing the annotation
1918  View view;
1919  };
1920 
1921 private:
1922  void AddAnnotationUserData();
1923  void StartNewNote();
1924 
1925  bool InputDown(WindowKey const & window_key, Point const & location, KeyPath & event_path);
1926  bool InputMove(Point const & location, KeyPath & event_path);
1927 
1928  void CenterCamera(Point const & camera_center);
1929  void ResetCamera();
1930 
1931  class KeyboardHiddenEventHandler : public EventHandler
1932  {
1933  public:
1934  KeyboardHiddenEventHandler()
1935  : EventHandler()
1936  { }
1937 
1938  virtual ~KeyboardHiddenEventHandler()
1939  { Shutdown(); }
1940 
1941  virtual HandleResult Handle(Event const * /*in_event*/)
1942  {
1943  annotation_operator->keyboard_active = false;
1944 
1945  annotation_operator->ResetCamera();
1946  return HandleResult::Handled;
1947  }
1948 
1949  void SetOperator(AnnotationOperator * in_operator) { annotation_operator = in_operator; }
1950 
1951  private:
1952  AnnotationOperator * annotation_operator;
1953  };
1954 
1955 
1956  SegmentKey annotation_segment; //segment containing all annotations
1957  View last_attached_view; //the last view that was attached to this operator
1958  SelectionOptionsKit selection_options; //selection options used to select geometry
1959  SelectionOptionsKit annotation_selection_options; //selection options used when trying to select annotations
1960  bool editing_text; //whether we are in a state which allows editing of an annotation
1961  bool start_new_note; //whether we should delete the text of an annotation when typing
1962  UTF8 annotation_user_data; //the user data set on annotation geometry to distinguish it from non annotation geometry
1963  UTF8 annotation_shape; //the name of the shape definition used to draw the annotation background
1964 
1965  PortfolioKey current_portfolio; //the portfolio used to store the default definitions used by this operator
1966  SegmentKey highlight_style_segment; //the highlight background style
1967 
1968  RGBColor background_color; //the color of the annotation background
1969  RGBColor leader_line_color; //the color of the annotation leader line and edges
1970  RGBColor highlight_color; //the color the annotation becomes while it is being edited
1971 
1972  TextKey text_to_edit; //the annotation text which we are working on
1973  SizeTArray text_columns; //the number of columns of the text for the current annotation
1974  size_t current_text_row; //the number of rows of the text for the current annotation
1975 
1976  //touch only flags -- these flags are only relevant when running the operator on a touch enabled device
1977  TouchID tracked_touch_id; //the ID of the touch we are tracking
1978  bool keyboard_active; //whether the software keyboard is visible
1979  CameraKit original_camera; //the camera setting as they were just before the annotation text is edited
1980  KeyboardHiddenEventHandler handler; //a handler that takes care of resetting the camera when the software keyboard is hidden
1981  Point touch_down_position; //the position the last touch down occurred at
1982  bool always_show_keyboard_on_touch_up; //true if we are just inserting the annotation, false if we are editing a previously inserted one.
1983 };
1984 
2007 class SPRK_OPS_API HandlesOperator : public Operator
2008 {
2009 public:
2010  HandlesOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
2011  ~HandlesOperator();
2012 
2013  enum class HandleType
2014  {
2015  Rotation,
2016  RotationX,
2017  RotationY,
2018  RotationZ,
2019  AxisTranslation,
2020  AxisTranslationX,
2021  AxisTranslationY,
2022  AxisTranslationZ,
2023  PlaneTranslation,
2024  PlaneTranslationXY,
2025  PlaneTranslationYZ,
2026  PlaneTranslationZX,
2027  CenterPoint,
2028  };
2029 
2031  virtual HPS::UTF8 GetName() const override { return "HPS_HandlesOperator"; }
2032 
2033  virtual void OnViewAttached(HPS::View const & in_attached_view) override;
2034  virtual void OnViewDetached(HPS::View const & in_detached_view) override;
2035 
2042  virtual bool OnMouseDown(MouseState const & in_state) override;
2043 
2048  virtual bool OnMouseMove(MouseState const & in_state) override;
2049 
2053  virtual bool OnMouseUp(MouseState const & in_state) override;
2054 
2061  virtual bool OnTouchDown(TouchState const & in_state) override;
2062 
2067  virtual bool OnTouchMove(TouchState const & in_state) override;
2068 
2072  virtual bool OnTouchUp(TouchState const & in_state) override;
2073 
2088  void SetHandlesColors(MaterialKitArray const & in_colors) { handles_colors = in_colors; }
2089 
2105  MaterialKitArray GetHandlesColors() const { return handles_colors; }
2106 
2110  void SetHighlightColor(RGBAColor const & in_highlight_color);
2111 
2114  RGBAColor GetHighlightColor() const { return highlight_color; }
2115 
2121  void SetHandlesAppearance(float in_length = 0.16f, float in_radius = 0.005f, size_t in_handles_points = 30);
2122 
2128  void SetRotationHandleAppearance(float in_offset = 0.045f, float in_angle = 25.0f, float in_tip_size = 0.15f);
2129 
2135  void SetPlaneTranslationAppearance(float in_plane_offset = 0.2f, float in_plane_length = 0.6f, float in_center_radius = 0.2f);
2136 
2142  void SetCADModel(CADModel const & in_cad_model);
2143 
2148  void GetHandlesAppearance(float & out_length, float & out_radius, size_t & out_handles_points) const;
2149 
2154  void GetRotationHandleAppearance(float & out_offset, float & out_angle, float & out_tip_size) const;
2155 
2160  void GetPlaneTranslationAppearance(float & out_plane_offset, float & out_plane_length, float & out_center_radius) const;
2161 
2165  void SetTrailingGeometry(bool in_state) { display_trailing_geometry = in_state; }
2166 
2170  bool GetTrailingGeometry() const { return display_trailing_geometry; }
2171 
2175  CADModel GetCADModel() const { return cad_model; }
2176 
2180  void AddHandles(HandleType handle_type);
2181 
2185  void RemoveHandles(HandleType handle_type);
2186 
2187  /* Dismisses the handles.*/
2188  void DismissHandles();
2189 
2190  class SPRK_OPS_API GeometryTransformedEvent : public HPS::Event
2191  {
2192  public:
2195  {
2196  channel = GetClassID();
2197  consumable = false;
2198  }
2199 
2200  GeometryTransformedEvent(HPS::View const & in_view, HPS::SegmentKey const & in_segment_key, HPS::MatrixKit const & in_transform) : Event()
2201  {
2202  channel = GetClassID();
2203  consumable = false;
2204  view = in_view;
2205  segment_key = in_segment_key;
2206  transform = in_transform;
2207  }
2208 
2211  GeometryTransformedEvent(Event const & in_event) : Event(in_event)
2212  {
2213  if (in_event.GetChannel() == Object::ClassID<GeometryTransformedEvent>())
2214  {
2215  auto that = static_cast<GeometryTransformedEvent const &>(in_event);
2216  view = that.view;
2217  segment_key = that.segment_key;
2218  transform = that.transform;
2219  }
2220  else
2221  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
2222  }
2223 
2225 
2228  Event * Clone() const
2229  {
2230  GeometryTransformedEvent * new_event = new GeometryTransformedEvent(*this);
2231  return new_event;
2232  }
2233 
2234  SegmentKey segment_key;
2235  MatrixKit transform;
2236  View view;
2237  };
2238 
2239 private:
2240  enum class Movement
2241  {
2242  None,
2243  Translation,
2244  Rotation,
2245  PlaneTranslation,
2246  ViewPlaneTranslation,
2247  };
2248 
2249  enum InternalHandleType : size_t
2250  {
2251  rotation_x = 0,
2252  rotation_y,
2253  rotation_z,
2254  axis_translation_x,
2255  axis_translation_y,
2256  axis_translation_z,
2257  plane_translation_x,
2258  plane_translation_y,
2259  plane_translation_z,
2260  center_point_translation,
2261  last = center_point_translation,
2262  };
2263 
2264  CanvasArray canvases; //A list of Canvas objects that the View attached to this operator belongs to. This value only gets updated on OnViewAttached.
2265  View last_attached_view; //The last View to where this operator was pushed.
2266  TouchID tracked_touch_id;
2267 
2268  SegmentKey handles; //top level segment
2269  SegmentKey handles_segment; //segment where the matrices for the handles transformations are accumulated
2270  SegmentKey handles_geometry; //segment where the handles geometry lives
2271  SegmentKey center_sphere;
2272  SegmentKey reference_segment; //segment containing all the net attributes of segment_to_move
2273  SegmentKey segment_to_move; //segment containing geometry affected by the handles
2274  SegmentKey temporary_segment_to_move; //segment where we accumulate changes while the handles are active
2275  SegmentKey handles_trail; //segment containing the trailing geometry
2276  KeyPath path_to_segment_to_move;
2277  KeyPath complete_referenced_path;
2278 
2279  //Component level variables
2280  CADModel cad_model; //The CADModel associated with this operator. Might be Invalid.
2281  HPS::Type cad_model_type; //HPS::Type::None when cad_model is not valid.
2282  ComponentPath component_path_to_move; //Analogous to path_to_segment_to_move in the case where a CADModel is valid.
2283  Component component_to_move; //Analogous to segment_to_move in the case where a CADModel is valid.
2284 
2285  std::vector<bool> requested_handle_type;
2286  std::vector<bool> current_handle_type;
2287 
2288  WorldPoint handles_origin_point;
2289  WorldPoint movement_start_point;
2290  Point input_down_position;
2291 
2292  Camera::Projection camera_projection;
2293 
2294  SelectionOptionsKit geometry_selection_options;
2295  SelectionOptionsKit handles_selection_options;
2296 
2297  HighlightOptionsKit hide_highlight_options;
2298  HighlightOptionsKit partial_transparency_options;
2299  HighlightOptionsKit highlight_options;
2300  SegmentKey style_segment;
2301  SegmentKey transparency_style_segment;
2302  UTF8 style_name;
2303  bool something_is_highlighted;
2304  MaterialKitArray handles_colors;
2305  RGBAColor highlight_color;
2306  Key highlighted_handle;
2307 
2308  //state flags
2309  bool are_handles_on;
2310  bool remove_handles;
2311  Movement move_geometry;
2312  Movement previous_movement;
2313  Vector movement_direction;
2314  Plane movement_plane;
2315  Vector base_vector;
2316 
2317  //handles appearance
2318  float handles_length; //Length of the handles. Expressed in percentage of screen [0 - 1]
2319  float handles_radius; //Radius of the handles. Expressed in percentage of screen [0 - 1]
2320  float arc_offset; //Distance between the end of the translation handle and the start of the translation arc. Expressed in percentage of handles_length [0 - 1].
2321  float arc_angle; //The angle formed by the arc handles. Must be greater than zero.
2322  size_t arc_points; //The number of points used to draw the arc handles.
2323  float tip_size; //The size of the tips at the end of the handles, specified as a percentage of the handles length
2324  float plane_offset; //The distance between the axis translation handle and the start of the plane translation handle, specified as a percentage of handles_length.
2325  float plane_length; //The length of the plane translation handle, specified as a percentage of handles_length.
2326  float center_radius;
2327 
2328  //handle geometry
2329  CylinderKey x;
2330  CylinderKey y;
2331  CylinderKey z;
2332  CylinderKey arc_x;
2333  CylinderKey arc_y;
2334  CylinderKey arc_z;
2335  ShellKey xy;
2336  ShellKey xz;
2337  ShellKey yz;
2338  SphereKey center;
2339 
2340  //trailing geometry
2341  bool display_trailing_geometry;
2342  Point trailing_line_start;
2343  Point trailing_circle_start;
2344  Point trailing_circle_center;
2345  Vector trailing_rotation;
2346  MarkerKey trail_marker;
2347  LineKey trailing_line;
2348  CircularArcKey trailing_circle;
2349  float rotation_direction;
2350 
2351  bool InputDown(size_t in_click_count, WindowKey const & in_window, KeyArray const & in_event_path, Point const & in_location);
2352  bool InputMove(KeyPath const & in_path, Point const & in_location);
2353  void InputUp(Point const & in_location);
2354 
2355  void InsertHandles();
2356  void InsertRotationHandles(bool in_x, bool in_y, bool in_z);
2357  void InsertAxisTranslationHandles(bool in_x, bool in_y, bool in_z);
2358  void InsertPlaneTranslationHandles(bool in_x, bool in_y, bool in_z);
2359  void InsertCenterPoint();
2360 
2361  bool HighlightHandles(WindowKey & in_window, KeyArray const & in_event_path, Point const & in_location);
2362 
2363  //moves the geometry affected by handles into a new segment, and hides the original
2364  void ReferenceGeometry(KeyPath const & in_path);
2365 
2366  //copies the accumulated transform from the reference geometry segment back into the original place.
2367  //removes the hide highlight from the original geometry
2368  //if a CADModel is associated with this operator, it propagates the changes to the Component and PRC/Parasolid geometry
2369  void CommitChanges();
2370 };
2371 
2423 class SPRK_OPS_API MeasurementOperator : public Operator
2424 {
2425 public:
2426  MeasurementOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
2428 
2429  enum class MeasurementType
2430  {
2431  PointToPoint,
2432  Line,
2433  Angle,
2434  Area,
2435  Distance,
2436  };
2437 
2439  {
2440  LastPoint,
2441  FirstPoint,
2442  MidPoint,
2443  };
2444 
2446  {
2447  Entity,
2448  Body,
2449  };
2450 
2451 #if TARGET_OS_IPHONE == 0 && TARGET_OS_ANDROID == 0
2452  enum class SelectionHint
2453  {
2454  Snapped,
2455  Valid,
2456  Invalid,
2457  };
2458 
2463  SegmentKey GetHintSegment(SelectionHint in_hint);
2464 #endif
2465 
2467  virtual HPS::UTF8 GetName() const override { return "HPS_MeasurementOperator"; }
2468 
2470  virtual void OnViewAttached(HPS::View const & in_attached_view) override;
2472  virtual void OnViewDetached(HPS::View const & in_detached_view) override;
2473 
2476  virtual void OnModelAttached() override;
2477 
2480  virtual void OnModelDetached() override;
2481 
2486  virtual bool OnMouseDown(MouseState const & in_state) override;
2491  virtual bool OnMouseMove(MouseState const & in_state) override;
2496  virtual bool OnMouseUp(MouseState const & in_state) override;
2497 
2502  virtual bool OnTouchDown(TouchState const & in_state) override;
2507  virtual bool OnTouchMove(TouchState const & in_state) override;
2512  virtual bool OnTouchUp(TouchState const & in_state) override;
2513 
2518  virtual bool OnKeyDown(KeyboardState const & in_state) override;
2519 
2522  void SetMeasurementType(MeasurementType in_measurement_type);
2523 
2525  MeasurementType GetMeasurementType() const { return current_measurement_type; }
2526 
2532  void SetVertexSnapping(bool in_state, float in_proximity = 0.0f);
2533 
2535  void GetVertexSnapping(bool & out_state, float & out_proximity) const;
2536 
2537 #if TARGET_OS_IPHONE == 0 && TARGET_OS_ANDROID == 0
2538 
2541  void SetSelectionHinting(bool in_state);
2542 
2544  bool GetSelectionHinting();
2545 #endif
2546 
2552  void SetPrecision(size_t in_precision);
2553 
2555  size_t GetPrecision() const;
2556 
2558  void DeleteAllMeasurements();
2559 
2561  void SetLineMeasurementPosition(LineMeasurementPosition in_position) { line_measurement_position = in_position; }
2562 
2564  LineMeasurementPosition GetLineMeasurementPosition() const { return line_measurement_position; }
2565 
2566  /* Sets the reference used when performing distance measurements. The default is Body.
2567  * When Body is selected, and an Exchange or Parasolid CADModel is associated with this operator,
2568  * the minimum distance between two selected Representation Items (for Exchange) or Bodies (for Parasolid) will be computed.
2569  * If Entity is selected, the distance will be calculated between the topological faces being selected
2570  * When a CADModel is not associated with this operator, Body is a synonym for Segment. */
2571  void SetDistanceMeasurementReference(DistanceMeasurementReference in_reference) { distance_measurement_reference = in_reference; }
2572 
2574  DistanceMeasurementReference GetDistanceMeasurementReference() const { return distance_measurement_reference; }
2575 
2576  /* An event which will be injected when a measurement is inserted into the scene through this operator.
2577  * Intercepting this event through a class derived from HPS::EventHandler allows for fine control over measurements
2578  * by having access to their backing SegmentKey.
2579  * Information about the inserted measurement, such as its type and value is also conveyed through this Event */
2580  class SPRK_OPS_API MeasurementEvent : public HPS::Event
2581  {
2582  public:
2585  {
2586  channel = GetClassID();
2587  consumable = false;
2588  }
2589 
2591  HPS::View const & in_view,
2592  HPS::SegmentKey const & in_segment_key,
2593  MeasurementOperator::MeasurementType in_measurement_type,
2594  float in_measurement_value)
2595  : Event()
2596  , view(in_view)
2597  , segment_key(in_segment_key)
2598  , measurement_type(in_measurement_type)
2599  , measurement_value(in_measurement_value)
2600  {
2601  channel = GetClassID();
2602  consumable = false;
2603  }
2604 
2607  MeasurementEvent(Event const & in_event) : Event(in_event)
2608  {
2609  if (in_event.GetChannel() == Object::ClassID<MeasurementEvent>())
2610  {
2611  auto that = static_cast<MeasurementEvent const &>(in_event);
2612  view = that.view;
2613  segment_key = that.segment_key;
2614  measurement_type = that.measurement_type;
2615  measurement_value = that.measurement_value;
2616  }
2617  else
2618  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
2619  }
2620 
2621  ~MeasurementEvent();
2622 
2625  Event * Clone() const
2626  {
2627  MeasurementEvent * new_event = new MeasurementEvent(*this);
2628  return new_event;
2629  }
2630 
2631  SegmentKey segment_key;
2632  MeasurementOperator::MeasurementType measurement_type;
2633  float measurement_value;
2634  View view;
2635  };
2636 
2637 private:
2638  struct DistanceInfo
2639  {
2640  DistanceInfo();
2641  Point point1;
2642  Point point2;
2643  float distance_squared;
2644  };
2645 
2646 #if TARGET_OS_IPHONE == 0 && TARGET_OS_ANDROID == 0
2647  void SetHintState(SelectionHint in_state, HPS::Point const & world_space_point);
2648 #endif
2649  bool EstablishSelectionScope(HPS::KeyArray const & event_path);
2650  bool InputDown(size_t in_click_count, WindowKey const & in_window, KeyArray const & in_event_path, Point const & in_location);
2651  bool InputMove(WindowKey const & in_window, KeyPath const & in_path, Point const & in_location);
2652  void InputUp(WindowKey const & in_window, KeyArray const & in_event_path, Point const & in_location);
2653 
2654  SegmentKey CreateMeasurementSegment();
2655 
2656  void InsertAngleMeasurement();
2657  void InsertPointToPointMeasurement();
2658  void InsertAreaMeasurement(bool in_last_point = false);
2659  void InsertLineMeasurement(bool in_last_point = false);
2660  void InsertDistanceMeasurement();
2661 
2662  void RemoveMeasurementPoint();
2663 
2664  void CalculateAndInsertArea();
2665  UTF8 FormatMeasurementText(float measurement, HPS::UTF8 const & suffix_str = HPS::UTF8());
2666  TextKey InsertMeasurementText(Point const & text_insertion_point, float measurement, HPS::UTF8 const & suffix_str = HPS::UTF8());
2667  void FinalizeMeasurement(float measurement);
2668  void CleanupActiveMeasurement(bool delete_segment = false);
2669  Point CalculateLineMeasurementPosition();
2670  DistanceInfo CalculateDistance();
2671  Point ClosestPointOnTriangleToPoint(Point const & p, Point const & a, Point const & b, Point const & c);
2672  double ClosestPointSegmentSegment(Point const & p1, Point const & q1, Point const & p2, Point const & q2, Point & c1, Point & c2);
2673 
2674  bool SelectSnappingToVertex(WindowKey const & in_window, Point const & in_location, bool & point_is_snap_point);
2675  bool SelectSnappingToVertex(WindowKey const & in_window, Point const & in_location);
2676  bool SelectWithoutSnapping(WindowKey const & in_window, Point const & in_location);
2677 
2678  Point GetWorldPointFromVertex(size_t in_vertex_index, Key in_owning_geometry, KeyPath const & in_path_to_geometry);
2679  template <class T> Point GetPointFromGeometry(size_t in_point_index, T in_geometry)
2680  {
2681  PointArray points;
2682  if (in_geometry.ShowPointsByRange(in_point_index, 1, points))
2683  return points[0];
2684  return Point();
2685  }
2686  bool MeasurementLabelUnderCursor(WindowKey const & in_window, WindowPoint const & in_location, TextKey & out_text);
2687  static std::mutex index_mutex;
2688  static size_t point_to_point_index;
2689  static size_t line_index;
2690  static size_t angle_index;
2691  static size_t area_index;
2692  static size_t distance_index;
2693 
2694  TouchID tracked_touch_ID; // for touch events, the ID of the touch that started the measurement insertion
2695  MeasurementType current_measurement_type; // what kind of measurement is currently being inserted
2696  bool measurement_in_progress; // true is a measurement is in the process of being inserted
2697  HighlightOptionsKit highlight_options;
2698  SegmentKey measurement_segment;
2699  View last_attached_view;
2700  CADModel cad_model;
2701  HPS::Type cad_model_type;
2702  UTF8 length_units;
2703  UTF8 area_units;
2704  WindowPoint input_down_location;
2705  size_t input_down_click_count;
2706 
2707  // Selection Members
2708  bool established_selection_scope;
2709  SelectionOptionsKit subentity_selection_options;
2710  SelectionOptionsKit entity_selection_options;
2711  SelectionOptionsKit markup_selection_options;
2712  TreeContext tree_context;
2713 
2714  // members only valid if a measurement is being repositioned
2715  bool measurement_selected;
2716  PointArray selected_measurement_points;
2717  Point selected_measurement_position;
2718  MeasurementType selected_measurement_type;
2719  TextKey selected_measurement_text;
2720  LineKeyArray selected_measurement_leaders;
2721  SegmentKeyArray selected_measurement_segments;
2722  Vector selected_camera_direction;
2723  CircularArcKey selected_angle_arc;
2724  Plane selected_angle_plane;
2725 
2726  // Construction Geometry Members
2727  SegmentKey current_measurement_segment; //segment where the current measurement should be inserted
2728 
2729  // Angle specific members
2730  CircularArcKey angle_arc;
2731  TextKey angle_text;
2732  float last_angle_measurement;
2733  bool angle_measurement_inserted;
2734 
2735  // selection hint members
2736 #if TARGET_OS_IPHONE == 0 && TARGET_OS_ANDROID == 0
2737  bool selection_hint_enabled;
2738  bool selection_hint_active;
2739  SelectionHint selection_hint_state;
2740  SegmentKey preview_marker_root_segment;
2741  SegmentKey snapped_marker_segment;
2742  MarkerKey snapped_marker;
2743  SegmentKey valid_marker_segment;
2744  MarkerKey valid_marker;
2745  SegmentKey invalid_marker_segment;
2746  MarkerKey invalid_marker;
2747 #endif
2748 
2749  // snapping data
2750  bool snap_to_vertex;
2751  float snap_proximity;
2752  size_t measurement_precision;
2753 
2754  // shared measurement variables
2755  PointArray measurement_points;
2756  bool processing_double_click;
2757 
2758  // Area specific data
2759  Vector area_normal;
2760 
2761  // Line measurement variables
2762  LineMeasurementPosition line_measurement_position;
2763  LineKey last_inserted_line;
2764  TextKey last_inserted_length;
2765  float line_length;
2766 
2767  //distance measurement variables
2768  KeyPathArray selected_objects;
2769  TypeArray selected_objects_types;
2770  HighlightOptionsKit distance_measurement_highlight;
2771  SegmentKey distance_measurement_style_segment;
2772  HighlightOptionsKit distance_measurement_line_highlight;
2773  SegmentKey distance_measurement_line_style_segment;
2774  SegmentKey scratch_segment;
2775  DistanceMeasurementReference distance_measurement_reference;
2776 };
2777 
2778 }
2779 #endif
2780 
2781 
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:143
Definition: hps.h:6418
Definition: hps.h:85
MaterialKitArray GetHandlesColors() const
Definition: sprk_ops.h:2105
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:631
HandleType
Definition: sprk_ops.h:2013
MeasurementEvent()
Definition: sprk_ops.h:2584
MarkupInsertedEvent(Event const &in_event)
Definition: sprk_ops.h:1669
HPS::Rectangle GetWindowRectangle() const
Definition: sprk_ops.h:359
Definition: sprk.h:1102
bool GetSectioning()
Definition: sprk_ops.h:1383
std::vector< SegmentKey, Allocator< SegmentKey > > SegmentKeyArray
Array of type HPS::SegmentKey.
Definition: hps.h:6846
An InvalidSpecificationException is thrown when a method is called with non-sensical or contradictory...
Definition: hps.h:6022
SegmentKey GetSegmentKey()
Definition: sprk_ops.h:1640
static MouseButtons ButtonRight()
Definition: hps.h:48610
Definition: sprk_ops.h:1041
float GetIndicatorScale() const
Definition: sprk_ops.h:1346
Definition: sprk_ops.h:284
virtual HPS::UTF8 GetName() const override
Definition: sprk_ops.h:2031
std::vector< LineKey, Allocator< LineKey > > LineKeyArray
Array of type HPS::LineKey.
Definition: hps.h:6907
intptr_t GetChannel() const
Definition: hps.h:6535
Definition: hps.h:37976
Definition: hps.h:1766
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:973
Definition: sprk_ops.h:408
void SetMarkupType(MarkupType in_markup_type)
Definition: sprk_ops.h:1614
std::vector< KeyPath, Allocator< KeyPath > > KeyPathArray
Array of type HPS::KeyPath.
Definition: hps.h:6884
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:425
Definition: hps.h:49119
Definition: hps.h:7929
Definition: sprk_ops.h:69
AnnotationInsertedEvent()
Definition: sprk_ops.h:1879
Definition: hps.h:3639
Definition: hps.h:6788
ZoomType
Definition: sprk_ops.h:586
void SetIndicatorScale(float in_scale)
Definition: sprk_ops.h:1350
HPS::SelectionOptionsKit GetSelectionOptions() const
Definition: sprk_ops.h:541
Definition: hps.h:16646
Definition: sprk_ops.h:626
GeometryTransformedEvent(Event const &in_event)
Definition: sprk_ops.h:2211
void SetHandlesColors(MaterialKitArray const &in_colors)
Definition: sprk_ops.h:2088
void SetPlaneHighlightOptions(HighlightOptionsKit const &in_highlight_options)
Definition: sprk_ops.h:1366
Definition: sprk_ops.h:505
Definition: sprk_ops.h:20
Definition: sprk_ops.h:192
TextAttributeKit GetTextAttributes()
Definition: sprk_ops.h:1625
GeometryTransformedEvent()
Definition: sprk_ops.h:2194
Definition: hps.h:1590
Definition: hps.h:9173
RGBAColor GetHighlightColor() const
Definition: sprk_ops.h:2114
void SetLineAttribute(LineAttributeKit const &in_line_attributes)
Definition: sprk_ops.h:1635
Definition: sprk_ops.h:337
Definition: sprk_ops.h:1649
Definition: sprk_ops.h:690
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:1047
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:389
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:197
void SetSelectionOptions(HPS::SelectionOptionsKit const &in_options)
Definition: sprk_ops.h:536
HPS::SelectionOptionsKit GetSelectionOptions() const
Definition: sprk_ops.h:448
Definition: sprk_ops.h:1271
Definition: sprk_ops.h:2007
MeasurementEvent(Event const &in_event)
Definition: sprk_ops.h:2607
Definition: hps.h:49017
Definition: sprk_ops.h:734
Definition: sprk_ops.h:458
virtual HPS::UTF8 GetName() const override
Definition: sprk_ops.h:1803
std::vector< MaterialKit, Allocator< MaterialKit > > MaterialKitArray
Array of type HPS::MaterialKit.
Definition: hps.h:6863
Definition: hps.h:4607
Definition: sprk_ops.h:2423
Definition: sprk_ops.h:1538
AnnotationInsertedEvent(Event const &in_event)
Definition: sprk_ops.h:1895
bool GetIndicatorVisibility()
Definition: sprk_ops.h:1392
Event * Clone() const
Definition: sprk_ops.h:2228
bool IsMarkupActive()
Definition: sprk_ops.h:1647
Definition: hps.h:4546
RGBColor GetColor()
Definition: sprk_ops.h:1618
Definition: hps.h:7300
Definition: hps.h:48488
Definition: hps.h:45319
HPS::Rectangle GetInnerWindowRectangle() const
Definition: sprk_ops.h:364
Definition: hps.h:6252
Definition: hps.h:47378
Definition: hps.h:44399
Event * Clone() const
Definition: sprk_ops.h:1685
Definition: hps.h:48904
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:598
void SetTrailingGeometry(bool in_state)
Definition: sprk_ops.h:2165
Definition: sprk_ops.h:553
Definition: hps.h:16019
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:1286
HighlightOptionsKit GetPlaneHighlightOptions() const
Definition: sprk_ops.h:1362
Definition: hps.h:15262
bool GetMouseOverHighlighting() const
Definition: sprk_ops.h:1370
Definition: hps.h:45606
Definition: hps.h:47995
Projection
Definition: hps.h:1461
bool GetTrailingGeometry() const
Definition: sprk_ops.h:2170
Event * Clone() const
Definition: sprk_ops.h:1911
Definition: hps.h:6502
void SetSelectionOptions(HPS::SelectionOptionsKit const &in_options)
Definition: sprk_ops.h:443
Definition: hps.h:14267
std::vector< HPS::Type, Allocator< HPS::Type > > TypeArray
Array of type HPS::Type.
Definition: hps.h:6905
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:252
virtual bool OnKeyDown(KeyboardState const &in_state)
Definition: sprk_ops.h:1059
void SetMouseOverHighlighting(bool in_enable_mouse_over_highlighting)
Definition: sprk_ops.h:1374
MarkupType GetMarkupType()
Definition: sprk_ops.h:1611
Definition: sprk_ops.h:241
LineAttributeKit GetLineAttributes()
Definition: sprk_ops.h:1632
MeasurementType GetMeasurementType() const
Definition: sprk_ops.h:2525
SelectionHint
Definition: sprk_ops.h:2452
CADModel GetCADModel() const
Definition: sprk_ops.h:2175
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:74
void SetHighlightOptions(HPS::HighlightOptionsKit const &in_options)
Definition: sprk_ops.h:481
Definition: sprk_ops.h:1797
MaterialMappingKit GetPlaneMaterial() const
Definition: sprk_ops.h:1354
Definition: hps.h:47303
std::vector< Key, Allocator< Key > > KeyArray
Array of type HPS::Key.
Definition: hps.h:6856
DistanceMeasurementReference
Definition: sprk_ops.h:2445
std::vector< Plane, Allocator< Plane > > PlaneArray
Array of type HPS::Plane.
Definition: hps.h:6839
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:522
Definition: sprk_ops.h:583
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:341
HPS::HighlightOptionsKit GetHighlightOptions() const
Definition: sprk_ops.h:486
Definition: sprk_ops.h:967
Handedness
Definition: hps.h:1321
static MouseButtons ButtonLeft()
Definition: hps.h:48606
static MouseButtons ButtonMiddle()
Definition: hps.h:48614
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:289
Definition: hps.h:9331
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:562
static ModifierKeys KeyControl()
Definition: hps.h:48199
Definition: hps.h:7847
DistanceMeasurementReference GetDistanceMeasurementReference() const
Definition: sprk_ops.h:2574
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:739
std::vector< Point, Allocator< Point > > PointArray
Array of type HPS::Point.
Definition: hps.h:6829
HPS::HighlightOptionsKit GetHighlightOptions() const
Definition: sprk_ops.h:575
Definition: hps.h:9560
Definition: hps.h:11250
void SetTextAttribute(TextAttributeKit const &in_text_attributes)
Definition: sprk_ops.h:1628
LineMeasurementPosition
Definition: sprk_ops.h:2438
Definition: hps.h:24926
Definition: hps.h:25288
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:695
Definition: sprk.h:3886
void SetLineMeasurementPosition(LineMeasurementPosition in_position)
Definition: sprk_ops.h:2561
Event * Clone() const
Definition: sprk_ops.h:2625
void SetColor(RGBColor const &in_color)
Definition: sprk_ops.h:1621
Definition: sprk.h:1945
Definition: sprk_ops.h:138
virtual HPS::UTF8 GetName() const override
Definition: sprk_ops.h:1552
virtual bool OnKeyUp(KeyboardState const &in_state)
Definition: sprk_ops.h:1063
virtual HPS::UTF8 GetName() const
Definition: sprk_ops.h:469
virtual HPS::UTF8 GetName() const override
Definition: sprk_ops.h:2467
std::vector< ShellKey, Allocator< ShellKey > > ShellKeyArray
Array of type HPS::ShellKey.
Definition: hps.h:6906
MarkupInsertedEvent()
Definition: sprk_ops.h:1653
void SetHighlightOptions(HPS::HighlightOptionsKit const &in_options)
Definition: sprk_ops.h:570
LineMeasurementPosition GetLineMeasurementPosition() const
Definition: sprk_ops.h:2564
MeasurementType
Definition: sprk_ops.h:2429
Definition: sprk_ops.h:385
std::vector< size_t, Allocator< size_t > > SizeTArray
Array of type size_t.
Definition: hps.h:6844