00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id: 5a614f6a660970006dd402efc1be34dc67fdad30 $ 00013 // 00014 00021 #ifndef _HSELECTIONSET_H 00022 #define _HSELECTIONSET_H 00023 00024 #ifdef H_PACK_8 00025 #pragma pack(push) 00026 #pragma pack(8) 00027 #endif 00028 00029 #include "HTools.h" 00030 #include "HGlobals.h" 00031 00032 00038 enum HSelectLevel 00039 { 00040 HSelectSegment, 00041 HSelectEntity, 00042 HSelectRegion, 00043 HSelectSubentity 00044 }; 00049 //forward declaration 00050 class HBaseView; 00051 class HSelectionItem; 00052 class HShellObject; 00053 class HVHashPShowCache; 00054 class HSelHash; 00055 class HSelList; 00056 class HSelectionSegmentConditionInfo; 00057 class HConditionStyleKeyInfoHash; 00058 00059 00060 00061 00063 00071 class MVO_API HSelectionSet 00072 { 00073 friend class HBaseView; 00074 00075 00076 protected: 00077 HBaseView * m_pView; 00078 HSelList * m_pSelItemsList; 00079 struct vhash_s *m_pHighlightSegsHash; 00080 HC_KEY m_SelectionSegment; 00081 HC_KEY m_TransparencyStyle; 00082 00083 HPixelRGBA m_selectedFaceColor; 00084 HPixelRGBA m_selectedEdgeColor; 00085 HPixelRGBA m_selectedCutEdgeColor; 00086 HPixelRGBA m_selectedCutFaceColor; 00087 HPixelRGBA m_selectedMarkerColor; 00088 00089 float m_fselectedEdgeWeight; 00090 float m_fselectedMarkerSize; 00091 00092 bool m_bForceGrayScale; 00093 bool m_bForceInvisible; 00094 bool m_bAllowDisplacement; 00095 bool m_bHighlightRegionEdges; 00096 bool m_bHighlightAnnotations; 00097 HRegionEdgeHighlightMode m_bHighlightRegionEdgesAutoVisibility; 00098 HRegionFaceHighlightMode m_bHighlightRegionFacesAutoVisibility; 00099 00100 HSelectionHighlightMode m_HighlightMode; 00101 float m_fTransmission; 00102 bool m_bSortSelectionList; 00103 00104 bool m_bNotify; 00105 00106 bool m_bUseDefinedHighlight; 00107 00108 00112 virtual void UpdateTransparency(bool force_flush=false); 00113 00114 public: 00116 HSelectionSet(HBaseView* view, bool bReferenceSelection = false); 00117 00118 virtual ~HSelectionSet(); 00119 00123 virtual void Init(); 00124 00125 00144 virtual void Select(HC_KEY key, int num_include_keys, HC_KEY include_keys[], bool emit_message = false); 00145 00159 virtual void Select(HSelectionItem * new_sel, bool emit_message = false); 00160 00178 virtual void SelectRegion(HShellObject const & oShell, int num_include_keys, HC_KEY include_keys[], int region, bool emit_message); 00179 00180 00204 virtual void SelectSubentity(HC_KEY key, int num_include_keys, HC_KEY include_keys[], 00205 int count, const int faces[]=0, const int vertex1[]=0, const int vertex2[]=0, bool emit_message=false); 00206 00220 virtual void Select(HC_KEY key, const char* segpath, HC_KEY include_key, HC_KEY includer_key, bool emit_message = false); 00221 00237 virtual void DeSelect(HC_KEY key, bool emit_message = false); 00238 00256 virtual void DeSelect(HC_KEY key, int num_include_keys, HC_KEY include_keys[], bool emit_message = false); 00257 00268 virtual void DeSelect(HSelectionItem * remove_sel, bool emit_message = false); 00269 00284 virtual void DeSelectRegion(HShellObject const & oShell, int region, bool emit_messag); 00285 00305 virtual void DeSelectRegion(HShellObject const & oShell, int num_include_keys, HC_KEY include_keys[], int region, bool emit_message = false); 00306 00307 00314 virtual void DeSelectSubentity(HC_KEY key, int num_include_keys, HC_KEY include_keys[], 00315 int count, const int faces[], const int vertex1[], const int vertex2[], bool emit_message = false); 00316 00318 virtual bool HighlightRegionEdges() {return m_bHighlightRegionEdges;}; 00319 00321 virtual void HighlightRegionEdges(bool yesno) {m_bHighlightRegionEdges = yesno;}; 00322 00324 virtual bool HighlightAnnotations() {return m_bHighlightAnnotations;}; 00325 00327 virtual void HighlightAnnotations(bool yesno) {m_bHighlightAnnotations = yesno;}; 00328 00330 virtual HRegionEdgeHighlightMode HighlightRegionEdgesAutoVisibility() {return m_bHighlightRegionEdgesAutoVisibility;}; 00331 00333 virtual void HighlightRegionEdgesAutoVisibility(bool yesno) {m_bHighlightRegionEdgesAutoVisibility = yesno ? AllEdges : NoEdges;}; 00334 00336 virtual void HighlightRegionEdgesAutoVisibility(HRegionEdgeHighlightMode edge_state) {m_bHighlightRegionEdgesAutoVisibility = edge_state;}; 00337 00339 virtual void HighlightRegionFacesAutoVisibility(HRegionFaceHighlightMode face_state) {m_bHighlightRegionFacesAutoVisibility = face_state;}; 00340 00342 virtual HRegionFaceHighlightMode HighlightRegionFacesAutoVisibility() {return m_bHighlightRegionFacesAutoVisibility;}; 00343 00351 virtual void DeSelectAll(); 00352 00363 virtual bool IsSelected(HC_KEY key) const; 00364 00382 virtual bool IsSelected(HC_KEY key, int num_include_keys, const HC_KEY include_keys[]) const; 00383 00395 virtual bool IsSelected(const HSelectionItem * item) const; 00396 00415 virtual bool IsRegionSelected(HC_KEY key, int num_include_keys, const HC_KEY include_keys[], int region) const; 00416 00422 virtual bool IsHighlightSegment(HC_KEY segment_key) const; 00423 00428 virtual void SetSelectionFaceColor(HPixelRGBA &rgba){m_selectedFaceColor = rgba; UpdateHighlightStyle();} 00429 00434 virtual void SetGrayScale(bool grayScale); 00435 00436 00441 virtual void SetInvisible(bool Invisible); 00442 00446 virtual bool GetInvisible() { return m_bForceInvisible; } 00447 00448 00452 virtual void SetAllowDisplacement(bool allowDisplacement) { m_bAllowDisplacement = allowDisplacement; } 00453 00457 virtual bool GetAllowDisplacement() { return m_bAllowDisplacement; } 00458 00463 virtual HSelList * GetSelectionList(); 00464 00469 virtual void GetSelectionFaceColor(HPixelRGBA &rgba){ rgba = m_selectedFaceColor; }; 00470 00471 00476 virtual void SetSelectionEdgeColor(HPixelRGBA &rgb){m_selectedEdgeColor = rgb; UpdateHighlightStyle();} 00477 00482 virtual void GetSelectionEdgeColor(HPixelRGBA &rgba){ rgba = m_selectedEdgeColor; }; 00483 00484 00489 virtual void SetSelectionCutEdgeColor(HPixelRGBA &rgb){m_selectedCutEdgeColor = rgb; UpdateHighlightStyle();} 00490 00495 virtual void GetSelectionCutEdgeColor(HPixelRGBA &rgba){ rgba = m_selectedCutEdgeColor; }; 00496 00501 virtual void SetSelectionCutFaceColor(HPixelRGBA &rgb){m_selectedCutFaceColor = rgb; UpdateHighlightStyle();} 00502 00507 virtual void GetSelectionCutFaceColor(HPixelRGBA &rgba){ rgba = m_selectedCutFaceColor; }; 00508 00513 virtual void SetSelectionMarkerColor(HPixelRGBA &rgb){m_selectedMarkerColor = rgb; UpdateHighlightStyle();} 00514 00515 00520 virtual void GetSelectionMarkerColor(HPixelRGBA &rgba){ rgba = m_selectedMarkerColor; }; 00521 00526 virtual void SetSelectionEdgeWeight(float weight){m_fselectedEdgeWeight= weight; UpdateHighlightStyle();} 00527 00528 00533 virtual float GetSelectionEdgeWeight(){return m_fselectedEdgeWeight;} 00534 00535 00540 virtual void SetSelectionMarkerSize(float size){m_fselectedMarkerSize = size; UpdateHighlightStyle();} 00541 00546 virtual float GetSelectionMarkerSize(){return m_fselectedMarkerSize;} 00547 00553 virtual HC_KEY GetAt(unsigned int index); 00554 00555 00560 const HSelectionItem * GetSelectionItemAt(unsigned int index); 00561 00562 00567 const HSelectionItem * GetSelectionItem(HC_KEY key); 00568 00569 00571 unsigned int GetSize() const; 00572 00576 virtual void Reset(); 00577 00578 00584 virtual bool DeleteSelection(bool emit_message=false); 00585 00589 HC_KEY GetHighlightStyle() const{ return m_keyHighlightStyle; }; 00590 00591 00592 void SetHighlightStyle(HC_KEY key) { m_keyHighlightStyle = key; }; 00593 00594 const char * GetHighlightStyleName() const{ return m_keyHighlightStyleName; }; 00595 00610 bool DeInstance(HSelectionItem * sel_item); 00611 00612 00617 bool DeInstance(unsigned int index); 00618 00623 virtual bool GetSubwindowPenetration() { return m_bSubwindowPenetration; } 00624 00632 virtual void SetSubwindowPenetration(bool allow); 00633 00635 virtual bool GetAllowSubentitySelection() { return m_selection_level == HSelectSubentity; } 00636 00641 virtual void SetAllowSubentitySelection(bool allow); 00642 00644 virtual HSelectLevel GetSelectionLevel() const { return m_selection_level; } 00645 00648 virtual void SetSelectionLevel(HSelectLevel level); 00649 00651 virtual bool GetAllowEntitySelection() { return m_selection_level == HSelectEntity; } 00652 00653 00658 virtual void SetAllowEntitySelection(bool allow); 00659 00661 virtual bool GetAllowRegionSelection() const { return m_selection_level == HSelectRegion; } 00662 00667 virtual void SetAllowRegionSelection(bool allow); 00668 00673 void RegisterHighlightSeg(HC_KEY seg_key); 00674 00679 void UnRegisterHighlightSeg(HC_KEY seg_key); 00680 00684 virtual const HSelectionHighlightMode GetHighlightMode() { return m_HighlightMode; } 00685 00712 virtual void SetHighlightMode(HSelectionHighlightMode m); 00713 00717 virtual void SetHighlightTransparency(float trans); 00718 00723 virtual HC_KEY GetSelectionSegment() {return m_SelectionSegment;} 00724 00730 void ToggleHighlightStyle(); 00731 00736 virtual bool GetIsSelection(HC_KEY key); 00737 00743 virtual bool GetReferenceSelection() const {return m_HighlightMode!=HighlightDefault 00744 || m_selection_level == HSelectSubentity;} 00745 00751 virtual void SetReferenceSelection(bool ref_sel) { 00752 m_HighlightMode = ref_sel ? HighlightQuickmoves : HighlightDefault; 00753 } 00754 00759 void SetUseDefinedHighlight(bool use_defined_highlight); 00760 00765 bool GetUseDefinedHighlight() { 00766 return m_bUseDefinedHighlight; 00767 } 00768 00769 00774 virtual void SetReferenceSelectionType(HRefSelType type); 00775 virtual HRefSelType GetReferenceSelectionType() {return m_quickmoves_type;} 00776 00780 virtual void UpdateHighlightStyle(); 00781 00787 HVHashPShowCache * GetPShowCache(){ return m_pshow_cache; } 00788 00794 void SetPShowCache(HVHashPShowCache * new_cache){ m_pshow_cache=new_cache; } 00795 00799 void FlushPShowCache(); 00800 00804 void UpdateHighlighting(); 00805 00806 HBaseView * GetView() { return m_pView; } 00807 00811 void SetSortSelectionList(bool sort) { m_list_last_updated=0; m_bSortSelectionList=sort;} 00812 00816 bool GetSortSelectionList() {return m_bSortSelectionList;} 00817 00821 virtual bool GetSubentityFaceSelection() { return m_subentity_face; } 00822 00826 virtual void SetSubentityFaceSelection(bool select) { m_subentity_face=select; } 00827 00831 virtual bool GetSubentityEdgeSelection() { return m_subentity_edge; } 00832 00836 virtual void SetSubentityEdgeSelection(bool select) { m_subentity_edge=select; } 00837 00841 virtual bool GetSubentityVertexSelection() { return m_subentity_vertex; } 00842 00846 virtual void SetSubentityVertexSelection(bool select) { m_subentity_vertex=select; } 00847 00851 virtual void SetAllowSubentityDeselection(bool allow) { SetSubentityTracking(allow); } 00852 00856 virtual bool GetAllowSubentityDeselection() { return GetSubentityTracking(); } 00857 00865 virtual void SetSubentityTracking(bool allow) { m_subentity_maintain_maps = allow; } 00866 00870 virtual bool GetSubentityTracking() { return m_subentity_maintain_maps; } 00871 00877 void GetSelectionBounding(HPoint * minimum, HPoint * maximum) const; 00878 00879 00883 virtual void SetSelectWillNotify(bool notify) {m_bNotify = notify;} 00884 00886 virtual bool GetSelectWillNotify() const { return m_bNotify; } 00887 00888 00889 // internal use only 00890 int GetAttrLookupID(const char * attribute_string); 00891 HSelectionSegmentConditionInfo * GetSelectionSegmentConditionInfo(); 00892 HConditionStyleKeyInfoHash * GetConditionStyleKeyInfo(); 00893 00894 00895 private: 00896 void HoopsRemove( HC_KEY key ); 00897 void DeselectSegment( HC_KEY key, char const *keytype ); 00898 void DeselectGeometry( HC_KEY key ); 00899 00903 inline bool is_selected(HC_KEY key) const; 00904 00905 void ensure_is_segment(HC_KEY &key) const; 00906 00907 00908 int m_AttrID; 00909 struct vhash_s *m_pAttrLookupHash; 00910 00911 HSelectionSegmentConditionInfo * m_pSelectionSegmentConditionInfo; 00912 HConditionStyleKeyInfoHash * m_pConditionStyleKeyInfoHash; 00913 00914 00915 HVHashPShowCache * m_pshow_cache; 00916 HSelHash * m_selected_hash; 00917 float m_hash_last_updated; 00918 float m_list_last_updated; 00919 HRefSelType m_quickmoves_type; 00920 00921 HC_KEY m_keyHighlightStyle; 00922 char m_keyHighlightStyleName[32]; 00923 00924 HSelectLevel m_selection_level; 00925 00926 bool m_subentity_face; 00927 bool m_subentity_edge; 00928 bool m_subentity_vertex; 00929 bool m_subentity_maintain_maps; 00930 00931 bool m_bSubwindowPenetration; 00932 00933 bool m_currently_in_DeleteSelection; 00934 }; 00935 00936 00937 #ifdef H_PACK_8 00938 #pragma pack(pop) 00939 #endif 00940 00941 #endif 00942 00943 00944