@@ -518,11 +518,42 @@ private SharpMap.Map InitializeMap(Size outputsize, Plot plot, int zoom = 1, boo
518518
519519 plotLayer . DataSource = new SharpMap . Data . Providers . GeometryProvider ( geometries ) ;
520520
521- newRow [ "Label" ] = Math . Round ( ( plotLayer . Envelope . MaxX - ( Convert . ToDouble ( plot . Longitude ) ) ) * 67000 ) + "," + Math . Round ( ( plotLayer . Envelope . MaxY - ( Convert . ToDouble ( plot . Latitude ) ) ) * 108800 ) + "\t \n " ;
521+ //newRow["Label"] = Math.Round((plotLayer.Envelope.MaxX - (Convert.ToDouble(plot.Longitude))) * 67000) + "," + Math.Round((plotLayer.Envelope.MaxY - (Convert.ToDouble(plot.Latitude))) * 108800) + "\t \n";
522+ if ( geometry . GeometryType . Equals ( "rectangle" ) )
523+ {
524+ string [ ] xy = geometry . Coordinate . Split ( ',' ) ;
525+ newRow [ "Label" ] = xy [ 2 ] + "," + xy [ 3 ] + "1" ;
526+ }
527+
528+ if ( geometry . GeometryType . Equals ( "polygon" ) )
529+ {
530+ string [ ] tmpXY = geometry . Coordinate . Split ( new [ ] { "),(" } , StringSplitOptions . None ) ;
531+ string [ ] x = tmpXY [ 0 ] . Split ( ',' ) ;
532+ string [ ] y = tmpXY [ 1 ] . Split ( ',' ) ;
533+ newRow [ "Label" ] = x [ 2 ] + "," + y [ 2 ] + "1" ;
534+ }
535+ if ( geometry . GeometryType . Equals ( "linestring" ) )
536+ {
537+ string [ ] tmpXY = geometry . Coordinate . Split ( new [ ] { "),(" } , StringSplitOptions . None ) ;
538+ string [ ] x = tmpXY [ 0 ] . Split ( ',' ) ;
539+ string [ ] y = tmpXY [ 1 ] . Split ( ',' ) ;
540+
541+ newRow [ "Label" ] = x [ 0 ] . Substring ( 1 ) + "," + y [ 0 ] ;
542+ }
543+
544+ if ( geometry . GeometryType . Equals ( "circle" ) )
545+ {
546+ string origin = geometry . Coordinate . Substring ( 0 ) ;
547+ origin = origin . TrimEnd ( ',' ) ;
548+ newRow [ "Label" ] = origin ;
549+ }
550+
522551 plotLayer . CoordinateTransformation = ctFact . CreateFromCoordinateSystems ( ProjNet . CoordinateSystems . GeographicCoordinateSystem . WGS84 , webmercator ) ;
523552 plotLayer . ReverseCoordinateTransformation = ctFact . CreateFromCoordinateSystems ( webmercator , ProjNet . CoordinateSystems . GeographicCoordinateSystem . WGS84 ) ;
524553
525- dd . Rows . Clear ( ) ; dd . Rows . Add ( newRow ) ; plotLayer . DataSource = new SharpMap . Data . Providers . GeometryFeatureProvider ( dd ) ;
554+ dd . Rows . Clear ( ) ;
555+ dd . Rows . Add ( newRow ) ;
556+ plotLayer . DataSource = new SharpMap . Data . Providers . GeometryFeatureProvider ( dd ) ;
526557
527558 SharpMap . Layers . LabelLayer layLabel = new SharpMap . Layers . LabelLayer ( "Country labels" )
528559 {
0 commit comments