Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

HSelectionSet.h
Go to the documentation of this file.
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 
16 #ifndef _HSELECTIONSET_H
17 #define _HSELECTIONSET_H
18 
19 #ifdef H_PACK_8
20 #pragma pack(push)
21 #pragma pack(8)
22 #endif
23 
24 #include "HTools.h"
25 #include "HGlobals.h"
26 
27 
34 {
39 };
44 //forward declaration
45 class HBaseView;
46 class HSelectionItem;
47 class HShellObject;
48 class HVHashPShowCache;
49 class HSelHash;
50 class HSelList;
53 
54 
55 
56 
58 
66 class MVO_API HSelectionSet
67 {
68  friend class HBaseView;
69 
70 
71 protected:
73  HSelList * m_pSelItemsList;
74  struct vhash_s *m_pHighlightSegsHash;
77 
83 
86 
93  HRegionFaceHighlightMode m_bHighlightRegionFacesAutoVisibility;
94 
98 
99  bool m_bNotify;
100 
101  bool m_bUseDefinedHighlight;
102 
103 
107  virtual void UpdateTransparency(bool force_flush=false);
108 
109 public:
111  HSelectionSet(HBaseView* view, bool bReferenceSelection = false);
112 
113  virtual ~HSelectionSet();
114 
118  virtual void Init();
119 
120 
139  virtual void Select(HC_KEY key, int num_include_keys, HC_KEY include_keys[], bool emit_message = false);
140 
154  virtual void Select(HSelectionItem * new_sel, bool emit_message = false);
155 
173  virtual void SelectRegion(HShellObject const & oShell, int num_include_keys, HC_KEY include_keys[], int region, bool emit_message);
174 
175 
199  virtual void SelectSubentity(HC_KEY key, int num_include_keys, HC_KEY include_keys[],
200  int count, const int faces[]=0, const int vertex1[]=0, const int vertex2[]=0, bool emit_message=false);
201 
215  virtual void Select(HC_KEY key, const char* segpath, HC_KEY include_key, HC_KEY includer_key, bool emit_message = false);
216 
232  virtual void DeSelect(HC_KEY key, bool emit_message = false);
233 
251  virtual void DeSelect(HC_KEY key, int num_include_keys, HC_KEY include_keys[], bool emit_message = false);
252 
263  virtual void DeSelect(HSelectionItem * remove_sel, bool emit_message = false);
264 
279  virtual void DeSelectRegion(HShellObject const & oShell, int region, bool emit_messag);
280 
300  virtual void DeSelectRegion(HShellObject const & oShell, int num_include_keys, HC_KEY include_keys[], int region, bool emit_message = false);
301 
302 
309  virtual void DeSelectSubentity(HC_KEY key, int num_include_keys, HC_KEY include_keys[],
310  int count, const int faces[], const int vertex1[], const int vertex2[], bool emit_message = false);
311 
312 
313 
314 
315 
316  virtual bool SelectSubentityOOC (
317  HC_KEY key, int num_include_keys, HC_KEY include_keys[],
318  int count, int const faces[] = 0, int const vertex1[] = 0, int const vertex2[] = 0,
319  bool emit_message = false);
320 
321  virtual bool DeSelectOOC (
322  HC_KEY key, int num_include_keys, HC_KEY include_keys[],
323  bool emit_message = false);
324 
325 
326 
327 
329  virtual bool HighlightRegionEdges() {return m_bHighlightRegionEdges;};
330 
332  virtual void HighlightRegionEdges(bool yesno) {m_bHighlightRegionEdges = yesno;};
333 
335  virtual bool HighlightAnnotations() {return m_bHighlightAnnotations;};
336 
338  virtual void HighlightAnnotations(bool yesno) {m_bHighlightAnnotations = yesno;};
339 
341  virtual HRegionEdgeHighlightMode HighlightRegionEdgesAutoVisibility() {return m_bHighlightRegionEdgesAutoVisibility;};
342 
344  virtual void HighlightRegionEdgesAutoVisibility(bool yesno) {m_bHighlightRegionEdgesAutoVisibility = yesno ? AllEdges : NoEdges;};
345 
347  virtual void HighlightRegionEdgesAutoVisibility(HRegionEdgeHighlightMode edge_state) {m_bHighlightRegionEdgesAutoVisibility = edge_state;};
348 
350  virtual void HighlightRegionFacesAutoVisibility(HRegionFaceHighlightMode face_state) {m_bHighlightRegionFacesAutoVisibility = face_state;};
351 
353  virtual HRegionFaceHighlightMode HighlightRegionFacesAutoVisibility() {return m_bHighlightRegionFacesAutoVisibility;};
354 
362  virtual void DeSelectAll();
363 
374  virtual bool IsSelected(HC_KEY key) const;
375 
393  virtual bool IsSelected(HC_KEY key, int num_include_keys, const HC_KEY include_keys[]) const;
394 
406  virtual bool IsSelected(const HSelectionItem * item) const;
407 
426  virtual bool IsRegionSelected(HC_KEY key, int num_include_keys, const HC_KEY include_keys[], int region) const;
427 
433  virtual bool IsHighlightSegment(HC_KEY segment_key) const;
434 
439  virtual void SetSelectionFaceColor(HPixelRGBA &rgba){m_selectedFaceColor = rgba; UpdateHighlightStyle();}
440 
445  virtual void SetGrayScale(bool grayScale);
446 
447 
452  virtual void SetInvisible(bool Invisible);
453 
457  virtual bool GetInvisible() { return m_bForceInvisible; }
458 
459 
463  virtual void SetAllowDisplacement(bool allowDisplacement) { m_bAllowDisplacement = allowDisplacement; }
464 
468  virtual bool GetAllowDisplacement() { return m_bAllowDisplacement; }
469 
474  virtual HSelList * GetSelectionList();
475 
480  virtual void GetSelectionFaceColor(HPixelRGBA &rgba){ rgba = m_selectedFaceColor; };
481 
482 
487  virtual void SetSelectionEdgeColor(HPixelRGBA &rgb){m_selectedEdgeColor = rgb; UpdateHighlightStyle();}
488 
493  virtual void GetSelectionEdgeColor(HPixelRGBA &rgba){ rgba = m_selectedEdgeColor; };
494 
495 
500  virtual void SetSelectionCutEdgeColor(HPixelRGBA &rgb){m_selectedCutEdgeColor = rgb; UpdateHighlightStyle();}
501 
506  virtual void GetSelectionCutEdgeColor(HPixelRGBA &rgba){ rgba = m_selectedCutEdgeColor; };
507 
512  virtual void SetSelectionCutFaceColor(HPixelRGBA &rgb){m_selectedCutFaceColor = rgb; UpdateHighlightStyle();}
513 
518  virtual void GetSelectionCutFaceColor(HPixelRGBA &rgba){ rgba = m_selectedCutFaceColor; };
519 
524  virtual void SetSelectionMarkerColor(HPixelRGBA &rgb){m_selectedMarkerColor = rgb; UpdateHighlightStyle();}
525 
526 
531  virtual void GetSelectionMarkerColor(HPixelRGBA &rgba){ rgba = m_selectedMarkerColor; };
532 
537  virtual void SetSelectionEdgeWeight(float weight){m_fselectedEdgeWeight= weight; UpdateHighlightStyle();}
538 
539 
544  virtual float GetSelectionEdgeWeight(){return m_fselectedEdgeWeight;}
545 
546 
551  virtual void SetSelectionMarkerSize(float size){m_fselectedMarkerSize = size; UpdateHighlightStyle();}
552 
557  virtual float GetSelectionMarkerSize(){return m_fselectedMarkerSize;}
558 
564  virtual HC_KEY GetAt(unsigned int index);
565 
571  virtual bool GetAll(HC_KEY out_array[]);
572 
573 
578  const HSelectionItem * GetSelectionItemAt(unsigned int index);
579 
580 
585  const HSelectionItem * GetSelectionItem(HC_KEY key);
586 
587 
589  unsigned int GetSize() const;
590 
594  virtual void Reset();
595 
596 
602  virtual bool DeleteSelection(bool emit_message=false);
603 
607  HC_KEY GetHighlightStyle() const{ return m_keyHighlightStyle; };
608 
609 
610  void SetHighlightStyle(HC_KEY key) { m_keyHighlightStyle = key; };
611 
612  const char * GetHighlightStyleName() const{ return m_keyHighlightStyleName; };
613 
628  bool DeInstance(HSelectionItem * sel_item);
629 
630 
635  bool DeInstance(unsigned int index);
636 
641  virtual bool GetSubwindowPenetration() { return m_bSubwindowPenetration; }
642 
650  virtual void SetSubwindowPenetration(bool allow);
651 
653  virtual bool GetAllowSubentitySelection() { return m_selection_level == HSelectSubentity; }
654 
659  virtual void SetAllowSubentitySelection(bool allow);
660 
662  virtual HSelectLevel GetSelectionLevel() const { return m_selection_level; }
663 
666  virtual void SetSelectionLevel(HSelectLevel level);
667 
669  virtual bool GetAllowEntitySelection() { return m_selection_level == HSelectEntity; }
670 
671 
676  virtual void SetAllowEntitySelection(bool allow);
677 
679  virtual bool GetAllowRegionSelection() const { return m_selection_level == HSelectRegion; }
680 
685  virtual void SetAllowRegionSelection(bool allow);
686 
691  void RegisterHighlightSeg(HC_KEY seg_key);
692 
697  void UnRegisterHighlightSeg(HC_KEY seg_key);
698 
702  virtual const HSelectionHighlightMode GetHighlightMode() { return m_HighlightMode; }
703 
730  virtual void SetHighlightMode(HSelectionHighlightMode m);
731 
735  virtual void SetHighlightTransparency(float trans);
736 
741  virtual HC_KEY GetSelectionSegment() {return m_SelectionSegment;}
742 
748  void ToggleHighlightStyle();
749 
754  virtual bool GetIsSelection(HC_KEY key);
755 
761  virtual bool GetReferenceSelection() const {return m_HighlightMode!=HighlightDefault
762  || m_selection_level == HSelectSubentity;}
763 
769  virtual void SetReferenceSelection(bool ref_sel) {
770  m_HighlightMode = ref_sel ? HighlightQuickmoves : HighlightDefault;
771  }
772 
777  void SetUseDefinedHighlight(bool use_defined_highlight);
778 
784  return m_bUseDefinedHighlight;
785  }
786 
787 
792  virtual void SetReferenceSelectionType(HRefSelType type);
793  virtual HRefSelType GetReferenceSelectionType() {return m_quickmoves_type;}
794 
798  virtual void UpdateHighlightStyle();
799 
805  HVHashPShowCache * GetPShowCache(){ return m_pshow_cache; }
806 
812  void SetPShowCache(HVHashPShowCache * new_cache){ m_pshow_cache=new_cache; }
813 
817  void FlushPShowCache();
818 
822  void UpdateHighlighting();
823 
824  HBaseView * GetView() { return m_pView; }
825 
829  void SetSortSelectionList(bool sort) { m_list_last_updated=0; m_bSortSelectionList=sort;}
830 
834  bool GetSortSelectionList() {return m_bSortSelectionList;}
835 
839  virtual bool GetSubentityFaceSelection() { return m_subentity_face; }
840 
844  virtual void SetSubentityFaceSelection(bool select) { m_subentity_face=select; }
845 
849  virtual bool GetSubentityEdgeSelection() { return m_subentity_edge; }
850 
854  virtual void SetSubentityEdgeSelection(bool select) { m_subentity_edge=select; }
855 
859  virtual bool GetSubentityVertexSelection() { return m_subentity_vertex; }
860 
864  virtual void SetSubentityVertexSelection(bool select) { m_subentity_vertex=select; }
865 
869  virtual void SetAllowSubentityDeselection(bool allow) { SetSubentityTracking(allow); }
870 
874  virtual bool GetAllowSubentityDeselection() { return GetSubentityTracking(); }
875 
883  virtual void SetSubentityTracking(bool allow) { m_subentity_maintain_maps = allow; }
884 
888  virtual bool GetSubentityTracking() { return m_subentity_maintain_maps; }
889 
895  void GetSelectionBounding(HPoint * minimum, HPoint * maximum) const;
896 
897 
901  virtual void SetSelectWillNotify(bool notify) {m_bNotify = notify;}
902 
904  virtual bool GetSelectWillNotify() const { return m_bNotify; }
905 
906 
907  // internal use only
908  int GetAttrLookupID(const char * attribute_string);
909  HSelectionSegmentConditionInfo * GetSelectionSegmentConditionInfo();
910  HConditionStyleKeyInfoHash * GetConditionStyleKeyInfo();
911 
912 
913 private:
914  void HoopsRemove( HC_KEY key );
915  void DeselectSegment( HC_KEY key, char const *keytype );
916  void DeselectGeometry( HC_KEY key );
917 
921  inline bool is_selected(HC_KEY key) const;
922 
923  void ensure_is_segment(HC_KEY &key) const;
924 
925 
926  int m_AttrID;
927  struct vhash_s *m_pAttrLookupHash;
928 
929  HSelectionSegmentConditionInfo * m_pSelectionSegmentConditionInfo;
930  HConditionStyleKeyInfoHash * m_pConditionStyleKeyInfoHash;
931 
932 
933  HVHashPShowCache * m_pshow_cache;
934  HSelHash * m_selected_hash;
935  float m_hash_last_updated;
936  float m_list_last_updated;
937  HRefSelType m_quickmoves_type;
938 
939  HC_KEY m_keyHighlightStyle;
940  char m_keyHighlightStyleName[32];
941 
942  HSelectLevel m_selection_level;
943 
944  bool m_subentity_face;
945  bool m_subentity_edge;
946  bool m_subentity_vertex;
947  bool m_subentity_maintain_maps;
948 
949  bool m_bSubwindowPenetration;
950 
951  bool m_currently_in_DeleteSelection;
952 };
953 
954 
955 #ifdef H_PACK_8
956 #pragma pack(pop)
957 #endif
958 
959 #endif
960 
961 
962 
virtual void SetSelectWillNotify(bool notify)
Definition: HSelectionSet.h:901
void SetPShowCache(HVHashPShowCache *new_cache)
Definition: HSelectionSet.h:812
virtual void SetSubentityFaceSelection(bool select)
Definition: HSelectionSet.h:844
float m_fselectedEdgeWeight
The line thickness used for selected edges.
Definition: HSelectionSet.h:84
The HShellObject class is a simple wrapper for a shell.
Definition: HUtility.h:202
virtual const HSelectionHighlightMode GetHighlightMode()
Definition: HSelectionSet.h:702
virtual void GetSelectionEdgeColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:493
HPixelRGBA m_selectedCutEdgeColor
The color used for selected cut edges.
Definition: HSelectionSet.h:80
virtual void SetSelectionFaceColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:439
Definition: HPShowCache.h:159
virtual void SetSelectionMarkerColor(HPixelRGBA &rgb)
Definition: HSelectionSet.h:524
bool GetUseDefinedHighlight()
Definition: HSelectionSet.h:783
bool m_bHighlightRegionEdges
This indicates whether edges in a region should be highlighted.
Definition: HSelectionSet.h:90
HVHashPShowCache * GetPShowCache()
Definition: HSelectionSet.h:805
virtual void SetSelectionMarkerSize(float size)
Definition: HSelectionSet.h:551
struct vhash_s * m_pHighlightSegsHash
The list of highlighted segment keys.
Definition: HSelectionSet.h:74
virtual bool GetSubwindowPenetration()
Definition: HSelectionSet.h:641
virtual bool GetSelectWillNotify() const
Definition: HSelectionSet.h:904
virtual void GetSelectionCutEdgeColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:506
virtual bool GetReferenceSelection() const
Definition: HSelectionSet.h:761
HRefSelType
Definition: HGlobals.h:577
HBaseView * m_pView
The HOOPS HBaseView associated with to this HSelectionSet.
Definition: HSelectionSet.h:72
select on a segment
Definition: HSelectionSet.h:35
virtual void SetSubentityVertexSelection(bool select)
Definition: HSelectionSet.h:864
The HPixelRGBA class is the data type of a rgba pixel.
Definition: HGlobals.h:509
The HSelectionSet class manages a list of selected items.
Definition: HSelectionSet.h:66
#define HC_KEY
HSelectionHighlightMode
Definition: HGlobals.h:547
virtual bool GetAllowRegionSelection() const
Definition: HSelectionSet.h:679
virtual HRegionEdgeHighlightMode HighlightRegionEdgesAutoVisibility()
Definition: HSelectionSet.h:341
virtual HRegionFaceHighlightMode HighlightRegionFacesAutoVisibility()
Definition: HSelectionSet.h:353
HSelList * m_pSelItemsList
The list of selected HOOPS entities (HSelectionItem pointers).
Definition: HSelectionSet.h:73
HRegionEdgeHighlightMode
Definition: HGlobals.h:561
use default conditional highlighting
Definition: HGlobals.h:548
virtual bool HighlightAnnotations()
Definition: HSelectionSet.h:335
virtual bool GetAllowSubentitySelection()
Definition: HSelectionSet.h:653
select on an entity (piece of geometry, cutting plane or light)
Definition: HSelectionSet.h:36
virtual float GetSelectionEdgeWeight()
Definition: HSelectionSet.h:544
virtual void SetSelectionEdgeWeight(float weight)
Definition: HSelectionSet.h:537
select on arbitrary subentities (face, edge, or vertex)
Definition: HSelectionSet.h:38
HPixelRGBA m_selectedEdgeColor
The color used for selected edges.
Definition: HSelectionSet.h:79
virtual void SetSelectionCutEdgeColor(HPixelRGBA &rgb)
Definition: HSelectionSet.h:500
virtual bool GetSubentityFaceSelection()
Definition: HSelectionSet.h:839
bool m_bForceInvisible
This flag indicating whether to make the selected items invisible.
Definition: HSelectionSet.h:88
virtual void SetAllowSubentityDeselection(bool allow)
Definition: HSelectionSet.h:869
HRegionFaceHighlightMode m_bHighlightRegionFacesAutoVisibility
This indicates whether faces in a region should be automatically made visible when highlighted...
Definition: HSelectionSet.h:93
virtual void HighlightRegionFacesAutoVisibility(HRegionFaceHighlightMode face_state)
Definition: HSelectionSet.h:350
use quick move reference highlighting
Definition: HGlobals.h:549
bool m_bSortSelectionList
If this is set, the selection list will be sorted before returning it.
Definition: HSelectionSet.h:97
virtual void SetReferenceSelection(bool ref_sel)
Definition: HSelectionSet.h:769
virtual void SetSubentityEdgeSelection(bool select)
Definition: HSelectionSet.h:854
bool GetSortSelectionList()
Definition: HSelectionSet.h:834
Definition: HPShowCache.h:182
float m_fselectedMarkerSize
The marker size used for selected markers.
Definition: HSelectionSet.h:85
virtual void GetSelectionFaceColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:480
HC_KEY m_SelectionSegment
The key of the reference selection segment.
Definition: HSelectionSet.h:75
virtual bool GetAllowDisplacement()
Definition: HSelectionSet.h:468
virtual float GetSelectionMarkerSize()
Definition: HSelectionSet.h:557
Definition: HPShowCache.h:180
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
HPixelRGBA m_selectedCutFaceColor
The color used for selected cut faces.
Definition: HSelectionSet.h:81
virtual bool GetAllowEntitySelection()
Definition: HSelectionSet.h:669
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:332
The HSelectionItem class is an interface definition for a selection item.
Definition: HSelectionItem.h:40
virtual void SetSubentityTracking(bool allow)
Definition: HSelectionSet.h:883
HSelectionHighlightMode m_HighlightMode
Stores the current highlighting mode.
Definition: HSelectionSet.h:95
virtual void HighlightRegionEdgesAutoVisibility(HRegionEdgeHighlightMode edge_state)
Definition: HSelectionSet.h:347
void SetSortSelectionList(bool sort)
Definition: HSelectionSet.h:829
bool m_bNotify
If this is set Select() will send HSignalSelected for each item.
Definition: HSelectionSet.h:99
HC_KEY m_TransparencyStyle
The key to a style used in inverse transparency highlighting.
Definition: HSelectionSet.h:76
virtual void HighlightRegionEdgesAutoVisibility(bool yesno)
Definition: HSelectionSet.h:344
virtual bool GetSubentityEdgeSelection()
Definition: HSelectionSet.h:849
bool m_bAllowDisplacement
This indicates whether selected segments should be drawn in front of coincident geometry.
Definition: HSelectionSet.h:89
virtual HC_KEY GetSelectionSegment()
Definition: HSelectionSet.h:741
virtual bool GetInvisible()
Definition: HSelectionSet.h:457
HPixelRGBA m_selectedFaceColor
The color used for selected faces.
Definition: HSelectionSet.h:78
HC_KEY GetHighlightStyle() const
Definition: HSelectionSet.h:607
virtual void SetSelectionEdgeColor(HPixelRGBA &rgb)
Definition: HSelectionSet.h:487
float m_fTransmission
the transmission value used in Inverse Transparency highlighting
Definition: HSelectionSet.h:96
virtual void HighlightAnnotations(bool yesno)
Definition: HSelectionSet.h:338
HSelectLevel
Definition: HSelectionSet.h:33
virtual void HighlightRegionEdges(bool yesno)
Definition: HSelectionSet.h:332
HPixelRGBA m_selectedMarkerColor
The color used for selected markers.
Definition: HSelectionSet.h:82
select on pre-defined regions of an entity
Definition: HSelectionSet.h:37
virtual bool GetAllowSubentityDeselection()
Definition: HSelectionSet.h:874
bool m_bForceGrayScale
This flag indicating whether to use gray scale selection.
Definition: HSelectionSet.h:87
virtual void SetAllowDisplacement(bool allowDisplacement)
Definition: HSelectionSet.h:463
virtual HSelectLevel GetSelectionLevel() const
Definition: HSelectionSet.h:662
virtual bool GetSubentityVertexSelection()
Definition: HSelectionSet.h:859
virtual bool HighlightRegionEdges()
Definition: HSelectionSet.h:329
virtual void GetSelectionCutFaceColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:518
virtual void SetSelectionCutFaceColor(HPixelRGBA &rgb)
Definition: HSelectionSet.h:512
HRegionEdgeHighlightMode m_bHighlightRegionEdgesAutoVisibility
This indicates whether edges in a region should be automatically made visible when highlighted...
Definition: HSelectionSet.h:92
virtual void GetSelectionMarkerColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:531
virtual bool GetSubentityTracking()
Definition: HSelectionSet.h:888
bool m_bHighlightAnnotations
This indicates whether MVO annotations should be highlighted.
Definition: HSelectionSet.h:91