TK_Text

class TK_Text

Handles the TKE_Text and TKE_Text_With_Encoding opcodes.

TK_Text provides support for writing/reading the TKE_Text and TKE_Text_With_Encoding opcode objects to/from an HSF file.

The HOOPS/3dGS scene-graph can contain ‘text’ primitives which are defined by a position and character string, and possibly by an encoding value for multibyte (non-ASCII) text.

Inherits from: BBaseOpcodeHandler

Methods

void TK_Text::set_string(char const *string)

protected

for internal use only

void TK_Text::set_string(int length)

protected

for internal use only

TK_Text::TK_Text(unsigned char opcode)

constructor

TK_Text::~TK_Text()
TK_Status TK_Text::Read(BStreamFileToolkit &tk)

virtual

Reads data from the toolkit buffer, decodes/decompresses it, and maps it to the opcode handlers data members. User-defined classes which need to write out custom data should utilize one of the available GetData() methods.

Parameters

tk: A reference to the BStreamFileToolkit object.

Returns

The result of the function call.
TK_Status TK_Text::Write(BStreamFileToolkit &tk)

virtual

Encodes/compresses data and writes data to the toolkit buffer. User-defined classes which need to write out custom data should utilize one of the available PutData() methods, and first write out the opcode associated with the group of binary data followed by the data itself.

Parameters

tk: A reference to the BStreamFileToolkit object.

Returns

The result of the function call.
TK_Status TK_Text::Clone(BStreamFileToolkit &tk, BBaseOpcodeHandler **handler) const

const virtual

Copies the opcode handler

Parameters

tk: A reference to the BStreamFileToolkit object.

handler: A pointer to the opcode handler object. Passed by reference.

Returns

The result of the function call.
TK_Status TK_Text::ReadAscii(BStreamFileToolkit &tk)

Deprecated.

TK_Status TK_Text::WriteAscii(BStreamFileToolkit &tk)

Deprecated.

void TK_Text::Reset()

virtual

Resets the current opcode handler. This is called by the toolkit when it is done processing an opcode. This method reinitializes any opcode handler variables and frees up temporary data.

void TK_Text::SetString(char const *string)

Sets the text string. Allocates the buffer and copies the string

void TK_Text::SetString(unsigned short const *string)

Sets the text string using Unicode data. Allocates the buffer and copies the string, and sets encoding

void TK_Text::SetString(unsigned int const *string)

Sets the text string using wide Unicode data. Allocates the buffer and copies the string, and sets encoding

void TK_Text::SetString(int length)

Sets the text string buffer. Allocates a buffer large enough to hold a string of ‘length’ bytes

char const *TK_Text::GetString() const

const

Returns the text string (if encoding is a form of Unicode, the pointer should be recast to the correct type)

char *TK_Text::GetString()

Returns the text string buffer, which may be modified directly (if encoding is a form of Unicode, the pointer should be recast to the correct type)

void TK_Text::SetPosition(float x, float y, float z)

Sets the text position using discrete float values

void TK_Text::SetPosition(float const p[])

Sets the text position using a float triplet

float const *TK_Text::GetPosition() const

const

Returns the text position as the address of a float triplet

void TK_Text::SetDPosition(double x, double y, double z)

Sets the text position using discrete double values

void TK_Text::SetDPosition(double const p[])

Sets the text position using a double triplet

double const *TK_Text::GetDPosition() const

const

Returns the text position as the address of a double triplet

void TK_Text::SetEncoding(int e)

Set the type of encoding for this string. Encodings are specified by TKO_Text_Encodings.

int TK_Text::GetEncoding() const

const

Returns the type of encoding for this string. Encodings are specified by TKO_Text_Encodings.

void TK_Text::SetTextRegion(int c, float const p[], int o = 0, int f = 0)

Set the text region for this string.

void TK_Text::SetTextDRegion(int c, double const p[], int o = 0, int f = 0)

Set the text region for this string.

int TK_Text::GetTextRegionCount() const

const

Returns the number of points defining the text region.

float const *TK_Text::GetTextRegionPoints() const

const

Returns the points defining the text region.

double const *TK_Text::GetTextRegionDPoints() const

const

Returns the points defining the text region.

int TK_Text::GetTextRegionOptions() const

