KeggShape: A class for representing a shape.

KeggShapeR Documentation

A class for representing a shape.

Description

A class for representing a shape.

A class for representing a shape.

Details

This abstract class represents a shape, used for graphical representation.

Arguments to the constructor are:

label: A text label to associate with the shape.

color: A color, as a character string.

Methods

Public methods


Method new()

Initialize new instance.

Usage
KeggShape$new(label = NA_character_, color = NA_character_)
Arguments
label

The text label to display.

color

The color to use.

Returns

Nothing.


Method equals()

Test if this shape is the same as another.

Usage
KeggShape$equals(other)
Arguments
other

The other shape to compare with.

Returns

TRUE or FALSE.


Method getLabel()

Gets the label associated with this shape.

Usage
KeggShape$getLabel()
Returns

The label.


Method getColor()

Gets the color associated with this shape.

Usage
KeggShape$getColor()
Returns

The color name as a string.


Method getRgbColor()

Gets the RGB color associated with this shape.

Usage
KeggShape$getRgbColor(alpha = 255)
Arguments
alpha

The value to use for the alpha channel when building the RGB color object.

Returns

The color as an RGB color object.


Method draw()

Draw the shape on the current image.

Usage
KeggShape$draw()
Returns

None.


Method clone()

The objects of this class are cloneable with this method.

Usage
KeggShape$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

KeggRect, KeggCircle.

Examples

# Create a circle instance
c <- KeggCircle$new(x=12, y=5, r=3, label='MyCircle')

# Create a rectangle instance
r <- KeggRect$new(left=10, top=10, bottom=20, right=30, color='yellow')


pkrog/biodbKegg documentation built on Oct. 1, 2022, 6:27 p.m.