API reference - Class Text

Notation used in Ruby API documentation

Description: A text object

A text object has a point (location), a text, a text transformation, a text size and a font id. Text size and font id are provided to be be able to render the text correctly. Text objects are used as labels (i.e. for pins) or to indiciate a particular position.

The Text class uses integer coordinates. A class that operates with floating-point coordinates is DText.

See The Database API for more details about the database objects.

Public constructors

new Text ptrnewDefault constructor
new Text ptrnew(string string,
const Trans trans)
Constructor with string and transformation
new Text ptrnew(string string,
int x,
int y)
Constructor with string and location
new Text ptrnew(string string,
const Trans trans,
int height,
int font)
Constructor with string, transformation, text height and font

Public methods

[const]bool!=(const Text text)Inequality
[const]bool<(const Text t)Less operator
[const]bool==(const Text text)Equality
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
voidassign(const Text other)Assigns another object to self
[const]new Text ptrdupCreates a copy of self
intfontGet the font number
voidfont=(int f)Set the font number
inthalignGet the horizontal alignment
voidhalign=(int a)Set the horizontal alignment
Textmove(const Point distance)Moves the text by a certain distance (modifies self)
Textmove(int dx,
int dy)
Moves the text by a certain distance (modifies self)
Textmoved(const Point distance)Returns the text moved by a certain distance (does not modify self)
Textmoved(int dx,
int dy)
Returns the text moved by a certain distance (does not modify self)
[const]intsizeGet the text height
voidsize=(int s)Set the text height of this object
[const]stringstringGet the text string
voidstring=(string text)Assign a text string to this object
[const]stringto_sConvert to a string
[const]TranstransGet the transformation
voidtrans=(const Trans t)Assign a transformation (text position and orientation) to this object
[const]Texttransformed(const ICplxTrans t)Transform the text with the given complex transformation
[const]Texttransformed(const Trans t)Transform the text with the given simple transformation
[const]DTexttransformed(const CplxTrans t)Transform the text with the given complex transformation
intvalignGet the vertical alignment
voidvalign=(int a)Set the vertical alignment
[const]intxGets the x location of the text
voidx=(int x)Sets the x location of the text
[const]intyGets the y location of the text
voidy=(int y)Sets the y location of the text

Public static methods and constants

Textfrom_dtext(const DText double_text)Construct an integer coordinate text object from a floating-point coordinate text
new Text ptrfrom_s(string s)Creates an object from a string

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead
[static]new Text ptrnew_st(string string,
const Trans trans)
Use of this method is deprecated. Use new instead
[static]new Text ptrnew_sthf(string string,
const Trans trans,
int height,
int font)
Use of this method is deprecated. Use new instead
[static]new Text ptrnew_sxy(string string,
int x,
int y)
Use of this method is deprecated. Use new instead
[const]Texttransformed_cplx(const ICplxTrans t)Use of this method is deprecated. Use transformed instead
[const]DTexttransformed_cplx(const CplxTrans t)Use of this method is deprecated. Use transformed instead

Detailed description

[const] bool !=(const Text text)

Description: Inequality

Return true, if this text object and the given text are not equal

[const] bool <(const Text t)

Description: Less operator

t:The object to compare against

This operator is provided to establish some, not necessarily a certain sorting order

[const] bool ==(const Text text)

Description: Equality

Return true, if this text object and the given text are equal

void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

