mapscript.classObj¶
- class mapscript.classObj(layer: Optional[mapscript.layerObj] = None)¶
The CLASS object. Used for symbolization and classification information.
Overview
The classObj has the following relationships:
Examples
Class creation:
lyr = mapscript.layerObj() lyr.name = 'foo' c = mapscript.classObj(lyr) assert c.thisown == 1 assert c.layer.name == lyr.name assert c.numstyles == 0
Attributes
debug
group
char See GROUP
isfallback
int
MS_TRUE
orMS_FALSE
useMS_TRUE
if this class should be applied if and only if no other class is applicablekeyimage
char See KEYIMAGE
layer
layerObj
immutable reference to the parent layerleader
labelLeaderObj
immutable see LEADERmaxscaledenom
double See MAXSCALEDENOM
metadata
hashTableObj
immutable see METADATAminfeaturesize
int See MINFEATURESIZE minimum feature size in pixels
minscaledenom
double See MINSCALEDENOM
name
char See NAME should be unique within a layer
numlabels
int immutable number of labels for class
numstyles
int immutable number of styles for class
refcount
int immutable number of references to this object
sizeunits
int Supersedes layer's sizeunits and applies to all styles and labels - see LAYER SIZEUNITS
status
int
MS_ON
orMS_OFF
- draw features of this class or do not - see STATUStemplate
char See TEMPLATE
thisown
The membership flag
title
char See TITLE
validation
hashTableObj
immutable see VALIDATIONMethods
- __init__(layer: Optional[mapscript.layerObj] = None)[source]¶
Create a new child classObj instance at the tail (highest index) of the class array of the parent_layer. A class can be created outside the context of a parent layer by omitting the layerObj constructor argument
- addLabel(label: mapscript.labelObj) int [source]¶
Add a
labelObj
to theclassObj
and return its index in the labels array
- clone() mapscript.classObj [source]¶
Return an independent copy of the class without a parent layer
- createLegendIcon(map: mapscript.mapObj, layer: mapscript.layerObj, width: int, height: int) mapscript.imageObj [source]¶
Draw and return a new legend icon
- drawLegendIcon(map: mapscript.mapObj, layer: mapscript.layerObj, width: int, height: int, dstImage: mapscript.imageObj, dstX: int, dstY: int) int [source]¶
Draw the legend icon onto image at dstx, dsty. Returns
MS_SUCCESS
orMS_FAILURE
- getExpressionString() char [source]¶
Return a string representation of the EXPRESSION enclosed in the quote characters appropriate to the expression type
- getLabel(i: int) mapscript.labelObj [source]¶
Return a reference to the
labelObj
at index in the labels array
- getStyle(i: int) mapscript.styleObj [source]¶
Return a reference to the
styleObj
at index in the styles array
- insertStyle(style: mapscript.styleObj, index: int = - 1) int [source]¶
Insert a copy of style into the styles array at index index Default is -1, or the end of the array. Returns the index at which the style was inserted.
- removeLabel(index: int) mapscript.labelObj [source]¶
Remove the
labelObj
at index from the labels array and return a reference to thelabelObj
. numlabels is decremented, and the array is updated
- removeStyle(index: int) mapscript.styleObj [source]¶
Remove the
styleObj
at index from the styles array and return a copy.
- setExpression(expression: char) int [source]¶
Set EXPRESSION string where expression is a MapServer regular, logical or string expression. Returns
MS_SUCCESS
orMS_FAILURE
- setText(text: char) int [source]¶
Set TEXT string where text is a MapServer text expression. Returns
MS_SUCCESS
orMS_FAILURE
- updateFromString(snippet: char) int [source]¶
Update a class from a string snippet. Returns
MS_SUCCESS
orMS_FAILURE