# HSmartSelItem

## Fields

int | `count`
HC_KEY * | `keys`

## Functions

| `HSmartSelItem`
| `HSmartSelItem`
| `~HSmartSelItem`
const char * | `GetName`
int | `GetIncludeCount`
const HC_KEY *const | `GetIncludeKeys`
void | `GetIncludeKeys`
const HC_KEY * | `GetFullPathKeys`
void | `GetFullPathKeys`
bool | `Equals`
bool | `Highlight`
bool | `UnHighlight`
bool | `IsHighlighted`
bool | `Delete`
bool | `IsInstanced`
bool | `QueryIncludeDependency`
bool | `UpdateIncludeDependency`
void | `UpdateIncludePath`
const int | `GetHighlightMode`
void | `SetHighlightMode`
int | `GetHighlightedRefListCount`
void | `GetHighlightedRefList`
bool | `IsSegment`
bool | `IsHighlighted`
bool | `IsRegionHighlighted`

## Detailed Description

class HSmartSelItem : public HSelectionItem

  The HSmartSelItem - selection item which can handle instancing.

  This implementation of HSelectionItem class handles instanced segments and entities. It also uses the ‘conditional styling’ mechanism to highlight the selection.

  Subclassed by HRegionSelItem, HSubentitySelItem

  Public Functions

  HSmartSelItem(HC_KEY key, HSelectionSet *selection_set, int incl_count, HC_KEY incl_keys[])

    Constructs a HSmartSelItem object.

    Parameters

      - key – HOOPS key to selection item.

      - selection_set – pointer to the HOOPS selection set which owns this selection item.

      - incl_count – Number of include keys in the selection item segment path.

      - incl_keys – An array of HOOPS keys of all the include keys in the selection item path.

  HSmartSelItem(HC_KEY key, HSelectionSet *selection_set, int incl_count, HC_KEY incl_keys[], bool is_segment)

    Constructs a HSmartSelItem object.

    Parameters

      - key – HOOPS key to selection item.

      - selection_set – pointer to the HOOPS selection set which owns this selection item.

      - incl_count – Number of include keys in the selection item segment path.

      - incl_keys – An array of HOOPS keys of all the include keys in the selection item path.

      - is_segment – Is the item known to be a segment.

  virtual ~HSmartSelItem()
  inline virtual const char *GetName() const
    Returns

      A character pointer denoting the name which is “HSmartSelItem.”

  inline virtual int GetIncludeCount() const
    Returns

      The number of include keys in the include path.

  inline virtual const HC_KEY *const GetIncludeKeys() const
    Returns

      An array to include keys. The return pointer is for read-only purpose.

  virtual void GetIncludeKeys(HC_KEY includes[]) const
    Parameters

      includes – An array of include keys (returned to the user). Note that the caller must ensure that the array is of the appropriate size, e.g, via the GetIncludeCount function.

  virtual const HC_KEY *GetFullPathKeys(HBaseView *view)
    Parameters

      view – The HBaseView in which this item is selected.

    Returns

      An array to include keys, just like GetIncludeKeys, except that the keys array includes the selection item and the view key (as passed in).

  virtual void GetFullPathKeys(HBaseView *view, HC_KEY path[])
    Parameters

      - view – The HBaseView in which the item is selected

      - path – An array of keys (returned to the user), just like GetIncludeKeys, except that the keys array includes the selection item and the view key (as passed in). Note that the caller must ensure that the array is of the appropriate size, e.g., via the GetFullPathCount function.

  virtual bool Equals(const HSelectionItem *i2) const
    Parameters

      i2 – An HSelectionItem object to be compared with this object

    Returns

      True if the two selection elements are equal.

  virtual bool Highlight()

    Call this function to highlight the selection item.

    Returns

      True if the highlight is successful.

  virtual bool UnHighlight()

    Call this function to unhighlight the selection item.

    Returns

      True if the unhighlight is successful.

  virtual bool IsHighlighted() const

    Checks to see if an item is currently highlighted.

    Returns

      True if the item is currently highlighted, false if otherwise.

  virtual bool Delete()

    Call this function to delete the selection item. NOTE: If the selection is a non-instanced segment or entity, it will be deleted. If the selection is an instanced segment or entity, it’s include link will be removed.

    Returns

      True if the item was successfully deleted.

  virtual bool IsInstanced() const

    Checks to see if the selection item has any segments/geometry which might be potentially shared. This is determined by checking the include keys in the selection path. If there is more than one (the model key), then it is instanced.

    Returns

      True if the item is instanced.

  virtual bool QueryIncludeDependency(HC_KEY include_key, HC_KEY &ret_dependent_key)

    Determines if the selection item has any dependency on the include key being provide. If it has, the api returns true and returns which key is dependent as the second argument.

    Parameters

      - include_key – HC_KEY to include key on which the dependency is wanted.

      - ret_dependent_key – HC_KEY to segment/entity which depends on the include key.

    Returns

      True if the item has dependency on the include_key.

  virtual bool UpdateIncludeDependency(HC_KEY include_key, HC_KEY dependent_key, HC_KEY replacement_key)

    This method updates the given key’s dependency on a given include key with a new include key.

    Parameters

      - include_key – HC_KEY to include key which is deleted/going to be deleted

      - dependent_key – HC_KEY to segment/entity which depends on the include key

      - replacement_key – new HC_KEY as a replacement to the dependent key

    Returns

      True if the dependency has been successfully updated.

  void UpdateIncludePath(int incl_count, HC_KEY incl_keys[])

    Replace the original include path and count passed into the constructor.

    Parameters

      - incl_count – The new number of keys in the include path

      - incl_keys – An array of include keys

  inline virtual const int GetHighlightMode()
    Returns

      The selection highlight mode.

  inline virtual void SetHighlightMode(HSelectionHighlightMode m)

    Sets the selection highlight mode.

    Parameters

      m – What the new highlight mode should be (see the SelectionHighlightMode enumeration for possible values)

  int GetHighlightedRefListCount()

    Retrieves the size of the list of highlighted objects

    Returns

      size of highlighted list

  void GetHighlightedRefList(HC_KEY *keys)

    Copies the list of Geometry Reference keys from this selection item.

    Parameters

      array – of Reference Geometry keys. Returned to user. Passed by reference always.

  inline bool IsSegment()

  Public Members

  int count
  HC_KEY *keys

  Public Static Functions

  static bool IsHighlighted(const HC_KEY key, const HSelectionSet *selection_set, const int incl_count, const HC_KEY incl_keys[])

    Checks to see if an item is currently highlighted. If you do not have the HSmartSelItem object, but just have the keys and include list returned from HOOPS, you could use this method to find out if the key was selected.

    Parameters

      - key – HOOPS key to the item to be tested for selection.

      - selection_set – A pointer to the HOOPS selection set in which this is to be tested.

      - incl_count – Number of include keys in the item segment path.

      - incl_keys – An array of HOOPS keys of all the include keys in the item path.

    Returns

      True if the item is currently highlighted, false if otherwise.

  static bool IsRegionHighlighted(const HC_KEY key, const HSelectionSet *selection_set, const int incl_count, const HC_KEY incl_keys[], int region)

    Checks to see if a region is currently highlighted. If you do not have the HSmartSelItem object, but just have the keys and include list returned from HOOPS, you could use this method to find out if the key was selected

    Parameters

      - key – HOOPS shell key to the item to be tested for selection.

      - selection_set – A pointer to the HOOPS selection set in which this is to be tested.

      - incl_count – Number of include keys in the item segment path.

      - incl_keys – An array of HOOPS keys of all the include keys in the item path.

      - region – The region number in the shell.

    Returns

      True if the item is currently highlighted, false if otherwise.