@@ -586,8 +586,6 @@ public override void Render(Graphics g, MapViewport map)
586586 label . Style . BackColor , label . Style . Halo , label . Rotation ,
587587 label . Text , map , label . Style . HorizontalAlignment ,
588588 label . LabelPoint ) ;
589-
590- affectedArea = VectorRenderer . RectExpandToInclude ( affectedArea , rect ) ;
591589 }
592590 else
593591 {
@@ -602,44 +600,30 @@ public override void Render(Graphics g, MapViewport map)
602600 //g.FillPolygon(labels[i].Style.BackColor, labels[i].TextOnPathLabel.PointsText.ToArray());
603601 }
604602 }
605-
606- label . TextOnPathLabel . DrawTextOnPath ( ) ;
603+ rect = label . TextOnPathLabel . DrawTextOnPathEx ( ) ;
607604 }
608605 }
609606 else if ( labels [ i ] is PathLabel )
610607 {
611608 var plbl = labels [ i ] as PathLabel ;
612609 var lblStyle = plbl . Style ;
613- g . DrawString ( lblStyle . Halo , new SolidBrush ( lblStyle . ForeColor ) , plbl . Text ,
610+ rect = g . DrawStringEx ( lblStyle . Halo , new SolidBrush ( lblStyle . ForeColor ) , plbl . Text ,
614611 lblStyle . Font . FontFamily , ( int ) lblStyle . Font . Style , lblStyle . Font . Size ,
615612 lblStyle . GetStringFormat ( ) , lblStyle . IgnoreLength , plbl . Location ) ;
616613 }
614+ affectedArea = VectorRenderer . RectExpandToInclude ( affectedArea , rect ) ;
617615 }
618616
619617 if ( ! affectedArea . IsEmpty )
620618 {
621- // TODO optimise for Rotation = 0.
622619 var pts = new PointF [ ]
623620 {
624621 new PointF ( affectedArea . Left - 1 , affectedArea . Top - 1 ) ,
625- new PointF ( affectedArea . Right + 1 , affectedArea . Top - 1 ) ,
626622 new PointF ( affectedArea . Right + 1 , affectedArea . Bottom + 1 ) ,
627- new PointF ( affectedArea . Left - 1 , affectedArea . Bottom + 1 )
628623 } ;
629-
630- var coords = map . ImageToWorld ( pts , true ) ;
631-
632- var minX = Math . Min ( coords [ 0 ] . X , Math . Min ( coords [ 1 ] . X , Math . Min ( coords [ 2 ] . X , coords [ 3 ] . X ) ) ) ;
633- var maxX = Math . Max ( coords [ 0 ] . X , Math . Max ( coords [ 1 ] . X , Math . Max ( coords [ 2 ] . X , coords [ 3 ] . X ) ) ) ;
634- var minY = Math . Min ( coords [ 0 ] . Y , Math . Min ( coords [ 1 ] . Y , Math . Min ( coords [ 2 ] . Y , coords [ 3 ] . Y ) ) ) ;
635- var maxY = Math . Max ( coords [ 0 ] . Y , Math . Max ( coords [ 1 ] . Y , Math . Max ( coords [ 2 ] . Y , coords [ 3 ] . Y ) ) ) ;
636-
637- var env = new Envelope ( minX , maxX , minY , maxY ) ;
638- //env.ExpandBy(env.Width * 0.05, env.Height * 0.05);
639-
640- base . _affectedArea . ExpandToInclude ( env ) ;
624+ var coords = map . ImageToWorld ( pts , false ) ;
625+ base . _affectedArea . ExpandToInclude ( new Envelope ( coords [ 0 ] , coords [ 1 ] ) ) ;
641626 }
642-
643627 base . Render ( g , map ) ;
644628 }
645629
0 commit comments