[const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

[const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

void assign(const Text other)

Description: Assigns another object to self

void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

[const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

[const] new Text ptr dup

Description: Creates a copy of self

int font

Description: Get the font number

Python specific notes:

The object exposes a readable attribute 'font'. This is the getter.

void font=(int f)

Description: Set the font number

Python specific notes:

The object exposes a writable attribute 'font'. This is the setter.

[static] Text from_dtext(const DText double_text)

Description: Construct an integer coordinate text object from a floating-point coordinate text

[static] new Text ptr from_s(string s)

Description: Creates an object from a string

Creates the object from a string representation (as returned by to_s)

This method has been added in version 0.23.

int halign

Description: Get the horizontal alignment

See halign= for a description of this property.

Python specific notes:

The object exposes a readable attribute 'halign'. This is the getter.

void halign=(int a)

Description: Set the horizontal alignment

This property specifies how the text is aligned relative to the anchor point. Allowed values for this property are 0 (left), 1 (center) and 2 (right). This property has been introduced in version 0.22.

Python specific notes:

The object exposes a writable attribute 'halign'. This is the setter.

[const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

Text move(const Point distance)

Description: Moves the text by a certain distance (modifies self)

p:The offset to move the text.
Returns:A reference to this text object

Moves the text by a given offset and returns the moved text. Does not check for coordinate overflows.

Text move(int dx,int dy)

Description: Moves the text by a certain distance (modifies self)

dx:The x distance to move the text.
dy:The y distance to move the text.
Returns:A reference to this text object

Moves the text by a given distance in x and y direction and returns the moved text. Does not check for coordinate overflows.

This method was introduced in version 0.23.

Text moved(const Point distance)

Description: Returns the text moved by a certain distance (does not modify self)

p:The offset to move the text.
Returns:The moved text.

Moves the text by a given offset and returns the moved text. Does not modify *this. Does not check for coordinate overflows.

Text moved(int dx,int dy)

Description: Returns the text moved by a certain distance (does not modify self)

dx:The x distance to move the text.
dy:The y distance to move the text.
Returns:The moved text.

Moves the text by a given offset and returns the moved text. Does not modify *this. Does not check for coordinate overflows.

This method was introduced in version 0.23.

[static] new Text ptr new

Description: Default constructor

Creates a text with unit transformation and empty text.

Python specific notes:

This method is the default initializer of the object

[static] new Text ptr new(string string,const Trans trans)

Description: Constructor with string and transformation

A string and a transformation is provided to this constructor. The transformation specifies the location and orientation of the text object.

Python specific notes:

This method is the default initializer of the object

[static] new Text ptr new(string string,int x,int y)

Description: Constructor with string and location

A string and a location is provided to this constructor. The location is specifies as a pair of x and y coordinates.

This method has been introduced in version 0.23.

Python specific notes:

This method is the default initializer of the object

[static] new Text ptr new(string string,const Trans trans,int height,int font)

Description: Constructor with string, transformation, text height and font

A string and a transformation is provided to this constructor. The transformation specifies the location and orientation of the text object. In addition, the text height and font can be specified.

Python specific notes:

This method is the default initializer of the object

[static] new Text ptr new_st(string string,const Trans trans)

Description: Constructor with string and transformation

Use of this method is deprecated. Use new instead

[static] new Text ptr new_sthf(string string,const Trans trans,int height,int font)

Description: Constructor with string, transformation, text height and font

Use of this method is deprecated. Use new instead

[static] new Text ptr new_sxy(string string,int x,int y)

Description: Constructor with string and location

Use of this method is deprecated. Use new instead

[const] int size

Description: Get the text height

Python specific notes:

The object exposes a readable attribute 'size'. This is the getter.

void size=(int s)

Description: Set the text height of this object

Python specific notes:

The object exposes a writable attribute 'size'. This is the setter.

[const] string string

Description: Get the text string

Python specific notes:

The object exposes a readable attribute 'string'. This is the getter.

void string=(string text)

Description: Assign a text string to this object

Python specific notes:

The object exposes a writable attribute 'string'. This is the setter.

[const] string to_s

Description: Convert to a string

Python specific notes:

This method is also available as 'str(object)'

[const] Trans trans

Description: Get the transformation

Python specific notes:

The object exposes a readable attribute 'trans'. This is the getter.

void trans=(const Trans t)

Description: Assign a transformation (text position and orientation) to this object

Python specific notes:

The object exposes a writable attribute 'trans'. This is the setter.

[const] Text transformed(const ICplxTrans t)

Description: Transform the text with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed text (in this case an integer coordinate object now)

This method has been introduced in version 0.18.

[const] Text transformed(const Trans t)

Description: Transform the text with the given simple transformation

t:The transformation to apply
Returns:The transformed text

[const] DText transformed(const CplxTrans t)

Description: Transform the text with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed text (a DText now)

[const] Text transformed_cplx(const ICplxTrans t)

Description: Transform the text with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed text (in this case an integer coordinate object now)

Use of this method is deprecated. Use transformed instead

[const] DText transformed_cplx(const CplxTrans t)

Description: Transform the text with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed text (a DText now)

Use of this method is deprecated. Use transformed instead

int valign

Description: Get the vertical alignment

See valign= for a description of this property.

Python specific notes:

The object exposes a readable attribute 'valign'. This is the getter.

void valign=(int a)

Description: Set the vertical alignment

This property specifies how the text is aligned relative to the anchor point. Allowed values for this property are 0 (top), 1 (center) and 2 (bottom). This property has been introduced in version 0.22.

Python specific notes:

The object exposes a writable attribute 'valign'. This is the setter.

[const] int x

Description: Gets the x location of the text

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a readable attribute 'x'. This is the getter.

void x=(int x)

Description: Sets the x location of the text

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'x'. This is the setter.

[const] int y

Description: Gets the y location of the text

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a readable attribute 'y'. This is the getter.

void y=(int y)

Description: Sets the y location of the text

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'y'. This is the setter.