HUtilityAnnotation

Detailed Description

class HUtilityAnnotation

The HUtilityAnnotation class defines and manages annotations.

This class simplified the creation of annotations.

Subclassed by HUtilityAnnotationMeasure

Public Functions

inline HUtilityAnnotation()
inline virtual ~HUtilityAnnotation()
virtual void AddChar(char the_char)

Adds a char to the note

virtual void AddChar(unsigned short the_char)

Adds a unicode char to the note

virtual HC_KEY GetBackgroundSegmentKey()

Returns a key to the background segment. In the segment a user-defined background can be set. Assume the text will range from x=[-1, 1] y=[-1, 1] and the background will be scaled to fit the text

inline virtual HC_KEY GetKey()

Returns the key to the root of the note sub-tree

virtual void GetText(char *text, int &length)

Fills text with the current note text

Parameters:
  • text – a pointer to where the text should be written (may be null)
  • length – return values for how much text was put in the buffer
virtual int GetTextLength()

Returns just the length of the text

virtual void GetTextWithEncoding(unsigned short *text, int &length)

Fills text with the current note text

Parameters:
  • text – a pointer to where the text should be written (may be null)
  • length – return values for how much text was put in the buffer
inline virtual char const *GetType()

Returns “HUtilityAnnotation”

virtual HC_KEY Insert(HPoint target, HPoint position, HC_KEY AnnotateThis, HBaseView *pView, HC_KEY layer_key = (-1L), int bg_type = 1, bool useArrow = true, HC_KEY *key_path = (HC_KEY*)0, int key_path_length = 0)

Inserts a note

Parameters:
  • target – where the arrow should point
  • position – where the text is positioned
  • AnnotateThis – key to what this annotation is annotating
  • pView – pointer to the view
  • layer_key – style segment for this note
  • bg_type – one of four stock background types
  • useArrow – sets the visibility of the arrow
  • key_path – is the key path returned by HC_Show_Selection_Original_Keys
  • key_path_length – is the length returned by HC_Show_Selection_Original_Keys
Returns:

key to the root of the note segment tree

virtual HC_KEY Insert(char const *text, HPoint target, HPoint position, HC_KEY AnnotateThis, HBaseView *pView, HC_KEY layer_key = (-1L), int bg_type = 1, bool useArrow = true, HC_KEY *key_path = (HC_KEY*)0, int key_path_length = 0)

Inserts a note

Parameters:
  • text – initial text for this note
  • target – where the arrow should point
  • position – where the text is positioned
  • AnnotateThis – key to what this annotation is annotating
  • pView – pointer to the view
  • layer_key – style segment for this note
  • bg_type – one of four stock background types
  • useArrow – sets the visibility of the arrow
  • key_path – is the key path returned by HC_Show_Selection_Original_Keys
  • key_path_length – is the length returned by HC_Show_Selection_Original_Keys
Returns:

key to the root of the note segment tree

virtual HC_KEY InsertWithEncoding(unsigned short const *text, HPoint target, HPoint position, HC_KEY AnnotateThis, HBaseView *pView, HC_KEY layer_key = (-1L), int bg_type = 1, bool useArrow = true, HC_KEY *key_path = (HC_KEY*)0, int key_path_length = 0)

Inserts a note

Parameters:
  • text – initial text for this note
  • target – where the arrow should point
  • position – where the text is positioned
  • AnnotateThis – key to what this annotation is annotating
  • pView – pointer to the view
  • layer_key – style segment for this note
  • bg_type – one of four stock background types
  • useArrow – sets the visibility of the arrow
  • key_path – is the key path returned by HC_Show_Selection_Original_Keys
  • key_path_length – is the length returned by HC_Show_Selection_Original_Keys
Returns:

key to the root of the note segment tree

virtual void MoveText(HPoint const &pos, HCamera const *camera = 0)

Repositions the text

virtual void MoveText(HPoint const &tar, HPoint const &pos, HCamera const *camera = 0)

Repositions the text and target.

virtual void SetBackgroundType(long type)

Sets the background type to one of the four predefined types

Parameters:type – can be 0, 1, 2, 3 or BG_CIRCLE, BG_QUAD, BG_CLOUD, BG_NONE
virtual void SetColor(char const *color)

