Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
qtype_ddmarker_shape Class Reference

Base class to represent a shape. More...

Inheritance diagram for qtype_ddmarker_shape:
qtype_ddmarker_shape_circle qtype_ddmarker_shape_polygon qtype_ddmarker_shape_rectangle

Public Member Functions

 __construct ($coordsstring)
 
 center_point ()
 Returns the center location of the shape.
 
 get_coords_interpreter_error ()
 Gets any coordinate error.
 
 inside_width_height ($widthheight)
 
 is_point_in_shape ($xy)
 Check if the location is within the shape.
 

Static Public Member Functions

static create ($shape, $coordsstring)
 Creates a new shape of the specified type.
 
static exists ($shape)
 Checks if the passed shape exists.
 
static human_readable_coords_format ()
 
static human_readable_name ($lowercase=false)
 Return a human readable name of the shape.
 
static name ()
 Returns the name of the shape.
 
static shape_options ()
 

Protected Member Functions

 is_only_numbers ()
 Test if all passed parameters consist of only numbers.
 
 is_point_in_bounding_box ($pointxy, $xleftytop, $xrightybottom)
 Checks if the point is within the bounding box made by top left and bottom right.
 
 outlying_coords_to_test ()
 

Protected Attributes

bool $error = false
 Indicates if there is an error.
 

Static Protected Attributes

static string $classnameprefix = 'qtype_ddmarker_shape_'
 The shape class prefix.
 

Detailed Description

Base class to represent a shape.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ center_point()

qtype_ddmarker_shape::center_point ( )
abstract

Returns the center location of the shape.

Return values
arrayX and Y location

Reimplemented in qtype_ddmarker_shape_circle, qtype_ddmarker_shape_polygon, and qtype_ddmarker_shape_rectangle.

◆ create()

static qtype_ddmarker_shape::create ( $shape,
$coordsstring )
static

Creates a new shape of the specified type.

Parameters
string$shapeThe shape to create
string$coordsstringThe string describing the coordinates
Return values
object

◆ exists()

static qtype_ddmarker_shape::exists ( $shape)
static

Checks if the passed shape exists.

Parameters
string$shapeThe shape name
Return values
bool

◆ get_coords_interpreter_error()

qtype_ddmarker_shape::get_coords_interpreter_error ( )

Gets any coordinate error.

Return values
string|boolString of the error or false if there is no error

◆ human_readable_name()

static qtype_ddmarker_shape::human_readable_name ( $lowercase = false)
static

Return a human readable name of the shape.

Parameters
bool$lowercaseTrue if it should be lowercase.
Return values
string

◆ is_only_numbers()

qtype_ddmarker_shape::is_only_numbers ( )
protected

Test if all passed parameters consist of only numbers.

Return values
boolTrue if only numbers

◆ is_point_in_bounding_box()

qtype_ddmarker_shape::is_point_in_bounding_box ( $pointxy,
$xleftytop,
$xrightybottom )
protected

Checks if the point is within the bounding box made by top left and bottom right.

Parameters
array$pointxyArray of the point (x, y)
array$xleftytopTop left point of bounding box
array$xrightybottomBottom left point of bounding box
Return values
bool

◆ is_point_in_shape()

qtype_ddmarker_shape::is_point_in_shape ( $xy)
abstract

Check if the location is within the shape.

Parameters
array$xy$xy[0] is x, $xy[1] is y
Return values
booleanis point inside shape

Reimplemented in qtype_ddmarker_shape_circle, qtype_ddmarker_shape_polygon, and qtype_ddmarker_shape_rectangle.

◆ name()

static qtype_ddmarker_shape::name ( )
static

Returns the name of the shape.

Return values
string

The documentation for this class was generated from the following file: