API Search || Global Search
sprk.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_H
11 #define SPRK_H
12 
13 #include "hps.h"
14 
15 #include <memory>
16 
17 #ifdef _MSC_VER
18 # pragma warning(disable: 4251) //Not an issue as long as debug and release libraries aren't mixed
19 #ifndef STATIC_APP
20 # ifdef SPRK
21 # define SPRK_API __declspec (dllexport)
22 # else
23 # define SPRK_API __declspec (dllimport)
24 # endif
25 #endif
26 #else
27 # include <stddef.h>
28 # if defined(LINUX_SYSTEM) && defined(SPRK)
29 # ifndef STATIC_APP
30 # define SPRK_API __attribute__ ((visibility ("default")))
31 # endif
32 # endif
33 #endif
34 
35 #ifndef SPRK_API
36 # define SPRK_API
37 #endif
38 namespace SPRKI
39 {
40  class X;
41 };
42 
43 namespace HPS
44 {
45 
46 class Factory;
47 class Canvas;
48 class Layout;
49 class View;
50 class Model;
51 class Operator;
52 class OperatorControl;
53 class NavigationCubeControl;
54 class AxisTriadControl;
55 class Component;
56 class ComponentPath;
57 class ComponentHighlightEvent;
58 class Filter;
59 class Capture;
60 class CADModel;
61 class Metadata;
62 
63 
64 
65 
66 class SPRK_API Sprocket : public HPS::Object
67 {
68 public:
69  Sprocket() {}
70 #if !defined(_MSC_VER) || _MSC_VER >= 1900
71  Sprocket(HPS::Sprocket const & in_that) = default;
72 #endif
73  Sprocket(Sprocket && in_that) : HPS::Object(std::move(in_that)) {}
74 
75  virtual ~Sprocket() {}
76 };
77 
78 typedef std::shared_ptr<Operator> OperatorPtr;
79 
80 typedef std::vector<OperatorPtr, Allocator<OperatorPtr> > OperatorPtrArray;
81 
82 typedef std::vector<Canvas, Allocator<Canvas> > CanvasArray;
83 typedef std::vector<Layout, Allocator<Layout> > LayoutArray;
84 typedef std::vector<View, Allocator<View> > ViewArray;
85 typedef std::vector<Model, Allocator<Model> > ModelArray;
86 
87 typedef std::vector<Component, Allocator<Component> > ComponentArray;
88 typedef std::vector<Metadata, Allocator<Metadata> > MetadataArray;
89 typedef std::vector<Filter, Allocator<Filter> > FilterArray;
90 typedef std::vector<Capture, Allocator<Capture> > CaptureArray;
91 typedef std::vector<CADModel, Allocator<CADModel> > CADModelArray;
92 typedef std::vector<ReferenceKeyArray, Allocator<ReferenceKeyArray>> ReferenceKeyArrayArray;
93 typedef std::vector<ComponentPath, Allocator<ComponentPath>> ComponentPathArray;
94 typedef std::vector<HighlightOptionsKit, Allocator<HighlightOptionsKit>> HighlightOptionsKitArray;
95 
96 
100 class SPRK_API Canvas : public Sprocket
101 {
102 public:
103  Canvas();
104  Canvas(Canvas const & that);
105  ~Canvas();
106 
107  HPS::Type ObjectType() const { return HPS::Type::Canvas; }
108 
110  void Delete();
111 
112  Canvas & operator=(Canvas const & in_that);
113  void Assign(Canvas const & in_that);
114 
115  bool Equals(Canvas const & in_that) const;
116  bool operator!= (Canvas const & in_that) const;
117  bool operator== (Canvas const & in_that) const;
118 
120  UTF8 GetName() const;
121 
125  void AttachLayout(Layout const & in_layout);
126 
130  void AttachViewAsLayout(View const & in_view);
131 
133  void DetachLayout();
134 
136  Layout GetAttachedLayout() const;
137 
139  IncludeKey GetAttachedLayoutIncludeLink() const;
140 
142  View GetFrontView() const;
143 
144  WindowKey const GetWindowKey() const;
145 
148  WindowKey GetWindowKey();
149 
150  PortfolioKey const GetPortfolioKey() const;
151 
153  PortfolioKey GetPortfolioKey();
154 
156  void Update() const;
157 
160  UpdateNotifier UpdateWithNotifier() const;
161 
165  void Update(HPS::Window::UpdateType in_type, HPS::Time in_time_limit = -1.0) const;
166 
171  UpdateNotifier UpdateWithNotifier(HPS::Window::UpdateType in_type, HPS::Time in_time_limit = -1.0) const;
172 
176  void SetFrameRate(float in_frame_rate=20);
177 
181  float GetFrameRate() const;
182 };
183 
184 class SPRK_API Rendering
185 {
186 public:
189  enum class Mode
190  {
191  Gouraud,
192  GouraudWithLines,
193  Flat,
194  FlatWithLines,
195  Phong,
196  PhongWithLines,
197  HiddenLine,
198  FastHiddenLine,
199  Wireframe,
200  Default = Phong
201  };
202 
203 private:
204  Rendering() {}
205 };
206 
207 class SPRK_API SprocketControl : public Sprocket
208 {
209 public:
210  HPS::Type ObjectType() const {return HPS::Type::SprocketControl;}
211 
212 #if !defined(_MSC_VER) || _MSC_VER >= 1900
213  SprocketControl(HPS::SprocketControl const & in_that) = default;
214 #endif
215 
216 protected:
217  SprocketControl() {}
218 
222  SprocketControl(SprocketControl && in_that) : Sprocket(std::move(in_that)) {}
223 
228  {
229  this->Object::operator=(std::move(in_that));
230  return *this;
231  }
232 };
233 
234 class SPRK_API SprocketKit : public Sprocket
235 {
236 public:
237  HPS::Type ObjectType() const { return HPS::Type::SprocketKit; }
238 
239 #if !defined(_MSC_VER) || _MSC_VER >= 1900
240  SprocketKit(HPS::SprocketKit const & in_that) = default;
241 #endif
242 
243 protected:
244  SprocketKit() {}
245 
249  SprocketKit(SprocketKit && in_that) : Sprocket(std::move(in_that)) {}
250 
255  {
256  this->Object::operator=(std::move(in_that));
257  return *this;
258  }
259 };
260 
264 class SPRK_API View : public Sprocket
265 {
266 public:
267  View();
268  View(View const & that);
269  explicit View(SprocketControl const & in_ctrl);
270  ~View();
271 
272  HPS::Type ObjectType() const { return HPS::Type::View; }
273 
275  void Delete();
276 
277  View & operator=(View const & in_that);
278  void Assign(View const & in_that);
279 
280  bool Equals(View const & in_that) const;
281  bool operator!= (View const & in_that) const;
282  bool operator== (View const & in_that) const;
283 
285  UTF8 GetName() const;
286 
287 
290  HPS::View & ComputeFitWorldCamera(HPS::CameraKit & out_camera);
291 
295  HPS::View & ComputeFitWorldCamera(SegmentKey const & in_segment, HPS::CameraKit & out_camera);
296 
297 
301  HPS::View & ComputeFitWorldCamera(BoundingKit const & in_bounding, HPS::CameraKit & out_camera);
302 
308  HPS::View & ComputeFitWorldCamera(SegmentKey const & in_segment, MatrixKit const & in_transform, HPS::CameraKit & out_camera);
309 
310 
316  HPS::View & ComputeFitWorldCamera(BoundingKit const & in_bounding, MatrixKit const & in_transform, HPS::CameraKit & out_camera);
317 
318 
320  HPS::View & FitWorld();
321 
324  HPS::View & FitWorld(SegmentKey const & in_segment);
325 
326 
329  HPS::View & FitWorld(BoundingKit const & in_bounding);
330 
335  HPS::View & FitWorld(SegmentKey const & in_segment, MatrixKit const & in_transform);
336 
337 
342  HPS::View & FitWorld(BoundingKit const & in_bounding, MatrixKit const & in_transform);
343 
348  void AttachModel(Model const & in_model);
349 
351  void DetachModel();
352 
354  Model GetAttachedModel() const;
355 
357  IncludeKey GetAttachedModelIncludeLink() const;
358 
362  void SetRenderingMode(Rendering::Mode in_mode);
363 
366  Rendering::Mode GetRenderingMode() const;
367 
369  OperatorPtrArray GetOperators() const;
370 
373  void SetOperators(OperatorPtrArray & in_operators);
374 
378  void SetOperators(size_t in_count, OperatorPtr in_operators []);
379 
382  void SetOperator(OperatorPtr const & in_operator);
383 
387  void SetOperator(Operator * in_operator);
388 
390  OperatorControl GetOperatorControl();
391  OperatorControl const GetOperatorControl() const;
392 
394  NavigationCubeControl GetNavigationCubeControl();
395  NavigationCubeControl const GetNavigationCubeControl() const;
396 
398  AxisTriadControl GetAxisTriadControl();
399  AxisTriadControl const GetAxisTriadControl() const;
400 
403  SegmentKey GetSegmentKey();
404  SegmentKey const GetSegmentKey() const;
405 
408  SegmentKey GetModelOverrideSegmentKey();
409  SegmentKey const GetModelOverrideSegmentKey() const;
410 
411 
412  PortfolioKey const GetPortfolioKey() const;
413 
415  PortfolioKey GetPortfolioKey();
416 
421  void SetSimpleShadow(bool in_state, float in_percent_offset = 5.0f);
422 
424  bool GetSimpleShadow();
425 
430  void SetSimpleReflection(bool in_state, float in_percent_offset = 5.0f);
431 
433  bool GetSimpleReflection();
434 
436  void Update() const;
437 
440  UpdateNotifier UpdateWithNotifier() const;
441 
445  void Update(HPS::Window::UpdateType in_type, HPS::Time in_time_limit = -1.0) const;
446 
452  UpdateNotifier UpdateWithNotifier(HPS::Window::UpdateType in_type, HPS::Time in_time_limit = -1.0) const;
453 
457  void SmoothTransition(HPS::CameraKit const & in_camera_kit, HPS::Time in_duration = 0.5);
458 
459  static UTF8 GetHideStyleName();
460  static UTF8 GetShowStyleName();
461 
463  KeyArray const GetNavigationKeys();
464 
466  LayoutArray GetOwningLayouts();
467  LayoutArray const GetOwningLayouts() const;
468 };
469 
473 class SPRK_API Model : public Sprocket
474 {
475 public:
476  Model();
477  Model(Model const & that);
478  ~Model();
479 
480  HPS::Type ObjectType() const { return HPS::Type::Model; }
481 
483  void Delete();
484 
485  Model & operator=(Model const & in_that);
486  void Assign(Model const & in_that);
487 
488  bool Equals(Model const & in_that) const;
489  bool operator!= (Model const & in_that) const;
490  bool operator== (Model const & in_that) const;
491 
493  UTF8 GetName() const;
494 
497  SegmentKey GetSegmentKey();
498  SegmentKey const GetSegmentKey() const;
499 
501  SegmentKey GetLibraryKey();
502  SegmentKey const GetLibraryKey() const;
503 
505  PortfolioKey GetPortfolioKey();
506  PortfolioKey const GetPortfolioKey() const;
507 
509  HPS::Vector GetUpVector();
510  HPS::Vector const GetUpVector() const;
511 
513  HPS::Vector GetFrontVector();
514  HPS::Vector const GetFrontVector() const;
515 
517  HPS::ViewArray GetOwningViews();
518  HPS::ViewArray const GetOwningViews() const;
519 
523  void SetOrientation(HPS::Vector & in_up_vector, HPS::Vector & in_front_vector);
524 
526  bool ShowOrientation(HPS::Vector & out_up_vector, HPS::Vector & out_front_vector) const;
527 
529  void Update() const;
530 
533  UpdateNotifier UpdateWithNotifier() const;
534 
538  void Update(HPS::Window::UpdateType in_type, HPS::Time in_time_limit = -1.0) const;
539 
545  UpdateNotifier UpdateWithNotifier(HPS::Window::UpdateType in_type, HPS::Time in_time_limit = -1.0) const;
546 
547 };
548 
552 class SPRK_API Layout : public Sprocket
553 {
554 public:
555  Layout();
556  Layout(Layout const & that);
557  ~Layout();
558 
559  HPS::Type ObjectType() const { return HPS::Type::Layout; }
560 
562  void Delete();
563 
564  Layout & operator=(Layout const & in_that);
565  void Assign(Layout const & in_that);
566 
567  bool Equals(Layout const & in_that) const;
568  bool operator!= (Layout const & in_that) const;
569  bool operator== (Layout const & in_that) const;
570 
572  UTF8 GetName() const;
573 
575  size_t GetLayerCount() const;
576 
580  void AttachViewFront(View const & in_view, HPS::Rectangle const & in_position = HPS::Rectangle(-1.0f, 1.0f, -1.0f, 1.0f));
584  void AttachViewBack(View const & in_view, HPS::Rectangle const & in_position = HPS::Rectangle(-1.0f, 1.0f, -1.0f, 1.0f));
585 
588  void DetachLayer(size_t in_layer);
589 
592  void DetachView(View const & in_view); // everywhere it occurs
593 
596  void BringToFront(size_t in_layer);
597 
601  void ReassignLayer(size_t in_layer, HPS::View in_view);
602 
606  void RepositionLayer(size_t in_layer, HPS::Rectangle const & in_position);
607 
609  View GetFrontView() const;
610 
614  View GetAttachedView(size_t in_layer = 0) const;
615 
619  Rectangle GetPosition(size_t in_layer) const;
620 
622  IncludeKey GetAttachedViewIncludeLink(size_t in_layer) const;
623 
625  SegmentKey GetLayerSegmentKey(size_t in_layer) const;
626 
630  size_t GetLayerAt(HPS::WindowPoint const & in_point) const;
631 
635  bool ShowLayerAt(HPS::WindowPoint const & in_point) const;
636 
639  SegmentKey GetSegmentKey();
640  SegmentKey const GetSegmentKey() const;
641 
643  CanvasArray GetOwningCanvases();
644  CanvasArray const GetOwningCanvases() const;
645 
647  void Update() const;
648 
651  UpdateNotifier UpdateWithNotifier() const;
652 
656  void Update(HPS::Window::UpdateType in_type, HPS::Time in_time_limit = -1.0) const;
657 
663  UpdateNotifier UpdateWithNotifier(HPS::Window::UpdateType in_type, HPS::Time in_time_limit = -1.0) const;
664 
665 };
666 
667 class SPRK_API CanvasDeletedEvent : public Event
668 {
669 public:
672  {
673  channel = GetClassID();
674  consumable = false;
675  }
676 
677  CanvasDeletedEvent(Canvas const & in_canvas)
678  : Event(), canvas(in_canvas)
679  {
680  channel = GetClassID();
681  consumable = false;
682  }
683 
686  CanvasDeletedEvent(Event const & in_event) : Event(in_event)
687  {
688  if (in_event.GetChannel() == Object::ClassID<CanvasDeletedEvent>())
689  {
690  auto that = static_cast<CanvasDeletedEvent const &>(in_event);
691  canvas = that.canvas;
692  }
693  else
694  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
695  }
696 
698 
701  Event * Clone() const
702  {
703  CanvasDeletedEvent * new_event = new CanvasDeletedEvent(*this);
704  return new_event;
705  }
706 
707  Canvas canvas;
708 };
709 
710 class SPRK_API LayoutDetachedEvent : public Event
711 {
712 public:
715  {
716  channel = GetClassID();
717  consumable = false;
718  }
719 
720  LayoutDetachedEvent(Canvas const & in_canvas, Layout const & in_layout)
721  : Event(), canvas(in_canvas), layout(in_layout)
722  {
723  channel = GetClassID();
724  consumable = false;
725  }
726 
729  LayoutDetachedEvent(Event const & in_event) : Event(in_event)
730  {
731  if (in_event.GetChannel() == Object::ClassID<LayoutDetachedEvent>())
732  {
733  auto that = static_cast<LayoutDetachedEvent const &>(in_event);
734  canvas = that.canvas;
735  layout = that.layout;
736  }
737  else
738  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
739  }
740 
742 
745  Event * Clone() const
746  {
747  LayoutDetachedEvent * new_event = new LayoutDetachedEvent(*this);
748  return new_event;
749  }
750 
751  Canvas canvas;
752  Layout layout;
753 };
754 
755 class SPRK_API LayoutDeletedEvent : public Event
756 {
757 public:
760  {
761  channel = GetClassID();
762  consumable = false;
763  }
764 
765  LayoutDeletedEvent(Layout const & in_layout)
766  : Event(), layout(in_layout)
767  {
768  channel = GetClassID();
769  consumable = false;
770  }
771 
774  LayoutDeletedEvent(Event const & in_event) : Event(in_event)
775  {
776  if (in_event.GetChannel() == Object::ClassID<LayoutDeletedEvent>())
777  {
778  auto that = static_cast<LayoutDeletedEvent const &>(in_event);
779  layout = that.layout;
780  }
781  else
782  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
783  }
784 
786 
789  Event * Clone() const
790  {
791  LayoutDeletedEvent * new_event = new LayoutDeletedEvent(*this);
792  return new_event;
793  }
794 
795  Layout layout;
796 };
797 
798 class SPRK_API ViewDetachedEvent : public Event
799 {
800 public:
801  enum class Action
802  {
803  None = 0,
804  SpecificLayer,
805  AllLayers,
806  };
807 
809  ViewDetachedEvent() : Event(), action(Action::None), layer(0)
810  {
811  channel = GetClassID();
812  consumable = false;
813  }
814 
815  ViewDetachedEvent(Layout const & in_layout, size_t in_layer, View const & in_view)
816  : Event(), layout(in_layout), action(Action::SpecificLayer), layer(in_layer), view(in_view)
817  {
818  channel = GetClassID();
819  consumable = false;
820  }
821 
822  ViewDetachedEvent(Layout const & in_layout, View const & in_view)
823  : Event(), layout(in_layout), action(Action::AllLayers), layer(std::numeric_limits<size_t>::max()), view(in_view)
824  {
825  channel = GetClassID();
826  consumable = false;
827  }
828 
831  ViewDetachedEvent(Event const & in_event) : Event(in_event)
832  {
833  if (in_event.GetChannel() == Object::ClassID<ViewDetachedEvent>())
834  {
835  auto that = static_cast<ViewDetachedEvent const &>(in_event);
836  layout = that.layout;
837  action = that.action;
838  layer = that.layer;
839  view = that.view;
840  }
841  else
842  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
843  }
844 
846 
849  Event * Clone() const
850  {
851  ViewDetachedEvent * new_event = new ViewDetachedEvent(*this);
852  return new_event;
853  }
854 
855  Layout layout;
856  Action action;
857  size_t layer;
858  View view;
859 };
860 
861 class SPRK_API ViewDeletedEvent : public Event
862 {
863 public:
866  {
867  channel = GetClassID();
868  consumable = false;
869  }
870 
871  ViewDeletedEvent(View const & in_view)
872  : Event(), view(in_view)
873  {
874  channel = GetClassID();
875  consumable = false;
876  }
877 
880  ViewDeletedEvent(Event const & in_event) : Event(in_event)
881  {
882  if (in_event.GetChannel() == Object::ClassID<ViewDeletedEvent>())
883  {
884  auto that = static_cast<ViewDeletedEvent const &>(in_event);
885  view = that.view;
886  }
887  else
888  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
889  }
890 
891  ~ViewDeletedEvent();
892 
895  Event * Clone() const
896  {
897  ViewDeletedEvent * new_event = new ViewDeletedEvent(*this);
898  return new_event;
899  }
900 
901  View view;
902 };
903 
904 class SPRK_API ModelDetachedEvent : public Event
905 {
906 public:
909  {
910  channel = GetClassID();
911  consumable = false;
912  }
913 
914  ModelDetachedEvent(View const & in_view, Model const & in_model)
915  : Event(), view(in_view), model(in_model)
916  {
917  channel = GetClassID();
918  consumable = false;
919  }
920 
923  ModelDetachedEvent(Event const & in_event) : Event(in_event)
924  {
925  if (in_event.GetChannel() == Object::ClassID<ModelDetachedEvent>())
926  {
927  auto that = static_cast<ModelDetachedEvent const &>(in_event);
928  view = that.view;
929  model = that.model;
930  }
931  else
932  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
933  }
934 
936 
939  Event * Clone() const
940  {
941  ModelDetachedEvent * new_event = new ModelDetachedEvent(*this);
942  return new_event;
943  }
944 
945  View view;
946  Model model;
947 };
948 
949 class SPRK_API ModelDeletedEvent : public Event
950 {
951 public:
954  {
955  channel = GetClassID();
956  consumable = false;
957  }
958 
959  ModelDeletedEvent(Model const & in_model)
960  : Event(), model(in_model)
961  {
962  channel = GetClassID();
963  consumable = false;
964  }
965 
968  ModelDeletedEvent(Event const & in_event) : Event(in_event)
969  {
970  if (in_event.GetChannel() == Object::ClassID<ModelDeletedEvent>())
971  {
972  auto that = static_cast<ModelDeletedEvent const &>(in_event);
973  model = that.model;
974  }
975  else
976  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
977  }
978 
980 
983  Event * Clone() const
984  {
985  ModelDeletedEvent * new_event = new ModelDeletedEvent(*this);
986  return new_event;
987  }
988 
989  Model model;
990 };
991 
992 class SPRK_API CameraChangedEvent : public Event
993 {
994 public:
997  {
998  channel = GetClassID();
999  consumable = false;
1000  }
1001 
1002  CameraChangedEvent(View const & in_view)
1003  : Event(), view(in_view)
1004  {
1005  channel = GetClassID();
1006  consumable = false;
1007  }
1008 
1011  CameraChangedEvent(Event const & in_event) : Event(in_event)
1012  {
1013  if (in_event.GetChannel() == Object::ClassID<CameraChangedEvent>())
1014  {
1015  auto that = static_cast<CameraChangedEvent const &>(in_event);
1016  view = that.view;
1017  }
1018  else
1019  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
1020  }
1021 
1022  ~CameraChangedEvent();
1023 
1024  virtual bool Drop(Event const * in_that_event) const
1025  {
1026  CameraChangedEvent const * that_event = static_cast<CameraChangedEvent const *>(in_that_event);
1027 
1028  if (view == that_event->view)
1029  return true;
1030 
1031  return false;
1032  }
1033 
1034  virtual intptr_t Freshen() const
1035  {
1036  return GetClassID();
1037  }
1038 
1041  Event * Clone() const
1042  {
1043  CameraChangedEvent * new_event = new CameraChangedEvent(*this);
1044  return new_event;
1045  }
1046 
1047  View view;
1048 };
1049 
1052 class SPRK_API SprocketPath : public Sprocket
1053 {
1054 public:
1055  SprocketPath();
1056  SprocketPath(Model const & in_model, View const & in_view, Layout const & in_layout, Canvas const & in_canvas);
1057  SprocketPath(Canvas const & in_canvas, Layout const & in_layout, View const & in_view, Model const & in_model);
1058  SprocketPath(Canvas const & in_canvas, size_t in_layer = 0);
1059  SprocketPath(SprocketPath const & that);
1060  ~SprocketPath();
1061 
1062  HPS::Type ObjectType() const { return HPS::Type::SprocketPath; }
1063 
1064  SprocketPath & operator=(SprocketPath const & in_that);
1065  void Set(SprocketPath const & in_that);
1066 
1067  bool Equals(SprocketPath const & in_that) const;
1068  bool operator!= (SprocketPath const & in_that) const;
1069  bool operator== (SprocketPath const & in_that) const;
1070 
1072  Canvas GetCanvas() const;
1073 
1075  Layout GetLayout() const;
1076 
1078  View GetView() const;
1079 
1081  Model GetModel() const;
1082 
1087  KeyPath GetKeyPath() const;
1088 };
1089 
1090 
1093 class SPRK_API Operator : public Sprocket
1094 {
1095 public:
1096  Operator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
1097  Operator(Operator const & in_that);
1098 
1099  virtual ~Operator();
1100 
1101  HPS::Type ObjectType() const { return HPS::Type::Operator; }
1102 
1103  virtual Operator & operator= (Operator const & in_that);
1104 
1106  virtual void Assign(Operator const & in_that);
1107 
1109  virtual bool Equals(Operator const & in_that) const;
1110 
1112  virtual bool operator!= (Operator const & in_that) const;
1113 
1115  virtual bool operator== (Operator const & in_that) const;
1116 
1118  void DetachView();
1119 
1121  View GetAttachedView() const;
1122 
1124  virtual UTF8 GetName() const { return "Operator"; }
1125 
1129  virtual bool OnMouseDown(MouseState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1130 
1134  virtual bool OnMouseUp(MouseState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1135 
1139  virtual bool OnMouseMove(MouseState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1140 
1144  virtual bool OnMouseWheel(MouseState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1145 
1149  virtual bool OnMouseEnter(MouseState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1150 
1154  virtual bool OnMouseLeave(MouseState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1155 
1159  virtual bool OnTouchDown(TouchState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1160 
1164  virtual bool OnTouchUp(TouchState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1165 
1169  virtual bool OnTouchMove(TouchState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1170 
1174  virtual bool OnKeyDown(KeyboardState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1175 
1179  virtual bool OnKeyUp(KeyboardState const & in_state) { HPS_UNREFERENCED(in_state); return false; }
1180 
1184  virtual bool OnTextInput(HPS::UTF8 const & in_text) { HPS_UNREFERENCED(in_text); return false; }
1185 
1189  virtual bool OnTimerTick(HPS::TimerTickEvent const & in_event) { HPS_UNREFERENCED(in_event); return false; }
1190 
1192  virtual void OnViewAttached() { return; }
1193 
1195  virtual void OnViewDetached() { return; }
1196 
1199  virtual void OnModelAttached() { return; }
1200 
1203  virtual void OnModelDetached() { return; }
1204 
1206  void SetMouseTrigger(MouseButtons in_buttons) { mouse_trigger = in_buttons; }
1207 
1210  MouseButtons GetMouseTrigger() const { return mouse_trigger; }
1211 
1215  void SetModifierTrigger(ModifierKeys in_modifiers) { modifier_trigger = in_modifiers; }
1216 
1218  ModifierKeys GetModifierTrigger() const { return modifier_trigger; }
1219 
1221  virtual bool IsMouseTriggered(MouseState const & in_state) { return in_state.HasAll(mouse_trigger, modifier_trigger); }
1222 
1223  enum class Priority
1224  {
1225  Low,
1226  Default,
1227  High
1228  };
1229 
1230 protected:
1231 
1232  HPS::MouseButtons mouse_trigger;
1233  HPS::ModifierKeys modifier_trigger;
1234 };
1235 
1236 class SPRK_API OperatorUtility
1237 {
1238  static double internal_acos(double x)
1239  {
1240  return (((x)<-1) ? (HPS::PI) : (((x)>1) ? (0) : (acos(x))));
1241  }
1242 
1243 public:
1244 
1245  enum ProjectedPlane
1246  {
1247  Plane_XY,
1248  Plane_YZ,
1249  Plane_XZ
1250  };
1251 
1252  static void ScreenToSphereMousePoint(HPS::Point const &in_pt, HPS::Vector &out_vec)
1253  {
1254  out_vec = HPS::Vector(in_pt);
1255  float len = static_cast<float>(out_vec.Length());
1256  if (len > 1.0f)
1257  {
1258  out_vec /= len;
1259  out_vec.z = 0;
1260  }
1261  else
1262  out_vec.z = (float)sqrt(1.0f - (len*len));
1263  }
1264 
1265  static float CalculateAngleOrbitOnPlane(HPS::Vector const &axis, ProjectedPlane plane)
1266  {
1267  float theta;
1268 
1269  HPS::Vector vtmp;
1270  if (plane == Plane_XY)
1271  vtmp = HPS::Vector(axis.x, axis.y, 0);
1272  else if (plane == Plane_YZ)
1273  vtmp = HPS::Vector(0, axis.y, axis.z);
1274  else
1275  vtmp = HPS::Vector(axis.x, 0, axis.z);
1276  Vector naxis = axis;
1277 
1278  naxis.Normalize();
1279  vtmp.Normalize();
1280 
1281  float tmp = naxis.Dot(vtmp);
1282  if (static_cast<float>(Abs(tmp)) > 1.001f || static_cast<float>(Abs(tmp)) < 0.999f)
1283  theta = static_cast<float>(internal_acos(tmp));
1284  else
1285  theta = 0.0f;
1286 
1287  return theta;
1288  }
1289 };
1290 
1293 class SPRK_API OperatorControl : public SprocketControl
1294 {
1295 public:
1297  explicit OperatorControl(View const & in_view);
1298 
1300  OperatorControl(OperatorControl const & in_that);
1301 
1305  OperatorControl(OperatorControl && in_that);
1306 
1310  OperatorControl & operator=(OperatorControl && in_that);
1311 
1313  ~OperatorControl();
1314 
1315  HPS::Type ObjectType() const {return HPS::Type::OperatorControl;};
1316 
1318  OperatorControl & operator=(OperatorControl const & in_that);
1319 
1320 
1322  size_t GetCount();
1323 
1326  size_t GetCount(Operator::Priority in_priority);
1327 
1328 
1334  OperatorControl & Push(OperatorPtr const & in_operator, Operator::Priority in_priority = Operator::Priority::Default);
1335 
1342  OperatorControl & Push(Operator * in_operator, Operator::Priority in_priority = Operator::Priority::Default);
1343 
1347  bool Pop(Operator::Priority in_priority = Operator::Priority::Default);
1348 
1353  bool Pop(OperatorPtr & out_operator);
1354 
1360  bool Pop(Operator::Priority in_priority, OperatorPtr & out_operator);
1361 
1362 
1368  OperatorControl & Set(OperatorPtr const & in_operator, Operator::Priority in_priority = Operator::Priority::Default);
1369 
1376  OperatorControl & Set(Operator * in_operator, Operator::Priority in_priority = Operator::Priority::Default);
1377 
1383  OperatorControl & Set(OperatorPtrArray & in_operators, Operator::Priority in_priority = Operator::Priority::Default);
1384 
1391  OperatorControl & Set(size_t in_count, OperatorPtr in_operators [], Operator::Priority in_priority = Operator::Priority::Default);
1392 
1393 
1397  OperatorControl & UnsetTop(Operator::Priority in_priority = Operator::Priority::Default);
1398 
1402  OperatorControl & UnsetEverything(Operator::Priority in_priority);
1403 
1406  OperatorControl & UnsetEverything();
1407 
1408 
1412  bool ShowTop(OperatorPtr & out_operator) const;
1413 
1418  bool ShowTop(Operator::Priority in_priority, OperatorPtr & out_operator) const;
1419 
1423  bool Show(OperatorPtrArray & out_operators) const;
1424 
1429  bool Show(Operator::Priority in_priority, OperatorPtrArray & out_operators) const;
1430 
1431 private:
1433  OperatorControl() {}
1434 };
1435 
1442 {
1443 public:
1444 
1445  enum class Location
1446  {
1447  TopRight,
1448  TopLeft,
1449  BottomRight,
1450  BottomLeft,
1451  Custom,
1452  };
1453 
1455  explicit NavigationCubeControl(View const & in_view);
1456 
1459 
1464 
1468  NavigationCubeControl & operator=(NavigationCubeControl && in_that);
1469 
1472 
1473  HPS::Type ObjectType() const {return HPS::Type::NavigationCubeControl;};
1474 
1476  NavigationCubeControl & operator=(NavigationCubeControl const & in_that);
1477 
1486  NavigationCubeControl & SetLocation(Location in_location, HPS::Rectangle const & in_rectangle = HPS::Rectangle(), HPS::IntRectangle in_offsets = HPS::IntRectangle::Zero());
1487 
1490  Location GetLocation() const;
1491 
1495  NavigationCubeControl & SetPosition(HPS::Rectangle const & in_rectangle);
1496 
1499  HPS::Rectangle GetPosition() const;
1500 
1504  NavigationCubeControl & SetPositionOffsets(HPS::IntRectangle const & in_offsets);
1505 
1508  HPS::IntRectangle GetPositionOffsets() const;
1509 
1514  NavigationCubeControl & SetVisibility(bool in_visibility);
1515 
1518  bool GetVisibility() const;
1519 
1523  NavigationCubeControl & SetTextVisibility(bool in_text_visibility);
1524 
1527  bool GetTextVisibility() const;
1528 
1543  NavigationCubeControl & SetMaterialPalette(char const * in_material_palette);
1544 
1547  HPS::UTF8 GetMaterialPalette() const;
1548 
1556  NavigationCubeControl & SetInteractivity(bool in_interactivity);
1557 
1558 
1561  bool GetInteractivity() const;
1562 
1567  NavigationCubeControl & SetSize(float in_size);
1568 
1571  float GetSize() const;
1572 
1575  HPS::SegmentKey GetSegmentKey() const;
1576 
1577 private:
1580 
1582  HPS::SegmentKey GetNavigationCubeSegment() const;
1583 };
1584 
1587 class SPRK_API AxisTriadControl : public SprocketControl
1588 {
1589 public:
1590 
1591  enum class Location
1592  {
1593  TopRight,
1594  TopLeft,
1595  BottomRight,
1596  BottomLeft,
1597  Custom,
1598  };
1599 
1601  explicit AxisTriadControl(View const & in_view);
1602 
1604  AxisTriadControl(AxisTriadControl const & in_that);
1605 
1609  AxisTriadControl(AxisTriadControl && in_that);
1610 
1614  AxisTriadControl & operator=(AxisTriadControl && in_that);
1615 
1617  ~AxisTriadControl();
1618 
1619  HPS::Type ObjectType() const {return HPS::Type::AxisTriadControl;};
1620 
1622  AxisTriadControl & operator=(AxisTriadControl const & in_that);
1623 
1632  HPS::AxisTriadControl & SetLocation(Location in_location, HPS::Rectangle const & in_position = HPS::Rectangle(), HPS::IntRectangle in_offsets = HPS::IntRectangle::Zero());
1633 
1636  Location GetLocation() const;
1637 
1641  AxisTriadControl & SetPosition(HPS::Rectangle const & in_position);
1642 
1645  HPS::Rectangle GetPosition() const;
1646 
1650  AxisTriadControl & SetPositionOffsets(HPS::IntRectangle const & in_offsets);
1651 
1654  HPS::IntRectangle GetPositionOffsets() const;
1655 
1660  HPS::AxisTriadControl & SetVisibility(bool in_visibility);
1661 
1664  bool GetVisibility() const;
1665 
1669  HPS::AxisTriadControl & SetTextVisibility(bool in_text_visibility);
1670 
1673  bool GetTextVisibility() const;
1674 
1683  HPS::AxisTriadControl & SetMaterialPalette(char const * in_material_palette);
1684 
1687  HPS::UTF8 GetMaterialPalette() const;
1688 
1695  HPS::AxisTriadControl & SetInteractivity(bool in_interactivity);
1696 
1699  bool GetInteractivity() const;
1700 
1705  AxisTriadControl & SetSize(float in_size);
1706 
1709  float GetSize() const;
1710 
1713  HPS::SegmentKey GetSegmentKey() const;
1714 
1715 private:
1717  AxisTriadControl(){};
1718 
1720  HPS::SegmentKey GetAxisTriadSegment() const;
1721 };
1722 
1724 class SPRK_API Component : public Sprocket
1725 {
1726 public:
1729  enum class ComponentType : uint32_t
1730  {
1731  None = 0x00000000,
1732  GenericMask = 0xfffff000,
1733 
1734  ExchangeComponentMask = 0x00001000,
1735  ExchangeModelFile = 0x00001001,
1736  ExchangeProductOccurrence = 0x00001002,
1737  ExchangePartDefinition = 0x00001003,
1738 
1739  ExchangeView = 0x00001004,
1740  ExchangeFilter = 0x00001005,
1741 
1742  ExchangeRepresentationItemMask = 0x00003000,
1743  ExchangeRIBRepModel = 0x00003001,
1744  ExchangeRICurve = 0x00003002,
1745  ExchangeRIDirection = 0x00003003,
1746  ExchangeRIPlane = 0x00003004,
1747  ExchangeRIPointSet = 0x00003005,
1748  ExchangeRIPolyBRepModel = 0x00003006,
1749  ExchangeRIPolyWire = 0x00003007,
1750  ExchangeRISet = 0x00003008,
1751  ExchangeRICoordinateSystem = 0x00003009,
1752 
1753  ExchangeTopologyMask = 0x00005000,
1754  ExchangeTopoBody = 0x00005001,
1755  ExchangeTopoConnex = 0x00005002,
1756  ExchangeTopoShell = 0x00005003,
1757  ExchangeTopoFace = 0x00005004,
1758  ExchangeTopoLoop = 0x00005005,
1759  ExchangeTopoCoEdge = 0x00005006,
1760  ExchangeTopoEdge = 0x00005007,
1761  ExchangeTopoVertex = 0x00005008,
1762  ExchangeTopoSingleWireBody = 0x00005009,
1763  ExchangeTopoWireEdge = 0x0000500a,
1764 
1765  ExchangeDrawingMask = 0x00009000,
1766  ExchangeDrawingModel = 0x00009001,
1767  ExchangeDrawingView = 0x00009002,
1768  ExchangeDrawingSheet = 0x00009003,
1769  ExchangeBasicDrawingBlock = 0x00009004,
1770  ExchangeOperatorDrawingBlock = 0x00009005,
1771 
1772  ExchangePMIMask = 0x00011000,
1773  ExchangePMI = ExchangePMIMask,
1774  ExchangePMIText = 0x00011100,
1775  ExchangePMIRichText = 0x00011200,
1776  ExchangePMIRoughness = 0x00011300,
1777  ExchangePMIGDT = 0x00011400,
1778  ExchangePMIDatum = 0x00011500,
1779  ExchangePMILineWelding = 0x00011600,
1780  ExchangePMISpotWelding = 0x00011700,
1781  ExchangePMIDimension = 0x00011800,
1782  ExchangePMIBalloon = 0x00011900,
1783  ExchangePMICoordinate = 0x00011a00,
1784  ExchangePMIFastener = 0x00011b00,
1785  ExchangePMILocator = 0x00011c00,
1786  ExchangePMIMeasurementPoint = 0x00011d00,
1787 
1788 
1789  ParasolidComponentMask = 0x00020000,
1790 
1791  ParasolidModelFile = 0x00020001,
1792  ParasolidAssembly = 0x00020002,
1793  ParasolidInstance = 0x00020003,
1794 
1795  ParasolidTopologyMask = 0x00060000,
1796  ParasolidTopoBody = 0x00060001,
1797  ParasolidTopoRegion = 0x00060002,
1798  ParasolidTopoShell = 0x00060003,
1799  ParasolidTopoFace = 0x00060004,
1800  ParasolidTopoLoop = 0x00060005,
1801  ParasolidTopoFin = 0x00060006,
1802  ParasolidTopoEdge = 0x00060007,
1803  ParasolidTopoVertex = 0x00060008,
1804 
1805 
1806  DWGComponentMask = 0x00100000,
1807  DWGModelFile = 0x00100001,
1808  DWGLayout = 0x00100002,
1809  DWGBlockTable = 0x00100003,
1810  DWGBlockTableRecord = 0x00100004,
1811  DWGEntity = 0x00100005,
1812  DWGLayerTable = 0x00100006,
1813  DWGLayer = 0x00100007,
1814 
1815 
1816  UserComponent = 0x01000000,
1817  };
1818 
1819 
1821  Component();
1822 
1825  Component(Component const & in_that);
1826 
1829  Component(Component && in_that);
1830 
1832  virtual ~Component();
1833 
1834  HPS::Type ObjectType() const { return HPS::Type::Component; }
1835 
1836 
1840  Component & operator=(Component const & in_that);
1841 
1845  Component & operator=(Component && in_that);
1846 
1850  virtual void Assign(Component const & in_that);
1851 
1855  bool Equals(Component const & in_that) const;
1856 
1860  bool operator!=(Component const & in_that) const;
1861 
1865  bool operator==(Component const & in_that) const;
1866 
1867 
1870  ComponentType GetComponentType() const;
1871 
1875  bool HasComponentType(ComponentType in_mask) const;
1876 
1877 
1878 
1884  void AddKey(Key const & in_key);
1885 
1888  KeyArray GetKeys() const;
1889 
1890 
1891 
1896  void AddOwner(Component & in_owner, IncludeKey const & in_include = IncludeKey());
1897 
1901  ComponentArray GetOwners() const;
1902 
1905  ComponentArray GetSubcomponents() const;
1906 
1911  ComponentArray GetAllSubcomponents(ComponentType in_type) const;
1912 
1913 
1914 
1917  void AddReference(Component & in_reference);
1918 
1921  ComponentArray GetReferrers() const;
1922 
1926  ComponentArray GetReferences() const;
1927 
1928 
1929 
1932  MetadataArray GetAllMetadata() const;
1933 
1937  Metadata GetMetadata(char const * in_name) const;
1938 
1942  UTF8 GetName() const;
1943 
1944 
1945 
1998  void Delete();
1999 
2003  void Flush();
2004 
2005 
2013  static KeyPathArray GetKeyPath(Component const & in_component);
2014 
2024  static KeyPathArray GetKeyPath(size_t in_count, Component const in_components[]);
2025 
2034  static KeyPathArray GetKeyPath(ComponentArray const & in_components);
2035 };
2036 
2038 class SPRK_API ComponentPath : public Sprocket
2039 {
2040 public:
2042  ComponentPath();
2043 
2046  ComponentPath(ComponentArray const & in_components);
2047 
2051  ComponentPath(size_t in_count, Component const in_components[]);
2052 
2054  ComponentPath(ComponentPath const & in_that);
2055 
2059  ComponentPath(ComponentPath && in_that);
2060 
2064  ComponentPath & operator=(ComponentPath && in_that);
2065 
2067  virtual ~ComponentPath();
2068 
2069  HPS::Type ObjectType() const { return HPS::Type::ComponentPath; }
2070 
2073  bool Empty() const;
2074 
2078  ComponentPath & operator+=(Component const & in_component);
2079 
2083  ComponentPath & operator+=(ComponentPath const & in_path);
2084 
2088  ComponentPath & operator+=(ComponentArray const & in_components);
2089 
2093  ComponentPath & Append(Component const & in_component);
2094 
2098  ComponentPath & Append(ComponentPath const & in_path);
2099 
2103  ComponentPath & Append(ComponentArray const & in_components);
2104 
2108  ComponentPath & operator=(ComponentPath const & in_that);
2109 
2113  ComponentPath & operator=(ComponentArray const & in_path);
2114 
2117  void Set(ComponentPath const & in_that);
2118 
2122  bool Equals(ComponentPath const & in_that) const;
2123 
2127  bool operator!= (ComponentPath const & in_that) const;
2128 
2132  bool operator== (ComponentPath const & in_that) const;
2133 
2134 
2138  ComponentPath & SetComponents(ComponentArray const & in_components);
2139 
2144  ComponentPath & SetComponents(size_t in_count, Component const in_components[]);
2145 
2148  ComponentArray GetComponents() const;
2149 
2153  KeyPathArray GetKeyPaths() const;
2154 
2159  KeyPathArray GetKeyPaths(Canvas const & in_canvas, size_t in_layer = 0) const;
2160 
2161 
2165  void Highlight(Canvas const & in_canvas, HighlightOptionsKit const & in_options) const;
2166 
2171  void Highlight(Canvas const & in_canvas, size_t in_layer, HighlightOptionsKit const & in_options) const;
2172 
2176  void Unhighlight(Canvas const & in_canvas, HighlightOptionsKit const & in_options = HighlightOptionsKit()) const;
2177 
2182  void Unhighlight(Canvas const & in_canvas, size_t in_layer, HighlightOptionsKit const & in_options = HighlightOptionsKit()) const;
2183 
2184 
2189  void Hide(Canvas const & in_canvas, size_t in_layer = 0);
2190 
2195  void Show(Canvas const & in_canvas, size_t in_layer = 0);
2196 
2202  bool IsHidden(Canvas const & in_canvas, size_t in_layer = 0);
2203 
2209  void Isolate(Canvas const & in_canvas, size_t in_layer = 0);
2210 
2217  static void Isolate(HPS::ComponentPathArray & in_components_to_be_isolated, Canvas const & in_canvas, size_t in_layer = 0);
2218 };
2219 
2220 
2225 inline ComponentPath operator+(Component const & in_lhs, Component const & in_rhs)
2226 {
2227  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2228 }
2229 
2234 inline ComponentPath operator+(Component const & in_lhs, ComponentArray const & in_rhs)
2235 {
2236  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2237 }
2238 
2243 inline ComponentPath operator+(Component const & in_lhs, ComponentPath const & in_rhs)
2244 {
2245  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2246 }
2247 
2252 inline ComponentPath operator+(ComponentArray const & in_lhs, Component const & in_rhs)
2253 {
2254  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2255 }
2256 
2261 inline ComponentPath operator+(ComponentArray const & in_lhs, ComponentArray const & in_rhs)
2262 {
2263  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2264 }
2265 
2270 inline ComponentPath operator+(ComponentArray const & in_lhs, ComponentPath const & in_rhs)
2271 {
2272  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2273 }
2274 
2279 inline ComponentPath operator+(ComponentPath const & in_lhs, Component const & in_rhs)
2280 {
2281  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2282 }
2283 
2288 inline ComponentPath operator+(ComponentPath const & in_lhs, ComponentArray const & in_rhs)
2289 {
2290  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2291 }
2292 
2297 inline ComponentPath operator+(ComponentPath const & in_lhs, ComponentPath const & in_rhs)
2298 {
2299  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2300 }
2301 
2302 
2304 class SPRK_API ComponentHighlightEvent : public Event
2305 {
2306 public:
2307  enum class Action
2308  {
2309  None = 0,
2310  Highlight,
2311  Unhighlight,
2312  };
2313 
2316  {
2317  channel = GetClassID();
2318  consumable = false;
2319  action = Action::None;
2320  }
2321 
2322  ComponentHighlightEvent(Action in_action,
2323  ComponentPath const & in_path = ComponentPath(),
2324  HighlightOptionsKit const & in_options = HighlightOptionsKit())
2325  : Event(), action(in_action), path(in_path), options(in_options)
2326  {
2327  channel = GetClassID();
2328  consumable = false;
2329  }
2330 
2333  ComponentHighlightEvent(Event const & in_event) : Event(in_event)
2334  {
2335  if (in_event.GetChannel() == Object::ClassID<ComponentHighlightEvent>())
2336  {
2337  auto that = static_cast<ComponentHighlightEvent const &>(in_event);
2338  action = that.action;
2339  path = that.path;
2340  options = that.options;
2341  }
2342  else
2343  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
2344  }
2345 
2347 
2350  Event * Clone() const
2351  {
2352  ComponentHighlightEvent * new_event = new ComponentHighlightEvent(*this);
2353  return new_event;
2354  }
2355 
2356  Action action;
2357  ComponentPath path;
2358  HighlightOptionsKit options;
2359 };
2360 
2361 
2363 class SPRK_API Filter : public Component
2364 {
2365 public:
2367  Filter();
2368 
2372  Filter(Component const & in_that);
2373 
2376  Filter(Filter const & in_that);
2377 
2380  Filter(Filter && in_that);
2381 
2382  virtual ~Filter();
2383 
2384  HPS::Type ObjectType() const { return HPS::Type::Filter; }
2385 
2386 
2387 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2388  Filter & operator=(Filter const & in_that) = default;
2389 #endif
2390 
2394  Filter & operator=(Filter && in_that);
2395 
2396 
2399  void Activate(View const & in_view);
2400 
2403  void Deactivate(View const & in_view);
2404 };
2405 
2406 
2407 class SPRK_API FilterActivationEvent : public Event
2408 {
2409 public:
2410  enum class Action
2411  {
2412  None = 0,
2413  Activate,
2414  Deactivate,
2415  };
2416 
2419  {
2420  channel = GetClassID();
2421  consumable = false;
2422  }
2423 
2424  FilterActivationEvent(Filter in_filter, Action in_action, View in_view) : Event(), filter(in_filter), action(in_action), view(in_view)
2425  {
2426  channel = GetClassID();
2427  consumable = false;
2428  }
2429 
2432  FilterActivationEvent(Event const & in_event) : Event(in_event)
2433  {
2434  if (in_event.GetChannel() == Object::ClassID<FilterActivationEvent>())
2435  {
2436  auto that = static_cast<FilterActivationEvent const &>(in_event);
2437  filter = that.filter;
2438  action = that.action;
2439  view = that.view;
2440  }
2441  else
2442  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
2443  }
2444 
2446 
2449  Event * Clone() const
2450  {
2451  FilterActivationEvent * new_event = new FilterActivationEvent(*this);
2452  return new_event;
2453  }
2454 
2455  Filter filter;
2456  Action action;
2457  View view;
2458 };
2459 
2460 
2462 class SPRK_API Capture : public Component
2463 {
2464 public:
2466  Capture();
2467 
2471  Capture(Component const & in_that);
2472 
2475  Capture(Capture const & in_that);
2476 
2479  Capture(Capture && in_that);
2480 
2481  virtual ~Capture();
2482 
2483  HPS::Type ObjectType() const { return HPS::Type::Capture; }
2484 
2485 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2486  Capture & operator=(Capture const & in_that) = default;
2487 #endif
2488 
2492  Capture & operator=(Capture && in_that);
2493 
2494 
2498  View Activate();
2499 };
2500 
2501 
2502 class SPRK_API CaptureActivationEvent : public Event
2503 {
2504 public:
2507  {
2508  channel = GetClassID();
2509  consumable = false;
2510  }
2511 
2512  CaptureActivationEvent(Capture in_capture, View in_view) : Event(), capture(in_capture), view(in_view)
2513  {
2514  channel = GetClassID();
2515  consumable = false;
2516  }
2517 
2520  CaptureActivationEvent(Event const & in_event) : Event(in_event)
2521  {
2522  if (in_event.GetChannel() == Object::ClassID<CaptureActivationEvent>())
2523  {
2524  auto that = static_cast<CaptureActivationEvent const &>(in_event);
2525  capture = that.capture;
2526  view = that.view;
2527  }
2528  else
2529  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
2530  }
2531 
2533 
2536  Event * Clone() const
2537  {
2538  CaptureActivationEvent * new_event = new CaptureActivationEvent(*this);
2539  return new_event;
2540  }
2541 
2542  Capture capture;
2543  View view;
2544 };
2545 
2546 
2548 class SPRK_API CADModel : public Component
2549 {
2550 public:
2552  CADModel();
2553 
2557  CADModel(Component const & in_that);
2558 
2561  CADModel(CADModel const & in_that);
2562 
2565  CADModel(CADModel && in_that);
2566 
2569  CADModel(Model const & in_that);
2570 
2571  virtual ~CADModel();
2572 
2573  HPS::Type ObjectType() const { return HPS::Type::CADModel; }
2574 
2575 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2576  CADModel & operator=(CADModel const & in_that) = default;
2577 #endif
2578 
2582  CADModel & operator=(CADModel && in_that);
2583 
2584 
2588  Component GetComponentFromKey(Key const & in_key) const;
2589 
2597  ComponentPath GetComponentPath(KeyPath const & in_key_path) const;
2598 
2607  ComponentPath GetComponentPath(SelectionItem const & in_item) const;
2608 
2609 
2612  Model GetModel() const;
2613 
2616  FilterArray GetAllFilters() const;
2617 
2620  CaptureArray GetAllCaptures() const;
2621 
2625  FilterArray GetActiveFilters(View const & in_view) const;
2626 
2627 
2631  View ActivateDefaultCapture();
2632 
2633 
2641  void ResetVisibility(Canvas & in_canvas, size_t in_layer = 0);
2642 };
2643 
2644 
2645 
2648 class SPRK_API Metadata : public Sprocket
2649 {
2650 public:
2652  Metadata();
2653 
2656  Metadata(Metadata const & in_that);
2657 
2660  Metadata(Metadata && in_that);
2661 
2664  Metadata(char const * in_name);
2665 
2666  virtual ~Metadata();
2667 
2668  HPS::Type ObjectType() const { return HPS::Type::Metadata; }
2669 
2670 
2674  Metadata & operator=(Metadata const & in_that);
2675 
2679  Metadata & operator=(Metadata && in_that);
2680 
2684  virtual void Assign(Metadata const & in_that);
2685 
2689  bool Equals(Metadata const & in_that) const;
2690 
2694  bool operator!=(Metadata const & in_that) const;
2695 
2699  bool operator==(Metadata const & in_that) const;
2700 
2701 
2704  HPS::UTF8 GetName() const;
2705 
2708  void SetName(char const * in_name);
2709 };
2710 
2712 class SPRK_API IntegerMetadata : public Metadata
2713 {
2714 public:
2716  IntegerMetadata();
2717 
2721  IntegerMetadata(Metadata const & in_that);
2722 
2725  IntegerMetadata(IntegerMetadata const & in_that);
2726 
2729  IntegerMetadata(IntegerMetadata && in_that);
2730 
2734  IntegerMetadata(char const * in_name, int in_value);
2735 
2736  virtual ~IntegerMetadata();
2737 
2738  HPS::Type ObjectType() const { return HPS::Type::IntegerMetadata; }
2739 
2740 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2741  IntegerMetadata & operator=(IntegerMetadata const & in_that) = default;
2742 #endif
2743 
2747  IntegerMetadata & operator=(IntegerMetadata && in_that);
2748 
2749 
2752  int GetValue() const;
2753 
2756  void SetValue(int in_value);
2757 };
2758 
2760 class SPRK_API UnsignedIntegerMetadata : public Metadata
2761 {
2762 public:
2765 
2769  UnsignedIntegerMetadata(Metadata const & in_that);
2770 
2774 
2778 
2782  UnsignedIntegerMetadata(char const * in_name, unsigned int in_value);
2783 
2784  virtual ~UnsignedIntegerMetadata();
2785 
2786  HPS::Type ObjectType() const { return HPS::Type::UnsignedIntegerMetadata; }
2787 
2788 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2789  UnsignedIntegerMetadata & operator=(UnsignedIntegerMetadata const & in_that) = default;
2790 #endif
2791 
2795  UnsignedIntegerMetadata & operator=(UnsignedIntegerMetadata && in_that);
2796 
2797 
2800  unsigned int GetValue() const;
2801 
2804  void SetValue(unsigned int in_value);
2805 };
2806 
2808 class SPRK_API DoubleMetadata : public Metadata
2809 {
2810 public:
2812  DoubleMetadata();
2813 
2817  DoubleMetadata(Metadata const & in_that);
2818 
2821  DoubleMetadata(DoubleMetadata const & in_that);
2822 
2825  DoubleMetadata(DoubleMetadata && in_that);
2826 
2830  DoubleMetadata(char const * in_name, double in_value);
2831 
2832  virtual ~DoubleMetadata();
2833 
2834  HPS::Type ObjectType() const { return HPS::Type::DoubleMetadata; }
2835 
2836 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2837  DoubleMetadata & operator=(DoubleMetadata const & in_that) = default;
2838 #endif
2839 
2843  DoubleMetadata & operator=(DoubleMetadata && in_that);
2844 
2845 
2848  double GetValue() const;
2849 
2852  void SetValue(double in_value);
2853 };
2854 
2856 class SPRK_API StringMetadata : public Metadata
2857 {
2858 public:
2860  StringMetadata();
2861 
2865  StringMetadata(Metadata const & in_that);
2866 
2869  StringMetadata(StringMetadata const & in_that);
2870 
2873  StringMetadata(StringMetadata && in_that);
2874 
2878  StringMetadata(char const * in_name, char const * in_value);
2879 
2880  virtual ~StringMetadata();
2881 
2882  HPS::Type ObjectType() const { return HPS::Type::StringMetadata; }
2883 
2884 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2885  StringMetadata & operator=(StringMetadata const & in_that) = default;
2886 #endif
2887 
2891  StringMetadata & operator=(StringMetadata && in_that);
2892 
2893 
2896  UTF8 GetValue() const;
2897 
2900  void SetValue(char const * in_value);
2901 };
2902 
2904 class SPRK_API TimeMetadata : public Metadata
2905 {
2906 public:
2908  TimeMetadata();
2909 
2913  TimeMetadata(Metadata const & in_that);
2914 
2917  TimeMetadata(TimeMetadata const & in_that);
2918 
2921  TimeMetadata(TimeMetadata && in_that);
2922 
2926  TimeMetadata(char const * in_name, unsigned int in_value);
2927 
2928  virtual ~TimeMetadata();
2929 
2930  HPS::Type ObjectType() const { return HPS::Type::TimeMetadata; }
2931 
2932 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2933  TimeMetadata & operator=(TimeMetadata const & in_that) = default;
2934 #endif
2935 
2939  TimeMetadata & operator=(TimeMetadata && in_that);
2940 
2941 
2944  unsigned int GetValue() const;
2945 
2948  HPS::UTF8 GetValueAsString() const;
2949 
2952  void SetValue(unsigned int in_value);
2953 };
2954 
2955 
2957 class SPRK_API BooleanMetadata : public Metadata
2958 {
2959 public:
2961  BooleanMetadata();
2962 
2966  BooleanMetadata(Metadata const & in_that);
2967 
2970  BooleanMetadata(BooleanMetadata const & in_that);
2971 
2974  BooleanMetadata(BooleanMetadata && in_that);
2975 
2979  BooleanMetadata(char const * in_name, bool in_value);
2980 
2981  virtual ~BooleanMetadata();
2982 
2983  HPS::Type ObjectType() const { return HPS::Type::BooleanMetadata; }
2984 
2985 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2986  BooleanMetadata & operator=(BooleanMetadata const & in_that) = default;
2987 #endif
2988 
2992  BooleanMetadata & operator=(BooleanMetadata && in_that);
2993 
2994 
2997  bool GetValue() const;
2998 
3001  void SetValue(bool in_value);
3002 };
3003 
3004 
3005 
3007 class SPRK_API Factory : public Sprocket
3008 {
3009 public:
3010 
3013  static CanvasArray GetCanvases();
3014 
3017  static LayoutArray GetLayouts();
3018 
3021  static ViewArray GetViews();
3022 
3025  static ModelArray GetModels();
3026 
3029  static CADModelArray GetCADModels();
3030 
3036  static Canvas CreateCanvas(HPS::WindowHandle in_window_handle, char const * in_name = "", HPS::ApplicationWindowOptionsKit const & in_options = HPS::ApplicationWindowOptionsKit());
3037 
3042  static Canvas CreateCanvas(char const * in_name = "", HPS::StandAloneWindowOptionsKit const & in_options = HPS::StandAloneWindowOptionsKit());
3043 
3049  static Canvas CreateCanvas(HPS::WindowKey const & in_window_key, HPS::PortfolioKey const & in_portfolio_key = HPS::PortfolioKey(), char const * in_name = "");
3050 
3054  static Layout CreateLayout(char const * in_name = "");
3055 
3059  static View CreateView(char const * in_name = "");
3060 
3064  static Model CreateModel(char const * in_name = "");
3065 
3066  static Component CreateComponent(HPS::Component const & in_owner, char const * in_name = "");
3067 
3068 private:
3069  Factory() {}
3070 };
3071 
3081 class SPRK_API AxisTriadOperator : public Operator
3082 {
3083 public:
3084  AxisTriadOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
3086  virtual HPS::UTF8 GetName() const { return "HPS_AxisTriadOperator"; }
3087 
3093  virtual bool OnMouseDown(MouseState const & in_state);
3098  virtual bool OnMouseUp(MouseState const & in_state);
3103  virtual bool OnMouseMove(MouseState const & in_state);
3104 
3109  virtual bool OnTouchDown(TouchState const & in_state);
3114  virtual bool OnTouchUp(TouchState const & in_state);
3119  virtual bool OnTouchMove(TouchState const & in_state);
3120 
3121  virtual void OnViewAttached();
3122 
3123 private:
3124 
3125  bool AxisOrbit(HPS::WindowPoint const & in_loc);
3126  void Transition(HPS::SelectionResults selection_results);
3127  void TranslatePoint(HPS::WindowPoint * point);
3128  bool IsEventRelevant(HPS::Point const & event_location);
3129 
3130  bool operator_active;
3131  HPS::WindowPoint start_point;
3132  HPS::Vector start_sphere_point;
3133  float axis_subwindow_width;
3134  float axis_subwindow_height;
3135  HPS::TouchID tracked_touch_ID;
3136  HPS::Rectangle axis_subwindow;
3137  HPS::IntRectangle axis_subwindow_offsets;
3138  HPS::SegmentKey axis_triad_segment;
3139 
3140 };
3141 
3144 {
3145 public:
3148  virtual ~SmoothTransitionCompleteEvent();
3149 
3152  SmoothTransitionCompleteEvent(HPS::View const & in_view) : view(in_view)
3153  { channel = HPS::Object::ClassID<SmoothTransitionCompleteEvent>(); }
3154 
3157  SmoothTransitionCompleteEvent(Event const & in_event) : Event(in_event)
3158  {
3159  if (in_event.GetChannel() == Object::ClassID<SmoothTransitionCompleteEvent>())
3160  {
3161  auto that = static_cast<SmoothTransitionCompleteEvent const &>(in_event);
3162  view = that.view;
3163  }
3164  else
3165  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
3166  }
3167 
3170  Event * Clone() const
3171  {
3173  return new_event;
3174  }
3175 
3179  virtual bool Drop(Event const * in_that_event) const
3180  {
3181  HPS_UNREFERENCED(in_that_event);
3182  return false;
3183  }
3184 
3185  HPS::View view;
3186 };
3187 
3206 class SPRK_API NavigationCubeOperator : public Operator
3207 {
3208 public:
3209  NavigationCubeOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
3210  ~NavigationCubeOperator() { }
3211 
3213  virtual HPS::UTF8 GetName() const { return "HPS_NavigationCubeOperator"; }
3214 
3219  virtual bool OnMouseDown(MouseState const & in_state);
3224  virtual bool OnMouseUp(MouseState const & in_state);
3229  virtual bool OnMouseMove(MouseState const & in_state);
3230 
3234  virtual bool OnTouchDown(TouchState const & in_state);
3239  virtual bool OnTouchUp(TouchState const & in_state);
3244  virtual bool OnTouchMove(TouchState const & in_state);
3245 
3246  virtual void OnViewAttached();
3247  virtual void OnViewDetached();
3248 
3249  virtual void OnModelAttached();
3250 
3251  void UpdateHighlightColor();
3252 
3257  void SetReferenceSegment(HPS::KeyPath const & in_path_to_segment);
3258 
3263  void SetReferenceSegment(HPS::KeyPathArray const & in_path_to_segments);
3264 
3268  HPS::KeyPathArray ShowReferenceSegment();
3269 
3270 private:
3271  void Transition(HPS::SelectionResults const & selection_results);
3272  bool Orbit(HPS::WindowPoint const & in_loc);
3273  void TranslatePoint(HPS::WindowPoint * point);
3274  bool IsEventRelevant(HPS::Point const & event_location, HPS::KeyPath const & event_path);
3275  bool AreCamerasEqual(HPS::CameraKit const & this_camera, HPS::CameraKit const & that_camera);
3276 
3277  bool operator_active;
3278  HPS::TouchID tracked_touch_ID;
3279  HPS::WindowPoint start_point;
3280  HPS::WindowPoint down_position;
3281  HPS::Vector start_sphere_point;
3282  HPS::KeyPathArray reference_segments; //rotation and zooming happen around these segments
3283 
3284  HPS::SegmentKey nav_cube_segment;
3285  HPS::SegmentKey style_segment;
3286  HPS::PortfolioKey portfolio;
3287  HPS::ReferenceKeyArrayArray groups;
3288  HPS::HighlightOptionsKit highlight_options_kit;
3289  HPS::CameraKit previous_camera;
3290  int previous_face;
3291  bool suppress_mouse_over_highlights;
3292 
3293  HPS::Rectangle nav_cube_subwindow;
3294  HPS::IntRectangle nav_cube_subwindow_offsets;
3295  float nav_cube_subwindow_width;
3296  float nav_cube_subwindow_height;
3297 
3298  int highlighted_group;
3299 
3300  bool moving;
3301 
3302  class SmoothTransitionCompleteEventHandler : public EventHandler
3303  {
3304  public:
3305  SmoothTransitionCompleteEventHandler(View const & in_view, bool & in_moving)
3306  : handler_view(in_view), handler_moving(&in_moving) {}
3307 
3308  ~SmoothTransitionCompleteEventHandler() { Shutdown(); }
3309 
3310  virtual HandleResult Handle(HPS::Event const * in_event);
3311 
3312  private:
3313  View handler_view;
3314  bool * handler_moving;
3315  };
3316 
3317  SmoothTransitionCompleteEventHandler * handler;
3318 };
3319 
3320 
3321 
3322 
3323 class SceneTreeItem;
3324 typedef std::shared_ptr<SceneTreeItem> SceneTreeItemPtr;
3325 class SceneTree;
3326 typedef std::shared_ptr<SceneTree> SceneTreePtr;
3327 
3330 class SPRK_API SceneTree : public Sprocket
3331 {
3332 public:
3335  enum class ItemType : uint32_t
3336  {
3337  None = 0x00000000,
3338  GenericMask = 0xffff0000,
3339 
3340  Segment = 0x00000001,
3341  Include = 0x00000002,
3342  ConditionalExpression = 0x00000003,
3343  StaticModelSegment = 0x00000004,
3344  AttributeFilter = 0x00000005,
3345 
3346  Geometry = 0x00010000,
3347  CuttingSection = 0x00010001,
3348  Shell = 0x00010002,
3349  Mesh = 0x00010003,
3350  Grid = 0x00010004,
3351  NURBSSurface = 0x00010005,
3352  Cylinder = 0x00010006,
3353  Sphere = 0x00010007,
3354  Polygon = 0x00010008,
3355  Circle = 0x00010009,
3356  CircularWedge = 0x0001000a,
3357  Ellipse = 0x0001000b,
3358  Line = 0x0001000c,
3359  NURBSCurve = 0x0001000d,
3360  CircularArc = 0x0001000e,
3361  EllipticalArc = 0x0001000f,
3362  InfiniteLine = 0x00010010,
3363  InfiniteRay = 0x00010011,
3364  Marker = 0x00010012,
3365  Text = 0x00010013,
3366  Reference = 0x00010014,
3367  DistantLight = 0x00010015,
3368  Spotlight = 0x00010016,
3369 
3370  Attribute = 0x00020000,
3371  Portfolio = 0x00020001,
3372  SegmentStyle = 0x00020002,
3373  NamedStyle = 0x00020003,
3374  MaterialPalette = 0x00020004,
3375  Priority = 0x00020005,
3376  Material = 0x00020006,
3377  Camera = 0x00020007,
3378  ModellingMatrix = 0x00020008,
3379  UserData = 0x00020009,
3380  TextureMatrix = 0x0002000a,
3381  Culling = 0x0002000b,
3382  CurveAttribute = 0x0002000c,
3383  CylinderAttribute = 0x0002000d,
3384  EdgeAttribute = 0x0002000e,
3385  LightingAttribute = 0x0002000f,
3386  LineAttribute = 0x00020010,
3387  MarkerAttribute = 0x00020011,
3388  SurfaceAttribute = 0x00020012,
3389  Selectability = 0x00020013,
3390  SphereAttribute = 0x00020014,
3391  Subwindow = 0x00020015,
3392  TextAttribute = 0x00020016,
3393  Transparency = 0x00020017,
3394  Visibility = 0x00020018,
3395  VisualEffects = 0x00020019,
3396  Performance = 0x00020020,
3397  DrawingAttribute = 0x00020021,
3398  HiddenLineAttribute = 0x00020022,
3399  ContourLine = 0x00020023,
3400  Condition = 0x00020024,
3401  Bounding = 0x00020025,
3402  AttributeLock = 0x00020026,
3403  TransformMask = 0x00020027,
3404  ColorInterpolation = 0x00020028,
3405  CuttingSectionAttribute = 0x00020029,
3406 
3407  // window only attributes
3408  Debugging = 0x00020030,
3409  PostProcessEffects = 0x00020031,
3410  SelectionOptions = 0x00020032,
3411  UpdateOptions = 0x00020033,
3412 
3413  Definition = 0x00040000,
3414  NamedStyleDefinition = 0x00040001,
3415  TextureDefinition = 0x00040002,
3416  LinePatternDefinition = 0x00040003,
3417  GlyphDefinition = 0x00040004,
3418  CubeMapDefinition = 0x00040005,
3419  ImageDefinition = 0x00040006,
3420  MaterialPaletteDefinition = 0x00040007,
3421  ShaderDefinition = 0x00040008,
3422  ShapeDefinition = 0x00040009,
3423 
3424  Group = 0x00080000,
3425  SegmentGroup = 0x00080100,
3426  GeometryGroup = 0x00080200,
3427  AttributeGroup = 0x00080300,
3428  PortfolioGroup = 0x00080400,
3429  StyleGroup = 0x00080500,
3430  IncludeGroup = 0x00080600,
3431  DefinitionGroup = 0x00180000,
3432  NamedStyleDefinitionGroup = 0x00180700,
3433  TextureDefinitionGroup = 0x00180800,
3434  LinePatternDefinitionGroup = 0x00180900,
3435  GlyphDefinitionGroup = 0x00180a00,
3436  CubeMapDefinitionGroup = 0x00180b00,
3437  ImageDefinitionGroup = 0x00180c00,
3438  MaterialPaletteDefinitionGroup = 0x00180d00,
3439  ShaderDefinitionGroup = 0x00180e00,
3440  ShapeDefinitionGroup = 0x00180f00,
3441  CuttingSectionGroup = 0x00080001,
3442  ShellGroup = 0x00080002,
3443  MeshGroup = 0x00080003,
3444  GridGroup = 0x00080004,
3445  NURBSSurfaceGroup = 0x00080005,
3446  CylinderGroup = 0x00080006,
3447  SphereGroup = 0x00080007,
3448  PolygonGroup = 0x00080008,
3449  CircleGroup = 0x00080009,
3450  CircularWedgeGroup = 0x0008000a,
3451  EllipseGroup = 0x0008000b,
3452  LineGroup = 0x0008000c,
3453  NURBSCurveGroup = 0x0008000d,
3454  CircularArcGroup = 0x0008000e,
3455  EllipticalArcGroup = 0x0008000f,
3456  InfiniteLineGroup = 0x00080010,
3457  InfiniteRayGroup = 0x00080011,
3458  MarkerGroup = 0x00080012,
3459  TextGroup = 0x00080013,
3460  ReferenceGroup = 0x00080014,
3461  DistantLightGroup = 0x00080015,
3462  SpotlightGroup = 0x00080016,
3463  };
3464 
3466  SceneTree();
3467 
3470  SceneTree(Canvas const & in_canvas);
3471 
3474  SceneTree(SceneTree const & in_that);
3475 
3478  SceneTree(SceneTree && in_that);
3479 
3480  virtual ~SceneTree();
3481 
3482  virtual HPS::Type ObjectType() const { return HPS::Type::SceneTree; }
3483 
3487  SceneTree & operator=(SceneTree const & in_that);
3488 
3492  SceneTree & operator=(SceneTree && in_that);
3493 
3497  virtual void Assign(SceneTree const & in_that);
3498 
3502  bool Equals(SceneTree const & in_that) const;
3503 
3507  bool operator!=(SceneTree const & in_that) const;
3508 
3512  bool operator==(SceneTree const & in_that) const;
3513 
3514 
3523  void SetHighlightOptions(HighlightOptionsKit const & in_options);
3524 
3534  void SetHighlightOptions(HighlightOptionsKitArray const & in_options);
3535 
3546  void SetHighlightOptions(size_t in_count, HighlightOptionsKit const in_options []);
3547 
3555  void AddHighlightOptions(HighlightOptionsKit const & in_options);
3556 
3559  HighlightOptionsKitArray GetHighlightOptions() const;
3560 
3561 
3566  void SetGroupingLimit(size_t in_limit);
3567 
3570  size_t GetGroupingLimit() const;
3571 
3572 
3579  void SetRoot(SceneTreeItemPtr const & in_root);
3580 
3583  SceneTreeItemPtr GetRoot() const;
3584 
3585 
3588  virtual void Flush();
3589 
3594  void SetHighlightEventHandling(bool in_state);
3595 
3599  bool GetHighlightEventHandling() const;
3600 
3603  void ReExpand();
3604 };
3605 
3606 
3609 class SPRK_API SceneTreeItem : public Sprocket
3610 {
3611 public:
3613  SceneTreeItem();
3614 
3617  SceneTreeItem(SceneTreeItem const & in_that);
3618 
3621  SceneTreeItem(SceneTreeItem && in_that);
3622 
3628  SceneTreeItem(SceneTreePtr const & in_tree, Model const & in_model);
3629 
3635  SceneTreeItem(SceneTreePtr const & in_tree, View const & in_view);
3636 
3642  SceneTreeItem(SceneTreePtr const & in_tree, Layout const & in_layout);
3643 
3649  SceneTreeItem(SceneTreePtr const & in_tree, Canvas const & in_canvas);
3650 
3658  SceneTreeItem(SceneTreePtr const & in_tree, Key const & in_key, SceneTree::ItemType in_type, char const * in_title = nullptr);
3659 
3660  virtual ~SceneTreeItem();
3661 
3662  HPS::Type ObjectType() const { return HPS::Type::SceneTreeItem; }
3663 
3667  SceneTreeItem & operator=(SceneTreeItem const & in_that);
3668 
3672  SceneTreeItem & operator=(SceneTreeItem && in_that);
3673 
3677  virtual void Assign(SceneTreeItem const & in_that);
3678 
3682  bool Equals(SceneTreeItem const & in_that) const;
3683 
3687  bool operator!=(SceneTreeItem const & in_that) const;
3688 
3692  bool operator==(SceneTreeItem const & in_that) const;
3693 
3694 
3697  SceneTreePtr GetTree() const;
3698 
3701  UTF8 GetTitle() const;
3702 
3705  SceneTree::ItemType GetItemType() const;
3706 
3710  bool HasItemType(SceneTree::ItemType in_mask) const;
3711 
3714  Key GetKey() const;
3715 
3718  KeyPath GetKeyPath() const;
3719 
3722  bool HasChildren() const;
3723 
3724 
3733  virtual SceneTreeItemPtr AddChild(Key const & in_key, SceneTree::ItemType in_type, char const * in_title = nullptr) = 0;
3734 
3735 
3738  virtual void Expand();
3739 
3742  virtual void Collapse();
3743 
3744 
3749  bool IsSelected() const;
3750 
3756  virtual void Select();
3757 
3763  virtual void Unselect();
3764 
3769  bool IsHighlightable() const;
3770 
3776  bool IsHighlighted() const;
3777 
3782  void Highlight(size_t in_highlight_options_index = 0);
3783 
3789  void Highlight(HighlightOptionsKit const & in_highlight_options);
3790 
3796  void Unhighlight(size_t in_highlight_options_index = 0);
3797 
3804  void Unhighlight(HighlightOptionsKit const & in_highlight_options);
3805 
3808  bool IsExpanded() const;
3809 
3812  void ReExpand();
3813 };
3814 
3815 
3816 
3817 class ComponentTreeItem;
3818 typedef std::shared_ptr<ComponentTreeItem> ComponentTreeItemPtr;
3819 class ComponentTree;
3820 typedef std::shared_ptr<ComponentTree> ComponentTreePtr;
3821 
3824 class SPRK_API ComponentTree : public Sprocket
3825 {
3826 public:
3829  enum class ItemType
3830  {
3831  None,
3832  ExchangeComponent,
3833  ExchangeModelFile,
3834 
3835  ExchangeViewGroup,
3836  ExchangeAnnotationViewGroup,
3837  ExchangePMIGroup,
3838  ExchangeModelGroup,
3839 
3840  ParasolidComponent,
3841  ParasolidModelFile,
3842 
3843  DWGComponent,
3844  DWGModelFile,
3845  };
3846 
3848  ComponentTree();
3849 
3853  ComponentTree(Canvas const & in_canvas, size_t in_layer = 0);
3854 
3857  ComponentTree(ComponentTree const & in_that);
3858 
3861  ComponentTree(ComponentTree && in_that);
3862 
3863  virtual ~ComponentTree();
3864 
3865  virtual HPS::Type ObjectType() const { return HPS::Type::ComponentTree; }
3866 
3870  ComponentTree & operator=(ComponentTree const & in_that);
3871 
3875  ComponentTree & operator=(ComponentTree && in_that);
3876 
3880  virtual void Assign(ComponentTree const & in_that);
3881 
3885  bool Equals(ComponentTree const & in_that) const;
3886 
3890  bool operator!=(ComponentTree const & in_that) const;
3891 
3895  bool operator==(ComponentTree const & in_that) const;
3896 
3897 
3906  void SetHighlightOptions(HighlightOptionsKit const & in_options);
3907 
3917  void SetHighlightOptions(HighlightOptionsKitArray const & in_options);
3918 
3929  void SetHighlightOptions(size_t in_count, HighlightOptionsKit const in_options []);
3930 
3940  void AddHighlightOptions(HighlightOptionsKit const & in_options);
3941 
3944  HighlightOptionsKitArray GetHighlightOptions() const;
3945 
3946 
3953  void SetRoot(ComponentTreeItemPtr const & in_root);
3954 
3957  ComponentTreeItemPtr GetRoot() const;
3958 
3959 
3962  virtual void Flush();
3963 
3966  void ReExpand();
3967 
3972  void SetHighlightEventHandling(bool in_state);
3973 
3977  bool GetHighlightEventHandling() const;
3978 };
3979 
3980 
3983 class SPRK_API ComponentTreeItem : public Sprocket
3984 {
3985 public:
3988 
3991  ComponentTreeItem(ComponentTreeItem const & in_that);
3992 
3996 
4002  ComponentTreeItem(ComponentTreePtr const & in_tree, CADModel const & in_cad_model);
4003 
4010  ComponentTreeItem(ComponentTreePtr const & in_tree, Component const & in_component, ComponentTree::ItemType in_type);
4011 
4012  virtual ~ComponentTreeItem();
4013 
4014  HPS::Type ObjectType() const { return HPS::Type::ComponentTreeItem; }
4015 
4019  ComponentTreeItem & operator=(ComponentTreeItem const & in_that);
4020 
4024  ComponentTreeItem & operator=(ComponentTreeItem && in_that);
4025 
4029  virtual void Assign(ComponentTreeItem const & in_that);
4030 
4034  bool Equals(ComponentTreeItem const & in_that) const;
4035 
4039  bool operator!=(ComponentTreeItem const & in_that) const;
4040 
4044  bool operator==(ComponentTreeItem const & in_that) const;
4045 
4046 
4047 
4050  ComponentTreePtr GetTree() const;
4051 
4054  UTF8 GetTitle() const;
4055 
4058  ComponentTree::ItemType GetItemType() const;
4059 
4062  Component GetComponent() const;
4063 
4066  bool HasChildren() const;
4067 
4070  ComponentPath GetPath() const;
4071 
4072 
4080  virtual ComponentTreeItemPtr AddChild(Component const & in_component, ComponentTree::ItemType in_type) = 0;
4081 
4082 
4085  virtual void Expand();
4086 
4089  virtual void Collapse();
4090 
4091 
4099  bool IsHighlighted() const;
4100 
4105  virtual void OnHighlight(HighlightOptionsKit const & in_options);
4106 
4111  virtual void OnUnhighlight(HighlightOptionsKit const & in_options);
4112 
4113 
4118  void Highlight(size_t in_highlight_options_index = 0);
4119 
4125  void Highlight(HighlightOptionsKit const & in_highlight_options);
4126 
4131  void Unhighlight(size_t in_highlight_options_index = 0);
4132 
4138  void Unhighlight(HighlightOptionsKit const & in_highlight_options);
4139 
4140 
4152  bool IsHidden() const;
4153 
4157  virtual void OnHide();
4158 
4162  virtual void OnShow();
4163 
4168  void Hide();
4169 
4174  void Show();
4175 
4180  void Isolate();
4181 
4184  bool IsExpanded() const;
4185 
4188  void ReExpand();
4189 };
4190 
4191 
4192 
4193 
4194 }
4195 #endif
4196 
4197 
4198 
Definition: sprk.h:2904
HPS::Type ObjectType() const
Definition: sprk.h:2738
Definition: hps.h:3390
Definition: hps.h:6132
Definition: sprk.h:992
HPS::Type ObjectType() const
Definition: sprk.h:480
Event * Clone() const
Definition: sprk.h:745
Definition: sprk.h:3081
Definition: sprk.h:264
ComponentHighlightEvent(Event const &in_event)
Definition: sprk.h:2333
HPS::Type ObjectType() const
Definition: sprk.h:272
virtual bool OnTimerTick(HPS::TimerTickEvent const &in_event)
Definition: sprk.h:1189
Definition: hps.h:41925
ComponentHighlightEvent()
Definition: sprk.h:2315
void SetModifierTrigger(ModifierKeys in_modifiers)
Definition: sprk.h:1215
Definition: hps.h:477
CameraChangedEvent(Event const &in_event)
Definition: sprk.h:1011
HPS::Type ObjectType() const
Definition: sprk.h:210
HPS::Type ObjectType() const
Definition: sprk.h:1101
virtual bool OnKeyDown(KeyboardState const &in_state)
Definition: sprk.h:1174
HPS::Type ObjectType() const
Definition: sprk.h:2384
An InvalidSpecificationException is thrown when a method is called with non-sensical or contradictory...
Definition: hps.h:5750
Location
Definition: sprk.h:1445
ModifierKeys GetModifierTrigger() const
Definition: sprk.h:1218
virtual bool OnKeyUp(KeyboardState const &in_state)
Definition: sprk.h:1179
ItemType
Definition: sprk.h:3829
Definition: hps.h:5790
virtual intptr_t Freshen() const
Definition: sprk.h:1034
CaptureActivationEvent()
Definition: sprk.h:2506
Definition: sprk.h:66
Definition: sprk.h:207
Definition: sprk.h:667
Definition: sprk.h:100
virtual bool OnMouseMove(MouseState const &in_state)
Definition: sprk.h:1139
Definition: sprk.h:3983
virtual bool OnMouseEnter(MouseState const &in_state)
Definition: sprk.h:1149
Definition: sprk.h:2957
HPS::Type ObjectType() const
Definition: sprk.h:2573
Definition: hps.h:41712
Definition: hps.h:1344
Definition: hps.h:1062
HPS::Type ObjectType() const
Definition: sprk.h:2069
Definition: hps.h:1732
Definition: sprk.h:234
ModelDeletedEvent()
Definition: sprk.h:953
SmoothTransitionCompleteEvent(HPS::View const &in_view)
Definition: sprk.h:3152
std::vector< KeyPath, Allocator< KeyPath > > KeyPathArray
Array of type HPS::KeyPath.
Definition: hps.h:6596
Definition: sprk.h:3824
Definition: hps.h:47165
Definition: sprk.h:1052
virtual bool OnTouchUp(TouchState const &in_state)
Definition: sprk.h:1164
Definition: hps.h:7630
MouseButtons GetMouseTrigger() const
Definition: sprk.h:1210
virtual HPS::Type ObjectType() const
Definition: sprk.h:3482
Definition: hps.h:3541
Definition: hps.h:2098
Definition: sprk.h:904
bool HasAll(MouseButtons in_mouse_trigger, ModifierKeys in_modifier_trigger) const
Event * Clone() const
Definition: sprk.h:789
Definition: sprk.h:755
Definition: hps.h:1427
Definition: hps.h:883
HPS::Type ObjectType() const
Definition: sprk.h:1619
Definition: hps.h:41830
virtual void OnModelDetached()
Definition: sprk.h:1203
SmoothTransitionCompleteEvent(Event const &in_event)
Definition: sprk.h:3157
Definition: hps.h:1790
Definition: hps.h:1556
Definition: hps.h:8837
Definition: hps.h:251
void SetMouseTrigger(MouseButtons in_buttons)
Definition: sprk.h:1206
ComponentPath & Append(Component const &in_component)
Definition: hps.h:1850
Event * Clone() const
Definition: sprk.h:895
CameraChangedEvent()
Definition: sprk.h:996
SprocketKit & operator=(SprocketKit &&in_that)
Definition: sprk.h:254
Definition: hps.h:47064
Definition: hps.h:40773
Definition: sprk.h:1441
Definition: sprk.h:949
Definition: sprk.h:552
HPS::Type ObjectType() const
Definition: sprk.h:107
ViewDetachedEvent(Event const &in_event)
Definition: sprk.h:831
virtual void OnViewDetached()
Definition: sprk.h:1195
Definition: hps.h:40819
HPS::Type ObjectType() const
Definition: sprk.h:3662
LayoutDeletedEvent()
Definition: sprk.h:759
Event * Clone() const
Definition: sprk.h:939
virtual void OnViewAttached()
Definition: sprk.h:1192
Definition: hps.h:40207
Definition: hps.h:43399
Definition: hps.h:1102
Definition: sprk.h:2648
LayoutDetachedEvent()
Definition: sprk.h:714
Definition: sprk.h:2760
virtual bool OnMouseLeave(MouseState const &in_state)
Definition: sprk.h:1154
Definition: hps.h:9658
Definition: hps.h:41873
Definition: hps.h:1515
SmoothTransitionCompleteEvent()
Definition: sprk.h:3147
Definition: hps.h:1447
HPS::Type ObjectType() const
Definition: sprk.h:559
virtual bool OnMouseUp(MouseState const &in_state)
Definition: sprk.h:1134
FilterActivationEvent()
Definition: sprk.h:2418
Definition: hps.h:1466
virtual void OnModelAttached()
Definition: sprk.h:1199
Definition: hps.h:37985
FilterActivationEvent(Event const &in_event)
Definition: sprk.h:2432
ModelDetachedEvent(Event const &in_event)
Definition: sprk.h:923
HPS::Type ObjectType() const
Definition: sprk.h:1473
HPS::Type ObjectType() const
Definition: sprk.h:1834
Definition: hps.h:7003
Location
Definition: sprk.h:1591
HPS::Type ObjectType() const
Definition: sprk.h:237
Definition: hps.h:46556
Definition: sprk.h:2712
Definition: sprk.h:1587
Definition: hps.h:43576
HPS::Type ObjectType() const
Definition: sprk.h:1315
SprocketControl & operator=(SprocketControl &&in_that)
Definition: sprk.h:227
Definition: hps.h:45463
virtual UTF8 GetName() const
Definition: sprk.h:1124
Definition: hps.h:46952
Definition: sprk.h:710
Event * Clone() const
Definition: sprk.h:2449
CaptureActivationEvent(Event const &in_event)
Definition: sprk.h:2520
virtual bool OnTouchDown(TouchState const &in_state)
Definition: sprk.h:1159
HPS::Type ObjectType() const
Definition: sprk.h:2834
CanvasDeletedEvent()
Definition: sprk.h:671
virtual bool OnMouseWheel(MouseState const &in_state)
Definition: sprk.h:1144
HPS::Type ObjectType() const
Definition: sprk.h:2668
HPS::Type ObjectType() const
Definition: sprk.h:2786
SprocketControl(SprocketControl &&in_that)
Definition: sprk.h:222
Event * Clone() const
Definition: sprk.h:2536
Definition: hps.h:15297
ViewDeletedEvent()
Definition: sprk.h:865
intptr_t GetChannel() const
Definition: hps.h:6249
Definition: sprk.h:798
SprocketKit(SprocketKit &&in_that)
Definition: sprk.h:249
virtual bool Drop(Event const *in_that_event) const
Definition: sprk.h:3179
virtual HPS::UTF8 GetName() const
Definition: sprk.h:3086
Definition: sprk.h:1724
Definition: hps.h:43853
Definition: hps.h:46075
virtual bool OnTextInput(HPS::UTF8 const &in_text)
Definition: sprk.h:1184
ViewDeletedEvent(Event const &in_event)
Definition: sprk.h:880
Definition: hps.h:37549
Definition: sprk.h:2856
ViewDetachedEvent()
Definition: sprk.h:809
Definition: hps.h:6216
Definition: sprk.h:1293
Definition: hps.h:413
HPS::Type ObjectType() const
Definition: sprk.h:2882
Event * Clone() const
Definition: sprk.h:2350
Definition: sprk.h:473
CanvasDeletedEvent(Event const &in_event)
Definition: sprk.h:686
Definition: sprk.h:3206
Definition: sprk.h:2038
virtual bool Drop(Event const *in_that_event) const
Definition: sprk.h:1024
ComponentType
Definition: sprk.h:1729
Definition: hps.h:45389
std::vector< Key, Allocator< Key > > KeyArray
Array of type HPS::Key.
Definition: hps.h:6568
Definition: hps.h:2117
Definition: sprk.h:2304
Event * Clone() const
Definition: sprk.h:701
LayoutDetachedEvent(Event const &in_event)
Definition: sprk.h:729
HPS::Type ObjectType() const
Definition: sprk.h:4014
virtual bool OnMouseDown(MouseState const &in_state)
Definition: sprk.h:1129
ItemType
Definition: sprk.h:3335
Definition: sprk.h:2363
Definition: sprk.h:3007
virtual HPS::UTF8 GetName() const
Definition: sprk.h:3213
Definition: sprk.h:184
Definition: sprk.h:3143
Definition: hps.h:432
Event * Clone() const
Definition: sprk.h:983
Definition: sprk.h:2462
Definition: hps.h:2137
ModelDetachedEvent()
Definition: sprk.h:908
static MouseButtons ButtonLeft()
Definition: hps.h:46674
virtual HPS::Type ObjectType() const
Definition: sprk.h:3865
Definition: sprk.h:3330
Definition: sprk.h:2808
UpdateType
Definition: hps.h:185
Definition: hps.h:8987
HPS::Type ObjectType() const
Definition: sprk.h:1062
virtual bool IsMouseTriggered(MouseState const &in_state)
Definition: sprk.h:1221
Definition: hps.h:7549
Definition: sprk.h:2407
Definition: hps.h:37165
Definition: hps.h:358
Event * Clone() const
Definition: sprk.h:3170
ModelDeletedEvent(Event const &in_event)
Definition: sprk.h:968
Event * Clone() const
Definition: sprk.h:849
LayoutDeletedEvent(Event const &in_event)
Definition: sprk.h:774
Definition: hps.h:9215
Definition: hps.h:10759
Definition: sprk.h:1236
virtual bool OnTouchMove(TouchState const &in_state)
Definition: sprk.h:1169
Definition: sprk.h:3609
Definition: sprk.h:2548
Definition: hps.h:42399
Mode
Definition: sprk.h:189
Definition: hps.h:518
Definition: sprk.h:1093
Definition: hps.h:1145
Definition: hps.h:41757
Definition: sprk.h:861
Definition: sprk.h:2502
Definition: hps.h:40270
HPS::Type ObjectType() const
Definition: sprk.h:2930
HPS::Type ObjectType() const
Definition: sprk.h:2483
HPS::Type ObjectType() const
Definition: sprk.h:2983
Definition: hps.h:7261
Event * Clone() const
Definition: sprk.h:1041