Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HSelectionItem.h
Go to the documentation of this file.
00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc.
00002 //
00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
00004 // and considered a trade secret as defined under civil and criminal statutes.
00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
00006 // unauthorized use or misappropriation of its trade secrets.  Use of this information
00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
00009 
00016 #ifndef _HSELECTIONITEM_H
00017 #define _HSELECTIONITEM_H
00018 
00019 #ifdef H_PACK_8
00020 #pragma pack(push)
00021 #pragma pack(8)
00022 #endif
00023 
00024 #include "HTools.h"
00025 #include "HUtility.h"
00026 
00027 class HPixelRGBA;
00028 class HSelectionSet;
00029 class HBaseView;
00030 
00031 
00033 
00040 class MVO_API HSelectionItem 
00041 {
00042 
00043 public:
00045     HSelectionItem(HC_KEY key, HSelectionSet * selection_set);
00046 
00047     virtual ~HSelectionItem();
00048 
00051     virtual const char * GetName() const { return "HSelectionItem"; };
00052 
00053 
00056     virtual HC_KEY GetKey() const { return m_key; };
00057 
00058 
00062     virtual HC_KEY GetSegmentKey() const;
00063 
00064 
00068     virtual bool Equals(const HSelectionItem * i2) const;
00069 
00070 
00074     virtual bool Highlight() = 0;
00075 
00079     virtual bool UnHighlight() = 0;
00080 
00085     virtual bool IsHighlighted() const = 0;
00086 
00087 
00093     virtual bool Delete() = 0;
00094 
00095 
00102     virtual bool IsInstanced() const = 0;
00103 
00104 
00107     virtual int GetIncludeCount() const = 0;
00108 
00111     virtual const HC_KEY * const GetIncludeKeys() const = 0;
00112 
00116     virtual void GetIncludeKeys(HC_KEY * includes) const = 0;
00117 
00125     virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY & ret_dependent_key) = 0;
00126 
00127 
00136     virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key) = 0;
00137 
00141     virtual int GetFullPathCount(HBaseView * view);
00142 
00147     virtual const HC_KEY *GetFullPathKeys (HBaseView * view);
00148 
00154     virtual void GetFullPathKeys (HBaseView * view, HC_KEY * path);
00155 
00160     void SetTimeStamp(float now) {m_TimeStamp=now;}
00161 
00166     float GetTimeStamp() {return m_TimeStamp;}          
00167 
00168 protected:
00169 
00170     HC_KEY m_key;                       
00171     HSelectionSet * m_pSelectionSet;    
00172 
00173     HC_KEY * m_FullPath;                
00174     int m_FullPathCount;                
00175 
00176     float m_TimeStamp;                  
00177 };
00178 
00179 
00180 
00182 
00187 class MVO_API HSmartSelItem : public HSelectionItem
00188 {
00189     friend class HSelectionSet;
00190 
00191 public:
00192 
00200     HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys);
00201 
00210     HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, bool is_segment);
00211 
00212     virtual ~HSmartSelItem();
00213 
00216     virtual const char * GetName() const { return "HSmartSelItem"; };
00217 
00218 
00221     virtual int GetIncludeCount() const { return m_IncludePath.count; };
00222 
00225     virtual const HC_KEY * const GetIncludeKeys() const { return m_IncludePath.keys; };
00226 
00230     virtual void GetIncludeKeys(HC_KEY *includes) const;
00231 
00236     virtual const HC_KEY *GetFullPathKeys (HBaseView *view);
00237 
00244     virtual void GetFullPathKeys (HBaseView *view, HC_KEY *path);
00245 
00249     virtual bool Equals(const HSelectionItem* i2) const;
00250 
00251 
00255     virtual bool Highlight();
00256 
00260     virtual bool UnHighlight();
00261 
00266     virtual bool IsHighlighted() const;
00267 
00268 
00279     static bool IsHighlighted(const HC_KEY key, const HSelectionSet * selection_set, 
00280                               const int incl_count, const HC_KEY * incl_keys);
00292     static bool IsRegionHighlighted(const HC_KEY key, const HSelectionSet * selection_set, 
00293                               const int incl_count, const HC_KEY * incl_keys, int region);
00294 
00295 
00301     virtual bool Delete();
00302 
00303 
00310     virtual bool IsInstanced() const;
00311 
00312 
00320     virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key);
00321 
00322 
00331     virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key);
00332 
00338     void UpdateIncludePath(int incl_count, HC_KEY * incl_keys);
00339 
00343     virtual const int GetHighlightMode() { return m_HighlightMode; }
00344 
00349     virtual void SetHighlightMode(HSelectionHighlightMode m) { m_HighlightMode = m;}
00350 
00351 protected:
00352     HSmartSelItem(bool is_ooc, HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, bool is_segment);
00353 
00354     void CommonUnhighlightRef();
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     friend class HSelectionSet;
00525 
00526 public:
00527         
00544     HSubentitySelItem(
00545         HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, 
00546         int face_count, const int * faces, int vertex_count, int const * vertex1, int const * vertex2, 
00547         bool highlight_faces = true, bool highlight_vertices = true, bool highlight_edges = true, bool maintain_maps = false);
00548 
00549     ~HSubentitySelItem();
00550 
00553     virtual const char * GetName() const { return "HSubentitySelItem"; };
00554 
00558     virtual bool Equals(const HSelectionItem* i2) const;
00559 
00564     virtual bool Similar(const HSelectionItem * i2) const;
00565 
00569     virtual bool Highlight();
00570     
00574     virtual bool UnHighlight();
00575 
00579     virtual bool UnHighlight(HSubentitySelItem const * remove_sel);
00580 
00584     bool IsEmpty() {return !m_vertex_count && !m_face_count; }
00585 
00589     virtual bool Delete();
00590 
00591     int GetFaceCount() const { return m_face_count; } 
00592 
00593     void GetFaces(int * faces);
00594 
00595     int GetVertexCount() const { return m_vertex_count; }
00596 
00597     void GetVertices(int * vertex1, int * vertex2);
00598 
00599     bool MaintainMaps() { return m_maintain_maps; }
00600     
00601     void MaintainMaps(bool maintain_maps) { m_maintain_maps=maintain_maps; }
00602 
00603     void GetMapCounts(int * face_map_count, int * vertex_map_count);
00604     
00605     void GetMaps(int * face_map, int * vertex_map);
00606 
00607     void MergeMaps(HSubentitySelItem * that);
00608 
00609 protected:
00610     HSubentitySelItem(
00611         bool is_ooc, HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, 
00612         int face_count, const int * faces, int vertex_count, int const * vertex1, int const * vertex2, 
00613         bool highlight_faces = true, bool highlight_vertices = true, bool highlight_edges = true, bool maintain_maps = false);
00614 
00615 private:
00616 
00617     int m_face_count;
00618     int * m_faces;
00619     int m_vertex_count;
00620     int * m_vertex1;
00621     int * m_vertex2;
00622     bool m_maintain_maps;
00623     int m_vertex_map_count;
00624     SubentityMap * m_vertex_map;
00625     int m_face_map_count;
00626     SubentityMap * m_face_map;
00627     int m_subentity_highlight;
00628 };
00629 
00630 
00631 
00632 
00633 
00635 
00640 class MVO_API HOldSelItem : public HSelectionItem
00641 {
00642 
00643 public:
00645     HOldSelItem(HC_KEY key, HSelectionSet * selection_set, const char * selection_path, 
00646                 HC_KEY include_key, HC_KEY includer_key);
00647 
00648 
00649     virtual ~HOldSelItem();
00650 
00653     virtual const char * GetName() const { return "HOldSelItem"; };
00654 
00655 
00659     virtual bool Equals(const HSelectionItem* i2) const;
00660 
00661 
00665     virtual bool Highlight();
00666 
00670     virtual bool UnHighlight();
00671 
00676     virtual bool IsHighlighted() const;
00677 
00678 
00684     virtual bool Delete();
00685 
00691     virtual bool IsInstanced() const { return false; };
00692 
00695     virtual int GetIncludeCount() const { return 0; };
00696 
00700     virtual const HC_KEY * const GetIncludeKeys() const { return 0; };
00701 
00702     virtual void GetIncludeKeys(HC_KEY*) const { do {/*nothing*/} while(0); }
00703 
00711     virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key);
00712 
00713 
00722     virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key);
00723 
00724 private:
00725 
00726     char * m_pSelectionPath;
00727     HC_KEY m_IncludeKey;
00728     HC_KEY m_IncluderKey;
00729 
00730     void HoopsRemove( HC_KEY key );
00731     void DeselectSegment( HC_KEY key, char const *keytype );
00732     void DeselectGeometry( HC_KEY key );
00733 };
00734 
00735 
00736 
00737 
00738 #ifdef H_PACK_8
00739 #pragma pack(pop)
00740 #endif
00741 
00742 #endif
00743 
00744 
00745 
00746 
00747