mapscript.classObj

class classObj(layer: Optional[mapscript.layerObj] = None)

The CLASS object. Used for symbolization and classification information.

Overview

The classObj has the following relationships:

../../_images/classObj_hashTableObj1.png ../../_images/classObj_labelObj1.png ../../_images/classObj_layerObj1.png ../../_images/classObj_styleObj1.png

Examples

Have some Python code here.

    c = mapscript.classObj()
    fn = "/tmp/legend.png"
    c.keyimage = fn

Attributes

debug

debug : int MS_TRUE or MS_FALSE.

group

group : p.char See GROUP

isfallback

isfallback : int MS_TRUE or MS_FALSE.

keyimage

keyimage : p.char See KEYIMAGE

layer

layer : p.struct layerObj immutable Reference to the parent layer

leader

leader : p.labelLeaderObj immutable.

maxscaledenom

maxscaledenom : double See MAXSCALEDENOM

metadata

metadata : hashTableObj immutable.

minfeaturesize

minfeaturesize : int See MINFEATURESIZE

minscaledenom

minscaledenom : double See MINSCALEDENOM

name

name : p.char See NAME

numlabels

numlabels : int immutable.

numstyles

numstyles : int immutable.

refcount

refcount : int

sizeunits

sizeunits : int Supersedes layer’s sizeunits and applies to all styles and labels.

status

status : int MS_ON or MS_OFF - draw features of this class or do not.

template

template : p.char

thisown

The membership flag

title

title : p.char See TITLE

validation

validation : hashTableObj immutable.

Methods

__init__(layer: Optional[mapscript.layerObj] = None)

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

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

clone()mapscript.classObj

Return an independent copy of the class without a parent layer

convertToString() → char

Output the CLASS as a Mapfile string

createLegendIcon(map: mapscript.mapObj, layer: mapscript.layerObj, width: int, height: int) → mapscript.imageObj

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

Draw the legend icon onto image at dstx, dsty. Returns MS_SUCCESS or MS_FAILURE

getExpressionString() → char

Return a string representation of the EXPRESSION enclosed in the quote characters appropriate to the expression type

getFirstMetaDataKey() → char

To be removed in 8.0 - use the metadata property

getLabel(i: int) → mapscript.labelObj

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

getMetaData(name: char) → char

To be removed in 8.0 - use the metadata property

getNextMetaDataKey(lastkey: char) → char

To be removed in 8.0 - use the metadata property

getStyle(i: int)mapscript.styleObj

Return a reference to the styleObj at index in the styles array

getTextString() → char

Return a string representation of TEXT

insertStyle(style: mapscript.styleObj, index: int = - 1) → int

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.

moveStyleDown(index: int) → int

Swap the styleObj at index with the styleObj at index + 1

moveStyleUp(index: int) → int

Swap the styleObj at index with the styleObj at index - 1

removeLabel(index: int) → mapscript.labelObj

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

removeStyle(index: int)mapscript.styleObj

Remove the styleObj at index from the styles array and return a copy.

setExpression(expression: char) → int

Set EXPRESSION string where expression is a MapServer regular, logical or string expression. Returns MS_SUCCESS or MS_FAILURE

setMetaData(name: char, value: char) → int

To be removed in 8.0 - use the metadata property

setText(text: char) → int

Set TEXT string where text is a MapServer text expression. Returns MS_SUCCESS or MS_FAILURE

updateFromString(snippet: char) → int

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