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);
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 
2074  ComponentPath & operator+=(Component const & in_component);
2075 
2079  ComponentPath & operator+=(ComponentPath const & in_path);
2080 
2084  ComponentPath & operator+=(ComponentArray const & in_components);
2085 
2089  ComponentPath & Append(Component const & in_component);
2090 
2094  ComponentPath & Append(ComponentPath const & in_path);
2095 
2099  ComponentPath & Append(ComponentArray const & in_components);
2100 
2104  ComponentPath & operator=(ComponentPath const & in_that);
2105 
2109  ComponentPath & operator=(ComponentArray const & in_path);
2110 
2113  void Set(ComponentPath const & in_that);
2114 
2118  bool Equals(ComponentPath const & in_that) const;
2119 
2123  bool operator!= (ComponentPath const & in_that) const;
2124 
2128  bool operator== (ComponentPath const & in_that) const;
2129 
2130 
2134  ComponentPath & SetComponents(ComponentArray const & in_components);
2135 
2140  ComponentPath & SetComponents(size_t in_count, Component const in_components[]);
2141 
2144  ComponentArray GetComponents() const;
2145 
2149  KeyPathArray GetKeyPaths() const;
2150 
2155  KeyPathArray GetKeyPaths(Canvas const & in_canvas, size_t in_layer = 0) const;
2156 
2157 
2161  void Highlight(Canvas const & in_canvas, HighlightOptionsKit const & in_options) const;
2162 
2167  void Highlight(Canvas const & in_canvas, size_t in_layer, HighlightOptionsKit const & in_options) const;
2168 
2172  void Unhighlight(Canvas const & in_canvas, HighlightOptionsKit const & in_options = HighlightOptionsKit()) const;
2173 
2178  void Unhighlight(Canvas const & in_canvas, size_t in_layer, HighlightOptionsKit const & in_options = HighlightOptionsKit()) const;
2179 
2180 
2184  void Hide(Canvas const & in_canvas, size_t in_layer = 0);
2185 
2189  void Show(Canvas const & in_canvas, size_t in_layer = 0);
2190 
2196  bool IsHidden(Canvas const & in_canvas, size_t in_layer = 0);
2197 
2203  void Isolate(Canvas const & in_canvas, size_t in_layer = 0);
2204 
2211  static void Isolate(HPS::ComponentPathArray & in_components_to_be_isolated, Canvas const & in_canvas, size_t in_layer = 0);
2212 };
2213 
2214 
2219 inline ComponentPath operator+(Component const & in_lhs, Component const & in_rhs)
2220 {
2221  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2222 }
2223 
2228 inline ComponentPath operator+(Component const & in_lhs, ComponentArray const & in_rhs)
2229 {
2230  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2231 }
2232 
2237 inline ComponentPath operator+(Component const & in_lhs, ComponentPath const & in_rhs)
2238 {
2239  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2240 }
2241 
2246 inline ComponentPath operator+(ComponentArray const & in_lhs, Component const & in_rhs)
2247 {
2248  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2249 }
2250 
2255 inline ComponentPath operator+(ComponentArray const & in_lhs, ComponentArray const & in_rhs)
2256 {
2257  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2258 }
2259 
2264 inline ComponentPath operator+(ComponentArray const & in_lhs, ComponentPath const & in_rhs)
2265 {
2266  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2267 }
2268 
2273 inline ComponentPath operator+(ComponentPath const & in_lhs, Component const & in_rhs)
2274 {
2275  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2276 }
2277 
2282 inline ComponentPath operator+(ComponentPath const & in_lhs, ComponentArray const & in_rhs)
2283 {
2284  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2285 }
2286 
2291 inline ComponentPath operator+(ComponentPath const & in_lhs, ComponentPath const & in_rhs)
2292 {
2293  return HPS::ComponentPath().Append(in_lhs).Append(in_rhs);
2294 }
2295 
2296 
2298 class SPRK_API ComponentHighlightEvent : public Event
2299 {
2300 public:
2301  enum class Action
2302  {
2303  None = 0,
2304  Highlight,
2305  Unhighlight,
2306  };
2307 
2310  {
2311  channel = GetClassID();
2312  consumable = false;
2313  action = Action::None;
2314  }
2315 
2316  ComponentHighlightEvent(Action in_action,
2317  ComponentPath const & in_path = ComponentPath(),
2318  HighlightOptionsKit const & in_options = HighlightOptionsKit())
2319  : Event(), action(in_action), path(in_path), options(in_options)
2320  {
2321  channel = GetClassID();
2322  consumable = false;
2323  }
2324 
2327  ComponentHighlightEvent(Event const & in_event) : Event(in_event)
2328  {
2329  if (in_event.GetChannel() == Object::ClassID<ComponentHighlightEvent>())
2330  {
2331  auto that = static_cast<ComponentHighlightEvent const &>(in_event);
2332  action = that.action;
2333  path = that.path;
2334  options = that.options;
2335  }
2336  else
2337  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
2338  }
2339 
2341 
2344  Event * Clone() const
2345  {
2346  ComponentHighlightEvent * new_event = new ComponentHighlightEvent(*this);
2347  return new_event;
2348  }
2349 
2350  Action action;
2351  ComponentPath path;
2352  HighlightOptionsKit options;
2353 };
2354 
2355 
2357 class SPRK_API Filter : public Component
2358 {
2359 public:
2361  Filter();
2362 
2366  Filter(Component const & in_that);
2367 
2370  Filter(Filter const & in_that);
2371 
2374  Filter(Filter && in_that);
2375 
2376  virtual ~Filter();
2377 
2378  HPS::Type ObjectType() const { return HPS::Type::Filter; }
2379 
2380 
2381 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2382  Filter & operator=(Filter const & in_that) = default;
2383 #endif
2384 
2388  Filter & operator=(Filter && in_that);
2389 
2390 
2393  void Activate(View const & in_view);
2394 
2397  void Deactivate(View const & in_view);
2398 };
2399 
2400 
2401 class SPRK_API FilterActivationEvent : public Event
2402 {
2403 public:
2404  enum class Action
2405  {
2406  None = 0,
2407  Activate,
2408  Deactivate,
2409  };
2410 
2413  {
2414  channel = GetClassID();
2415  consumable = false;
2416  }
2417 
2418  FilterActivationEvent(Filter in_filter, Action in_action, View in_view) : Event(), filter(in_filter), action(in_action), view(in_view)
2419  {
2420  channel = GetClassID();
2421  consumable = false;
2422  }
2423 
2426  FilterActivationEvent(Event const & in_event) : Event(in_event)
2427  {
2428  if (in_event.GetChannel() == Object::ClassID<FilterActivationEvent>())
2429  {
2430  auto that = static_cast<FilterActivationEvent const &>(in_event);
2431  filter = that.filter;
2432  action = that.action;
2433  view = that.view;
2434  }
2435  else
2436  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
2437  }
2438 
2440 
2443  Event * Clone() const
2444  {
2445  FilterActivationEvent * new_event = new FilterActivationEvent(*this);
2446  return new_event;
2447  }
2448 
2449  Filter filter;
2450  Action action;
2451  View view;
2452 };
2453 
2454 
2456 class SPRK_API Capture : public Component
2457 {
2458 public:
2460  Capture();
2461 
2465  Capture(Component const & in_that);
2466 
2469  Capture(Capture const & in_that);
2470 
2473  Capture(Capture && in_that);
2474 
2475  virtual ~Capture();
2476 
2477  HPS::Type ObjectType() const { return HPS::Type::Capture; }
2478 
2479 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2480  Capture & operator=(Capture const & in_that) = default;
2481 #endif
2482 
2486  Capture & operator=(Capture && in_that);
2487 
2488 
2492  View Activate();
2493 };
2494 
2495 
2496 class SPRK_API CaptureActivationEvent : public Event
2497 {
2498 public:
2501  {
2502  channel = GetClassID();
2503  consumable = false;
2504  }
2505 
2506  CaptureActivationEvent(Capture in_capture, View in_view) : Event(), capture(in_capture), view(in_view)
2507  {
2508  channel = GetClassID();
2509  consumable = false;
2510  }
2511 
2514  CaptureActivationEvent(Event const & in_event) : Event(in_event)
2515  {
2516  if (in_event.GetChannel() == Object::ClassID<CaptureActivationEvent>())
2517  {
2518  auto that = static_cast<CaptureActivationEvent const &>(in_event);
2519  capture = that.capture;
2520  view = that.view;
2521  }
2522  else
2523  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
2524  }
2525 
2527 
2530  Event * Clone() const
2531  {
2532  CaptureActivationEvent * new_event = new CaptureActivationEvent(*this);
2533  return new_event;
2534  }
2535 
2536  Capture capture;
2537  View view;
2538 };
2539 
2540 
2542 class SPRK_API CADModel : public Component
2543 {
2544 public:
2546  CADModel();
2547 
2551  CADModel(Component const & in_that);
2552 
2555  CADModel(CADModel const & in_that);
2556 
2559  CADModel(CADModel && in_that);
2560 
2563  CADModel(Model const & in_that);
2564 
2565  virtual ~CADModel();
2566 
2567  HPS::Type ObjectType() const { return HPS::Type::CADModel; }
2568 
2569 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2570  CADModel & operator=(CADModel const & in_that) = default;
2571 #endif
2572 
2576  CADModel & operator=(CADModel && in_that);
2577 
2578 
2582  Component GetComponentFromKey(Key const & in_key) const;
2583 
2588  ComponentPath GetComponentPath(KeyPath const & in_key_path) const;
2589 
2595  ComponentPath GetComponentPath(SelectionItem const & in_item) const;
2596 
2597 
2600  Model GetModel() const;
2601 
2604  FilterArray GetAllFilters() const;
2605 
2608  CaptureArray GetAllCaptures() const;
2609 
2613  FilterArray GetActiveFilters(View const & in_view) const;
2614 
2615 
2619  View ActivateDefaultCapture();
2620 
2621 
2629  void ResetVisibility(Canvas & in_canvas, size_t in_layer = 0);
2630 };
2631 
2632 
2633 
2636 class SPRK_API Metadata : public Sprocket
2637 {
2638 public:
2640  Metadata();
2641 
2644  Metadata(Metadata const & in_that);
2645 
2648  Metadata(Metadata && in_that);
2649 
2652  Metadata(char const * in_name);
2653 
2654  virtual ~Metadata();
2655 
2656  HPS::Type ObjectType() const { return HPS::Type::Metadata; }
2657 
2658 
2662  Metadata & operator=(Metadata const & in_that);
2663 
2667  Metadata & operator=(Metadata && in_that);
2668 
2672  virtual void Assign(Metadata const & in_that);
2673 
2677  bool Equals(Metadata const & in_that) const;
2678 
2682  bool operator!=(Metadata const & in_that) const;
2683 
2687  bool operator==(Metadata const & in_that) const;
2688 
2689 
2692  HPS::UTF8 GetName() const;
2693 
2696  void SetName(char const * in_name);
2697 };
2698 
2700 class SPRK_API IntegerMetadata : public Metadata
2701 {
2702 public:
2704  IntegerMetadata();
2705 
2709  IntegerMetadata(Metadata const & in_that);
2710 
2713  IntegerMetadata(IntegerMetadata const & in_that);
2714 
2717  IntegerMetadata(IntegerMetadata && in_that);
2718 
2722  IntegerMetadata(char const * in_name, int in_value);
2723 
2724  virtual ~IntegerMetadata();
2725 
2726  HPS::Type ObjectType() const { return HPS::Type::IntegerMetadata; }
2727 
2728 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2729  IntegerMetadata & operator=(IntegerMetadata const & in_that) = default;
2730 #endif
2731 
2735  IntegerMetadata & operator=(IntegerMetadata && in_that);
2736 
2737 
2740  int GetValue() const;
2741 
2744  void SetValue(int in_value);
2745 };
2746 
2748 class SPRK_API UnsignedIntegerMetadata : public Metadata
2749 {
2750 public:
2753 
2757  UnsignedIntegerMetadata(Metadata const & in_that);
2758 
2762 
2766 
2770  UnsignedIntegerMetadata(char const * in_name, unsigned int in_value);
2771 
2772  virtual ~UnsignedIntegerMetadata();
2773 
2774  HPS::Type ObjectType() const { return HPS::Type::UnsignedIntegerMetadata; }
2775 
2776 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2777  UnsignedIntegerMetadata & operator=(UnsignedIntegerMetadata const & in_that) = default;
2778 #endif
2779 
2783  UnsignedIntegerMetadata & operator=(UnsignedIntegerMetadata && in_that);
2784 
2785 
2788  unsigned int GetValue() const;
2789 
2792  void SetValue(unsigned int in_value);
2793 };
2794 
2796 class SPRK_API DoubleMetadata : public Metadata
2797 {
2798 public:
2800  DoubleMetadata();
2801 
2805  DoubleMetadata(Metadata const & in_that);
2806 
2809  DoubleMetadata(DoubleMetadata const & in_that);
2810 
2813  DoubleMetadata(DoubleMetadata && in_that);
2814 
2818  DoubleMetadata(char const * in_name, double in_value);
2819 
2820  virtual ~DoubleMetadata();
2821 
2822  HPS::Type ObjectType() const { return HPS::Type::DoubleMetadata; }
2823 
2824 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2825  DoubleMetadata & operator=(DoubleMetadata const & in_that) = default;
2826 #endif
2827 
2831  DoubleMetadata & operator=(DoubleMetadata && in_that);
2832 
2833 
2836  double GetValue() const;
2837 
2840  void SetValue(double in_value);
2841 };
2842 
2844 class SPRK_API StringMetadata : public Metadata
2845 {
2846 public:
2848  StringMetadata();
2849 
2853  StringMetadata(Metadata const & in_that);
2854 
2857  StringMetadata(StringMetadata const & in_that);
2858 
2861  StringMetadata(StringMetadata && in_that);
2862 
2866  StringMetadata(char const * in_name, char const * in_value);
2867 
2868  virtual ~StringMetadata();
2869 
2870  HPS::Type ObjectType() const { return HPS::Type::StringMetadata; }
2871 
2872 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2873  StringMetadata & operator=(StringMetadata const & in_that) = default;
2874 #endif
2875 
2879  StringMetadata & operator=(StringMetadata && in_that);
2880 
2881 
2884  UTF8 GetValue() const;
2885 
2888  void SetValue(char const * in_value);
2889 };
2890 
2892 class SPRK_API TimeMetadata : public Metadata
2893 {
2894 public:
2896  TimeMetadata();
2897 
2901  TimeMetadata(Metadata const & in_that);
2902 
2905  TimeMetadata(TimeMetadata const & in_that);
2906 
2909  TimeMetadata(TimeMetadata && in_that);
2910 
2914  TimeMetadata(char const * in_name, unsigned int in_value);
2915 
2916  virtual ~TimeMetadata();
2917 
2918  HPS::Type ObjectType() const { return HPS::Type::TimeMetadata; }
2919 
2920 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2921  TimeMetadata & operator=(TimeMetadata const & in_that) = default;
2922 #endif
2923 
2927  TimeMetadata & operator=(TimeMetadata && in_that);
2928 
2929 
2932  unsigned int GetValue() const;
2933 
2936  HPS::UTF8 GetValueAsString() const;
2937 
2940  void SetValue(unsigned int in_value);
2941 };
2942 
2943 
2945 class SPRK_API BooleanMetadata : public Metadata
2946 {
2947 public:
2949  BooleanMetadata();
2950 
2954  BooleanMetadata(Metadata const & in_that);
2955 
2958  BooleanMetadata(BooleanMetadata const & in_that);
2959 
2962  BooleanMetadata(BooleanMetadata && in_that);
2963 
2967  BooleanMetadata(char const * in_name, bool in_value);
2968 
2969  virtual ~BooleanMetadata();
2970 
2971  HPS::Type ObjectType() const { return HPS::Type::BooleanMetadata; }
2972 
2973 #if !defined(_MSC_VER) || _MSC_VER >= 1900
2974  BooleanMetadata & operator=(BooleanMetadata const & in_that) = default;
2975 #endif
2976 
2980  BooleanMetadata & operator=(BooleanMetadata && in_that);
2981 
2982 
2985  bool GetValue() const;
2986 
2989  void SetValue(bool in_value);
2990 };
2991 
2992 
2993 
2995 class SPRK_API Factory : public Sprocket
2996 {
2997 public:
2998 
3001  static CanvasArray GetCanvases();
3002 
3005  static LayoutArray GetLayouts();
3006 
3009  static ViewArray GetViews();
3010 
3013  static ModelArray GetModels();
3014 
3017  static CADModelArray GetCADModels();
3018 
3024  static Canvas CreateCanvas(HPS::WindowHandle in_window_handle, char const * in_name = "", HPS::ApplicationWindowOptionsKit const & in_options = HPS::ApplicationWindowOptionsKit());
3025 
3030  static Canvas CreateCanvas(char const * in_name = "", HPS::StandAloneWindowOptionsKit const & in_options = HPS::StandAloneWindowOptionsKit());
3031 
3037  static Canvas CreateCanvas(HPS::WindowKey const & in_window_key, HPS::PortfolioKey const & in_portfolio_key = HPS::PortfolioKey(), char const * in_name = "");
3038 
3042  static Layout CreateLayout(char const * in_name = "");
3043 
3047  static View CreateView(char const * in_name = "");
3048 
3052  static Model CreateModel(char const * in_name = "");
3053 
3054  static Component CreateComponent(HPS::Component const & in_owner, char const * in_name = "");
3055 
3056 private:
3057  Factory() {}
3058 };
3059 
3069 class SPRK_API AxisTriadOperator : public Operator
3070 {
3071 public:
3072  AxisTriadOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
3074  virtual HPS::UTF8 GetName() const { return "HPS_AxisTriadOperator"; }
3075 
3081  virtual bool OnMouseDown(MouseState const & in_state);
3086  virtual bool OnMouseUp(MouseState const & in_state);
3091  virtual bool OnMouseMove(MouseState const & in_state);
3092 
3097  virtual bool OnTouchDown(TouchState const & in_state);
3102  virtual bool OnTouchUp(TouchState const & in_state);
3107  virtual bool OnTouchMove(TouchState const & in_state);
3108 
3109  virtual void OnViewAttached();
3110 
3111 private:
3112 
3113  bool AxisOrbit(HPS::WindowPoint const & in_loc);
3114  void Transition(HPS::SelectionResults selection_results);
3115  void TranslatePoint(HPS::WindowPoint * point);
3116  bool IsEventRelevant(HPS::Point const & event_location);
3117 
3118  bool operator_active;
3119  HPS::WindowPoint start_point;
3120  HPS::Vector start_sphere_point;
3121  float axis_subwindow_width;
3122  float axis_subwindow_height;
3123  HPS::TouchID tracked_touch_ID;
3124  HPS::Rectangle axis_subwindow;
3125  HPS::IntRectangle axis_subwindow_offsets;
3126  HPS::SegmentKey axis_triad_segment;
3127 
3128 };
3129 
3132 {
3133 public:
3136  virtual ~SmoothTransitionCompleteEvent();
3137 
3140  SmoothTransitionCompleteEvent(HPS::View const & in_view) : view(in_view)
3141  { channel = HPS::Object::ClassID<SmoothTransitionCompleteEvent>(); }
3142 
3145  SmoothTransitionCompleteEvent(Event const & in_event) : Event(in_event)
3146  {
3147  if (in_event.GetChannel() == Object::ClassID<SmoothTransitionCompleteEvent>())
3148  {
3149  auto that = static_cast<SmoothTransitionCompleteEvent const &>(in_event);
3150  view = that.view;
3151  }
3152  else
3153  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
3154  }
3155 
3158  Event * Clone() const
3159  {
3161  return new_event;
3162  }
3163 
3167  virtual bool Drop(Event const * in_that_event) const
3168  {
3169  HPS_UNREFERENCED(in_that_event);
3170  return false;
3171  }
3172 
3173  HPS::View view;
3174 };
3175 
3194 class SPRK_API NavigationCubeOperator : public Operator
3195 {
3196 public:
3197  NavigationCubeOperator(MouseButtons in_mouse_trigger = MouseButtons::ButtonLeft(), ModifierKeys in_modifier_trigger = ModifierKeys());
3198  ~NavigationCubeOperator() { }
3199 
3201  virtual HPS::UTF8 GetName() const { return "HPS_NavigationCubeOperator"; }
3202 
3207  virtual bool OnMouseDown(MouseState const & in_state);
3212  virtual bool OnMouseUp(MouseState const & in_state);
3217  virtual bool OnMouseMove(MouseState const & in_state);
3218 
3222  virtual bool OnTouchDown(TouchState const & in_state);
3227  virtual bool OnTouchUp(TouchState const & in_state);
3232  virtual bool OnTouchMove(TouchState const & in_state);
3233 
3234  virtual void OnViewAttached();
3235  virtual void OnViewDetached();
3236 
3237  virtual void OnModelAttached();
3238 
3239  void UpdateHighlightColor();
3240 
3244  void SetReferenceSegment(HPS::SegmentKey const & in_segment);
3245 
3250  void SetReferenceSegment(HPS::SegmentKeyArray const & in_segments);
3251 
3255  HPS::SegmentKeyArray ShowReferenceSegment();
3256 
3257 private:
3258  void Transition(HPS::SelectionResults selection_results);
3259  bool Orbit(HPS::WindowPoint const & in_loc);
3260  void TranslatePoint(HPS::WindowPoint * point);
3261  bool IsEventRelevant(HPS::Point const & event_location, HPS::KeyPath const & event_path);
3262  bool AreCamerasEqual(HPS::CameraKit const & this_camera, HPS::CameraKit const & that_camera);
3263 
3264  bool operator_active;
3265  HPS::TouchID tracked_touch_ID;
3266  HPS::WindowPoint start_point;
3267  HPS::WindowPoint down_position;
3268  HPS::Vector start_sphere_point;
3269  HPS::SegmentKeyArray reference_segments; //rotation and zooming happen around these segments
3270 
3271  HPS::SegmentKey nav_cube_segment;
3272  HPS::SegmentKey style_segment;
3273  HPS::PortfolioKey portfolio;
3274  HPS::ReferenceKeyArrayArray groups;
3275  HPS::HighlightOptionsKit highlight_options_kit;
3276  HPS::CameraKit previous_camera;
3277  int previous_face;
3278  bool suppress_mouse_over_highlights;
3279 
3280  HPS::Rectangle nav_cube_subwindow;
3281  HPS::IntRectangle nav_cube_subwindow_offsets;
3282  float nav_cube_subwindow_width;
3283  float nav_cube_subwindow_height;
3284 
3285  int highlighted_group;
3286 
3287  bool moving;
3288 
3289  class SmoothTransitionCompleteEventHandler : public EventHandler
3290  {
3291  public:
3292  SmoothTransitionCompleteEventHandler(View const & in_view, bool & in_moving)
3293  : handler_view(in_view), handler_moving(&in_moving) {}
3294 
3295  ~SmoothTransitionCompleteEventHandler() { Shutdown(); }
3296 
3297  virtual HandleResult Handle(HPS::Event const * in_event);
3298 
3299  private:
3300  View handler_view;
3301  bool * handler_moving;
3302  };
3303 
3304  SmoothTransitionCompleteEventHandler * handler;
3305 };
3306 
3307 
3308 
3309 
3310 class SceneTreeItem;
3311 typedef std::shared_ptr<SceneTreeItem> SceneTreeItemPtr;
3312 class SceneTree;
3313 typedef std::shared_ptr<SceneTree> SceneTreePtr;
3314 
3317 class SPRK_API SceneTree : public Sprocket
3318 {
3319 public:
3322  enum class ItemType : uint32_t
3323  {
3324  None = 0x00000000,
3325  GenericMask = 0xffff0000,
3326 
3327  Segment = 0x00000001,
3328  Include = 0x00000002,
3329  ConditionalExpression = 0x00000003,
3330  StaticModelSegment = 0x00000004,
3331  AttributeFilter = 0x00000005,
3332 
3333  Geometry = 0x00010000,
3334  CuttingSection = 0x00010001,
3335  Shell = 0x00010002,
3336  Mesh = 0x00010003,
3337  Grid = 0x00010004,
3338  NURBSSurface = 0x00010005,
3339  Cylinder = 0x00010006,
3340  Sphere = 0x00010007,
3341  Polygon = 0x00010008,
3342  Circle = 0x00010009,
3343  CircularWedge = 0x0001000a,
3344  Ellipse = 0x0001000b,
3345  Line = 0x0001000c,
3346  NURBSCurve = 0x0001000d,
3347  CircularArc = 0x0001000e,
3348  EllipticalArc = 0x0001000f,
3349  InfiniteLine = 0x00010010,
3350  InfiniteRay = 0x00010011,
3351  Marker = 0x00010012,
3352  Text = 0x00010013,
3353  Reference = 0x00010014,
3354  DistantLight = 0x00010015,
3355  Spotlight = 0x00010016,
3356 
3357  Attribute = 0x00020000,
3358  Portfolio = 0x00020001,
3359  SegmentStyle = 0x00020002,
3360  NamedStyle = 0x00020003,
3361  MaterialPalette = 0x00020004,
3362  Priority = 0x00020005,
3363  Material = 0x00020006,
3364  Camera = 0x00020007,
3365  ModellingMatrix = 0x00020008,
3366  UserData = 0x00020009,
3367  TextureMatrix = 0x0002000a,
3368  Culling = 0x0002000b,
3369  CurveAttribute = 0x0002000c,
3370  CylinderAttribute = 0x0002000d,
3371  EdgeAttribute = 0x0002000e,
3372  LightingAttribute = 0x0002000f,
3373  LineAttribute = 0x00020010,
3374  MarkerAttribute = 0x00020011,
3375  SurfaceAttribute = 0x00020012,
3376  Selectability = 0x00020013,
3377  SphereAttribute = 0x00020014,
3378  Subwindow = 0x00020015,
3379  TextAttribute = 0x00020016,
3380  Transparency = 0x00020017,
3381  Visibility = 0x00020018,
3382  VisualEffects = 0x00020019,
3383  Performance = 0x00020020,
3384  DrawingAttribute = 0x00020021,
3385  HiddenLineAttribute = 0x00020022,
3386  ContourLine = 0x00020023,
3387  Condition = 0x00020024,
3388  Bounding = 0x00020025,
3389  AttributeLock = 0x00020026,
3390  TransformMask = 0x00020027,
3391  ColorInterpolation = 0x00020028,
3392  CuttingSectionAttribute = 0x00020029,
3393 
3394  // window only attributes
3395  Debugging = 0x00020030,
3396  PostProcessEffects = 0x00020031,
3397  SelectionOptions = 0x00020032,
3398  UpdateOptions = 0x00020033,
3399 
3400  Definition = 0x00040000,
3401  NamedStyleDefinition = 0x00040001,
3402  TextureDefinition = 0x00040002,
3403  LinePatternDefinition = 0x00040003,
3404  GlyphDefinition = 0x00040004,
3405  CubeMapDefinition = 0x00040005,
3406  ImageDefinition = 0x00040006,
3407  MaterialPaletteDefinition = 0x00040007,
3408  ShaderDefinition = 0x00040008,
3409  ShapeDefinition = 0x00040009,
3410 
3411  Group = 0x00080000,
3412  SegmentGroup = 0x00080100,
3413  GeometryGroup = 0x00080200,
3414  AttributeGroup = 0x00080300,
3415  PortfolioGroup = 0x00080400,
3416  StyleGroup = 0x00080500,
3417  IncludeGroup = 0x00080600,
3418  DefinitionGroup = 0x00180000,
3419  NamedStyleDefinitionGroup = 0x00180700,
3420  TextureDefinitionGroup = 0x00180800,
3421  LinePatternDefinitionGroup = 0x00180900,
3422  GlyphDefinitionGroup = 0x00180a00,
3423  CubeMapDefinitionGroup = 0x00180b00,
3424  ImageDefinitionGroup = 0x00180c00,
3425  MaterialPaletteDefinitionGroup = 0x00180d00,
3426  ShaderDefinitionGroup = 0x00180e00,
3427  ShapeDefinitionGroup = 0x00180f00,
3428  CuttingSectionGroup = 0x00080001,
3429  ShellGroup = 0x00080002,
3430  MeshGroup = 0x00080003,
3431  GridGroup = 0x00080004,
3432  NURBSSurfaceGroup = 0x00080005,
3433  CylinderGroup = 0x00080006,
3434  SphereGroup = 0x00080007,
3435  PolygonGroup = 0x00080008,
3436  CircleGroup = 0x00080009,
3437  CircularWedgeGroup = 0x0008000a,
3438  EllipseGroup = 0x0008000b,
3439  LineGroup = 0x0008000c,
3440  NURBSCurveGroup = 0x0008000d,
3441  CircularArcGroup = 0x0008000e,
3442  EllipticalArcGroup = 0x0008000f,
3443  InfiniteLineGroup = 0x00080010,
3444  InfiniteRayGroup = 0x00080011,
3445  MarkerGroup = 0x00080012,
3446  TextGroup = 0x00080013,
3447  ReferenceGroup = 0x00080014,
3448  DistantLightGroup = 0x00080015,
3449  SpotlightGroup = 0x00080016,
3450  };
3451 
3453  SceneTree();
3454 
3457  SceneTree(Canvas const & in_canvas);
3458 
3461  SceneTree(SceneTree const & in_that);
3462 
3465  SceneTree(SceneTree && in_that);
3466 
3467  virtual ~SceneTree();
3468 
3469  virtual HPS::Type ObjectType() const { return HPS::Type::SceneTree; }
3470 
3474  SceneTree & operator=(SceneTree const & in_that);
3475 
3479  SceneTree & operator=(SceneTree && in_that);
3480 
3484  virtual void Assign(SceneTree const & in_that);
3485 
3489  bool Equals(SceneTree const & in_that) const;
3490 
3494  bool operator!=(SceneTree const & in_that) const;
3495 
3499  bool operator==(SceneTree const & in_that) const;
3500 
3501 
3510  void SetHighlightOptions(HighlightOptionsKit const & in_options);
3511 
3521  void SetHighlightOptions(HighlightOptionsKitArray const & in_options);
3522 
3533  void SetHighlightOptions(size_t in_count, HighlightOptionsKit const in_options []);
3534 
3542  void AddHighlightOptions(HighlightOptionsKit const & in_options);
3543 
3546  HighlightOptionsKitArray GetHighlightOptions() const;
3547 
3548 
3553  void SetGroupingLimit(size_t in_limit);
3554 
3557  size_t GetGroupingLimit() const;
3558 
3559 
3566  void SetRoot(SceneTreeItemPtr const & in_root);
3567 
3570  SceneTreeItemPtr GetRoot() const;
3571 
3572 
3575  virtual void Flush();
3576 
3581  void SetHighlightEventHandling(bool in_state);
3582 
3586  bool GetHighlightEventHandling() const;
3587 
3590  void ReExpand();
3591 };
3592 
3593 
3596 class SPRK_API SceneTreeItem : public Sprocket
3597 {
3598 public:
3600  SceneTreeItem();
3601 
3604  SceneTreeItem(SceneTreeItem const & in_that);
3605 
3608  SceneTreeItem(SceneTreeItem && in_that);
3609 
3615  SceneTreeItem(SceneTreePtr const & in_tree, Model const & in_model);
3616 
3622  SceneTreeItem(SceneTreePtr const & in_tree, View const & in_view);
3623 
3629  SceneTreeItem(SceneTreePtr const & in_tree, Layout const & in_layout);
3630 
3636  SceneTreeItem(SceneTreePtr const & in_tree, Canvas const & in_canvas);
3637 
3645  SceneTreeItem(SceneTreePtr const & in_tree, Key const & in_key, SceneTree::ItemType in_type, char const * in_title = nullptr);
3646 
3647  virtual ~SceneTreeItem();
3648 
3649  HPS::Type ObjectType() const { return HPS::Type::SceneTreeItem; }
3650 
3654  SceneTreeItem & operator=(SceneTreeItem const & in_that);
3655 
3659  SceneTreeItem & operator=(SceneTreeItem && in_that);
3660 
3664  virtual void Assign(SceneTreeItem const & in_that);
3665 
3669  bool Equals(SceneTreeItem const & in_that) const;
3670 
3674  bool operator!=(SceneTreeItem const & in_that) const;
3675 
3679  bool operator==(SceneTreeItem const & in_that) const;
3680 
3681 
3684  SceneTreePtr GetTree() const;
3685 
3688  UTF8 GetTitle() const;
3689 
3692  SceneTree::ItemType GetItemType() const;
3693 
3697  bool HasItemType(SceneTree::ItemType in_mask) const;
3698 
3701  Key GetKey() const;
3702 
3705  KeyPath GetKeyPath() const;
3706 
3709  bool HasChildren() const;
3710 
3711 
3720  virtual SceneTreeItemPtr AddChild(Key const & in_key, SceneTree::ItemType in_type, char const * in_title = nullptr) = 0;
3721 
3722 
3725  virtual void Expand();
3726 
3729  virtual void Collapse();
3730 
3731 
3736  bool IsSelected() const;
3737 
3743  virtual void Select();
3744 
3750  virtual void Unselect();
3751 
3756  bool IsHighlightable() const;
3757 
3763  bool IsHighlighted() const;
3764 
3769  void Highlight(size_t in_highlight_options_index = 0);
3770 
3776  void Highlight(HighlightOptionsKit const & in_highlight_options);
3777 
3783  void Unhighlight(size_t in_highlight_options_index = 0);
3784 
3791  void Unhighlight(HighlightOptionsKit const & in_highlight_options);
3792 
3795  bool IsExpanded() const;
3796 
3799  void ReExpand();
3800 };
3801 
3802 
3803 
3804 class ComponentTreeItem;
3805 typedef std::shared_ptr<ComponentTreeItem> ComponentTreeItemPtr;
3806 class ComponentTree;
3807 typedef std::shared_ptr<ComponentTree> ComponentTreePtr;
3808 
3811 class SPRK_API ComponentTree : public Sprocket
3812 {
3813 public:
3816  enum class ItemType
3817  {
3818  None,
3819  ExchangeComponent,
3820  ExchangeModelFile,
3821 
3822  ExchangeViewGroup,
3823  ExchangeAnnotationViewGroup,
3824  ExchangePMIGroup,
3825  ExchangeModelGroup,
3826 
3827  ParasolidComponent,
3828  ParasolidModelFile,
3829 
3830  DWGComponent,
3831  DWGModelFile,
3832  };
3833 
3835  ComponentTree();
3836 
3840  ComponentTree(Canvas const & in_canvas, size_t in_layer = 0);
3841 
3844  ComponentTree(ComponentTree const & in_that);
3845 
3848  ComponentTree(ComponentTree && in_that);
3849 
3850  virtual ~ComponentTree();
3851 
3852  virtual HPS::Type ObjectType() const { return HPS::Type::ComponentTree; }
3853 
3857  ComponentTree & operator=(ComponentTree const & in_that);
3858 
3862  ComponentTree & operator=(ComponentTree && in_that);
3863 
3867  virtual void Assign(ComponentTree const & in_that);
3868 
3872  bool Equals(ComponentTree const & in_that) const;
3873 
3877  bool operator!=(ComponentTree const & in_that) const;
3878 
3882  bool operator==(ComponentTree const & in_that) const;
3883 
3884 
3893  void SetHighlightOptions(HighlightOptionsKit const & in_options);
3894 
3904  void SetHighlightOptions(HighlightOptionsKitArray const & in_options);
3905 
3916  void SetHighlightOptions(size_t in_count, HighlightOptionsKit const in_options []);
3917 
3927  void AddHighlightOptions(HighlightOptionsKit const & in_options);
3928 
3931  HighlightOptionsKitArray GetHighlightOptions() const;
3932 
3933 
3940  void SetRoot(ComponentTreeItemPtr const & in_root);
3941 
3944  ComponentTreeItemPtr GetRoot() const;
3945 
3946 
3949  virtual void Flush();
3950 
3953  void ReExpand();
3954 
3959  void SetHighlightEventHandling(bool in_state);
3960 
3964  bool GetHighlightEventHandling() const;
3965 };
3966 
3967 
3970 class SPRK_API ComponentTreeItem : public Sprocket
3971 {
3972 public:
3975 
3978  ComponentTreeItem(ComponentTreeItem const & in_that);
3979 
3983 
3989  ComponentTreeItem(ComponentTreePtr const & in_tree, CADModel const & in_cad_model);
3990 
3997  ComponentTreeItem(ComponentTreePtr const & in_tree, Component const & in_component, ComponentTree::ItemType in_type);
3998 
3999  virtual ~ComponentTreeItem();
4000 
4001  HPS::Type ObjectType() const { return HPS::Type::ComponentTreeItem; }
4002 
4006  ComponentTreeItem & operator=(ComponentTreeItem const & in_that);
4007 
4011  ComponentTreeItem & operator=(ComponentTreeItem && in_that);
4012 
4016  virtual void Assign(ComponentTreeItem const & in_that);
4017 
4021  bool Equals(ComponentTreeItem const & in_that) const;
4022 
4026  bool operator!=(ComponentTreeItem const & in_that) const;
4027 
4031  bool operator==(ComponentTreeItem const & in_that) const;
4032 
4033 
4034 
4037  ComponentTreePtr GetTree() const;
4038 
4041  UTF8 GetTitle() const;
4042 
4045  ComponentTree::ItemType GetItemType() const;
4046 
4049  Component GetComponent() const;
4050 
4053  bool HasChildren() const;
4054 
4057  ComponentPath GetPath() const;
4058 
4059 
4067  virtual ComponentTreeItemPtr AddChild(Component const & in_component, ComponentTree::ItemType in_type) = 0;
4068 
4069 
4072  virtual void Expand();
4073 
4076  virtual void Collapse();
4077 
4078 
4084  bool IsHighlighted() const;
4085 
4090  virtual void OnHighlight(HighlightOptionsKit const & in_options);
4091 
4096  virtual void OnUnhighlight(HighlightOptionsKit const & in_options);
4097 
4098 
4103  void Highlight(size_t in_highlight_options_index = 0);
4104 
4110  void Highlight(HighlightOptionsKit const & in_highlight_options);
4111 
4116  void Unhighlight(size_t in_highlight_options_index = 0);
4117 
4123  void Unhighlight(HighlightOptionsKit const & in_highlight_options);
4124 
4125 
4135  bool IsHidden() const;
4136 
4140  virtual void OnHide();
4141 
4145  virtual void OnShow();
4146 
4150  void Hide();
4151 
4155  void Show();
4156 
4161  void Isolate();
4162 
4165  bool IsExpanded() const;
4166 
4169  void ReExpand();
4170 };
4171 
4172 
4173 
4174 
4175 }
4176 #endif
4177 
4178 
4179 
Definition: sprk.h:2892
HPS::Type ObjectType() const
Definition: sprk.h:2726
Definition: hps.h:3333
Definition: hps.h:6205
Definition: sprk.h:992
HPS::Type ObjectType() const
Definition: sprk.h:480
Event * Clone() const
Definition: sprk.h:745
Definition: sprk.h:3069
Definition: sprk.h:264
ComponentHighlightEvent(Event const &in_event)
Definition: sprk.h:2327
HPS::Type ObjectType() const
Definition: sprk.h:272
virtual bool OnTimerTick(HPS::TimerTickEvent const &in_event)
Definition: sprk.h:1189
Definition: hps.h:41673
ComponentHighlightEvent()
Definition: sprk.h:2309
void SetModifierTrigger(ModifierKeys in_modifiers)
Definition: sprk.h:1215
Definition: hps.h:476
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:2378
An InvalidSpecificationException is thrown when a method is called with non-sensical or contradictory...
Definition: hps.h:5685
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:3816
Definition: hps.h:5725
virtual intptr_t Freshen() const
Definition: sprk.h:1034
CaptureActivationEvent()
Definition: sprk.h:2500
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:3970
virtual bool OnMouseEnter(MouseState const &in_state)
Definition: sprk.h:1149
Definition: sprk.h:2945
HPS::Type ObjectType() const
Definition: sprk.h:2567
Definition: hps.h:41460
Definition: hps.h:1322
Definition: hps.h:1040
HPS::Type ObjectType() const
Definition: sprk.h:2069
Definition: hps.h:1683
Definition: sprk.h:234
ModelDeletedEvent()
Definition: sprk.h:953
SmoothTransitionCompleteEvent(HPS::View const &in_view)
Definition: sprk.h:3140
Definition: sprk.h:3811
Definition: hps.h:46516
Definition: sprk.h:1052
virtual bool OnTouchUp(TouchState const &in_state)
Definition: sprk.h:1164
Definition: hps.h:7713
MouseButtons GetMouseTrigger() const
Definition: sprk.h:1210
virtual HPS::Type ObjectType() const
Definition: sprk.h:3469
Definition: hps.h:3484
Definition: hps.h:2038
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:1390
Definition: hps.h:861
HPS::Type ObjectType() const
Definition: sprk.h:1619
Definition: hps.h:41578
virtual void OnModelDetached()
Definition: sprk.h:1203
SmoothTransitionCompleteEvent(Event const &in_event)
Definition: sprk.h:3145
Definition: hps.h:1730
Definition: hps.h:1519
Definition: hps.h:8886
Definition: hps.h:250
void SetMouseTrigger(MouseButtons in_buttons)
Definition: sprk.h:1206
ComponentPath & Append(Component const &in_component)
Definition: hps.h:1790
Event * Clone() const
Definition: sprk.h:895
CameraChangedEvent()
Definition: sprk.h:996
SprocketKit & operator=(SprocketKit &&in_that)
Definition: sprk.h:254
Definition: hps.h:46415
Definition: hps.h:40521
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:40567
HPS::Type ObjectType() const
Definition: sprk.h:3649
LayoutDeletedEvent()
Definition: sprk.h:759
Event * Clone() const
Definition: sprk.h:939
virtual void OnViewAttached()
Definition: sprk.h:1192
Definition: hps.h:39955
Definition: hps.h:43104
Definition: hps.h:1080
Definition: sprk.h:2636
LayoutDetachedEvent()
Definition: sprk.h:714
Definition: sprk.h:2748
virtual bool OnMouseLeave(MouseState const &in_state)
Definition: sprk.h:1154
Definition: hps.h:9682
Definition: hps.h:41621
Definition: hps.h:1478
SmoothTransitionCompleteEvent()
Definition: sprk.h:3135
Definition: hps.h:1410
HPS::Type ObjectType() const
Definition: sprk.h:559
virtual bool OnMouseUp(MouseState const &in_state)
Definition: sprk.h:1134
FilterActivationEvent()
Definition: sprk.h:2412
Definition: hps.h:1429
virtual void OnModelAttached()
Definition: sprk.h:1199
Definition: hps.h:37816
FilterActivationEvent(Event const &in_event)
Definition: sprk.h:2426
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:7086
Location
Definition: sprk.h:1591
HPS::Type ObjectType() const
Definition: sprk.h:237
Definition: hps.h:45907
Definition: sprk.h:2700
Definition: sprk.h:1587
Definition: hps.h:43281
HPS::Type ObjectType() const
Definition: sprk.h:1315
SprocketControl & operator=(SprocketControl &&in_that)
Definition: sprk.h:227
Definition: hps.h:44814
virtual UTF8 GetName() const
Definition: sprk.h:1124
Definition: hps.h:46303
Definition: sprk.h:710
Event * Clone() const
Definition: sprk.h:2443
CaptureActivationEvent(Event const &in_event)
Definition: sprk.h:2514
virtual bool OnTouchDown(TouchState const &in_state)
Definition: sprk.h:1159
HPS::Type ObjectType() const
Definition: sprk.h:2822
CanvasDeletedEvent()
Definition: sprk.h:671
virtual bool OnMouseWheel(MouseState const &in_state)
Definition: sprk.h:1144
HPS::Type ObjectType() const
Definition: sprk.h:2656
HPS::Type ObjectType() const
Definition: sprk.h:2774
SprocketControl(SprocketControl &&in_that)
Definition: sprk.h:222
Event * Clone() const
Definition: sprk.h:2530
Definition: hps.h:15321
ViewDeletedEvent()
Definition: sprk.h:865
intptr_t GetChannel() const
Definition: hps.h:6338
Definition: sprk.h:798
SprocketKit(SprocketKit &&in_that)
Definition: sprk.h:249
virtual bool Drop(Event const *in_that_event) const
Definition: sprk.h:3167
virtual HPS::UTF8 GetName() const
Definition: sprk.h:3074
Definition: sprk.h:1724
Definition: hps.h:43558
Definition: hps.h:45426
virtual bool OnTextInput(HPS::UTF8 const &in_text)
Definition: sprk.h:1184
ViewDeletedEvent(Event const &in_event)
Definition: sprk.h:880
Definition: hps.h:37380
Definition: sprk.h:2844
ViewDetachedEvent()
Definition: sprk.h:809
Definition: hps.h:6305
Definition: sprk.h:1293
Definition: hps.h:412
HPS::Type ObjectType() const
Definition: sprk.h:2870
Event * Clone() const
Definition: sprk.h:2344
Definition: sprk.h:473
CanvasDeletedEvent(Event const &in_event)
Definition: sprk.h:686
Definition: sprk.h:3194
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:44740
Definition: hps.h:2057
Definition: sprk.h:2298
Event * Clone() const
Definition: sprk.h:701
LayoutDetachedEvent(Event const &in_event)
Definition: sprk.h:729
HPS::Type ObjectType() const
Definition: sprk.h:4001
virtual bool OnMouseDown(MouseState const &in_state)
Definition: sprk.h:1129
ItemType
Definition: sprk.h:3322
Definition: sprk.h:2357
Definition: sprk.h:2995
virtual HPS::UTF8 GetName() const
Definition: sprk.h:3201
Definition: sprk.h:184
Definition: sprk.h:3131
Definition: hps.h:431
Event * Clone() const
Definition: sprk.h:983
Definition: sprk.h:2456
Definition: hps.h:2077
ModelDetachedEvent()
Definition: sprk.h:908
static MouseButtons ButtonLeft()
Definition: hps.h:46025
virtual HPS::Type ObjectType() const
Definition: sprk.h:3852
Definition: sprk.h:3317
Definition: sprk.h:2796
UpdateType
Definition: hps.h:184
Definition: hps.h:9025
HPS::Type ObjectType() const
Definition: sprk.h:1062
virtual bool IsMouseTriggered(MouseState const &in_state)
Definition: sprk.h:1221
Definition: hps.h:7632
Definition: sprk.h:2401
Definition: hps.h:36996
Definition: hps.h:357
Event * Clone() const
Definition: sprk.h:3158
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:9239
Definition: hps.h:10783
Definition: sprk.h:1236
virtual bool OnTouchMove(TouchState const &in_state)
Definition: sprk.h:1169
Definition: sprk.h:3596
Definition: sprk.h:2542
Definition: hps.h:42147
Mode
Definition: sprk.h:189
Definition: hps.h:517
Definition: sprk.h:1093
Definition: hps.h:1123
Definition: hps.h:41505
Definition: sprk.h:861
Definition: sprk.h:2496
Definition: hps.h:40018
HPS::Type ObjectType() const
Definition: sprk.h:2918
HPS::Type ObjectType() const
Definition: sprk.h:2477
HPS::Type ObjectType() const
Definition: sprk.h:2971
Definition: hps.h:7344
Event * Clone() const
Definition: sprk.h:1041