Ejemplo n.º 1
0
        public Feature MapAsSingleFeature(AbCurve guidancePatternAdapt)
        {
            var lineStrings = new List <GeoJSON.Net.Geometry.LineString>();

            foreach (var adaptLineString in guidancePatternAdapt.Shape)
            {
                lineStrings.Add(LineStringMapper.MapLineString(adaptLineString, _properties.AffineTransformation));
            }
            return(new Feature(MultiLineStringMapper.MapMultiLineString(lineStrings), _featProps));
        }
Ejemplo n.º 2
0
        public List <Feature> MapAsMultipleFeatures(PivotGuidancePattern guidancePatternAdapt)
        {
            _featProps.Add("DefinitionMethod", guidancePatternAdapt.DefinitionMethod.ToString());
            List <Feature>  centerPivotFeatures = new List <Feature>();
            const string    labelPT             = "PointType";
            const string    labelCP             = "Center";
            const string    labelRa             = "Radius (m)";
            List <Position> positions           = new List <Position>();
            var             oneDegree           = Math.PI / 180.0;

            switch (guidancePatternAdapt.DefinitionMethod)
            {
            case PivotGuidanceDefinitionEnum.PivotGuidancePatternStartEndCenter:
            case PivotGuidanceDefinitionEnum.PivotGuidancePatternThreePoints:
                while (_featProps.ContainsKey(labelPT))
                {
                    _featProps.Remove(labelPT);
                }
                Dictionary <string, object> featProps2 = new Dictionary <string, object>(_featProps);
                Dictionary <string, object> featProps3 = new Dictionary <string, object>(_featProps);
                var distanceEllipsoidal = GetDistanceEllipsoidal(guidancePatternAdapt.Center.X, guidancePatternAdapt.Center.Y, guidancePatternAdapt.StartPoint.X, guidancePatternAdapt.StartPoint.Y);

                _featProps.Add(labelPT, "StartPoint");
                centerPivotFeatures.Add(new Feature(PointMapper.MapPoint2Point(guidancePatternAdapt.StartPoint, _properties.AffineTransformation), _featProps));
                featProps2.Add(labelPT, labelCP);
                featProps2.Add(labelRa, distanceEllipsoidal);
                centerPivotFeatures.Add(new Feature(PointMapper.MapPoint2Point(guidancePatternAdapt.Center, _properties.AffineTransformation), featProps2));
                featProps3.Add(labelPT, "EndPoint");
                centerPivotFeatures.Add(new Feature(PointMapper.MapPoint2Point(guidancePatternAdapt.EndPoint, _properties.AffineTransformation), featProps3));

                // extra "visually nice" Features
                var distanceCartesian = GetDistanceCartesian(guidancePatternAdapt.Center.X, guidancePatternAdapt.Center.Y, guidancePatternAdapt.StartPoint.X, guidancePatternAdapt.StartPoint.Y);
                for (int i = 0; i <= 360; i += 2)
                {
                    // guidancePatternAdapt.GuidancePatternOptions ([1]Clockwise [2]Couter-clockwise [3]Full Circle) not yet available
                    positions.Add(new Position((distanceCartesian * Math.Cos(i * oneDegree)) + guidancePatternAdapt.Center.Y,
                                               (distanceCartesian * Math.Sin(i * oneDegree)) + guidancePatternAdapt.Center.X));
                }
                centerPivotFeatures.Add(new Feature(new GeoJSON.Net.Geometry.LineString(positions), new Dictionary <string, object>()
                {
                    { labelRa, distanceEllipsoidal }
                }));
                centerPivotFeatures.Add(new Feature(LineStringMapper.MapLineString(guidancePatternAdapt.Center, guidancePatternAdapt.StartPoint, null), null));
                centerPivotFeatures.Add(new Feature(LineStringMapper.MapLineString(guidancePatternAdapt.Center, guidancePatternAdapt.EndPoint, null), null));
                break;

            case PivotGuidanceDefinitionEnum.PivotGuidancePatternCenterRadius:
                if (guidancePatternAdapt.Radius == null)
                {
                    Console.WriteLine("Error if (guidancePatternAdapt.Radius == null)");
                    break;
                }
                while (_featProps.ContainsKey(labelPT))
                {
                    _featProps.Remove(labelPT);
                }

                _featProps.Add(labelPT, labelCP);
                _featProps.Add(labelRa, guidancePatternAdapt.Radius.Multiply(1000.0));
                centerPivotFeatures.Add(new Feature(PointMapper.MapPoint2Point(guidancePatternAdapt.Center, _properties.AffineTransformation), _featProps));

                // extra "visually nice" Features
                for (int i = 0; i <= 360; i += 2)
                {
                    positions.Add(new Position((0.00036 * Math.Cos(i * oneDegree)) + guidancePatternAdapt.Center.Y,
                                               (0.00036 * Math.Sin(i * oneDegree)) + guidancePatternAdapt.Center.X));
                }
                centerPivotFeatures.Add(new Feature(new GeoJSON.Net.Geometry.LineString(positions), new Dictionary <string, object>()
                {
                    { labelRa, guidancePatternAdapt.Radius.Multiply(1000.0) }
                }));
                break;

            default:
                break;
            }

            return(centerPivotFeatures);
        }
Ejemplo n.º 3
0
 public Feature MapAsSingleFeature(AbLine guidancePatternAdapt)
 {
     GeoJSON.Net.Geometry.LineString lineString = LineStringMapper.MapLineString(guidancePatternAdapt.A, guidancePatternAdapt.B, _properties.AffineTransformation);
     return(new Feature(lineString, _featProps));
 }