/// <summary>
        /// Method used to draw the rings at the desired interval
        /// Rings are constructed as geodetic circles
        /// </summary>
        private IGeometry DrawRings()
        {
            double radius = 0.0;

            try
            {
                IConstructGeodetic construct = null;
                for (int x = 0; x < numberOfRings; x++)
                {
                    // set the current radius
                    radius += Distance;
                    var polyLine = new Polyline() as IPolyline;
                    polyLine.SpatialReference = Point1.SpatialReference;
                    construct = polyLine as IConstructGeodetic;
                    construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), radius, esriCurveDensifyMethod.esriCurveDensifyByAngle, 0.001);
                    AddGraphicToMap(construct as IGeometry);

                    // Use negative radius to get the location for the distance label
                    DistanceTypes dtVal = (DistanceTypes)LineDistanceType;
                    construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), -radius, esriCurveDensifyMethod.esriCurveDensifyByAngle, 0.001);
                    this.AddTextToMap(construct as IGeometry, String.Format("{0} {1}", radius.ToString(), dtVal.ToString()));
                }

                return(construct as IGeometry);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
        }
        /// <summary>
        /// Method used to draw the rings at the desired interval
        /// Rings are constructed as geodetic circles
        /// </summary>
        private IGeometry DrawRings()
        {
            double radius = 0.0;

            try
            {
                IConstructGeodetic construct = null;
                for (int x = 0; x < numberOfRings; x++)
                {
                    // set the current radius
                    radius += Distance;
                    var polyLine = new Polyline() as IPolyline;
                    polyLine.SpatialReference = Point1.SpatialReference;
                    const double DENSIFY_ANGLE_IN_DEGREES = 5.0;
                    construct = polyLine as IConstructGeodetic;
                    construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), radius,
                                                      esriCurveDensifyMethod.esriCurveDensifyByAngle, DENSIFY_ANGLE_IN_DEGREES);
                    var color = new RgbColorClass()
                    {
                        Red = 255
                    } as IColor;
                    IDictionary <String, System.Object> rrAttributes = new Dictionary <String, System.Object>();
                    rrAttributes.Add("rings", NumberOfRings);
                    rrAttributes.Add("distance", radius);
                    rrAttributes.Add("distanceunit", lineDistanceType.ToString());
                    rrAttributes.Add("radials", NumberOfRadials);
                    rrAttributes.Add("centerx", Point1.X);
                    rrAttributes.Add("centery", Point1.Y);
                    AddGraphicToMap(construct as IGeometry, color, attributes: rrAttributes);

                    // Use negative radius to get the location for the distance label
                    // TODO: someone explain why we need to construct this circle twice, and what -radius means (top of circle or something)?
                    DistanceTypes dtVal = (DistanceTypes)LineDistanceType;
                    construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), -radius,
                                                      esriCurveDensifyMethod.esriCurveDensifyByAngle, DENSIFY_ANGLE_IN_DEGREES);
                    this.AddTextToMap(construct as IGeometry, String.Format("{0} {1}", radius.ToString(), dtVal.ToString()));
                }

                return(construct as IGeometry);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
        }
Example #3
0
        private IGeometry CreateRangeRings(double radius)
        {
            IConstructGeodetic construct = null;

            var polyLine = (IPolyline) new Polyline();

            polyLine.SpatialReference = Point1.SpatialReference;
            const double DENSIFY_ANGLE_IN_DEGREES = 5.0;

            construct = (IConstructGeodetic)polyLine;
            construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), radius,
                                              esriCurveDensifyMethod.esriCurveDensifyByAngle, DENSIFY_ANGLE_IN_DEGREES);
            var color = (IColor) new RgbColorClass()
            {
                Red = 255
            };
            var displayValue = new EnumToFriendlyNameConverter();
            var unitLabel    = Convert.ToString(displayValue.Convert(lineDistanceType, typeof(string), new object(), CultureInfo.CurrentCulture));

            IDictionary <String, System.Object> rrAttributes = new Dictionary <String, System.Object>();

            rrAttributes.Add("rings", NumberOfRings);
            rrAttributes.Add("distance", radius);
            rrAttributes.Add("distanceunit", unitLabel);
            rrAttributes.Add("centerx", Point1.X);
            rrAttributes.Add("centery", Point1.Y);
            AddGraphicToMap((IGeometry)construct, color, attributes: rrAttributes);

            // Use negative radius to get the location for the distance label
            // TODO: someone explain why we need to construct this circle twice, and what -radius means (top of circle or something)?
            DistanceTypes dtVal = (DistanceTypes)LineDistanceType;

            construct.ConstructGeodesicCircle(Point1, GetLinearUnit(), -radius,
                                              esriCurveDensifyMethod.esriCurveDensifyByAngle, DENSIFY_ANGLE_IN_DEGREES);
            this.AddTextToMap((IGeometry)construct, String.Format("{0} {1}", radius.ToString(), unitLabel));

            return((IGeometry)construct);
        }