Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HSelectionItem.h
Go to the documentation of this file.
1 // Copyright (c) 1998-2014 by 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 _HSELECTIONITEM_H
17 #define _HSELECTIONITEM_H
18 
19 #ifdef H_PACK_8
20 #pragma pack(push)
21 #pragma pack(8)
22 #endif
23 
24 #include "HTools.h"
25 #include "HUtility.h"
26 
27 class HPixelRGBA;
28 class HSelectionSet;
29 class HBaseView;
30 
31 
33 
40 class MVO_API HSelectionItem
41 {
42 
43 public:
45  HSelectionItem(HC_KEY key, HSelectionSet * selection_set);
46 
47  virtual ~HSelectionItem();
48 
51  virtual const char * GetName() const { return "HSelectionItem"; };
52 
53 
56  virtual HC_KEY GetKey() const { return m_key; };
57 
58 
62  virtual HC_KEY GetSegmentKey() const;
63 
64 
68  virtual bool Equals(const HSelectionItem * i2) const;
69 
70 
74  virtual bool Highlight() = 0;
75 
79  virtual bool UnHighlight() = 0;
80 
85  virtual bool IsHighlighted() const = 0;
86 
87 
93  virtual bool Delete() = 0;
94 
95 
102  virtual bool IsInstanced() const = 0;
103 
104 
107  virtual int GetIncludeCount() const = 0;
108 
111  virtual const HC_KEY * const GetIncludeKeys() const = 0;
112 
116  virtual void GetIncludeKeys(HC_KEY * includes) const = 0;
117 
125  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY & ret_dependent_key) = 0;
126 
127 
136  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key) = 0;
137 
141  virtual int GetFullPathCount(HBaseView * view);
142 
147  virtual const HC_KEY *GetFullPathKeys (HBaseView * view);
148 
154  virtual void GetFullPathKeys (HBaseView * view, HC_KEY * path);
155 
160  void SetTimeStamp(float now) {m_TimeStamp=now;}
161 
166  float GetTimeStamp() {return m_TimeStamp;}
167 
168 protected:
169 
172 
175 
176  float m_TimeStamp;
177 };
178 
179 
180 
182 
187 class MVO_API HSmartSelItem : public HSelectionItem
188 {
189 
190 public:
191 
199  HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys);
200 
209  HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, bool is_segment);
210 
211  virtual ~HSmartSelItem();
212 
215  virtual const char * GetName() const { return "HSmartSelItem"; };
216 
217 
220  virtual int GetIncludeCount() const { return m_IncludePath.count; };
221 
224  virtual const HC_KEY * const GetIncludeKeys() const { return m_IncludePath.keys; };
225 
229  virtual void GetIncludeKeys(HC_KEY *includes) const;
230 
235  virtual const HC_KEY *GetFullPathKeys (HBaseView *view);
236 
243  virtual void GetFullPathKeys (HBaseView *view, HC_KEY *path);
244 
248  virtual bool Equals(const HSelectionItem* i2) const;
249 
250 
254  virtual bool Highlight();
255 
259  virtual bool UnHighlight();
260 
265  virtual bool IsHighlighted() const;
266 
267 
278  static bool IsHighlighted(const HC_KEY key, const HSelectionSet * selection_set,
279  const int incl_count, const HC_KEY * incl_keys);
291  static bool IsRegionHighlighted(const HC_KEY key, const HSelectionSet * selection_set,
292  const int incl_count, const HC_KEY * incl_keys, int region);
293 
294 
300  virtual bool Delete();
301 
302 
309  virtual bool IsInstanced() const;
310 
311 
319  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key);
320 
321 
330  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key);
331 
337  void UpdateIncludePath(int incl_count, HC_KEY * incl_keys);
338 
342  virtual const int GetHighlightMode() { return m_HighlightMode; }
343 
348  virtual void SetHighlightMode(HSelectionHighlightMode m) { m_HighlightMode = m;}
349 
350 private:
351 
352  HC_KEY m_ConditionStyle;
353 
354  HSelectionHighlightMode m_HighlightMode;
355 
356 public:
357 
362  int GetHighlightedRefListCount();
363 
368  void GetHighlightedRefList(HC_KEY * keys);
369 
370  bool IsSegment() {return m_is_segment;}
371 
372 protected:
376  void FixIncludePath();
377 
382  HC_KEY GetHighlightedRefKey();
383 
388  void AddHighlightedRefKey(HC_KEY key);
389 
390  struct vlist_s *m_pSelKeyList;
391 
392 private:
393  void GetBaseTag(char * retTag);
394 
395 private:
396 
397  // The include path is a list of all the include keys from the root segment right down to
398  // entity/segment. This can be constructed from the selection path returned by HOOPS by filtering
399  // out any keys other than include keys.
400  struct {
401  int count;
402  HC_KEY * keys;
403  } m_IncludePath;
404 
405  bool m_is_segment;
406 
407  // Selection of a non-segment item with conditional highlighting will throw the item into a proxy
408  // segment so the item can be styled. However, if different selection set selects the same item,
409  // it should *not* move the item to a further proxy subsegment because this can cause cleanup
410  // problems. Now we cannot clean up after ourselves if another selection set has selected that
411  // item, even if we want to clean up after our own selection set. So an in-use tag needs to
412  // be funneled in as well to allow us to see if others are using the proxy segment as well.
413  // The could probably be done with a simple counter attached to the segment as a user option or
414  // the like, but I suspect that a multithreaded environment could make this quickly go awry.
415  HC_KEY m_entity_proxy_seg_tag;
416 };
417 
419 
424 class MVO_API HRegionSelItem : public HSmartSelItem
425 {
426 public:
427 
435  HRegionSelItem(HShellObject const & oShellObj, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, int region);
436 
437  ~HRegionSelItem(){
438 
439  }
440 
443  virtual const char * GetName() const { return "HRegionSelItem"; };
444 
447  virtual int const GetRegion() const { return m_Region; }
448 
452  virtual bool Equals(const HSelectionItem* i2) const;
453 
457  virtual bool Highlight();
458 
462  virtual bool UnHighlight();
463 
464 private:
467  int m_Region;
468 
472  virtual int IncrEdgeHighlightCount(HC_KEY key, HShellEdge const & Edge);
473 
477  virtual int DecrEdgeHighlightCount(HC_KEY key, HShellEdge const & Edge);
478 
481  virtual void HighlightEdges();
482 
485  virtual void UnHighlightEdges();
486 
489  virtual void HighlightFaces();
490 
493  virtual void UnHighlightFaces();
494 
495  HShellObject m_oShellObj;
496  HShellRegion m_oRegionObj;
497 };
498 
499 
500 #define HSUBENTITY_FACES 0x01
501 #define HSUBENTITY_VERTICES 0x02
502 #define HSUBENTITY_EDGES 0x04
503 
505 
510 #include "vhash.h"
511 
512 class SubentityMap: public VHash<int, int>
513 {
514 
515 };
516 
517 class MVO_API HSubentitySelItem : public HSmartSelItem
518 {
519 public:
520 
537  HSubentitySelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys,
538  int face_count, const int * faces, int vertex_count, const int * vertex1, const int * vertex2,
539  bool highlight_faces=true, bool highlight_vertices=true, bool highlight_edges=true, bool maintain_maps = false);
540 
542 
545  virtual const char * GetName() const { return "HSubentitySelItem"; };
546 
550  virtual bool Equals(const HSelectionItem* i2) const;
551 
556  virtual bool Similar(const HSelectionItem * i2) const;
557 
561  virtual bool Highlight();
562 
566  virtual bool UnHighlight();
567 
571  virtual bool UnHighlight(HSubentitySelItem const * remove_sel);
572 
576  bool IsEmpty() {return !m_vertex_count && !m_face_count; }
577 
581  virtual bool Delete();
582 
583  int GetFaceCount() const { return m_face_count; }
584 
585  void GetFaces(int * faces);
586 
587  int GetVertexCount() const { return m_vertex_count; }
588 
589  void GetVertices(int * vertex1, int * vertex2);
590 
591  bool MaintainMaps() { return m_maintain_maps; }
592 
593  void MaintainMaps(bool maintain_maps) { m_maintain_maps=maintain_maps; }
594 
595  void GetMapCounts(int * face_map_count, int * vertex_map_count);
596 
597  void GetMaps(int * face_map, int * vertex_map);
598 
599  void MergeMaps(HSubentitySelItem * that);
600 
601 private:
602 
603  int m_face_count;
604  int * m_faces;
605  int m_vertex_count;
606  int * m_vertex1;
607  int * m_vertex2;
608  bool m_maintain_maps;
609  int m_vertex_map_count;
610  SubentityMap * m_vertex_map;
611  int m_face_map_count;
612  SubentityMap * m_face_map;
613  int m_subentity_highlight;
614 };
615 
616 
617 
618 
619 
621 
626 class MVO_API HOldSelItem : public HSelectionItem
627 {
628 
629 public:
631  HOldSelItem(HC_KEY key, HSelectionSet * selection_set, const char * selection_path,
632  HC_KEY include_key, HC_KEY includer_key);
633 
634 
635  virtual ~HOldSelItem();
636 
639  virtual const char * GetName() const { return "HOldSelItem"; };
640 
641 
645  virtual bool Equals(const HSelectionItem* i2) const;
646 
647 
651  virtual bool Highlight();
652 
656  virtual bool UnHighlight();
657 
662  virtual bool IsHighlighted() const;
663 
664 
670  virtual bool Delete();
671 
677  virtual bool IsInstanced() const { return false; };
678 
681  virtual int GetIncludeCount() const { return 0; };
682 
686  virtual const HC_KEY * const GetIncludeKeys() const { return 0; };
687 
688  virtual void GetIncludeKeys(HC_KEY*) const { do {/*nothing*/} while(0); }
689 
697  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key);
698 
699 
708  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key);
709 
710 private:
711 
712  char * m_pSelectionPath;
713  HC_KEY m_IncludeKey;
714  HC_KEY m_IncluderKey;
715 
716  void HoopsRemove( HC_KEY key );
717  void DeselectSegment( HC_KEY key, char const *keytype );
718  void DeselectGeometry( HC_KEY key );
719 };
720 
721 
722 
723 
724 #ifdef H_PACK_8
725 #pragma pack(pop)
726 #endif
727 
728 #endif
729 
730 
731 
732 
733 
virtual bool Highlight()
The HShellObject class is a simple wrapper for a shell.
Definition: HUtility.h:198
float m_TimeStamp
Time the item was created. Used for sorting the selection list.
Definition: HSelectionItem.h:176
Definition: HSelectionItem.h:517
virtual const HC_KEY * GetFullPathKeys(HBaseView *view)
virtual const char * GetName() const
Definition: HSelectionItem.h:443
bool IsEmpty()
Definition: HSelectionItem.h:576
virtual bool UnHighlight()
virtual const HC_KEY *const GetIncludeKeys() const
Definition: HSelectionItem.h:686
int m_FullPathCount
The length of the m_FullPath array of keys including the selection item and view key.
Definition: HSelectionItem.h:174
virtual const int GetHighlightMode()
Definition: HSelectionItem.h:342
virtual int GetIncludeCount() const
Definition: HSelectionItem.h:681
virtual bool Delete()=0
#define HC_KEY
virtual bool Equals(const HSelectionItem *i2) const
virtual const char * GetName() const
Definition: HSelectionItem.h:215
virtual const HC_KEY *const GetIncludeKeys() const =0
The HSubentitySelItem - subentity selection item which can handle instancing.
Definition: HSelectionItem.h:512
The HPixelRGBA class is the data type of a rgba pixel.
Definition: HGlobals.h:509
The HShellRegion class is a simple wrapper for a shell's region.
Definition: HUtility.h:164
The HSelectionSet class manages a list of selected items.
Definition: HSelectionSet.h:66
HSelectionHighlightMode
Definition: HGlobals.h:547
The HSmartSelItem - selection item which can handle instancing.
Definition: HSelectionItem.h:187
virtual bool IsInstanced() const
Definition: HSelectionItem.h:677
virtual bool IsHighlighted() const =0
virtual bool Highlight()=0
virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY &ret_dependent_key)=0
virtual bool IsInstanced() const =0
virtual bool Delete()
virtual const char * GetName() const
Definition: HSelectionItem.h:639
virtual void GetIncludeKeys(HC_KEY *) const
Definition: HSelectionItem.h:688
float GetTimeStamp()
Definition: HSelectionItem.h:166
virtual void SetHighlightMode(HSelectionHighlightMode m)
Definition: HSelectionItem.h:348
virtual const HC_KEY *const GetIncludeKeys() const
Definition: HSelectionItem.h:224
virtual HC_KEY GetKey() const
Definition: HSelectionItem.h:56
virtual bool UnHighlight()=0
virtual int const GetRegion() const
Definition: HSelectionItem.h:447
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
HSelectionSet * m_pSelectionSet
The selection set which owns this selection item.
Definition: HSelectionItem.h:171
virtual int GetIncludeCount() const
Definition: HSelectionItem.h:220
virtual const char * GetName() const
Definition: HSelectionItem.h:51
The HRegionSelItem - region selection item which can handle instancing.
Definition: HSelectionItem.h:424
The HShellEdge class is a simple wrapper for a shell's edge.
Definition: HUtility.h:84
The HOldSelItem class implements selection using the old style highlighting which does not handle inc...
Definition: HSelectionItem.h:626
virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key)=0
HC_KEY m_key
The HOOPS key to the selection element.
Definition: HSelectionItem.h:170
void SetTimeStamp(float now)
Definition: HSelectionItem.h:160
virtual const char * GetName() const
Definition: HSelectionItem.h:545
virtual bool Equals(const HSelectionItem *i2) const
HC_KEY * m_FullPath
The include path plus the selection item and view key. If the object is not a HSmartSelItem, the path may be incomplete.
Definition: HSelectionItem.h:173