Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HSelectionSet.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2000 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 // $Id: ec17438dbc241988474191f52df04a4987a7a71a $
13 //
14 
21 #ifndef _HSELECTIONSET_H
22 #define _HSELECTIONSET_H
23 
24 #ifdef H_PACK_8
25 #pragma pack(push)
26 #pragma pack(8)
27 #endif
28 
29 #include "HTools.h"
30 #include "HGlobals.h"
31 
32 
39 {
44 };
49 //forward declaration
50 class HBaseView;
51 class HSelectionItem;
52 class HShellObject;
53 class HVHashPShowCache;
54 class HSelHash;
55 class HSelList;
58 
59 
60 
61 
63 
71 class MVO_API HSelectionSet
72 {
73  friend class HBaseView;
74 
75 
76 protected:
78  HSelList * m_pSelItemsList;
79  struct vhash_s *m_pHighlightSegsHash;
82 
88 
91 
98  HRegionFaceHighlightMode m_bHighlightRegionFacesAutoVisibility;
99 
103 
104  bool m_bNotify;
105 
106 
110  virtual void UpdateTransparency(bool force_flush=false);
111 
112 public:
114  HSelectionSet(HBaseView* view, bool bReferenceSelection = false);
115 
116  virtual ~HSelectionSet();
117 
121  virtual void Init();
122 
123 
142  virtual void Select(HC_KEY key, int num_include_keys, HC_KEY include_keys[], bool emit_message = false);
143 
157  virtual void Select(HSelectionItem * new_sel, bool emit_message = false);
158 
176  virtual void SelectRegion(HShellObject const & oShell, int num_include_keys, HC_KEY include_keys[], int region, bool emit_message);
177 
178 
202  virtual void SelectSubentity(HC_KEY key, int num_include_keys, HC_KEY include_keys[],
203  int count, const int faces[]=0, const int vertex1[]=0, const int vertex2[]=0, bool emit_message=false);
204 
218  virtual void Select(HC_KEY key, const char* segpath, HC_KEY include_key, HC_KEY includer_key, bool emit_message = false);
219 
235  virtual void DeSelect(HC_KEY key, bool emit_message = false);
236 
254  virtual void DeSelect(HC_KEY key, int num_include_keys, HC_KEY include_keys[], bool emit_message = false);
255 
266  virtual void DeSelect(HSelectionItem * remove_sel, bool emit_message = false);
267 
282  virtual void DeSelectRegion(HShellObject const & oShell, int region, bool emit_messag);
283 
303  virtual void DeSelectRegion(HShellObject const & oShell, int num_include_keys, HC_KEY include_keys[], int region, bool emit_message = false);
304 
305 
312  virtual void DeSelectSubentity(HC_KEY key, int num_include_keys, HC_KEY include_keys[],
313  int count, const int faces[], const int vertex1[], const int vertex2[], bool emit_message = false);
314 
316  virtual bool HighlightRegionEdges() {return m_bHighlightRegionEdges;};
317 
319  virtual void HighlightRegionEdges(bool yesno) {m_bHighlightRegionEdges = yesno;};
320 
322  virtual bool HighlightAnnotations() {return m_bHighlightAnnotations;};
323 
325  virtual void HighlightAnnotations(bool yesno) {m_bHighlightAnnotations = yesno;};
326 
328  virtual HRegionEdgeHighlightMode HighlightRegionEdgesAutoVisibility() {return m_bHighlightRegionEdgesAutoVisibility;};
329 
331  virtual void HighlightRegionEdgesAutoVisibility(bool yesno) {m_bHighlightRegionEdgesAutoVisibility = yesno ? AllEdges : NoEdges;};
332 
334  virtual void HighlightRegionEdgesAutoVisibility(HRegionEdgeHighlightMode edge_state) {m_bHighlightRegionEdgesAutoVisibility = edge_state;};
335 
337  virtual void HighlightRegionFacesAutoVisibility(HRegionFaceHighlightMode face_state) {m_bHighlightRegionFacesAutoVisibility = face_state;};
338 
340  virtual HRegionFaceHighlightMode HighlightRegionFacesAutoVisibility() {return m_bHighlightRegionFacesAutoVisibility;};
341 
349  virtual void DeSelectAll();
350 
361  virtual bool IsSelected(HC_KEY key) const;
362 
380  virtual bool IsSelected(HC_KEY key, int num_include_keys, const HC_KEY include_keys[]) const;
381 
393  virtual bool IsSelected(const HSelectionItem * item) const;
394 
413  virtual bool IsRegionSelected(HC_KEY key, int num_include_keys, const HC_KEY include_keys[], int region) const;
414 
420  virtual bool IsHighlightSegment(HC_KEY segment_key) const;
421 
426  virtual void SetSelectionFaceColor(HPixelRGBA &rgba){m_selectedFaceColor = rgba; UpdateHighlightStyle();}
427 
432  virtual void SetGrayScale(bool grayScale);
433 
434 
439  virtual void SetInvisible(bool Invisible);
440 
444  virtual bool GetInvisible() { return m_bForceInvisible; }
445 
446 
450  virtual void SetAllowDisplacement(bool allowDisplacement) { m_bAllowDisplacement = allowDisplacement; }
451 
455  virtual bool GetAllowDisplacement() { return m_bAllowDisplacement; }
456 
461  virtual HSelList * GetSelectionList();
462 
467  virtual void GetSelectionFaceColor(HPixelRGBA &rgba){ rgba = m_selectedFaceColor; };
468 
469 
474  virtual void SetSelectionEdgeColor(HPixelRGBA &rgb){m_selectedEdgeColor = rgb; UpdateHighlightStyle();}
475 
480  virtual void GetSelectionEdgeColor(HPixelRGBA &rgba){ rgba = m_selectedEdgeColor; };
481 
482 
487  virtual void SetSelectionCutEdgeColor(HPixelRGBA &rgb){m_selectedCutEdgeColor = rgb; UpdateHighlightStyle();}
488 
493  virtual void GetSelectionCutEdgeColor(HPixelRGBA &rgba){ rgba = m_selectedCutEdgeColor; };
494 
499  virtual void SetSelectionCutFaceColor(HPixelRGBA &rgb){m_selectedCutFaceColor = rgb; UpdateHighlightStyle();}
500 
505  virtual void GetSelectionCutFaceColor(HPixelRGBA &rgba){ rgba = m_selectedCutFaceColor; };
506 
511  virtual void SetSelectionMarkerColor(HPixelRGBA &rgb){m_selectedMarkerColor = rgb; UpdateHighlightStyle();}
512 
513 
518  virtual void GetSelectionMarkerColor(HPixelRGBA &rgba){ rgba = m_selectedMarkerColor; };
519 
524  virtual void SetSelectionEdgeWeight(float weight){m_fselectedEdgeWeight= weight; UpdateHighlightStyle();}
525 
526 
531  virtual float GetSelectionEdgeWeight(){return m_fselectedEdgeWeight;}
532 
533 
538  virtual void SetSelectionMarkerSize(float size){m_fselectedMarkerSize = size; UpdateHighlightStyle();}
539 
544  virtual float GetSelectionMarkerSize(){return m_fselectedMarkerSize;}
545 
551  virtual HC_KEY GetAt(unsigned int index);
552 
553 
558  const HSelectionItem * GetSelectionItemAt(unsigned int index);
559 
560 
565  const HSelectionItem * GetSelectionItem(HC_KEY key);
566 
567 
569  unsigned int GetSize() const;
570 
574  virtual void Reset();
575 
576 
582  virtual bool DeleteSelection(bool emit_message=false);
583 
587  HC_KEY GetHighlightStyle() const{ return m_keyHighlightStyle; };
588  void SetHighlightStyle(HC_KEY key) { m_keyHighlightStyle = key; };
589 
590 
605  bool DeInstance(HSelectionItem * sel_item);
606 
607 
612  bool DeInstance(unsigned int index);
613 
618  virtual bool GetSubwindowPenetration() { return m_bSubwindowPenetration; }
619 
627  virtual void SetSubwindowPenetration(bool allow);
628 
630  virtual bool GetAllowSubentitySelection() { return m_selection_level == HSelectSubentity; }
631 
636  virtual void SetAllowSubentitySelection(bool allow);
637 
639  virtual HSelectLevel GetSelectionLevel() const { return m_selection_level; }
640 
643  virtual void SetSelectionLevel(HSelectLevel level);
644 
646  virtual bool GetAllowEntitySelection() { return m_selection_level == HSelectEntity; }
647 
648 
653  virtual void SetAllowEntitySelection(bool allow);
654 
656  virtual bool GetAllowRegionSelection() const { return m_selection_level == HSelectRegion; }
657 
662  virtual void SetAllowRegionSelection(bool allow);
663 
668  void RegisterHighlightSeg(HC_KEY seg_key);
669 
674  void UnRegisterHighlightSeg(HC_KEY seg_key);
675 
679  virtual const HSelectionHighlightMode GetHighlightMode() { return m_HighlightMode; }
680 
707  virtual void SetHighlightMode(HSelectionHighlightMode m);
708 
712  virtual void SetHighlightTransparency(float trans);
713 
718  virtual HC_KEY GetSelectionSegment() {return m_SelectionSegment;}
719 
725  void ToggleHighlightStyle();
726 
731  virtual bool GetIsSelection(HC_KEY key);
732 
738  virtual bool GetReferenceSelection() const {return (m_HighlightMode!=HighlightDefault
739  || m_selection_level == HSelectSubentity);}
740 
746  virtual void SetReferenceSelection(bool ref_sel) {
747  m_HighlightMode = ref_sel ? HighlightQuickmoves : HighlightDefault;
748  }
749 
754  virtual void SetReferenceSelectionType(HRefSelType type);
755 
756 
760  virtual void UpdateHighlightStyle();
761 
767  HVHashPShowCache * GetPShowCache(){ return m_pshow_cache; }
768 
774  void SetPShowCache(HVHashPShowCache * new_cache){ m_pshow_cache=new_cache; }
775 
779  void FlushPShowCache();
780 
784  void UpdateHighlighting();
785 
786  HBaseView * GetView() { return m_pView; }
787 
791  void SetSortSelectionList(bool sort) { m_list_last_updated=0; m_bSortSelectionList=sort;}
792 
796  bool GetSortSelectionList() {return m_bSortSelectionList;}
797 
801  virtual bool GetSubentityFaceSelection() { return m_subentity_face; }
802 
806  virtual void SetSubentityFaceSelection(bool select) { m_subentity_face=select; }
807 
811  virtual bool GetSubentityEdgeSelection() { return m_subentity_edge; }
812 
816  virtual void SetSubentityEdgeSelection(bool select) { m_subentity_edge=select; }
817 
821  virtual bool GetSubentityVertexSelection() { return m_subentity_vertex; }
822 
826  virtual void SetSubentityVertexSelection(bool select) { m_subentity_vertex=select; }
827 
831  virtual void SetAllowSubentityDeselection(bool allow) { SetSubentityTracking(allow); }
832 
836  virtual bool GetAllowSubentityDeselection() { return GetSubentityTracking(); }
837 
845  virtual void SetSubentityTracking(bool allow) { m_subentity_maintain_maps = allow; }
846 
850  virtual bool GetSubentityTracking() { return m_subentity_maintain_maps; }
851 
857  void GetSelectionBounding(HPoint * minimum, HPoint * maximum) const;
858 
859 
863  virtual void SetSelectWillNotify(bool notify) {m_bNotify = notify;}
864 
866  virtual bool GetSelectWillNotify() const { return m_bNotify; }
867 
868 
869  // internal use only
870  int GetAttrLookupID(const char * attribute_string);
871  HSelectionSegmentConditionInfo * GetSelectionSegmentConditionInfo();
872  HConditionStyleKeyInfoHash * GetConditionStyleKeyInfo();
873 
874 
875 private:
876  void HoopsRemove( HC_KEY key );
877  void DeselectSegment( HC_KEY key, char const *keytype );
878  void DeselectGeometry( HC_KEY key );
879 
883  inline bool is_selected(HC_KEY key) const;
884 
885  void ensure_is_segment(HC_KEY &key) const;
886 
887 
888  int m_AttrID;
889  struct vhash_s *m_pAttrLookupHash;
890 
891  HSelectionSegmentConditionInfo * m_pSelectionSegmentConditionInfo;
892  HConditionStyleKeyInfoHash * m_pConditionStyleKeyInfoHash;
893 
894 
895  HVHashPShowCache * m_pshow_cache;
896  HSelHash * m_selected_hash;
897  float m_hash_last_updated;
898  float m_list_last_updated;
899  HRefSelType m_quickmoves_type;
900 
901  HC_KEY m_keyHighlightStyle;
902 
903  HSelectLevel m_selection_level;
904 
905  bool m_subentity_face;
906  bool m_subentity_edge;
907  bool m_subentity_vertex;
908  bool m_subentity_maintain_maps;
909 
910  bool m_bSubwindowPenetration;
911 
912  bool m_currently_in_DeleteSelection;
913 };
914 
915 
916 #ifdef H_PACK_8
917 #pragma pack(pop)
918 #endif
919 
920 #endif
921 
922 
923 
virtual void SetSelectWillNotify(bool notify)
Definition: HSelectionSet.h:863
void SetPShowCache(HVHashPShowCache *new_cache)
Definition: HSelectionSet.h:774
virtual void SetSubentityFaceSelection(bool select)
Definition: HSelectionSet.h:806
float m_fselectedEdgeWeight
The line thickness used for selected edges.
Definition: HSelectionSet.h:89
The HShellObject class is a simple wrapper for a shell.
Definition: HUtility.h:204
virtual const HSelectionHighlightMode GetHighlightMode()
Definition: HSelectionSet.h:679
virtual void GetSelectionEdgeColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:480
HPixelRGBA m_selectedCutEdgeColor
The color used for selected cut edges.
Definition: HSelectionSet.h:85
virtual void SetSelectionFaceColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:426
Definition: HPShowCache.h:193
virtual void SetSelectionMarkerColor(HPixelRGBA &rgb)
Definition: HSelectionSet.h:511
bool m_bHighlightRegionEdges
This indicates whether edges in a region should be highlighted.
Definition: HSelectionSet.h:95
HVHashPShowCache * GetPShowCache()
Definition: HSelectionSet.h:767
virtual void SetSelectionMarkerSize(float size)
Definition: HSelectionSet.h:538
struct vhash_s * m_pHighlightSegsHash
The list of highlighted segment keys.
Definition: HSelectionSet.h:79
virtual bool GetSubwindowPenetration()
Definition: HSelectionSet.h:618
virtual bool GetSelectWillNotify() const
Definition: HSelectionSet.h:866
#define HC_KEY
virtual void GetSelectionCutEdgeColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:493
virtual bool GetReferenceSelection() const
Definition: HSelectionSet.h:738
HRefSelType
Definition: HGlobals.h:584
HBaseView * m_pView
The HOOPS HBaseView associated with to this HSelectionSet.
Definition: HSelectionSet.h:77
select on a segment
Definition: HSelectionSet.h:40
virtual void SetSubentityVertexSelection(bool select)
Definition: HSelectionSet.h:826
The HPixelRGBA class is the data type of a rgba pixel.
Definition: HGlobals.h:516
The HSelectionSet class manages a list of selected items.
Definition: HSelectionSet.h:71
HSelectionHighlightMode
Definition: HGlobals.h:554
virtual bool GetAllowRegionSelection() const
Definition: HSelectionSet.h:656
virtual HRegionEdgeHighlightMode HighlightRegionEdgesAutoVisibility()
Definition: HSelectionSet.h:328
virtual HRegionFaceHighlightMode HighlightRegionFacesAutoVisibility()
Definition: HSelectionSet.h:340
HSelList * m_pSelItemsList
The list of selected HOOPS entities (HSelectionItem pointers).
Definition: HSelectionSet.h:78
HRegionEdgeHighlightMode
Definition: HGlobals.h:568
use default conditional highlighting
Definition: HGlobals.h:555
virtual bool HighlightAnnotations()
Definition: HSelectionSet.h:322
virtual bool GetAllowSubentitySelection()
Definition: HSelectionSet.h:630
select on an entity (piece of geometry, cutting plane or light)
Definition: HSelectionSet.h:41
virtual float GetSelectionEdgeWeight()
Definition: HSelectionSet.h:531
virtual void SetSelectionEdgeWeight(float weight)
Definition: HSelectionSet.h:524
select on arbitrary subentities (face, edge, or vertex)
Definition: HSelectionSet.h:43
HPixelRGBA m_selectedEdgeColor
The color used for selected edges.
Definition: HSelectionSet.h:84
virtual void SetSelectionCutEdgeColor(HPixelRGBA &rgb)
Definition: HSelectionSet.h:487
virtual bool GetSubentityFaceSelection()
Definition: HSelectionSet.h:801
bool m_bForceInvisible
This flag indicating whether to make the selected items invisible.
Definition: HSelectionSet.h:93
virtual void SetAllowSubentityDeselection(bool allow)
Definition: HSelectionSet.h:831
HRegionFaceHighlightMode m_bHighlightRegionFacesAutoVisibility
This indicates whether faces in a region should be automatically made visible when highlighted...
Definition: HSelectionSet.h:98
virtual void HighlightRegionFacesAutoVisibility(HRegionFaceHighlightMode face_state)
Definition: HSelectionSet.h:337
use quick move reference highlighting
Definition: HGlobals.h:556
bool m_bSortSelectionList
If this is set, the selection list will be sorted before returning it.
Definition: HSelectionSet.h:102
virtual void SetReferenceSelection(bool ref_sel)
Definition: HSelectionSet.h:746
virtual void SetSubentityEdgeSelection(bool select)
Definition: HSelectionSet.h:816
bool GetSortSelectionList()
Definition: HSelectionSet.h:796
Definition: HPShowCache.h:216
float m_fselectedMarkerSize
The marker size used for selected markers.
Definition: HSelectionSet.h:90
virtual void GetSelectionFaceColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:467
HC_KEY m_SelectionSegment
The key of the reference selection segment.
Definition: HSelectionSet.h:80
virtual bool GetAllowDisplacement()
Definition: HSelectionSet.h:455
virtual float GetSelectionMarkerSize()
Definition: HSelectionSet.h:544
Definition: HPShowCache.h:214
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
HPixelRGBA m_selectedCutFaceColor
The color used for selected cut faces.
Definition: HSelectionSet.h:86
virtual bool GetAllowEntitySelection()
Definition: HSelectionSet.h:646
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:337
The HSelectionItem class is an interface definition for a selection item.
Definition: HSelectionItem.h:45
virtual void SetSubentityTracking(bool allow)
Definition: HSelectionSet.h:845
HSelectionHighlightMode m_HighlightMode
Stores the current highlighting mode.
Definition: HSelectionSet.h:100
virtual void HighlightRegionEdgesAutoVisibility(HRegionEdgeHighlightMode edge_state)
Definition: HSelectionSet.h:334
void SetSortSelectionList(bool sort)
Definition: HSelectionSet.h:791
bool m_bNotify
If this is set Select() will send HSignalSelected for each item.
Definition: HSelectionSet.h:104
HC_KEY m_TransparencyStyle
The key to a style used in inverse transparency highlighting.
Definition: HSelectionSet.h:81
virtual void HighlightRegionEdgesAutoVisibility(bool yesno)
Definition: HSelectionSet.h:331
virtual bool GetSubentityEdgeSelection()
Definition: HSelectionSet.h:811
bool m_bAllowDisplacement
This indicates whether selected segments should be drawn in front of coincident geometry.
Definition: HSelectionSet.h:94
virtual HC_KEY GetSelectionSegment()
Definition: HSelectionSet.h:718
virtual bool GetInvisible()
Definition: HSelectionSet.h:444
HPixelRGBA m_selectedFaceColor
The color used for selected faces.
Definition: HSelectionSet.h:83
HC_KEY GetHighlightStyle() const
Definition: HSelectionSet.h:587
virtual void SetSelectionEdgeColor(HPixelRGBA &rgb)
Definition: HSelectionSet.h:474
float m_fTransmission
the transmission value used in Inverse Transparency highlighting
Definition: HSelectionSet.h:101
virtual void HighlightAnnotations(bool yesno)
Definition: HSelectionSet.h:325
HSelectLevel
Definition: HSelectionSet.h:38
virtual void HighlightRegionEdges(bool yesno)
Definition: HSelectionSet.h:319
HPixelRGBA m_selectedMarkerColor
The color used for selected markers.
Definition: HSelectionSet.h:87
select on pre-defined regions of an entity
Definition: HSelectionSet.h:42
virtual bool GetAllowSubentityDeselection()
Definition: HSelectionSet.h:836
bool m_bForceGrayScale
This flag indicating whether to use gray scale selection.
Definition: HSelectionSet.h:92
virtual void SetAllowDisplacement(bool allowDisplacement)
Definition: HSelectionSet.h:450
virtual HSelectLevel GetSelectionLevel() const
Definition: HSelectionSet.h:639
virtual bool GetSubentityVertexSelection()
Definition: HSelectionSet.h:821
virtual bool HighlightRegionEdges()
Definition: HSelectionSet.h:316
virtual void GetSelectionCutFaceColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:505
virtual void SetSelectionCutFaceColor(HPixelRGBA &rgb)
Definition: HSelectionSet.h:499
HRegionEdgeHighlightMode m_bHighlightRegionEdgesAutoVisibility
This indicates whether edges in a region should be automatically made visible when highlighted...
Definition: HSelectionSet.h:97
virtual void GetSelectionMarkerColor(HPixelRGBA &rgba)
Definition: HSelectionSet.h:518
virtual bool GetSubentityTracking()
Definition: HSelectionSet.h:850
bool m_bHighlightAnnotations
This indicates whether MVO annotations should be highlighted.
Definition: HSelectionSet.h:96