const

Returns the options for the text region.

int TK_Text::GetTextRegionFitting() const

const

Returns the fit options for the text region.

void TK_Text::SetStringCursors(int length, int *locations = 0)

Sets the text string cursors. Allocates a buffer large enough to hold a ‘length’ row/column pairs, and optionally copies data

int TK_Text::GetStringCursorCount() const

const

Returns the number of string cursors

int const *TK_Text::GetStringCursors() const

const

Returns the string cursor buffer

int *TK_Text::GetStringCursors()

Returns the string cursor buffer, which may be modified directly

void TK_Text::SetTextLeaders(int length, float *locations = 0, unsigned char *flags = 0)

Sets the text leaders. Allocates a buffer large enough to hold a ‘length’ points & flags, and optionally copies data

int TK_Text::GetTextLeaderCount() const

const

Returns the number of text leaders

float const *TK_Text::GetTextLeaders() const

const

Returns the text leader buffer

float *TK_Text::GetTextLeaders()

Returns the text leader buffer, which may be modified directly

unsigned char const *TK_Text::GetTextLeaderFlags() const

const

Returns the text leader flags buffer

unsigned char *TK_Text::GetTextLeaderFlags()

Returns the text leader flags buffer, which may be modified directly

void TK_Text::SetDTextLeaders(int length, double *locations = 0, unsigned char *flags = 0)

Sets the text leaders. Allocates a buffer large enough to hold a ‘length’ dpoints & flags, and optionally copies data

int TK_Text::GetDTextLeaderCount() const

const

Returns the number of text leaders

double const *TK_Text::GetDTextLeaders() const

const

Returns the text leader buffer

double *TK_Text::GetDTextLeaders()

Returns the text leader buffer, which may be modified directly

unsigned char const *TK_Text::GetDTextLeaderFlags() const

const

Returns the text leader flags buffer

unsigned char *TK_Text::GetDTextLeaderFlags()

Returns the text leader flags buffer, which may be modified directly

Variables

float TK_Text::m_position[3]

protected

float

internal use; Insertion point

double TK_Text::m_dposition[3]

protected

double

internal use; Insertion point

int TK_Text::m_length

protected

int

internal use; Length of text string

int TK_Text::m_written_length

protected

int

internal use; Length of text string

int TK_Text::m_allocated

protected

int

internal use; Size of allocated string buffer

char *TK_Text::m_string

protected

char

internal use; Text string

unsigned char TK_Text::m_encoding

protected

unsigned char

internal use; Encoding of characters (only used by TKE_Text_With_Encoding)

unsigned char TK_Text::m_options

protected

unsigned char

internal use: Additional options such as attached Text_Region

unsigned char TK_Text::m_region_options

protected

unsigned char

internal use: Text Region Controls

unsigned char TK_Text::m_region_fit

protected

unsigned char

internal use: packed Text Region fit options

unsigned char TK_Text::m_region_count

protected

unsigned char

internal use: Text Region Point Count

float TK_Text::m_region[4 * 3]

protected

float

internal use: Text Region Points

double TK_Text::m_dregion[4 * 3]

protected

double

internal use: Text Region Points

int TK_Text::m_cursor_count

protected

int

internal use: String Cursor Count

int *TK_Text::m_cursors

protected

int

internal use: String Cursor row/column pairs

int TK_Text::m_leader_count

protected

int

internal use: Text_Leader Count

float *TK_Text::m_leaders

protected

float

internal use: Text_Leader Positions

unsigned char *TK_Text::m_leader_flags

protected

unsigned char

internal use: Text_Leader Flags

int TK_Text::m_dleader_count

protected

int

internal use: Text_Leader (double-precision) Count

double *TK_Text::m_dleaders

protected

double

internal use: Text_Leader (double-precision) Positions

unsigned char *TK_Text::m_dleader_flags

protected

unsigned char

internal use: Text_Leader (double-precision) Flags

int TK_Text::m_count

protected

int

internal use: Number of characters (length is number of bytes to store)

TK_Character_Attribute *TK_Text::m_character_attributes

protected

internal use: Character Attribute array

int TK_Text::m_substage

protected

int

internal use: write/read progress

int TK_Text::m_tmp

protected

int

internal use: temp value