final class classObj (View source)

Class Objects can be returned by the layerObj_ class, or can be created using:

Properties

string $group
string $keyimage
labelObj $label

Removed (6.2) - use addLabel, getLabel, .

float $maxscaledenom
hashTableObj $metadata
float $minscaledenom
string $name
int $numlabels

read-only (since 6.2)

int $numstyles read-only
int $status

MS_ON, MS_OFF or MS_DELETE

string $template
string $title
int $type

Methods

__construct(layerObj $layer, classObj $class)

The second argument class is optional. If given, the new class created will be a copy of this class.

ms_newClassObj(layerObj $layer, classObj $class)

Old style constructor

int
addLabel(labelObj $label)

Add a labelObj to the classObj and return its index in the labels array.

string
convertToString()

Saves the object to a string. Provides the inverse option for updateFromString.

createLegendIcon(int $width, int $height)

Draw the legend icon and return a new imageObj.

int
deletestyle(int $index)

Delete the style specified by the style index. If there are any style that follow the deleted style, their index will decrease by 1.

int
drawLegendIcon(int $width, int $height, imageObj $im, int $dstX, int $dstY)

Draw the legend icon on im object at dstX, dstY.

void
free()

Free the object properties and break the internal references.

string
getExpressionString()

Returns the :ref:expression <expressions> string for the class object.

getLabel(int $index)

Return a reference to the labelObj at index in the labels array.

int
getMetaData(string $name)

Fetch class metadata entry by name. Returns "" if no entry matches the name. Note that the search is case sensitive.

getStyle(int $index)

Return the style object using an index. index >= 0 && index < class->numstyles.

string
getTextString()

Returns the text string for the class object.

int
movestyledown(int $index)

The style specified by the style index will be moved down into the array of classes. Returns MS_SUCCESS or MS_FAILURE.

int
movestyleup(int $index)

The style specified by the style index will be moved up into the array of classes. Returns MS_SUCCESS or MS_FAILURE.

removeLabel(int $index)

Remove the labelObj at index from the labels array and return a reference to the labelObj. numlabels is decremented, and the array is updated.

int
removeMetaData(string $name)

Remove a metadata entry for the class. Returns MS_SUCCESS/MS_FAILURE.

int
set(string $property_name, $new_value)

Set object property to a new value.

int
setExpression(string $expression)

Set the :ref:expression <expressions> string for the class object.

int
setMetaData(string $name, string $value)

Set a metadata entry for the class. Returns MS_SUCCESS/MS_FAILURE.

int
settext(string $text)

Set the text string for the class object.

int
updateFromString(string $snippet)

Update a class from a string snippet. Returns MS_SUCCESS/MS_FAILURE.

Details

final __construct(layerObj $layer, classObj $class)

The second argument class is optional. If given, the new class created will be a copy of this class.

Parameters

layerObj $layer
classObj $class

final classObj ms_newClassObj(layerObj $layer, classObj $class)

Old style constructor

Parameters

layerObj $layer
classObj $class

Return Value

classObj

final int addLabel(labelObj $label)

Add a labelObj to the classObj and return its index in the labels array.

.. versionadded:: 6.2

Parameters

labelObj $label

Return Value

int

final string convertToString()

Saves the object to a string. Provides the inverse option for updateFromString.

Return Value

string

final imageObj createLegendIcon(int $width, int $height)

Draw the legend icon and return a new imageObj.

Parameters

int $width
int $height

Return Value

imageObj

final int deletestyle(int $index)

Delete the style specified by the style index. If there are any style that follow the deleted style, their index will decrease by 1.

Parameters

int $index

Return Value

int

final int drawLegendIcon(int $width, int $height, imageObj $im, int $dstX, int $dstY)

Draw the legend icon on im object at dstX, dstY.

Returns MS_SUCCESS/MS_FAILURE.

Parameters

int $width
int $height
imageObj $im
int $dstX
int $dstY

Return Value

int

final void free()

Free the object properties and break the internal references.

Note that you have to unset the php variable to free totally the resources.

Return Value

void

final string getExpressionString()

Returns the :ref:expression <expressions> string for the class object.

Return Value

string

final labelObj getLabel(int $index)

Return a reference to the labelObj at index in the labels array.

See the labelObj_ section for more details on multiple class labels. .. versionadded:: 6.2

Parameters

int $index

Return Value

labelObj

final int getMetaData(string $name)

Fetch class metadata entry by name. Returns "" if no entry matches the name. Note that the search is case sensitive.

.. note:: getMetaData's query is case sensitive.

Parameters

string $name

Return Value

int

final styleObj getStyle(int $index)

Return the style object using an index. index >= 0 && index < class->numstyles.

Parameters

int $index

Return Value

styleObj

final string getTextString()

Returns the text string for the class object.

Return Value

string

final int movestyledown(int $index)

The style specified by the style index will be moved down into the array of classes. Returns MS_SUCCESS or MS_FAILURE.

ex class->movestyledown(0) will have the effect of moving style 0 up to position 1, and the style at position 1 will be moved to position 0.

Parameters

int $index

Return Value

int

final int movestyleup(int $index)

The style specified by the style index will be moved up into the array of classes. Returns MS_SUCCESS or MS_FAILURE.

ex class->movestyleup(1) will have the effect of moving style 1 up to position 0, and the style at position 0 will be moved to position 1.

Parameters

int $index

Return Value

int

final labelObj removeLabel(int $index)

Remove the labelObj at index from the labels array and return a reference to the labelObj. numlabels is decremented, and the array is updated.

.. versionadded:: 6.2

Parameters

int $index

Return Value

labelObj

final int removeMetaData(string $name)

Remove a metadata entry for the class. Returns MS_SUCCESS/MS_FAILURE.

Parameters

string $name

Return Value

int

final int set(string $property_name, $new_value)

Set object property to a new value.

Parameters

string $property_name
$new_value

Return Value

int

final int setExpression(string $expression)

Set the :ref:expression <expressions> string for the class object.

Parameters

string $expression

Return Value

int

final int setMetaData(string $name, string $value)

Set a metadata entry for the class. Returns MS_SUCCESS/MS_FAILURE.

Parameters

string $name
string $value

Return Value

int

final int settext(string $text)

Set the text string for the class object.

Parameters

string $text

Return Value

int

final int updateFromString(string $snippet)

Update a class from a string snippet. Returns MS_SUCCESS/MS_FAILURE.

.. code-block:: php set the color $oClass->updateFromString('CLASS STYLE COLOR 255 0 255 END END');

Parameters

string $snippet

Return Value

int