KLayout 0.29.8 (2024-10-28 63dd591e5) [master]

API reference - Class Annotation

Notation used in Ruby API documentation

Module: lay

Description: A layout annotation (i.e. ruler)

Class hierarchy: Annotation

Annotation objects provide a way to attach measurements or descriptive information to a layout view. Annotation objects can appear as rulers for example. Annotation objects can be configured in different ways using the styles provided. By configuring an annotation object properly, it can appear as a rectangle or a plain line for example. See Ruler properties for more details about the appearance options.

Annotations are inserted into a layout view using LayoutView#insert_annotation. Here is some sample code in Ruby:

app = RBA::Application.instance
mw = app.main_window
view = mw.current_view

ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0, 0)
ant.p2 = RBA::DPoint::new(100, 0)
ant.style = RBA::Annotation::StyleRuler
view.insert_annotation(ant)

Annotations can be retrieved from a view with LayoutView#each_annotation and all annotations can be cleared with LayoutView#clear_annotations.

Starting with version 0.25, annotations are 'live' objects once they are inserted into the view. Changing properties of annotations will automatically update the view (however, that is not true the other way round).

Here is some sample code of changing the style of all rulers to two-sided arrows:

view = RBA::LayoutView::current

begin

  view.transaction("Restyle annotations")

  view.each_annotation do |a|
    a.style = RBA::Annotation::StyleArrowBoth
  end
  
ensure
  view.commit
end

Public constructors

new Annotation ptrnewCreates a new object of this class

Public methods

[const]bool!=(const Annotation other)Inequality operator
[const]bool==(const Annotation other)Equality operator
void_assign(const Annotation other)Assigns another object to self
[const]Annotation ptr_const_castReturns a non-const reference to self.
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]new Annotation ptr_dupCreates a copy of self
[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.
[const]intangle_constraintReturns the angle constraint attribute
voidangle_constraint=(int flag)Sets the angle constraint attribute
voidassign(const Annotation other)Assigns another object to self
[const]DBoxboxGets the bounding box of the object (not including text)
[const]stringcategoryGets the category string
voidcategory=(string cat)Sets the category string of the annotation
voiddeleteDeletes this annotation from the view
voiddetachDetaches the annotation object from the view
[const]new Annotation ptrdupCreates a copy of self
[const]stringfmtReturns the format used for the label
voidfmt=(string format)Sets the format used for the label
[const]stringfmt_xReturns the format used for the x-axis label
voidfmt_x=(string format)Sets the format used for the x-axis label
[const]stringfmt_yReturns the format used for the y-axis label
voidfmt_y=(string format)Sets the format used for the y-axis label
[const]intidReturns the annotation's ID
[const]boolis_valid?Returns a value indicating whether the object is a valid reference.
[const]intmain_positionGets the position of the main label
voidmain_position=(int pos)Sets the position of the main label
[const]intmain_xalignGets the horizontal alignment type of the main label
voidmain_xalign=(int align)Sets the horizontal alignment type of the main label
[const]intmain_yalignGets the vertical alignment type of the main label
voidmain_yalign=(int align)Sets the vertical alignment type of the main label
[const]intoutlineReturns the outline style of the annotation object
voidoutline=(int outline)Sets the outline style used for drawing the annotation object
[const]DPointp1Gets the first point of the ruler or marker
voidp1=(const DPoint point)Sets the first point of the ruler or marker
[const]DPointp2Gets the second point of the ruler or marker
voidp2=(const DPoint point)Sets the second point of the ruler or marker
[const]DPoint[]pointsGets the points of the ruler
voidpoints=(DPoint[] points)Sets the points for a (potentially) multi-segmented ruler
[const]DPointseg_p1(unsigned long segment_index)Gets the first point of the given segment.
[const]DPointseg_p2(unsigned long segment_index)Gets the second point of the given segment.
[const]unsigned longsegmentsGets the number of segments.
voidsnap=(bool flag)Sets the 'snap to objects' attribute
[const]boolsnap?Returns the 'snap to objects' attribute
[const]intstyleReturns the style of the annotation object
voidstyle=(int style)Sets the style used for drawing the annotation object
[const]stringtext(unsigned long index = 0)Returns the formatted text for the main label
[const]stringtext_x(unsigned long index = 0)Returns the formatted text for the x-axis label
[const]stringtext_y(unsigned long index = 0)Returns the formatted text for the y-axis label
[const]stringto_sReturns the string representation of the ruler
[const]Annotationtransformed(const DTrans t)Transforms the ruler or marker with the given simple transformation
[const]Annotationtransformed(const DCplxTrans t)Transforms the ruler or marker with the given complex transformation
[const]Annotationtransformed(const ICplxTrans t)Transforms the ruler or marker with the given complex transformation
[const]intxlabel_xalignGets the horizontal alignment type of the x axis label
voidxlabel_xalign=(int align)Sets the horizontal alignment type of the x axis label
[const]intxlabel_yalignGets the vertical alignment type of the x axis label
voidxlabel_yalign=(int align)Sets the vertical alignment type of the x axis label
[const]intylabel_xalignGets the horizontal alignment type of the y axis label
voidylabel_xalign=(int align)Sets the horizontal alignment type of the y axis label
[const]intylabel_yalignGets the vertical alignment type of the y axis label
voidylabel_yalign=(int align)Sets the vertical alignment type of the y axis label

Public static methods and constants

intAlignAutoThis code indicates automatic alignment.
intAlignBottomThis code indicates bottom alignment.
intAlignCenterThis code indicates automatic alignment.
intAlignDownThis code indicates left or bottom alignment, depending on the context.
intAlignLeftThis code indicates left alignment.
intAlignRightThis code indicates right alignment.
intAlignTopThis code indicates top alignment.
intAlignUpThis code indicates right or top alignment, depending on the context.
intAngleAnyGets the any angle code for use with the angle_constraint method
intAngleDiagonalGets the diagonal angle code for use with the angle_constraint method
intAngleGlobalGets the global angle code for use with the angle_constraint method.
intAngleHorizontalGets the horizontal angle code for use with the angle_constraint method
intAngleOrthoGets the ortho angle code for use with the angle_constraint method
intAngleVerticalGets the vertical angle code for use with the angle_constraint method
intOutlineAngleGets the angle measurement ruler outline code for use with the outline method
intOutlineBoxGets the box outline code for use with the outline method
intOutlineDiagGets the diagonal output code for use with the outline method
intOutlineDiagXYoutline_xy code used by the outline method
intOutlineDiagYXGets the yx plus diagonal outline code for use with the outline method
intOutlineEllipseGets the ellipse outline code for use with the outline method
intOutlineRadiusGets the radius measurement ruler outline code for use with the outline method
intOutlineXYGets the xy outline code for use with the outline method
intOutlineYXGets the yx outline code for use with the outline method
intPositionAutoThis code indicates automatic positioning.
intPositionCenterThis code indicates positioning of the main label at the mid point between p1 and p2.
intPositionP1This code indicates positioning of the main label at p1.
intPositionP2This code indicates positioning of the main label at p2.
intRulerModeAutoMetricSpecifies auto-metric ruler mode for the register_template method
intRulerModeAutoMetricEdgeSpecifies edge-sensitive auto-metric ruler mode for the register_template method
intRulerModeNormalSpecifies normal ruler mode for the register_template method
intRulerModeSingleClickSpecifies single-click ruler mode for the register_template method
intRulerMultiSegmentSpecifies multi-segment mode
intRulerThreeClicksSpecifies three-click ruler mode for the register_template method
intStyleArrowBothGets the both arrow ends style code for use the style method
intStyleArrowEndGets the end arrow style code for use the style method
intStyleArrowStartGets the start arrow style code for use the style method
intStyleCrossBothGets the line style code for use with the style method
intStyleCrossEndGets the line style code for use with the style method
intStyleCrossStartGets the line style code for use with the style method
intStyleLineGets the line style code for use with the style method
intStyleRulerGets the ruler style code for use the style method
new Annotation ptrfrom_s(string s)Creates a ruler from a string representation
voidregister_template(const Annotation annotation,
string title,
int mode = RulerModeNormal)
Registers the given annotation as a template globally
voidunregister_templates(string category)Unregisters the template or templates with the given category string globally

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
[const]Annotationtransformed_cplx(const DCplxTrans t)Use of this method is deprecated. Use transformed instead
[const]Annotationtransformed_cplx(const ICplxTrans t)Use of this method is deprecated. Use transformed instead

Detailed description

!=

Signature: [const] bool != (const Annotation other)

Description: Inequality operator

==

Signature: [const] bool == (const Annotation other)

Description: Equality operator

AlignAuto

Signature: [static] int AlignAuto

Description: This code indicates automatic alignment.

This code makes the annotation align the label the way it thinks is best.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'AlignAuto'. This is the getter.

AlignBottom

Signature: [static] int AlignBottom

Description: This code indicates bottom alignment.

If used in a vertical context, this alignment code makes the label aligned at the bottom side - i.e. it will appear top of the reference point.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'AlignBottom'. This is the getter.

AlignCenter

Signature: [static] int AlignCenter

Description: This code indicates automatic alignment.

This code makes the annotation align the label centered. When used in a horizontal context, centering is in horizontal direction. If used in a vertical context, centering is in vertical direction.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'AlignCenter'. This is the getter.

AlignDown

Signature: [static] int AlignDown

Description: This code indicates left or bottom alignment, depending on the context.

This code is equivalent to AlignLeft and AlignBottom.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'AlignDown'. This is the getter.

AlignLeft

Signature: [static] int AlignLeft

Description: This code indicates left alignment.

If used in a horizontal context, this alignment code makes the label aligned at the left side - i.e. it will appear right of the reference point.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'AlignLeft'. This is the getter.

AlignRight

Signature: [static] int AlignRight

Description: This code indicates right alignment.

If used in a horizontal context, this alignment code makes the label aligned at the right side - i.e. it will appear left of the reference point.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'AlignRight'. This is the getter.

AlignTop

Signature: [static] int AlignTop

Description: This code indicates top alignment.

If used in a vertical context, this alignment code makes the label aligned at the top side - i.e. it will appear bottom of the reference point.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'AlignTop'. This is the getter.

AlignUp

Signature: [static] int AlignUp

Description: This code indicates right or top alignment, depending on the context.

This code is equivalent to AlignRight and AlignTop.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'AlignUp'. This is the getter.

AngleAny

Signature: [static] int AngleAny

Description: Gets the any angle code for use with the angle_constraint method

If this value is specified for the angle constraint, all angles will be allowed.

Python specific notes:
The object exposes a readable attribute 'AngleAny'. This is the getter.

AngleDiagonal

Signature: [static] int AngleDiagonal

Description: Gets the diagonal angle code for use with the angle_constraint method

If this value is specified for the angle constraint, only multiples of 45 degree are allowed.

Python specific notes:
The object exposes a readable attribute 'AngleDiagonal'. This is the getter.

AngleGlobal

Signature: [static] int AngleGlobal

Description: Gets the global angle code for use with the angle_constraint method.

This code will tell the ruler or marker to use the angle constraint defined globally.

Python specific notes:
The object exposes a readable attribute 'AngleGlobal'. This is the getter.

AngleHorizontal

Signature: [static] int AngleHorizontal

Description: Gets the horizontal angle code for use with the angle_constraint method

If this value is specified for the angle constraint, only horizontal rulers are allowed.

Python specific notes:
The object exposes a readable attribute 'AngleHorizontal'. This is the getter.

AngleOrtho

Signature: [static] int AngleOrtho

Description: Gets the ortho angle code for use with the angle_constraint method

If this value is specified for the angle constraint, only multiples of 90 degree are allowed.

Python specific notes:
The object exposes a readable attribute 'AngleOrtho'. This is the getter.

AngleVertical

Signature: [static] int AngleVertical

Description: Gets the vertical angle code for use with the angle_constraint method

If this value is specified for the angle constraint, only vertical rulers are allowed.

Python specific notes:
The object exposes a readable attribute 'AngleVertical'. This is the getter.

OutlineAngle

Signature: [static] int OutlineAngle

Description: Gets the angle measurement ruler outline code for use with the outline method

When this outline style is specified, the ruler is drawn to indicate the angle between the first and last segment.

This constant has been introduced in version 0.28.

Python specific notes:
The object exposes a readable attribute 'OutlineAngle'. This is the getter.

OutlineBox

Signature: [static] int OutlineBox

Description: Gets the box outline code for use with the outline method

When this outline style is specified, a box is drawn with the corners specified by the start and end point. All box edges are drawn in the style specified with the style attribute.

Python specific notes:
The object exposes a readable attribute 'OutlineBox'. This is the getter.

OutlineDiag

Signature: [static] int OutlineDiag

Description: Gets the diagonal output code for use with the outline method

When this outline style is specified, a line connecting start and end points in the given style (ruler, arrow or plain line) is drawn.

Python specific notes:
The object exposes a readable attribute 'OutlineDiag'. This is the getter.

OutlineDiagXY

Signature: [static] int OutlineDiagXY

Description: outline_xy code used by the outline method

When this outline style is specified, three lines are drawn: one horizontal from left to right and attached to the end of that a line from the bottom to the top. Another line is drawn connecting the start and end points directly. The lines are drawn in the specified style (see style method).

Python specific notes:
The object exposes a readable attribute 'OutlineDiagXY'. This is the getter.

OutlineDiagYX

Signature: [static] int OutlineDiagYX

Description: Gets the yx plus diagonal outline code for use with the outline method

When this outline style is specified, three lines are drawn: one vertical from bottom to top and attached to the end of that a line from the left to the right. Another line is drawn connecting the start and end points directly. The lines are drawn in the specified style (see style method).

Python specific notes:
The object exposes a readable attribute 'OutlineDiagYX'. This is the getter.

OutlineEllipse

Signature: [static] int OutlineEllipse

Description: Gets the ellipse outline code for use with the outline method

When this outline style is specified, an ellipse is drawn with the extensions specified by the start and end point. The contour drawn as a line.

This constant has been introduced in version 0.26.

Python specific notes:
The object exposes a readable attribute 'OutlineEllipse'. This is the getter.

OutlineRadius

Signature: [static] int OutlineRadius

Description: Gets the radius measurement ruler outline code for use with the outline method

When this outline style is specified, the ruler is drawn to indicate a radius defined by at least three points of the ruler.

This constant has been introduced in version 0.28.

Python specific notes:
The object exposes a readable attribute 'OutlineRadius'. This is the getter.

OutlineXY

Signature: [static] int OutlineXY

Description: Gets the xy outline code for use with the outline method

When this outline style is specified, two lines are drawn: one horizontal from left to right and attached to the end of that a line from the bottom to the top. The lines are drawn in the specified style (see style method).

Python specific notes:
The object exposes a readable attribute 'OutlineXY'. This is the getter.

OutlineYX

Signature: [static] int OutlineYX

Description: Gets the yx outline code for use with the outline method

When this outline style is specified, two lines are drawn: one vertical from bottom to top and attached to the end of that a line from the left to the right. The lines are drawn in the specified style (see style method).

Python specific notes:
The object exposes a readable attribute 'OutlineYX'. This is the getter.

PositionAuto

Signature: [static] int PositionAuto

Description: This code indicates automatic positioning.

The main label will be put either to p1 or p2, whichever the annotation considers best.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'PositionAuto'. This is the getter.

PositionCenter

Signature: [static] int PositionCenter

Description: This code indicates positioning of the main label at the mid point between p1 and p2.

The main label will be put to the center point.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'PositionCenter'. This is the getter.

PositionP1

Signature: [static] int PositionP1

Description: This code indicates positioning of the main label at p1.

The main label will be put to p1.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'PositionP1'. This is the getter.

PositionP2

Signature: [static] int PositionP2

Description: This code indicates positioning of the main label at p2.

The main label will be put to p2.

This constant has been introduced in version 0.25.

Python specific notes:
The object exposes a readable attribute 'PositionP2'. This is the getter.

RulerModeAutoMetric

Signature: [static] int RulerModeAutoMetric

Description: Specifies auto-metric ruler mode for the register_template method

In auto-metric mode, a ruler can be placed with a single click and p1/p2 will be determined from the neighborhood.

This constant has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'RulerModeAutoMetric'. This is the getter.

RulerModeAutoMetricEdge

Signature: [static] int RulerModeAutoMetricEdge

Description: Specifies edge-sensitive auto-metric ruler mode for the register_template method

In auto-metric mode, a ruler can be placed with a single click and p1/p2 will be determined from the edge it is placed on.

This constant has been introduced in version 0.29

Python specific notes:
The object exposes a readable attribute 'RulerModeAutoMetricEdge'. This is the getter.

RulerModeNormal

Signature: [static] int RulerModeNormal

Description: Specifies normal ruler mode for the register_template method

This constant has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'RulerModeNormal'. This is the getter.

RulerModeSingleClick

Signature: [static] int RulerModeSingleClick

Description: Specifies single-click ruler mode for the register_template method

In single click-mode, a ruler can be placed with a single click and p1 will be == p2.

This constant has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'RulerModeSingleClick'. This is the getter.

RulerMultiSegment

Signature: [static] int RulerMultiSegment

Description: Specifies multi-segment mode

In multi-segment mode, multiple segments can be created. The ruler is finished with a double click.

This constant has been introduced in version 0.28

Python specific notes:
The object exposes a readable attribute 'RulerMultiSegment'. This is the getter.

RulerThreeClicks

Signature: [static] int RulerThreeClicks

Description: Specifies three-click ruler mode for the register_template method

In this ruler mode, two segments are created for angle and circle radius measurements. Three mouse clicks are required.

This constant has been introduced in version 0.28

Python specific notes:
The object exposes a readable attribute 'RulerThreeClicks'. This is the getter.

StyleArrowBoth

Signature: [static] int StyleArrowBoth

Description: Gets the both arrow ends style code for use the style method

When this style is specified, a two-headed arrow is drawn.

Python specific notes:
The object exposes a readable attribute 'StyleArrowBoth'. This is the getter.

StyleArrowEnd

Signature: [static] int StyleArrowEnd

Description: Gets the end arrow style code for use the style method

When this style is specified, an arrow is drawn pointing from the start to the end point.

Python specific notes:
The object exposes a readable attribute 'StyleArrowEnd'. This is the getter.

StyleArrowStart

Signature: [static] int StyleArrowStart

Description: Gets the start arrow style code for use the style method

When this style is specified, an arrow is drawn pointing from the end to the start point.

Python specific notes:
The object exposes a readable attribute 'StyleArrowStart'. This is the getter.

StyleCrossBoth

Signature: [static] int StyleCrossBoth

Description: Gets the line style code for use with the style method

When this style is specified, a cross is drawn at both points.

This constant has been added in version 0.26.

Python specific notes:
The object exposes a readable attribute 'StyleCrossBoth'. This is the getter.

StyleCrossEnd

Signature: [static] int StyleCrossEnd

Description: Gets the line style code for use with the style method

When this style is specified, a cross is drawn at the end point.

This constant has been added in version 0.26.

Python specific notes:
The object exposes a readable attribute 'StyleCrossEnd'. This is the getter.

StyleCrossStart

Signature: [static] int StyleCrossStart

Description: Gets the line style code for use with the style method

When this style is specified, a cross is drawn at the start point.

This constant has been added in version 0.26.

Python specific notes:
The object exposes a readable attribute 'StyleCrossStart'. This is the getter.

StyleLine

Signature: [static] int StyleLine

Description: Gets the line style code for use with the style method

When this style is specified, a plain line is drawn.

Python specific notes:
The object exposes a readable attribute 'StyleLine'. This is the getter.

StyleRuler

Signature: [static] int StyleRuler

Description: Gets the ruler style code for use the style method

When this style is specified, the annotation will show a ruler with some ticks at distances indicating a decade of units and a suitable subdivision into minor ticks at intervals of 1, 2 or 5 units.

Python specific notes:
The object exposes a readable attribute 'StyleRuler'. This is the getter.

_assign

Signature: void _assign (const Annotation other)

Description: Assigns another object to self

_const_cast

Signature: [const] Annotation ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_create

Signature: 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.

_destroy

Signature: 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.

_destroyed?

Signature: [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.

_dup

Signature: [const] new Annotation ptr _dup

Description: Creates a copy of self

_is_const_object?

Signature: [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.

_manage

Signature: 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.

_unmanage

Signature: 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.

angle_constraint

Signature: [const] int angle_constraint

Description: Returns the angle constraint attribute

See angle_constraint= for a more detailed description.

Python specific notes:
The object exposes a readable attribute 'angle_constraint'. This is the getter.

angle_constraint=

Signature: void angle_constraint= (int flag)

Description: Sets the angle constraint attribute

This attribute controls if an angle constraint is applied when moving one of the ruler's points. The Angle... values can be used for this purpose.

Python specific notes:
The object exposes a writable attribute 'angle_constraint'. This is the setter.

assign

Signature: void assign (const Annotation other)

Description: Assigns another object to self

box

Signature: [const] DBox box

Description: Gets the bounding box of the object (not including text)

Returns:The bounding box

category

Signature: [const] string category

Description: Gets the category string

See category= for details.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'category'. This is the getter.

category=

Signature: void category= (string cat)

Description: Sets the category string of the annotation

The category string is an arbitrary string that can be used by various consumers or generators to mark 'their' annotation.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a writable attribute 'category'. This is the setter.

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

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.

delete

Signature: void delete

Description: Deletes this annotation from the view

If the annotation is an "active" one, this method will remove it from the view. This object will become detached and can still be manipulated, but without having an effect on the view. This method has been introduced in version 0.25.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

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.

destroyed?

Signature: [const] bool destroyed?

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

Use of this method is deprecated. Use _destroyed? instead

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.

detach

Signature: void detach

Description: Detaches the annotation object from the view

If the annotation object was inserted into the view, property changes will be reflected in the view. To disable this feature, 'detach' can be called after which the annotation object becomes inactive and changes will no longer be reflected in the view.

This method has been introduced in version 0.25.

dup

Signature: [const] new Annotation ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

fmt

Signature: [const] string fmt

Description: Returns the format used for the label

Returns:The format string

Format strings can contain placeholders for values and formulas for computing derived values. See Ruler properties for more details.

Python specific notes:
The object exposes a readable attribute 'fmt'. This is the getter.

fmt=

Signature: void fmt= (string format)

Description: Sets the format used for the label

format:The format string

Format strings can contain placeholders for values and formulas for computing derived values. See Ruler properties for more details.

Python specific notes:
The object exposes a writable attribute 'fmt'. This is the setter.

fmt_x

Signature: [const] string fmt_x

Description: Returns the format used for the x-axis label

Returns:The format string

Format strings can contain placeholders for values and formulas for computing derived values. See Ruler properties for more details.

Python specific notes:
The object exposes a readable attribute 'fmt_x'. This is the getter.

fmt_x=

Signature: void fmt_x= (string format)

Description: Sets the format used for the x-axis label

format:The format string

X-axis labels are only used for styles that have a horizontal component. Format strings can contain placeholders for values and formulas for computing derived values. See Ruler properties for more details.

Python specific notes:
The object exposes a writable attribute 'fmt_x'. This is the setter.

fmt_y

Signature: [const] string fmt_y

Description: Returns the format used for the y-axis label

Returns:The format string

Format strings can contain placeholders for values and formulas for computing derived values. See Ruler properties for more details.

Python specific notes:
The object exposes a readable attribute 'fmt_y'. This is the getter.

fmt_y=

Signature: void fmt_y= (string format)

Description: Sets the format used for the y-axis label

format:The format string

Y-axis labels are only used for styles that have a vertical component. Format strings can contain placeholders for values and formulas for computing derived values. See Ruler properties for more details.

Python specific notes:
The object exposes a writable attribute 'fmt_y'. This is the setter.

from_s

Signature: [static] new Annotation ptr from_s (string s)

Description: Creates a ruler from a string representation

This function creates a ruler from the string returned by to_s.

This method was introduced in version 0.28.

id

Signature: [const] int id

Description: Returns the annotation's ID

The annotation ID is an integer that uniquely identifies an annotation inside a view. The ID is used for replacing an annotation (see LayoutView#replace_annotation).

This method was introduced in version 0.24.

is_const_object?

Signature: [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

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

is_valid?

Signature: [const] bool is_valid?

Description: Returns a value indicating whether the object is a valid reference.

If this value is true, the object represents an annotation on the screen. Otherwise, the object is a 'detached' annotation which does not have a representation on the screen.

This method was introduced in version 0.25.

main_position

Signature: [const] int main_position

Description: Gets the position of the main label

See main_position= for details.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'main_position'. This is the getter.

main_position=

Signature: void main_position= (int pos)

Description: Sets the position of the main label

This method accepts one of the Position... constants.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a writable attribute 'main_position'. This is the setter.

main_xalign

Signature: [const] int main_xalign

Description: Gets the horizontal alignment type of the main label

See main_xalign= for details.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'main_xalign'. This is the getter.

main_xalign=

Signature: void main_xalign= (int align)

Description: Sets the horizontal alignment type of the main label

This method accepts one of the Align... constants.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a writable attribute 'main_xalign'. This is the setter.

main_yalign

Signature: [const] int main_yalign

Description: Gets the vertical alignment type of the main label

See main_yalign= for details.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'main_yalign'. This is the getter.

main_yalign=

Signature: void main_yalign= (int align)

Description: Sets the vertical alignment type of the main label

This method accepts one of the Align... constants.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a writable attribute 'main_yalign'. This is the setter.

new

Signature: [static] new Annotation ptr new

Description: Creates a new object of this class

Python specific notes:
This method is the default initializer of the object.

outline

Signature: [const] int outline

Description: Returns the outline style of the annotation object

Python specific notes:
The object exposes a readable attribute 'outline'. This is the getter.

outline=

Signature: void outline= (int outline)

Description: Sets the outline style used for drawing the annotation object

The Outline... values can be used for defining the annotation object's outline. The outline style determines what components are drawn.

Python specific notes:
The object exposes a writable attribute 'outline'. This is the setter.

p1

Signature: [const] DPoint p1

Description: Gets the first point of the ruler or marker

Returns:The first point

The points of the ruler or marker are always given in micron units in floating-point coordinates.

This method is provided for backward compatibility. Starting with version 0.28, rulers can be multi-segmented. Use points or seg_p1 to retrieve the points of the ruler segments.

Python specific notes:
The object exposes a readable attribute 'p1'. This is the getter.

p1=

Signature: void p1= (const DPoint point)

Description: Sets the first point of the ruler or marker

The points of the ruler or marker are always given in micron units in floating-point coordinates.

This method is provided for backward compatibility. Starting with version 0.28, rulers can be multi-segmented. Use points= to specify the ruler segments.

Python specific notes:
The object exposes a writable attribute 'p1'. This is the setter.

p2

Signature: [const] DPoint p2

Description: Gets the second point of the ruler or marker

Returns:The second point

The points of the ruler or marker are always given in micron units in floating-point coordinates.

This method is provided for backward compatibility. Starting with version 0.28, rulers can be multi-segmented. Use points or seg_p1 to retrieve the points of the ruler segments.

Python specific notes:
The object exposes a readable attribute 'p2'. This is the getter.

p2=

Signature: void p2= (const DPoint point)

Description: Sets the second point of the ruler or marker

The points of the ruler or marker are always given in micron units in floating-point coordinates.

This method is provided for backward compatibility. Starting with version 0.28, rulers can be multi-segmented. Use points= to specify the ruler segments.

Python specific notes:
The object exposes a writable attribute 'p2'. This is the setter.

points

Signature: [const] DPoint[] points

Description: Gets the points of the ruler

A single-segmented ruler has two points. Rulers with more points have more segments correspondingly. Note that the point list may have one point only (single-point ruler) or may even be empty.

Use points= to set the segment points. Use segments to get the number of segments and seg_p1 and seg_p2 to get the first and second point of one segment.

Multi-segmented rulers have been introduced in version 0.28

Python specific notes:
The object exposes a readable attribute 'points'. This is the getter.

points=

Signature: void points= (DPoint[] points)

Description: Sets the points for a (potentially) multi-segmented ruler

See points for a description of multi-segmented rulers. The list of points passed to this method is cleaned from duplicates before being stored inside the ruler.

This method has been introduced in version 0.28.

Python specific notes:
The object exposes a writable attribute 'points'. This is the setter.

register_template

Signature: [static] void register_template (const Annotation annotation, string title, int mode = RulerModeNormal)

Description: Registers the given annotation as a template globally

title:The title to use for the ruler template
mode:The mode the ruler will be created in (see Ruler... constants)

@annotation The annotation to use for the template (positions are ignored)

In order to register a system template, the category string of the annotation has to be a unique and non-empty string. The annotation is added to the list of annotation templates and becomes available as a new template in the ruler drop-down menu.

The new annotation template is registered on all views.

NOTE: this setting is persisted and the the application configuration is updated.

This method has been added in version 0.25.

seg_p1

Signature: [const] DPoint seg_p1 (unsigned long segment_index)

Description: Gets the first point of the given segment.

The segment is indicated by the segment index which is a number between 0 and segments-1.

This method has been introduced in version 0.28.

seg_p2

Signature: [const] DPoint seg_p2 (unsigned long segment_index)

Description: Gets the second point of the given segment.

The segment is indicated by the segment index which is a number between 0 and segments-1. The second point of a segment is also the first point of the following segment if there is one.

This method has been introduced in version 0.28.

segments

Signature: [const] unsigned long segments

Description: Gets the number of segments.

This method returns the number of segments the ruler is made up. Even though the ruler can be one or even zero points, the number of segments is at least 1.

This method has been introduced in version 0.28.

snap=

Signature: void snap= (bool flag)

Description: Sets the 'snap to objects' attribute

If this attribute is set to true, the ruler or marker snaps to other objects when moved.

Python specific notes:
The object exposes a writable attribute 'snap'. This is the setter.

snap?

Signature: [const] bool snap?

Description: Returns the 'snap to objects' attribute

Python specific notes:
The object exposes a readable attribute 'snap'. This is the getter.

style

Signature: [const] int style

Description: Returns the style of the annotation object

Python specific notes:
The object exposes a readable attribute 'style'. This is the getter.

style=

Signature: void style= (int style)

Description: Sets the style used for drawing the annotation object

The Style... values can be used for defining the annotation object's style. The style determines if ticks or arrows are drawn.

Python specific notes:
The object exposes a writable attribute 'style'. This is the setter.

text

Signature: [const] string text (unsigned long index = 0)

Description: Returns the formatted text for the main label

The index parameter indicates which segment to use (0 is the first one). It has been added in version 0.28.

text_x

Signature: [const] string text_x (unsigned long index = 0)

Description: Returns the formatted text for the x-axis label

The index parameter indicates which segment to use (0 is the first one). It has been added in version 0.28.

text_y

Signature: [const] string text_y (unsigned long index = 0)

Description: Returns the formatted text for the y-axis label

The index parameter indicates which segment to use (0 is the first one). It has been added in version 0.28.

to_s

Signature: [const] string to_s

Description: Returns the string representation of the ruler

This method was introduced in version 0.19.

Python specific notes:
This method is also available as 'str(object)'.

transformed

(1) Signature: [const] Annotation transformed (const DTrans t)

Description: Transforms the ruler or marker with the given simple transformation

t:The transformation to apply
Returns:The transformed object

(2) Signature: [const] Annotation transformed (const DCplxTrans t)

Description: Transforms the ruler or marker with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed object

Starting with version 0.25, all overloads all available as 'transform'.

(3) Signature: [const] Annotation transformed (const ICplxTrans t)

Description: Transforms the ruler or marker with the given complex transformation

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

This method has been introduced in version 0.18.

Starting with version 0.25, all overloads all available as 'transform'.

transformed_cplx

(1) Signature: [const] Annotation transformed_cplx (const DCplxTrans t)

Description: Transforms the ruler or marker with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed object

Use of this method is deprecated. Use transformed instead

Starting with version 0.25, all overloads all available as 'transform'.

(2) Signature: [const] Annotation transformed_cplx (const ICplxTrans t)

Description: Transforms the ruler or marker with the given complex transformation

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

Use of this method is deprecated. Use transformed instead

This method has been introduced in version 0.18.

Starting with version 0.25, all overloads all available as 'transform'.

unregister_templates

Signature: [static] void unregister_templates (string category)

Description: Unregisters the template or templates with the given category string globally

This method will remove all templates with the given category string. If the category string is empty, all templates are removed.

NOTE: this setting is persisted and the the application configuration is updated.

This method has been added in version 0.28.

xlabel_xalign

Signature: [const] int xlabel_xalign

Description: Gets the horizontal alignment type of the x axis label

See xlabel_xalign= for details.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'xlabel_xalign'. This is the getter.

xlabel_xalign=

Signature: void xlabel_xalign= (int align)

Description: Sets the horizontal alignment type of the x axis label

This method accepts one of the Align... constants.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a writable attribute 'xlabel_xalign'. This is the setter.

xlabel_yalign

Signature: [const] int xlabel_yalign

Description: Gets the vertical alignment type of the x axis label

See xlabel_yalign= for details.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'xlabel_yalign'. This is the getter.

xlabel_yalign=

Signature: void xlabel_yalign= (int align)

Description: Sets the vertical alignment type of the x axis label

This method accepts one of the Align... constants.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a writable attribute 'xlabel_yalign'. This is the setter.

ylabel_xalign

Signature: [const] int ylabel_xalign

Description: Gets the horizontal alignment type of the y axis label

See ylabel_xalign= for details.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'ylabel_xalign'. This is the getter.

ylabel_xalign=

Signature: void ylabel_xalign= (int align)

Description: Sets the horizontal alignment type of the y axis label

This method accepts one of the Align... constants.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a writable attribute 'ylabel_xalign'. This is the setter.

ylabel_yalign

Signature: [const] int ylabel_yalign

Description: Gets the vertical alignment type of the y axis label

See ylabel_yalign= for details.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a readable attribute 'ylabel_yalign'. This is the getter.

ylabel_yalign=

Signature: void ylabel_yalign= (int align)

Description: Sets the vertical alignment type of the y axis label

This method accepts one of the Align... constants.

This method has been introduced in version 0.25

Python specific notes:
The object exposes a writable attribute 'ylabel_yalign'. This is the setter.