sets the color at the root of the note segment tree

Parameters:color – can be anything that HC_Set_Color accepts
virtual void SetEdgeWeight(float weight)

Sets the edge weight at the root of the note segment tree

virtual void SetExtents(int xpixels, int ypixels, HC_KEY view_key)

Sets the extents of the background. The text will be scaled to fit within these extents

virtual void SetFacePattern(char const *pattern)

Sets the face pattern at the root of the note segment tree

Parameters:pattern – can be anything that HC_Set_Face_Pattern accepts
virtual void SetLinePattern(char const *pattern)

Sets the line pattern at the root of the note segment tree

Parameters:pattern – can be anything that HC_Set_Line_Pattern accepts
virtual void SetLineWeight(float weight)

Sets the line weight at the root of the note segment tree

virtual void SetNote(HC_KEY noteskey, HC_KEY view_key)

Changes the note the class refers to

Parameters:
  • noteskey – should be a key that IsNote returns true on and is the key to the note we want this class to refer to and manipulate
  • view_key – The view key where a camera can be found by compute text extents
virtual void SetNote(HC_KEY noteskey, HBaseView *pView)

Changes the note the class refers to

Parameters:
  • noteskey – should be a key that IsNote returns true on and is the key to the note we want this class to refer to and manipulate
  • pView – The view where a camera can be found by compute text extents
virtual void SetOnTop(bool t)

Sets this note on top of “normal” geometry

Parameters:t – if true, the note will be on top, false will unset the note as on top.
virtual bool GetOnTop()

This return if the note on top of “normal” geometry

Returns:If note is on top
virtual void SetText(char const *text)

Sets the text of this note

virtual void SetTextFont(char const *font)

Sets the font for this note. If no font is set the font is inherited from it’s parent.

Parameters:font – is anything that is accepted by HC_Set_Text_Font Setting points or pixels may result in incorrectly sized text when printing.
virtual void SetTextWithEncoding(unsigned short const *text)

Sets unicode text for this note

virtual void ShowPosition(HPoint &p)

Returns the position of the text in world space

virtual void ShowPosition(float *x, float *y, float *z)

Returns the position of the text in world space

virtual void ShowTarget(HPoint &p)

Shows the target point in world space. The target point is the point that this note is annotating

virtual void ShowTarget(float *x, float *y, float *z)

Shows the target point in world space. The target point is the point that this note is annotating

virtual void UnSetExtents()

Unsets the extents set on this note if an extent is set.

virtual void Resize(int include_count, HC_KEY include_keys[], HC_KEY view_key)

This must be called after a note is modified and before the scene is updated. This method updates the size of the background and fits it to the text. If you’re note aren’t looking like you expect, you may be forgetting to update the notes with this method.

inline virtual void Resize(HC_KEY include_keys, HC_KEY view_key)
virtual HPoint GetFacing() const
virtual HPoint GetUp() const

Public Static Functions

static HC_KEY GetKey(HC_KEY)

Returns the key to the root of the note sub-tree giving a key in that subtree.

static bool IsAnnotation(HC_KEY key)

Returns true if the key is an Annotation object (also returns true for objects deriving from this class. If this function returns try on this key, SetNote may be called on this key to do some limited things to that note such as changing the text and calling update.

static bool IsNote(HC_KEY noteskey)

Returns true if noteskey refers to a note of this type. This key can then be passed to SetNote()

static void ChangeAllFonts(HBaseView *view, char const *const font, HC_KEY seg_key = (-1L))

Change the font on all annotations in the s

static void WindowResizeCallback(int signal, void *signal_data, void *user_data)

This method is registered to listen for window resize events. If the window is resized the all annotations with points or pixel sized fonts must be updated

static void recursive_resize(HC_KEY seg_key, int include_count, HC_KEY include_keys[], HC_KEY view_key)

This method is normally called from WindowResizeCallback, but it can also get called by user code where there’s no real view (such is in two pass printing).

static void drawLineCallback(HIC_Rendition const *rendition, int count, HIC_DC_Point p[])
static void drawLineCallbackClip(HIC_Rendition const *rendition, int count, HIC_DC_Point p[])
static void drawMarkerCallback(HIC_Rendition const *rendition, HIC_DC_Point *p)