private float GetPointSize(GeoCanvas canvas)
        {
            // Calculate the size of the points in pixel based on the world point size and the current extent.
            //Gets the proper point size according to the current extent. (meter is used as base unit)
            double canvasSizeMeter;
            double pointSizeMeter = Conversion.ConvertMeasureUnits(pointSize, pointSizeUnit, DistanceUnit.Meter);

            //if the mapunit is in Decimal Degrees, it uses a different logic than with other mapunits such as meters and feet.
            if (canvas.MapUnit == GeographyUnit.DecimalDegree)
            {
                try
                {
                    canvasSizeMeter = DecimalDegreesHelper.GetDistanceFromDecimalDegrees(canvas.CurrentWorldExtent.UpperLeftPoint.X,
                                                                                         canvas.CurrentWorldExtent.UpperLeftPoint.Y, canvas.CurrentWorldExtent.LowerLeftPoint.X, canvas.CurrentWorldExtent.LowerLeftPoint.Y, DistanceUnit.Meter);
                }
                catch { canvasSizeMeter = DecimalDegreesHelper.GetDistanceFromDecimalDegrees(180, 90, 180, -90, DistanceUnit.Meter); }
                finally { }
            }
            else
            {
                DistanceUnit fromUnit = DistanceUnit.Meter;
                if (canvas.MapUnit == GeographyUnit.Feet)
                {
                    fromUnit = DistanceUnit.Feet;
                }
                canvasSizeMeter = Conversion.ConvertMeasureUnits(canvas.CurrentWorldExtent.Height, fromUnit, DistanceUnit.Meter);
            }
            float size = (float)((pointSizeMeter * canvas.Height) / canvasSizeMeter);

            return(size);
        }
示例#2
0
 internal static double GetEvaluatedDistance(Vertex point1, PointShape point2)
 {
     return(DecimalDegreesHelper.GetDistanceFromDecimalDegrees(new PointShape(point1), point2, DistanceUnit.Meter));
 }