MCPcopy Create free account
hub / github.com/MapServer/MapServer / writeLabel

Function writeLabel

mapfile.c:1925–2004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1923}
1924
1925static void writeLabel(FILE *stream, int indent, labelObj *label)
1926{
1927 int i;
1928 colorObj c;
1929
1930 if(label->size == -1) return; /* there is no default label anymore */
1931
1932 indent++;
1933 writeBlockBegin(stream, indent, "LABEL");
1934
1935 /*
1936 ** a few attributes are bitmap or truetype only
1937 */
1938 if(label->type == MS_BITMAP) {
1939 writeKeyword(stream, indent, "SIZE", (int)label->size, 5, MS_TINY, "TINY", MS_SMALL, "SMALL", MS_MEDIUM, "MEDIUM", MS_LARGE, "LARGE", MS_GIANT, "GIANT");
1940 } else {
1941 if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_ANGLE].item)
1942 writeAttributeBinding(stream, indent, "ANGLE", &(label->bindings[MS_LABEL_BINDING_ANGLE]));
1943 else writeNumberOrKeyword(stream, indent, "ANGLE", 0, label->angle, label->anglemode, 3, MS_FOLLOW, "FOLLOW", MS_AUTO, "AUTO", MS_AUTO2, "AUTO2");
1944
1945 writeKeyword(stream, indent, "ANTIALIAS", label->antialias, 1, MS_TRUE, "TRUE");
1946
1947 if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_FONT].item)
1948 writeAttributeBinding(stream, indent, "FONT", &(label->bindings[MS_LABEL_BINDING_FONT]));
1949 else writeString(stream, indent, "FONT", NULL, label->font);
1950
1951 writeNumber(stream, indent, "MAXSIZE", MS_MAXFONTSIZE, label->maxsize);
1952 writeNumber(stream, indent, "MINSIZE", MS_MINFONTSIZE, label->minsize);
1953
1954 if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_SIZE].item)
1955 writeAttributeBinding(stream, indent, "SIZE", &(label->bindings[MS_LABEL_BINDING_SIZE]));
1956 else writeNumber(stream, indent, "SIZE", -1, label->size);
1957 }
1958
1959 writeKeyword(stream, indent, "ALIGN", label->align, MS_ALIGN_CENTER, "CENTER", MS_ALIGN_RIGHT, "RIGHT");
1960 writeNumber(stream, indent, "BUFFER", 0, label->buffer);
1961
1962 if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_COLOR].item)
1963 writeAttributeBinding(stream, indent, "COLOR", &(label->bindings[MS_LABEL_BINDING_COLOR]));
1964 else {
1965 MS_INIT_COLOR(c,0,0,0,255);
1966 writeColor(stream, indent, "COLOR", &c, &(label->color));
1967 }
1968
1969 writeString(stream, indent, "ENCODING", NULL, label->encoding);
1970 writeKeyword(stream, indent, "FORCE", label->force, 1, MS_TRUE, "TRUE");
1971 writeNumber(stream, indent, "MAXLENGTH", 0, label->maxlength);
1972 writeNumber(stream, indent, "MAXSCALEDENOM", -1, label->maxscaledenom);
1973 writeNumber(stream, indent, "MINDISTANCE", -1, label->mindistance);
1974 writeNumberOrKeyword(stream, indent, "MINFEATURESIZE", -1, label->minfeaturesize, 1, label->autominfeaturesize, MS_TRUE, "AUTO");
1975 writeNumber(stream, indent, "MINLENGTH", 0, label->minlength);
1976 writeNumber(stream, indent, "MINSCALEDENOM", -1, label->minscaledenom);
1977 writeDimension(stream, indent, "OFFSET", label->offsetx, label->offsety, NULL, NULL);
1978
1979 if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_OUTLINECOLOR].item)
1980 writeAttributeBinding(stream, indent, "OUTLINECOLOR", &(label->bindings[MS_LABEL_BINDING_OUTLINECOLOR]));
1981 else writeColor(stream, indent, "OUTLINECOLOR", NULL, &(label->outlinecolor));
1982

Callers 3

writeClassFunction · 0.85
writeLegendFunction · 0.85
writeScalebarFunction · 0.85

Calls 11

writeBlockBeginFunction · 0.85
writeKeywordFunction · 0.85
writeAttributeBindingFunction · 0.85
writeNumberOrKeywordFunction · 0.85
writeStringFunction · 0.85
writeNumberFunction · 0.85
writeColorFunction · 0.85
writeDimensionFunction · 0.85
writeStyleFunction · 0.85
writeCharacterFunction · 0.85
writeBlockEndFunction · 0.85

Tested by

no test coverage detected