Skip to content

Rectangle

Bases: Shape_Type

Represents the XML element Rectangle.

A simple rectangle object. If rotation is required apply a transformation at the Shape level.

fromBase(base) staticmethod

Cast a NBOBaseClass to a CMOS.

Parameters:

Name Type Description Default
base NBOBaseClass

The base class to cast

required

Returns:

Type Description
Rectangle

The casted element, or nullptr if the cast fails

getTypeName()

Returns the class type name.

Returns:

Type Description
string

The class type name

getXMLName()

Returns the XML element name corresponding to this class.

Returns:

Type Description
string

The XML element name

getNBOType()

Returns the NBO Type corresponding to this class.

Returns:

Type Description
int

The NBO Type value

getChildren()

Returns a list of all classes derived from this class.

Returns:

Type Description
List[NBOBaseClass]

The list of derived classes

getSubElements()

Returns a list of all child elements contained in this class.

Returns:

Type Description
List[NBOBaseClass]

The list of child classes

fromJsonFile(path, validate=True)

Populates this object from a JSON file.

Parameters:

Name Type Description Default
path string

The path to the JSON file

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

fromJsonString(json_string, validate=True)

Populates this object from a JSON string.

Parameters:

Name Type Description Default
json_string string

The JSON content as a string

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

fromXmlFile(path, validate=True)

Populates this object from a XML file.

Parameters:

Name Type Description Default
path string

The path to the XML file

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

fromXmlString(xml_string, validate=True)

Populates this object from a XML string.

Parameters:

Name Type Description Default
xml_string string

The XML content as a string

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

toXmlFile(filename, validate=True)

Serializes this object to an XML file.

Parameters:

Name Type Description Default
filename string

The path to the output XML file

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

toXmlString(validate=True)

Serializes this object to an XML string.

Parameters:

Name Type Description Default
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

Returns:

Type Description
string

A string containing the XML representation of this object

setX(value, validate=True)

Sets the value of the X attribute.

The X value of the left edge or the rectangle. [units pixels]

Parameters:

Name Type Description Default
value float

The value to set

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

getX()

Returns the value of the X attribute.

The X value of the left edge or the rectangle. [units pixels]

Returns:

Type Description
float

The value of the attribute

resetX()

Resets the X attribute to an unset state.

The X value of the left edge or the rectangle. [units pixels]

hasX()

Checks whether the X attribute is present.

The X value of the left edge or the rectangle. [units pixels]

Returns:

Type Description
boolean

true if the attribute has been set, false otherwise

setY(value, validate=True)

Sets the value of the Y attribute.

The y value of the top edge or the rectangle. [units pixels]

Parameters:

Name Type Description Default
value float

The value to set

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

getY()

Returns the value of the Y attribute.

The y value of the top edge or the rectangle. [units pixels]

Returns:

Type Description
float

The value of the attribute

resetY()

Resets the Y attribute to an unset state.

The y value of the top edge or the rectangle. [units pixels]

hasY()

Checks whether the Y attribute is present.

The y value of the top edge or the rectangle. [units pixels]

Returns:

Type Description
boolean

true if the attribute has been set, false otherwise

setWidth(value, validate=True)

Sets the value of the Width attribute.

The width of the rectangle. [units pixels]

Parameters:

Name Type Description Default
value float

The value to set

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

getWidth()

Returns the value of the Width attribute.

The width of the rectangle. [units pixels]

Returns:

Type Description
float

The value of the attribute

resetWidth()

Resets the Width attribute to an unset state.

The width of the rectangle. [units pixels]

hasWidth()

Checks whether the Width attribute is present.

The width of the rectangle. [units pixels]

Returns:

Type Description
boolean

true if the attribute has been set, false otherwise

setHeight(value, validate=True)

Sets the value of the Height attribute.

The height of the rectangle. [units pixels]

Parameters:

Name Type Description Default
value float

The value to set

required
validate (boolean, optional)

If true, validates constraints on value. Default is true.

True

getHeight()

Returns the value of the Height attribute.

The height of the rectangle. [units pixels]

Returns:

Type Description
float

The value of the attribute

resetHeight()

Resets the Height attribute to an unset state.

The height of the rectangle. [units pixels]

hasHeight()

Checks whether the Height attribute is present.

The height of the rectangle. [units pixels]

Returns:

Type Description
boolean

true if the attribute has been set, false otherwise