mapscript.classObj¶
- class mapscript.classObj(layer: 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
debuggroupchar See GROUP
isfallbackint
MS_TRUEorMS_FALSEuseMS_TRUEif this class should be applied if and only if no other class is applicablekeyimagechar See KEYIMAGE
layerlayerObjimmutable reference to the parent layerleaderlabelLeaderObjimmutable see LEADERmaxscaledenomdouble See MAXSCALEDENOM
metadatahashTableObjimmutable see METADATAminfeaturesizeint See MINFEATURESIZE minimum feature size in pixels
minscaledenomdouble See MINSCALEDENOM
namechar See NAME should be unique within a layer
numlabelsint immutable number of labels for class
numstylesint immutable number of styles for class
refcountint immutable number of references to this object
sizeunitsint Supersedes layer's sizeunits and applies to all styles and labels - see LAYER SIZEUNITS
statusint
MS_ONorMS_OFF- draw features of this class or do not - see STATUStemplatechar See TEMPLATE
thisownThe membership flag
titlechar See TITLE
validationhashTableObjimmutable see VALIDATIONMethods
- __init__(layer: 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: labelObj) int[исходный код]¶
Add a
labelObjto theclassObjand return its index in the labels array
- clone() classObj[исходный код]¶
Return an independent copy of the class without a parent layer
Примечание
In the Java & PHP modules this method is named
cloneClass.
- convertToString() char[исходный код]¶
Output the CLASS as a Mapfile string
- createLegendIcon(map: mapObj, layer: layerObj, width: int, height: int) imageObj[исходный код]¶
Draw and return a new legend icon
- drawLegendIcon(map: mapObj, layer: layerObj, width: int, height: int, dstImage: imageObj, dstX: int, dstY: int) int[исходный код]¶
Draw the legend icon onto image at dstx, dsty. Returns
MS_SUCCESSorMS_FAILURE
- getExpressionString() char[исходный код]¶
Return a string representation of the EXPRESSION enclosed in the quote characters appropriate to the expression type
- getLabel(i: int) labelObj[исходный код]¶
Return a reference to the
labelObjat index in the labels array
- getStyle(i: int) styleObj[исходный код]¶
Return a reference to the
styleObjat index in the styles array
- getTextString() char[исходный код]¶
Return a string representation of TEXT
- insertStyle(style: 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[исходный код]¶
- moveStyleUp(index: int) int[исходный код]¶
Swap the
styleObjat index with the styleObj at index - 1
- removeLabel(index: int) labelObj[исходный код]¶
Remove the
labelObjat index from the labels array and return a reference to thelabelObj. numlabels is decremented, and the array is updated
- removeStyle(index: int) styleObj[исходный код]¶
Remove the
styleObjat 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_SUCCESSorMS_FAILURE
- setText(text: char) int[исходный код]¶
Set TEXT string where text is a MapServer text expression. Returns
MS_SUCCESSorMS_FAILURE
- updateFromString(snippet: char) int[исходный код]¶
Update a class from a string snippet. Returns
MS_SUCCESSorMS_FAILURE
