Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HSelectionItem.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2004 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: 2968f177dcf07ab2a295c067a5c3908ecb3d0394 $
13 //
14 
21 #ifndef _HSELECTIONITEM_H
22 #define _HSELECTIONITEM_H
23 
24 #ifdef H_PACK_8
25 #pragma pack(push)
26 #pragma pack(8)
27 #endif
28 
29 #include "HTools.h"
30 #include "HUtility.h"
31 
32 class HPixelRGBA;
33 class HSelectionSet;
34 class HBaseView;
35 
36 
38 
45 class MVO_API HSelectionItem
46 {
47 
48 public:
50  HSelectionItem(HC_KEY key, HSelectionSet * selection_set);
51 
52  virtual ~HSelectionItem();
53 
56  virtual const char * GetName() const { return "HSelectionItem"; };
57 
58 
61  virtual HC_KEY GetKey() const { return m_key; };
62 
63 
67  virtual HC_KEY GetSegmentKey() const;
68 
69 
73  virtual bool Equals(const HSelectionItem * i2) const;
74 
75 
79  virtual bool Highlight() = 0;
80 
84  virtual bool UnHighlight() = 0;
85 
90  virtual bool IsHighlighted() const = 0;
91 
92 
98  virtual bool Delete() = 0;
99 
100 
107  virtual bool IsInstanced() const = 0;
108 
109 
112  virtual int GetIncludeCount() const = 0;
113 
116  virtual const HC_KEY * const GetIncludeKeys() const = 0;
117 
121  virtual void GetIncludeKeys(HC_KEY * includes) const = 0;
122 
130  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY & ret_dependent_key) = 0;
131 
132 
141  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key) = 0;
142 
146  virtual int GetFullPathCount(HBaseView * view);
147 
152  virtual const HC_KEY *GetFullPathKeys (HBaseView * view);
153 
159  virtual void GetFullPathKeys (HBaseView * view, HC_KEY * path);
160 
165  void SetTimeStamp(float now) {m_TimeStamp=now;}
166 
171  float GetTimeStamp() {return m_TimeStamp;}
172 
173 protected:
174 
177 
180 
181  float m_TimeStamp;
182 };
183 
184 
185 
187 
192 class MVO_API HSmartSelItem : public HSelectionItem
193 {
194 
195 public:
196 
204  HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys);
205 
214  HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, bool is_segment);
215 
216  virtual ~HSmartSelItem();
217 
220  virtual const char * GetName() const { return "HSmartSelItem"; };
221 
222 
225  virtual int GetIncludeCount() const { return m_IncludePath.count; };
226 
229  virtual const HC_KEY * const GetIncludeKeys() const { return m_IncludePath.keys; };
230 
234  virtual void GetIncludeKeys(HC_KEY *includes) const;
235 
240  virtual const HC_KEY *GetFullPathKeys (HBaseView *view);
241 
248  virtual void GetFullPathKeys (HBaseView *view, HC_KEY *path);
249 
253  virtual bool Equals(const HSelectionItem* i2) const;
254 
255 
259  virtual bool Highlight();
260 
264  virtual bool UnHighlight();
265 
270  virtual bool IsHighlighted() const;
271 
272 
283  static bool IsHighlighted(const HC_KEY key, const HSelectionSet * selection_set,
284  const int incl_count, const HC_KEY * incl_keys);
296  static bool IsRegionHighlighted(const HC_KEY key, const HSelectionSet * selection_set,
297  const int incl_count, const HC_KEY * incl_keys, int region);
298 
299 
305  virtual bool Delete();
306 
307 
314  virtual bool IsInstanced() const;
315 
316 
324  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key);
325 
326 
335  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key);
336 
342  void UpdateIncludePath(int incl_count, HC_KEY * incl_keys);
343 
347  virtual const int GetHighlightMode() { return m_HighlightMode; }
348 
353  virtual void SetHighlightMode(HSelectionHighlightMode m) { m_HighlightMode = m;}
354 
355 private:
356 
357  HC_KEY m_ConditionStyle;
358 
359  HSelectionHighlightMode m_HighlightMode;
360 
361 public:
362 
367  int GetHighlightedRefListCount();
368 
373  void GetHighlightedRefList(HC_KEY * keys);
374 
375  bool IsSegment() {return m_is_segment;}
376 
377 protected:
381  void FixIncludePath();
382 
387  HC_KEY GetHighlightedRefKey();
388 
393  void AddHighlightedRefKey(HC_KEY key);
394 
395  struct vlist_s *m_pSelKeyList;
396 
397 private:
398  void GetBaseTag(char * retTag);
399 
400 private:
401 
402  // The include path is a list of all the include keys from the root segment right down to
403  // entity/segment. This can be constructed from the selection path returned by HOOPS by filtering
404  // out any keys other than include keys.
405  struct {
406  int count;
407  HC_KEY * keys;
408  } m_IncludePath;
409 
410  bool m_is_segment;
411 
412  // Selection of a non-segment item with conditional highlighting will throw the item into a proxy
413  // segment so the item can be styled. However, if different selection set selects the same item,
414  // it should *not* move the item to a further proxy subsegment because this can cause cleanup
415  // problems. Now we cannot clean up after ourselves if another selection set has selected that
416  // item, even if we want to clean up after our own selection set. So an in-use tag needs to
417  // be funneled in as well to allow us to see if others are using the proxy segment as well.
418  // The could probably be done with a simple counter attached to the segment as a user option or
419  // the like, but I suspect that a multithreaded environment could make this quickly go awry.
420  HC_KEY m_entity_proxy_seg_tag;
421 };
422 
424 
429 class MVO_API HRegionSelItem : public HSmartSelItem
430 {
431 public:
432 
440  HRegionSelItem(HShellObject const & oShellObj, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys, int region);
441 
442  ~HRegionSelItem(){
443 
444  }
445 
448  virtual const char * GetName() const { return "HRegionSelItem"; };
449 
452  virtual int const GetRegion() const { return m_Region; }
453 
457  virtual bool Equals(const HSelectionItem* i2) const;
458 
462  virtual bool Highlight();
463 
467  virtual bool UnHighlight();
468 
469 private:
472  int m_Region;
473 
477  virtual int IncrEdgeHighlightCount(HC_KEY key, HShellEdge const & Edge);
478 
482  virtual int DecrEdgeHighlightCount(HC_KEY key, HShellEdge const & Edge);
483 
486  virtual void HighlightEdges();
487 
490  virtual void UnHighlightEdges();
491 
494  virtual void HighlightFaces();
495 
498  virtual void UnHighlightFaces();
499 
500  HShellObject m_oShellObj;
501  HShellRegion m_oRegionObj;
502 };
503 
504 
505 #define HSUBENTITY_FACES 0x01
506 #define HSUBENTITY_VERTICES 0x02
507 #define HSUBENTITY_EDGES 0x04
508 
510 
515 #include "vhash.h"
516 
517 class SubentityMap: public VHash<int, int>
518 {
519 
520 };
521 
522 class MVO_API HSubentitySelItem : public HSmartSelItem
523 {
524 public:
525 
542  HSubentitySelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY * incl_keys,
543  int face_count, const int * faces, int vertex_count, const int * vertex1, const int * vertex2,
544  bool highlight_faces=true, bool highlight_vertices=true, bool highlight_edges=true, bool maintain_maps = false);
545 
547 
550  virtual const char * GetName() const { return "HSubentitySelItem"; };
551 
555  virtual bool Equals(const HSelectionItem* i2) const;
556 
561  virtual bool Similar(const HSelectionItem * i2) const;
562 
566  virtual bool Highlight();
567 
571  virtual bool UnHighlight();
572 
576  virtual bool UnHighlight(HSubentitySelItem const * remove_sel);
577 
581  bool IsEmpty() {return (!m_vertex_count && !m_face_count); }
582 
586  virtual bool Delete();
587 
588  int GetFaceCount() const { return m_face_count; }
589 
590  void GetFaces(int * faces);
591 
592  int GetVertexCount() const { return m_vertex_count; }
593 
594  void GetVertices(int * vertex1, int * vertex2);
595 
596  bool MaintainMaps() { return m_maintain_maps; }
597 
598  void MaintainMaps(bool maintain_maps) { m_maintain_maps=maintain_maps; }
599 
600  void GetMapCounts(int * face_map_count, int * vertex_map_count);
601 
602  void GetMaps(int * face_map, int * vertex_map);
603 
604 private:
605  int m_face_count;
606  int * m_faces;
607  int m_vertex_count;
608  int * m_vertex1;
609  int * m_vertex2;
610  bool m_maintain_maps;
611  int m_vertex_map_count;
612  SubentityMap * m_vertex_map;
613  int m_face_map_count;
614  SubentityMap * m_face_map;
615  int m_subentity_highlight;
616 };
617 
618 
619 
620 
621 
623 
628 class MVO_API HOldSelItem : public HSelectionItem
629 {
630 
631 public:
633  HOldSelItem(HC_KEY key, HSelectionSet * selection_set, const char * selection_path,
634  HC_KEY include_key, HC_KEY includer_key);
635 
636 
637  virtual ~HOldSelItem();
638 
641  virtual const char * GetName() const { return "HOldSelItem"; };
642 
643 
647  virtual bool Equals(const HSelectionItem* i2) const;
648 
649 
653  virtual bool Highlight();
654 
658  virtual bool UnHighlight();
659 
664  virtual bool IsHighlighted() const;
665 
666 
672  virtual bool Delete();
673 
679  virtual bool IsInstanced() const { return false; };
680 
683  virtual int GetIncludeCount() const { return 0; };
684 
688  virtual const HC_KEY * const GetIncludeKeys() const { return 0; };
689 
690  virtual void GetIncludeKeys(HC_KEY*) const { do {/*nothing*/} while(0); }
691 
699  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key);
700 
701 
710  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key);
711 
712 private:
713 
714  char * m_pSelectionPath;
715  HC_KEY m_IncludeKey;
716  HC_KEY m_IncluderKey;
717 
718  void HoopsRemove( HC_KEY key );
719  void DeselectSegment( HC_KEY key, char const *keytype );
720  void DeselectGeometry( HC_KEY key );
721 };
722 
723 
724 
725 
726 #ifdef H_PACK_8
727 #pragma pack(pop)
728 #endif
729 
730 #endif
731 
732 
733 
734 
735 
virtual bool Highlight()
The HShellObject class is a simple wrapper for a shell.
Definition: HUtility.h:204
float m_TimeStamp
Time the item was created. Used for sorting the selection list.
Definition: HSelectionItem.h:181
Definition: HSelectionItem.h:522
virtual const HC_KEY * GetFullPathKeys(HBaseView *view)
virtual const char * GetName() const
Definition: HSelectionItem.h:448
bool IsEmpty()
Definition: HSelectionItem.h:581
virtual bool UnHighlight()
virtual const HC_KEY *const GetIncludeKeys() const
Definition: HSelectionItem.h:688
int m_FullPathCount
The length of the m_FullPath array of keys including the selection item and view key.
Definition: HSelectionItem.h:179
virtual const int GetHighlightMode()
Definition: HSelectionItem.h:347
virtual int GetIncludeCount() const
Definition: HSelectionItem.h:683
virtual bool Delete()=0
#define HC_KEY
virtual bool Equals(const HSelectionItem *i2) const
virtual const char * GetName() const
Definition: HSelectionItem.h:220
virtual const HC_KEY *const GetIncludeKeys() const =0
The HSubentitySelItem - subentity selection item which can handle instancing.
Definition: HSelectionItem.h:517
The HPixelRGBA class is the data type of a rgba pixel.
Definition: HGlobals.h:516
The HShellRegion class is a simple wrapper for a shell's region.
Definition: HUtility.h:170
The HSelectionSet class manages a list of selected items.
Definition: HSelectionSet.h:71
HSelectionHighlightMode
Definition: HGlobals.h:554
The HSmartSelItem - selection item which can handle instancing.
Definition: HSelectionItem.h:192
virtual bool IsInstanced() const
Definition: HSelectionItem.h:679
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:641
virtual void GetIncludeKeys(HC_KEY *) const
Definition: HSelectionItem.h:690
float GetTimeStamp()
Definition: HSelectionItem.h:171
virtual void SetHighlightMode(HSelectionHighlightMode m)
Definition: HSelectionItem.h:353
virtual const HC_KEY *const GetIncludeKeys() const
Definition: HSelectionItem.h:229
virtual HC_KEY GetKey() const
Definition: HSelectionItem.h:61
virtual bool UnHighlight()=0
virtual int const GetRegion() const
Definition: HSelectionItem.h:452
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
HSelectionSet * m_pSelectionSet
The selection set which owns this selection item.
Definition: HSelectionItem.h:176
virtual int GetIncludeCount() const
Definition: HSelectionItem.h:225
virtual const char * GetName() const
Definition: HSelectionItem.h:56
The HRegionSelItem - region selection item which can handle instancing.
Definition: HSelectionItem.h:429
The HShellEdge class is a simple wrapper for a shell's edge.
Definition: HUtility.h:90
The HOldSelItem class implements selection using the old style highlighting which does not handle inc...
Definition: HSelectionItem.h:628
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:175
void SetTimeStamp(float now)
Definition: HSelectionItem.h:165
virtual const char * GetName() const
Definition: HSelectionItem.h:550
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:178