MCPcopy Index your code
hub / github.com/MapServer/MapServer / msDrawLabelCacheIM

Function msDrawLabelCacheIM

mapimagemap.c:1810–1970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1808}
1809
1810int msDrawLabelCacheIM(imageObj* img, mapObj *map)
1811{
1812 pointObj p;
1813 int i, j, l, priority;
1814 rectObj r;
1815
1816 labelCacheMemberObj *cachePtr=NULL;
1817 layerObj *layerPtr=NULL;
1818 labelObj *labelPtr=NULL;
1819
1820 int marker_width, marker_height;
1821 int marker_offset_x, marker_offset_y, label_offset_x, label_offset_y;
1822 rectObj marker_rect;
1823 int label_mindistance, label_buffer;
1824
1825 label_mindistance=-1;
1826 label_buffer=0;
1827
1828 DEBUG_IF printf("msDrawLabelCacheIM\n<BR>");
1829 for(priority=MS_MAX_LABEL_PRIORITY-1; priority>=0; priority--) {
1830 labelCacheSlotObj *cacheslot;
1831 cacheslot = &(map->labelcache.slots[priority]);
1832
1833 for(l=cacheslot->numlabels-1; l>=0; l--) {
1834 double size = cachePtr->label.size*layerPtr->scalefactor;
1835 cachePtr = &(cacheslot->labels[l]); /* point to right spot in the label cache */
1836
1837 layerPtr = (GET_LAYER(map, cachePtr->layerindex)); /* set a couple of other pointers, avoids nasty references */
1838 labelPtr = &(cachePtr->label);
1839
1840 if(!cachePtr->text || strlen(cachePtr->text) == 0)
1841 continue; /* not an error, just don't want to do anything */
1842
1843 if(labelPtr->type == MS_TRUETYPE) {
1844 size = MS_MAX(size, labelPtr->minsize*img->resolutionfactor);
1845 size = MS_MIN(size, labelPtr->maxsize*img->resolutionfactor);
1846 }
1847
1848 if(msGetLabelSize(map,labelPtr,cachePtr->text, size,&r, NULL) != MS_SUCCESS) {
1849 return MS_FAILURE;
1850 }
1851
1852 label_offset_x = labelPtr->offsetx*layerPtr->scalefactor;
1853 label_offset_y = labelPtr->offsety*layerPtr->scalefactor;
1854 label_buffer = MS_NINT(labelPtr->buffer*img->resolutionfactor);
1855 label_mindistance = MS_NINT(labelPtr->mindistance*img->resolutionfactor);
1856
1857 if(labelPtr->autominfeaturesize && (cachePtr->featuresize != -1) && ((r.maxx-r.minx) > cachePtr->featuresize))
1858 continue; /* label too large relative to the feature */
1859
1860 marker_offset_x = marker_offset_y = 0; /* assume no marker */
1861 if((layerPtr->type == MS_LAYER_ANNOTATION && cachePtr->numstyles > 0) || layerPtr->type == MS_LAYER_POINT) { /* there *is* a marker */
1862
1863 /* TO DO: at the moment only checks the bottom style, perhaps should check all of them */
1864 if (msGetMarkerSize(&map->symbolset, &(cachePtr->styles[0]), &marker_width, &marker_height, layerPtr->scalefactor) != MS_SUCCESS)
1865 return(MS_FAILURE);
1866
1867 marker_width = (int) (marker_width * layerPtr->scalefactor);

Callers 1

msDrawLabelCacheFunction · 0.85

Calls 9

msGetLabelSizeFunction · 0.85
MS_NINTFunction · 0.85
msGetMarkerSizeFunction · 0.85
msSymbolGetDefaultSizeFunction · 0.85
msFreeShapeFunction · 0.85
get_metricsFunction · 0.85
msRectToPolygonFunction · 0.85
msDrawTextIMFunction · 0.85

Tested by

no test coverage detected