@@ -1354,7 +1354,6 @@ int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image)
1354
1354
if (map -> querymap .style == MS_NORMAL || status != MS_SUCCESS ) return (status );
1355
1355
}
1356
1356
1357
-
1358
1357
/* if MS_HILITE, alter the one style (always at least 1 style), and set a MINDISTANCE for the labelObj to avoid duplicates */
1359
1358
if (map -> querymap .style == MS_HILITE ) {
1360
1359
if (layer -> numclasses > 0 ) {
@@ -1433,19 +1432,28 @@ int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image)
1433
1432
}
1434
1433
1435
1434
cache = MS_FALSE ;
1436
- if (layer -> type == MS_LAYER_LINE && layer -> class [shape .classindex ]-> numstyles > 1 )
1435
+ if (layer -> type == MS_LAYER_LINE && (layer -> class [shape .classindex ]-> numstyles > 1 || (layer -> class [shape .classindex ]-> numstyles == 1 && layer -> class [shape .classindex ]-> styles [0 ]-> outlinewidth > 0 ))) {
1436
+ int i ;
1437
1437
cache = MS_TRUE ; /* only line layers with multiple styles need be cached (I don't think POLYLINE layers need caching - SDL) */
1438
1438
1439
+ /* we can't handle caching with attribute binding other than for the first style (#3976) */
1440
+ for (i = 1 ; i < layer -> class [shape .classindex ]-> numstyles ; i ++ ) {
1441
+ if (layer -> class [shape .classindex ]-> styles [i ]-> numbindings > 0 ) cache = MS_FALSE ;
1442
+ }
1443
+ }
1444
+
1439
1445
if (annotate && layer -> class [shape .classindex ]-> numlabels > 0 ) {
1440
1446
drawmode |= MS_DRAWMODE_LABELS ;
1441
1447
}
1442
1448
1443
1449
if (cache ) {
1444
- drawmode |= MS_DRAWMODE_SINGLESTYLE ;
1445
- status = msDrawShape (map , layer , & shape , image , 0 , drawmode ); /* draw only the first style */
1446
- }
1447
- else
1450
+ styleObj * pStyle = layer -> class [shape .classindex ]-> styles [0 ];
1451
+ if (pStyle -> outlinewidth > 0 ) msOutlineRenderingPrepareStyle (pStyle , map , layer , image );
1452
+ status = msDrawShape (map , layer , & shape , image , 0 , drawmode |MS_DRAWMODE_SINGLESTYLE ); /* draw only the first style */
1453
+ if (pStyle -> outlinewidth > 0 ) msOutlineRenderingRestoreStyle (pStyle , map , layer , image );
1454
+ } else {
1448
1455
status = msDrawShape (map , layer , & shape , image , -1 , drawmode ); /* all styles */
1456
+ }
1449
1457
if (status != MS_SUCCESS ) {
1450
1458
msLayerClose (layer );
1451
1459
msFree (colorbuffer );
@@ -1472,19 +1480,36 @@ int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image)
1472
1480
1473
1481
if (shpcache ) {
1474
1482
int s ;
1475
-
1476
- for (s = 1 ; s < maxnumstyles ; s ++ ) {
1483
+ for (s = 0 ; s < maxnumstyles ; s ++ ) {
1477
1484
for (current = shpcache ; current ; current = current -> next ) {
1478
1485
if (layer -> class [current -> shape .classindex ]-> numstyles > s ) {
1479
- styleObj * curStyle = layer -> class [current -> shape .classindex ]-> styles [s ];
1486
+ styleObj * pStyle = layer -> class [current -> shape .classindex ]-> styles [s ];
1487
+ if (pStyle -> _geomtransform .type != MS_GEOMTRANSFORM_NONE )
1488
+ continue ; /* skip this as it has already been rendered */
1480
1489
if (map -> scaledenom > 0 ) {
1481
- if ((curStyle -> maxscaledenom != -1 ) && (map -> scaledenom >= curStyle -> maxscaledenom ))
1490
+ if ((pStyle -> maxscaledenom != -1 ) && (map -> scaledenom >= pStyle -> maxscaledenom ))
1482
1491
continue ;
1483
- if ((curStyle -> minscaledenom != -1 ) && (map -> scaledenom < curStyle -> minscaledenom ))
1492
+ if ((pStyle -> minscaledenom != -1 ) && (map -> scaledenom < pStyle -> minscaledenom ))
1484
1493
continue ;
1485
1494
}
1486
- if (UNLIKELY (MS_FAILURE == msDrawLineSymbol (map , image , & current -> shape , (layer -> class [current -> shape .classindex ]-> styles [s ]), layer -> scalefactor )))
1487
- return MS_FAILURE ;
1495
+ if (s == 0 && pStyle -> outlinewidth > 0 && MS_VALID_COLOR (pStyle -> color )) {
1496
+ if (UNLIKELY (MS_FAILURE == msDrawLineSymbol (map , image , & current -> shape , pStyle , layer -> scalefactor ))) {
1497
+ return MS_FAILURE ;
1498
+ }
1499
+ } else if (s > 0 ) {
1500
+ if (pStyle -> outlinewidth > 0 && MS_VALID_COLOR (pStyle -> outlinecolor )) {
1501
+ msOutlineRenderingPrepareStyle (pStyle , map , layer , image );
1502
+ if (UNLIKELY (MS_FAILURE == msDrawLineSymbol (map , image , & current -> shape , pStyle , layer -> scalefactor ))) {
1503
+ return MS_FAILURE ;
1504
+ }
1505
+ msOutlineRenderingRestoreStyle (pStyle , map , layer , image );
1506
+ }
1507
+ /* draw a valid line, i.e. one with a color defined or of type pixmap */
1508
+ if (MS_VALID_COLOR (pStyle -> color ) || (pStyle -> symbol < map -> symbolset .numsymbols && (map -> symbolset .symbol [pStyle -> symbol ]-> type == MS_SYMBOL_PIXMAP || map -> symbolset .symbol [pStyle -> symbol ]-> type == MS_SYMBOL_SVG ))) {
1509
+ if (UNLIKELY (MS_FAILURE == msDrawLineSymbol (map , image , & current -> shape , pStyle , layer -> scalefactor )))
1510
+ return MS_FAILURE ;
1511
+ }
1512
+ }
1488
1513
}
1489
1514
}
1490
1515
}
@@ -1509,15 +1534,13 @@ int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image)
1509
1534
layer -> class [i ]-> styles [layer -> class [i ]-> numstyles - 1 ]-> color = colorbuffer [i ];
1510
1535
else if (MS_VALID_COLOR (layer -> class [i ]-> styles [layer -> class [i ]-> numstyles - 1 ]-> outlinecolor ))
1511
1536
layer -> class [i ]-> styles [layer -> class [i ]-> numstyles - 1 ]-> outlinecolor = colorbuffer [i ]; /* if no color, restore outlinecolor for the TOP style */
1512
- }
1513
- else if (layer -> class [i ]-> numlabels > 0 ) {
1514
- if (MS_VALID_COLOR (layer -> class [i ]-> labels [0 ]-> color ))
1515
- layer -> class [i ]-> labels [0 ]-> color = colorbuffer [i ];
1537
+ } else if (layer -> class [i ]-> numlabels > 0 ) {
1538
+ if (MS_VALID_COLOR (layer -> class [i ]-> labels [0 ]-> color ))
1539
+ layer -> class [i ]-> labels [0 ]-> color = colorbuffer [i ];
1516
1540
}
1517
1541
1518
1542
if (layer -> class [i ]-> numlabels > 0 )
1519
1543
layer -> class [i ]-> labels [0 ]-> mindistance = mindistancebuffer [i ]; /* RFC77 TODO: again, only using the first label, is that cool? */
1520
-
1521
1544
}
1522
1545
1523
1546
msFree (colorbuffer );
0 commit comments