Example #1
0
        private static AbLine LoadAbLinePattern(XmlNode inputNode, XmlNode lineNode)
        {
            var pattern = new AbLine {
                GuidancePatternType = GuidancePatternTypeEnum.AbLine
            };

            var pointNodes = lineNode.SelectNodes("PNT");

            if (pointNodes.Count != 2)
            {
                return(null);
            }

            var aPointNode = pointNodes[0];
            var bPointNode = pointNodes[1];

            pattern.A = ShapeLoader.LoadPoint(aPointNode);
            pattern.B = ShapeLoader.LoadPoint(bPointNode);
            if (pattern.A == null || pattern.B == null)
            {
                return(null);
            }

            pattern.Heading = GetHeading(inputNode.GetXmlNodeValue("@G"));
            return(pattern);
        }
Example #2
0
        private static GuidancePattern LoadGuidancePattern(XmlNode inputNode, out string patternId)
        {
            patternId = inputNode.GetXmlNodeValue("@A");
            if (string.IsNullOrEmpty(patternId))
            {
                return(null);
            }

            GuidancePattern pattern = GetPattern(inputNode);

            if (pattern == null)
            {
                return(null);
            }

            pattern.Description = inputNode.GetXmlNodeValue(@"B");

            pattern.PropagationDirection = GetPropagationDirection(inputNode.GetXmlNodeValue("@E"));
            pattern.BoundingPolygon      = ShapeLoader.LoadPolygon(inputNode.SelectNodes("PLN[0]"));
            pattern.Extension            = GetExtension(inputNode.GetXmlNodeValue("@F"));
            pattern.GpsSource            = GetGpsSource(inputNode);
            pattern.OriginalEpsgCode     = inputNode.GetXmlNodeValue("@M");

            return(pattern);
        }
Example #3
0
        private static AbCurve LoadAbCurvePattern(XmlNode inputNode, XmlNode lineNode)
        {
            var pattern = new AbCurve {
                GuidancePatternType = GuidancePatternTypeEnum.AbCurve
            };

            var pointNodes = lineNode.SelectNodes("PNT");

            if (pointNodes.Count == 0)
            {
                return(null);
            }

            var line = ShapeLoader.LoadLine(pointNodes);

            if (line != null)
            {
                pattern.Shape = new List <LineString>();
                pattern.Shape.Add(line);
            }

            pattern.Heading = GetHeading(inputNode.GetXmlNodeValue("@G"));

            return(pattern);
        }
Example #4
0
        private static APlus LoadAPlusPattern(XmlNode inputNode, XmlNode lineNode)
        {
            var pattern = new APlus {
                GuidancePatternType = GuidancePatternTypeEnum.APlus
            };

            var pointNodes = lineNode.SelectNodes("PNT");

            if (pointNodes.Count != 1)
            {
                return(null);
            }

            var aPointNode = pointNodes[0];

            pattern.Point = ShapeLoader.LoadPoint(aPointNode);
            if (pattern.Point == null)
            {
                return(null);
            }

            pattern.Heading = GetHeading(inputNode.GetXmlNodeValue("@G"));

            return(pattern);
        }
Example #5
0
        private void LoadFieldBoundary(XmlNode inputNode, Field field)
        {
            var polygon = ShapeLoader.LoadPolygon(inputNode.SelectNodes("PLN"));

            if (polygon != null)
            {
                var fieldBoundary = new FieldBoundary
                {
                    FieldId     = field.Id.ReferenceId,
                    SpatialData = polygon,
                };

                _taskDocument.FieldBoundaries.Add(fieldBoundary);

                field.ActiveBoundaryId = fieldBoundary.Id.ReferenceId;
            }
        }
Example #6
0
        private static Spiral LoadSpiralPattern(XmlNode lineNode)
        {
            var pattern = new Spiral {
                GuidancePatternType = GuidancePatternTypeEnum.Spiral
            };

            var pointNodes = lineNode.SelectNodes("PNT");

            if (pointNodes.Count == 0)
            {
                return(null);
            }

            pattern.Shape = ShapeLoader.LoadLine(pointNodes);

            return(pattern);
        }
Example #7
0
        private static GuidanceGroupDescriptor LoadGuidanceGroup(XmlNode inputNode, out string groupId)
        {
            groupId = inputNode.GetXmlNodeValue("@A");
            if (string.IsNullOrEmpty(groupId))
            {
                return(null);
            }

            var group = new GuidanceGroup();

            group.Description = inputNode.GetXmlNodeValue(@"B");

            group.BoundingPolygon = ShapeLoader.LoadPolygon(inputNode.SelectNodes("PLN[0]"));

            var patterns = GuidancePatternLoader.LoadGuidancePatterns(inputNode.SelectNodes("GPN"));

            group.GuidancePatternIds = patterns.Values.Select(x => x.Id.ReferenceId).ToList();

            return(new GuidanceGroupDescriptor(group, patterns));
        }
Example #8
0
        private static CenterPivot LoadCenterPivotPattern(XmlNode lineNode)
        {
            var pattern = new CenterPivot {
                GuidancePatternType = GuidancePatternTypeEnum.CenterPivot
            };

            var pointNodes = lineNode.SelectNodes("PNT");

            if (pointNodes.Count < 1 || pointNodes.Count > 3)
            {
                return(null);
            }

            pattern.Center = ShapeLoader.LoadPoint(pointNodes[0]);
            if (pattern.Center == null)
            {
                return(null);
            }

            pattern.StartPoint = pointNodes.Count > 1 ? ShapeLoader.LoadPoint(pointNodes[1]) : null;
            pattern.EndPoint   = pointNodes.Count > 2 ? ShapeLoader.LoadPoint(pointNodes[2]) : null;

            return(pattern);
        }