Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

HSelectionItem.h
Go to the documentation of this file.
1 // Copyright (c) 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  friend class HSelectionSet;
190 
191 public:
192 
200  HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY incl_keys[]);
201 
210  HSmartSelItem(HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY incl_keys[], bool is_segment);
211 
212  virtual ~HSmartSelItem();
213 
216  virtual const char * GetName() const { return "HSmartSelItem"; };
217 
218 
221  virtual int GetIncludeCount() const { return m_IncludePath.count; };
222 
225  virtual const HC_KEY * const GetIncludeKeys() const { return m_IncludePath.keys; };
226 
230  virtual void GetIncludeKeys(HC_KEY includes[]) const;
231 
236  virtual const HC_KEY *GetFullPathKeys (HBaseView *view);
237 
244  virtual void GetFullPathKeys (HBaseView *view, HC_KEY path[]);
245 
249  virtual bool Equals(const HSelectionItem* i2) const;
250 
251 
255  virtual bool Highlight();
256 
260  virtual bool UnHighlight();
261 
266  virtual bool IsHighlighted() const;
267 
268 
279  static bool IsHighlighted(const HC_KEY key, const HSelectionSet * selection_set,
280  const int incl_count, const HC_KEY incl_keys[]);
292  static bool IsRegionHighlighted(const HC_KEY key, const HSelectionSet * selection_set,
293  const int incl_count, const HC_KEY incl_keys[], int region);
294 
295 
301  virtual bool Delete();
302 
303 
310  virtual bool IsInstanced() const;
311 
312 
320  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key);
321 
322 
331  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key);
332 
338  void UpdateIncludePath(int incl_count, HC_KEY incl_keys[]);
339 
343  virtual const int GetHighlightMode() { return m_HighlightMode; }
344 
350 
351 protected:
352  HSmartSelItem(bool is_ooc, HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY incl_keys[], bool is_segment);
353 
354  void CommonUnhighlightRef();
355 private:
356 
357  HC_KEY m_ConditionStyle;
358 
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  friend class HSelectionSet;
525 
526 public:
527 
545  HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY incl_keys[],
546  int face_count, const int faces[], int vertex_count, int const vertex1[], int const vertex2[],
547  bool highlight_faces = true, bool highlight_vertices = true, bool highlight_edges = true, bool maintain_maps = false);
548 
550 
553  virtual const char * GetName() const { return "HSubentitySelItem"; };
554 
558  virtual bool Equals(const HSelectionItem* i2) const;
559 
564  virtual bool Similar(const HSelectionItem * i2) const;
565 
569  virtual bool Highlight();
570 
574  virtual bool UnHighlight();
575 
579  virtual bool UnHighlight(HSubentitySelItem const * remove_sel);
580 
584  bool IsEmpty() {return !m_vertex_count && !m_face_count; }
585 
589  virtual bool Delete();
590 
591  int GetFaceCount() const { return m_face_count; }
592 
593  void GetFaces(int faces[]);
594 
595  int GetVertexCount() const { return m_vertex_count; }
596 
597  void GetVertices(int vertex1[], int vertex2[]);
598 
599  bool MaintainMaps() { return m_maintain_maps; }
600 
601  void MaintainMaps(bool maintain_maps) { m_maintain_maps=maintain_maps; }
602 
603  void GetMapCounts(int * face_map_count, int * vertex_map_count);
604 
605  void GetMaps(int face_map[], int vertex_map[]);
606 
607  void MergeMaps(HSubentitySelItem * that);
608 
609 protected:
611  bool is_ooc, HC_KEY key, HSelectionSet * selection_set, int incl_count, HC_KEY incl_keys[],
612  int face_count, const int faces[], int vertex_count, int const vertex1[], int const vertex2[],
613  bool highlight_faces = true, bool highlight_vertices = true, bool highlight_edges = true, bool maintain_maps = false);
614 
615 private:
616 
617  int m_face_count;
618  int * m_faces;
619  int m_vertex_count;
620  int * m_vertex1;
621  int * m_vertex2;
622  bool m_maintain_maps;
623  int m_vertex_map_count;
624  SubentityMap * m_vertex_map;
625  int m_face_map_count;
626  SubentityMap * m_face_map;
627  int m_subentity_highlight;
628 };
629 
630 
631 
632 
633 
635 
640 class MVO_API HOldSelItem : public HSelectionItem
641 {
642 
643 public:
645  HOldSelItem(HC_KEY key, HSelectionSet * selection_set, const char * selection_path,
646  HC_KEY include_key, HC_KEY includer_key);
647 
648 
649  virtual ~HOldSelItem();
650 
653  virtual const char * GetName() const { return "HOldSelItem"; };
654 
655 
659  virtual bool Equals(const HSelectionItem* i2) const;
660 
661 
665  virtual bool Highlight();
666 
670  virtual bool UnHighlight();
671 
676  virtual bool IsHighlighted() const;
677 
678 
684  virtual bool Delete();
685 
691  virtual bool IsInstanced() const { return false; };
692 
695  virtual int GetIncludeCount() const { return 0; };
696 
700  virtual const HC_KEY * const GetIncludeKeys() const { return 0; };
701 
702  virtual void GetIncludeKeys(HC_KEY[]) const { /*do nothing*/ }
703 
711  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY& ret_dependent_key);
712 
713 
722  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key);
723 
724 private:
725 
726  char * m_pSelectionPath;
727  HC_KEY m_IncludeKey;
728  HC_KEY m_IncluderKey;
729 
730  void HoopsRemove( HC_KEY key );
731  void DeselectSegment( HC_KEY key, char const *keytype );
732  void DeselectGeometry( HC_KEY key );
733 };
734 
735 
736 
737 
738 #ifdef H_PACK_8
739 #pragma pack(pop)
740 #endif
741 
742 #endif
743 
744 
745 
746 
747 
virtual bool Highlight()
The HShellObject class is a simple wrapper for a shell.
Definition: HUtility.h:202
float m_TimeStamp
Time the item was created. Used for sorting the selection list.
Definition: HSelectionItem.h:176
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:584
virtual bool UnHighlight()
virtual const HC_KEY *const GetIncludeKeys() const
Definition: HSelectionItem.h:700
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:343
virtual int GetIncludeCount() const
Definition: HSelectionItem.h:695
virtual bool Delete()=0
virtual bool Equals(const HSelectionItem *i2) const
virtual const char * GetName() const
Definition: HSelectionItem.h:216
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:509
The HShellRegion class is a simple wrapper for a shell's region.
Definition: HUtility.h:168
The HSelectionSet class manages a list of selected items.
Definition: HSelectionSet.h:66
#define HC_KEY
HSelectionHighlightMode
Definition: HGlobals.h:547
The HSmartSelItem - selection item which can handle instancing.
Definition: HSelectionItem.h:187
virtual bool IsInstanced() const
Definition: HSelectionItem.h:691
virtual bool IsHighlighted() const =0
virtual bool Highlight()=0
virtual void GetIncludeKeys(HC_KEY[]) const
Definition: HSelectionItem.h:702
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:653
float GetTimeStamp()
Definition: HSelectionItem.h:166
virtual void SetHighlightMode(HSelectionHighlightMode m)
Definition: HSelectionItem.h:349
virtual const HC_KEY *const GetIncludeKeys() const
Definition: HSelectionItem.h:225
virtual HC_KEY GetKey() const
Definition: HSelectionItem.h:56
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: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
HSelectionHighlightMode m_HighlightMode
Stores the current highlighting mode.
Definition: HSelectionSet.h:95
virtual int GetIncludeCount() const
Definition: HSelectionItem.h:221
virtual const char * GetName() const
Definition: HSelectionItem.h:51
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:88
The HOldSelItem class implements selection using the old style highlighting which does not handle inc...
Definition: HSelectionItem.h:640
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:553
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