00001 // 00002 // Copyright (c) 2004 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: 2968f177dcf07ab2a295c067a5c3908ecb3d0394 $ 00013 // 00014 00021 #ifndef _HSELECTIONITEM_H 00022 #define _HSELECTIONITEM_H 00023 00024 #ifdef H_PACK_8 00025 #pragma pack(push) 00026 #pragma pack(8) 00027 #endif 00028 00029 #include "HTools.h" 00030 #include "HUtility.h" 00031 00032 class HPixelRGBA; 00033 class HSelectionSet; 00034 class HBaseView; 00035 00036 00038 00045 class MVO_API HSelectionItem 00046 { 00047 00048 public: 00050 HSelectionItem(HC_KEY key, HSelectionSet * selection_set); 00051 00052 virtual ~HSelectionItem(); 00053 00056 virtual const char * GetName() const { return "HSelectionItem"; }; 00057 00058 00061 virtual HC_KEY GetKey() const { return m_key; }; 00062 00063 00067 virtual HC_KEY GetSegmentKey() const; 00068 00069 00073 virtual bool Equals(const HSelectionItem * i2) const; 00074 00075 00079 virtual bool Highlight() = 0; 00080 00084 virtual bool UnHighlight() = 0; 00085 00090 virtual bool IsHighlighted() const = 0; 00091 00092 00098 virtual bool Delete() = 0; 00099 00100 00107 virtual bool IsInstanced() const = 0; 00108 00109 00112 virtual int GetIncludeCount() const = 0; 00113 00116 virtual const HC_KEY * const GetIncludeKeys() const = 0; 00117 00121 virtual void GetIncludeKeys(HC_KEY * includes) const = 0; 00122 00130 virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY & ret_dependent_key) = 0; 00131 00132 00141 virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key) = 0; 00142 00146 virtual int GetFullPathCount(HBaseView * view); 00147 00152 virtual const HC_KEY *GetFullPathKeys (HBaseView * view); 00153 00159 virtual void GetFullPathKeys (HBaseView * view, HC_KEY * path); 00160 00165 void SetTimeStamp(float now) {m_TimeStamp=now;} 00166 00171 float GetTimeStamp() {return m_TimeStamp;} 00172 00173 protected: 00174 00175 HC_KEY m_key; 00176 HSelectionSet * m_pSelectionSet; 00177 00178 HC_KEY * m_FullPath; 00179 int m_FullPathCount; 00180 00181 float m_TimeStamp; 00182 }; 00183 00184 00185 00187 00192 class MVO_API HSmartSelItem : public HSelectionItem 00193 { 00194 00195 public: 00196 00204 HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys); 00205 00214 HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, bool is_segment); 00215 00216 virtual ~HSmartSelItem(); 00217 00220 virtual const char * GetName() const { return "HSmartSelItem"; }; 00221 00222 00225 virtual int GetIncludeCount() const { return m_IncludePath.count; }; 00226 00229 virtual const HC_KEY * const GetIncludeKeys() const { return m_IncludePath.keys; }; 00230 00234 virtual void GetIncludeKeys(HC_KEY *includes) const; 00235 00240 virtual const HC_KEY *GetFullPathKeys (HBaseView *view); 00241 00248 virtual void GetFullPathKeys (HBaseView *view, HC_KEY *path); 00249 00253 virtual bool Equals(const HSelectionItem* i2) const; 00254 00255 00259 virtual bool Highlight(); 00260 00264 virtual bool UnHighlight(); 00265 00270 virtual bool IsHighlighted() const; 00271 00272 00283 static bool IsHighlighted(const HC_KEY key, const HSelectionSet * selection_set, 00284 const int incl_count, const HC_KEY * incl_keys); 00296 static bool IsRegionHighlighted(const HC_KEY key, const HSelectionSet * selection_set, 00297 const int incl_count, const HC_KEY * incl_keys, int region); 00298 00299 00305 virtual bool Delete(); 00306 00307 00314 virtual bool IsInstanced() const; 00315 00316 00324 virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key); 00325 00326 00335 virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key); 00336 00342 void UpdateIncludePath(int incl_count, HC_KEY * incl_keys); 00343 00347 virtual const int GetHighlightMode() { return m_HighlightMode; } 00348 00353 virtual void SetHighlightMode(HSelectionHighlightMode m) { m_HighlightMode = m;} 00354 00355 private: 00356 00357 HC_KEY m_ConditionStyle; 00358 00359 HSelectionHighlightMode m_HighlightMode; 00360 00361 public: 00362 00367 int GetHighlightedRefListCount(); 00368 00373 void GetHighlightedRefList(HC_KEY * keys); 00374 00375 bool IsSegment() {return m_is_segment;} 00376 00377 protected: 00381 void FixIncludePath(); 00382 00387 HC_KEY GetHighlightedRefKey(); 00388 00393 void AddHighlightedRefKey(HC_KEY key); 00394 00395 struct vlist_s *m_pSelKeyList; 00396 00397 private: 00398 void GetBaseTag(char * retTag); 00399 00400 private: 00401 00402 // The include path is a list of all the include keys from the root segment right down to 00403 // entity/segment. This can be constructed from the selection path returned by HOOPS by filtering 00404 // out any keys other than include keys. 00405 struct { 00406 int count; 00407 HC_KEY * keys; 00408 } m_IncludePath; 00409 00410 bool m_is_segment; 00411 00412 // Selection of a non-segment item with conditional highlighting will throw the item into a proxy 00413 // segment so the item can be styled. However, if different selection set selects the same item, 00414 // it should *not* move the item to a further proxy subsegment because this can cause cleanup 00415 // problems. Now we cannot clean up after ourselves if another selection set has selected that 00416 // item, even if we want to clean up after our own selection set. So an in-use tag needs to 00417 // be funneled in as well to allow us to see if others are using the proxy segment as well. 00418 // The could probably be done with a simple counter attached to the segment as a user option or 00419 // the like, but I suspect that a multithreaded environment could make this quickly go awry. 00420 HC_KEY m_entity_proxy_seg_tag; 00421 }; 00422 00424 00429 class MVO_API HRegionSelItem : public HSmartSelItem 00430 { 00431 public: 00432 00440 HRegionSelItem(HShellObject const & oShellObj, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, int region); 00441 00442 ~HRegionSelItem(){ 00443 00444 } 00445 00448 virtual const char * GetName() const { return "HRegionSelItem"; }; 00449 00452 virtual int const GetRegion() const { return m_Region; } 00453 00457 virtual bool Equals(const HSelectionItem* i2) const; 00458 00462 virtual bool Highlight(); 00463 00467 virtual bool UnHighlight(); 00468 00469 private: 00472 int m_Region; 00473 00477 virtual int IncrEdgeHighlightCount(HC_KEY key, HShellEdge const & Edge); 00478 00482 virtual int DecrEdgeHighlightCount(HC_KEY key, HShellEdge const & Edge); 00483 00486 virtual void HighlightEdges(); 00487 00490 virtual void UnHighlightEdges(); 00491 00494 virtual void HighlightFaces(); 00495 00498 virtual void UnHighlightFaces(); 00499 00500 HShellObject m_oShellObj; 00501 HShellRegion m_oRegionObj; 00502 }; 00503 00504 00505 #define HSUBENTITY_FACES 0x01 00506 #define HSUBENTITY_VERTICES 0x02 00507 #define HSUBENTITY_EDGES 0x04 00508 00510 00515 #include "vhash.h" 00516 00517 class SubentityMap: public VHash<int, int> 00518 { 00519 00520 }; 00521 00522 class MVO_API HSubentitySelItem : public HSmartSelItem 00523 { 00524 public: 00525 00542 HSubentitySelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, 00543 int face_count, const int * faces, int vertex_count, const int * vertex1, const int * vertex2, 00544 bool highlight_faces=true, bool highlight_vertices=true, bool highlight_edges=true, bool maintain_maps = false); 00545 00546 ~HSubentitySelItem(); 00547 00550 virtual const char * GetName() const { return "HSubentitySelItem"; }; 00551 00555 virtual bool Equals(const HSelectionItem* i2) const; 00556 00561 virtual bool Similar(const HSelectionItem * i2) const; 00562 00566 virtual bool Highlight(); 00567 00571 virtual bool UnHighlight(); 00572 00576 virtual bool UnHighlight(HSubentitySelItem const * remove_sel); 00577 00581 bool IsEmpty() {return (!m_vertex_count && !m_face_count); } 00582 00586 virtual bool Delete(); 00587 00588 int GetFaceCount() const { return m_face_count; } 00589 00590 void GetFaces(int * faces); 00591 00592 int GetVertexCount() const { return m_vertex_count; } 00593 00594 void GetVertices(int * vertex1, int * vertex2); 00595 00596 bool MaintainMaps() { return m_maintain_maps; } 00597 00598 void MaintainMaps(bool maintain_maps) { m_maintain_maps=maintain_maps; } 00599 00600 void GetMapCounts(int * face_map_count, int * vertex_map_count); 00601 00602 void GetMaps(int * face_map, int * vertex_map); 00603 00604 private: 00605 int m_face_count; 00606 int * m_faces; 00607 int m_vertex_count; 00608 int * m_vertex1; 00609 int * m_vertex2; 00610 bool m_maintain_maps; 00611 int m_vertex_map_count; 00612 SubentityMap * m_vertex_map; 00613 int m_face_map_count; 00614 SubentityMap * m_face_map; 00615 int m_subentity_highlight; 00616 }; 00617 00618 00619 00620 00621 00623 00628 class MVO_API HOldSelItem : public HSelectionItem 00629 { 00630 00631 public: 00633 HOldSelItem(HC_KEY key, HSelectionSet * selection_set, const char * selection_path, 00634 HC_KEY include_key, HC_KEY includer_key); 00635 00636 00637 virtual ~HOldSelItem(); 00638 00641 virtual const char * GetName() const { return "HOldSelItem"; }; 00642 00643 00647 virtual bool Equals(const HSelectionItem* i2) const; 00648 00649 00653 virtual bool Highlight(); 00654 00658 virtual bool UnHighlight(); 00659 00664 virtual bool IsHighlighted() const; 00665 00666 00672 virtual bool Delete(); 00673 00679 virtual bool IsInstanced() const { return false; }; 00680 00683 virtual int GetIncludeCount() const { return 0; }; 00684 00688 virtual const HC_KEY * const GetIncludeKeys() const { return 0; }; 00689 00690 virtual void GetIncludeKeys(HC_KEY*) const { do {/*nothing*/} while(0); } 00691 00699 virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key); 00700 00701 00710 virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key); 00711 00712 private: 00713 00714 char * m_pSelectionPath; 00715 HC_KEY m_IncludeKey; 00716 HC_KEY m_IncluderKey; 00717 00718 void HoopsRemove( HC_KEY key ); 00719 void DeselectSegment( HC_KEY key, char const *keytype ); 00720 void DeselectGeometry( HC_KEY key ); 00721 }; 00722 00723 00724 00725 00726 #ifdef H_PACK_8 00727 #pragma pack(pop) 00728 #endif 00729 00730 #endif 00731 00732 00733 00734 00735