/// <summary>
 /// The only constructor requires that you provide the number
 /// of parts in this feature so that the first dimention of 
 /// the array can be created.
 /// </summary>
 /// @param numOfParts the number of sub-features in this feature
 /// @param mapMetrics the GIS.MapMetrics object for this map
 public VectorFeature( int numOfParts, MapMetrics mapMetrics )
 {
     if ( numOfParts == 1094233352 )
     {
         numOfParts = 5;
     }
     _segment		= new PointD[ numOfParts ][];
     _mapMetrics		= mapMetrics;
     _extents		= new RectangleD();
     _segmentCounter = 0;
     _featureAngle	= 0;
 }
Esempio n. 2
0
        public ScaleBar( MapMetrics metrics )
        {
            Graphics gr = Graphics.FromImage( metrics.Canvas );
            int dpi = (int) gr.DpiX;
            double x1 = 0.0;
            double y1 = 0.0;
            double x2 = dpi;
            double y2 = 0.0;

            metrics.Pixel2World( ref x1, ref y1 );
            metrics.Pixel2World( ref x2, ref y2 );

            double distance = x2 - x1;

            Pen p = new Pen( Color.Chartreuse, 4 );

            int scaleBarLeft = metrics.Canvas.Width - ( dpi + 20 );
            int scaleBarRight = metrics.Canvas.Width - 20;
            int scaleBarTop = metrics.Canvas.Height - 35;
            int scaleBarBottom = metrics.Canvas.Height - 15;

            gr.DrawLine( p, new Point( scaleBarLeft, scaleBarBottom ),
                new Point( scaleBarRight, scaleBarBottom ) );

            p = new Pen( Color.Chartreuse, 1 );

            gr.DrawLine( p, new Point( scaleBarLeft, scaleBarBottom - 10 ),
                new Point( scaleBarLeft, scaleBarBottom ) );
            gr.DrawLine( p, new Point( scaleBarRight, scaleBarBottom - 10 ),
                new Point( scaleBarRight, scaleBarBottom ) );

            gr.DrawString( "1:" + distance.ToString("F4"), new Font("Arial", 8),
                new SolidBrush( Color.Chartreuse ), scaleBarLeft+25, scaleBarTop+5 );

            gr.Dispose();
        }