4.1.
ClassObj Class
Up one level
Constructor, members, and methods.
Constructor:
Class Objects can be returned by the LayerObj class, or can be created
using:
classObj ms_newClassObj(layerObj layer [, classObj class])
The second argument class is optional. If given, the new class
created will be a copy of this class.
Members:
string name
string title
int type
int status (MS_ON, MS_OFF or MS_DELETE)
double minscaledenom
double maxscaledenom
double minscale (Deprecated in v5.0, use minscaledenom instead)
double maxscale (Deprecated in v5.0, use maxscaledenom instead)
string template
labelObj label
int numstyles
string keyimage
string group
Methods:
int set(string property_name, new_value)
Set object property to a new value. Returns -1 on error.
int setExpression(string expression)
Set the expression string for the class object.
string getExpressionString()
Returns the expression string for the class object.
string getExpression()
Deprecated in v5.0. Use getExpressionString() instead.
int settext(string text)
Set the text string for the class object.
string getTextString()
Returns the text string for the class object.
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.
imageObj createLegendIcon(int width, int height)
Draw the legend icon and return a new imageObj.
styleObj getStyle(int index)
Return the style object using an index. index >= 0 &&
index < class->numstyles.
classObj clone()
Returns a cloned copy of the class.
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 calss->movestyleup(1) will have the effect of moving style 1
up to postion 0, and the style at position 0 will be moved
to position 1.
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 postion 1, and the style at position 1 will be moved
to position 0.
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.
NOTE : if you are using the numstyles parameter while using the
deletestyle function on the class object you need to refetch
a new class object. Example :
//class has 2 styles
$class = $oLayer->getclass(0);
$class->deletestyle(1);
echo $class->numstyles; : will echo 2
$class = $oLayer->getclass(0);
echo $class->numstyles; : will echo 1
int getMetaData(string name)
Fetch class metadata entry by name. Returns "" if no entry
matches the name. Note that the search is case sensitive.
int setMetaData(string name, string value)
Set a metadata entry for the class. Returns MS_SUCCESS/MS_FAILURE.
int removeMetaData(string name)
Remove a metadata entry for the class. Returns MS_SUCCESS/MS_FAILURE.
settext method
$poClass->settext($layer, "([BEV_10], [BEV_10], [BEV_99])");