Esempio n. 1
0
 private void SetMinMax(GuidancePattern guidancePattern)
 {
     if (guidancePattern is APlus)
     {
         (guidancePattern as APlus).SetMinMax(_drawingUtil);
     }
     else if (guidancePattern is AbLine)
     {
         (guidancePattern as AbLine).SetMinMax(_drawingUtil);
     }
     else if (guidancePattern is AbCurve)
     {
         (guidancePattern as AbCurve).SetMinMax(_drawingUtil);
     }
     else if (guidancePattern is CenterPivot)
     {
         (guidancePattern as CenterPivot).SetMinMax(_drawingUtil);
     }
     else if (guidancePattern is MultiAbLine)
     {
         (guidancePattern as MultiAbLine).SetMinMax(_drawingUtil);
     }
     else if (guidancePattern is Spiral)
     {
         (guidancePattern as Spiral).SetMinMax(_drawingUtil);
     }
 }
Esempio n. 2
0
        public void Write(XmlWriter writer, GuidancePattern guidancePattern)
        {
            if (guidancePattern == null)
                return;

            WriteGuidancePattern(writer, guidancePattern);
        }
Esempio n. 3
0
        public void ProccessGuidancePattern(GuidancePattern guidancePattern)
        {
            using (var graphics = _spatialViewer.CreateGraphics())
            {
                _drawingUtil = new DrawingUtil(_spatialViewer.Width, _spatialViewer.Height, graphics);

                SetMinMax(guidancePattern);

                ProcessPattern(guidancePattern);
            }
        }
Esempio n. 4
0
        private static string GetHeading(GuidancePattern guidancePattern)
        {
            double? heading = null;
            switch (guidancePattern.GuidancePatternType)
            {
                case GuidancePatternTypeEnum.AbCurve:
                    heading = (guidancePattern as AbCurve).Heading;
                    break;

                case GuidancePatternTypeEnum.AbLine:
                    heading = (guidancePattern as AbLine).Heading;
                    break;

                case GuidancePatternTypeEnum.APlus:
                    heading = (guidancePattern as APlus).Heading;
                    break;
            }

            if (!heading.HasValue)
                return null;

            return heading.Value.ToString(CultureInfo.InvariantCulture);
        }
Esempio n. 5
0
 private void ProcessPattern(GuidancePattern guidancePattern)
 {
     if (guidancePattern is APlus)
     {
         ProcessAPlus(guidancePattern as APlus);
     }
     else if (guidancePattern is AbLine)
     {
         ProcessAbLine(guidancePattern as AbLine);
     }
     else if (guidancePattern is AbCurve)
     {
         ProcessAbCurve(guidancePattern as AbCurve);
     }
     else if (guidancePattern is CenterPivot)
     {
         ProcessCenterPivot(guidancePattern as CenterPivot);
     }
     else if (guidancePattern is MultiAbLine)
     {
         ProcessMultiAbLine(guidancePattern as MultiAbLine);
     }
     else if (guidancePattern is Spiral)
     {
         ProcessSpiral(guidancePattern as Spiral);
     }
 }
Esempio n. 6
0
        private void WriteGuidancePattern(XmlWriter writer, GuidancePattern guidancePattern)
        {
            var patternType = ValidateAndGetPatternType(guidancePattern);
            // Bail out for inconsistent pattern type.
            if (string.IsNullOrEmpty(patternType))
                return;

            var guidancePatternId = guidancePattern.Id.FindIsoId() ?? GenerateId();
            TaskWriter.Ids.Add(guidancePatternId, guidancePattern.Id);

            writer.WriteStartElement(XmlPrefix);
            writer.WriteAttributeString("A", guidancePatternId);
            writer.WriteXmlAttribute("B", guidancePattern.Description);
            writer.WriteAttributeString("C", patternType);
            writer.WriteXmlAttribute("D", GetPropagationDirection(guidancePattern.PropagationDirection));
            writer.WriteXmlAttribute("E", GetExtension(guidancePattern.Extension));
            writer.WriteXmlAttribute("G", GetHeading(guidancePattern));
            writer.WriteXmlAttribute("M", guidancePattern.OriginalEpsgCode);

            WriteGpsData(writer, guidancePattern.GpsSource);
            WritePattern(writer, guidancePattern);

            WriteBoundary(writer, guidancePattern.BoundingPolygon);

            writer.WriteEndElement();
        }
Esempio n. 7
0
        private static void WritePattern(XmlWriter writer, GuidancePattern guidancePattern)
        {
            switch (guidancePattern.GuidancePatternType)
            {
                case GuidancePatternTypeEnum.AbCurve:
                    WriteAbCurve(writer, guidancePattern as AbCurve);
                    break;

                case GuidancePatternTypeEnum.AbLine:
                    WriteAbLine(writer, guidancePattern as AbLine);
                    break;

                case GuidancePatternTypeEnum.APlus:
                    WriteAplus(writer, guidancePattern as APlus);
                    break;

                case GuidancePatternTypeEnum.CenterPivot:
                    WritePivot(writer, guidancePattern as CenterPivot);
                    break;

                case GuidancePatternTypeEnum.Spiral:
                    WriteSpiral(writer, guidancePattern as Spiral);
                    break;
            }
        }
Esempio n. 8
0
        private static string ValidateAndGetPatternType(GuidancePattern guidancePattern)
        {
            switch (guidancePattern.GuidancePatternType)
            {
                case GuidancePatternTypeEnum.AbLine:
                    {
                        var abLine = guidancePattern as AbLine;
                        if (abLine == null || abLine.A == null || abLine.B == null)
                            return null;
                    }
                    return "1";

                case GuidancePatternTypeEnum.APlus:
                    {
                        var aPlus = guidancePattern as APlus;
                        if (aPlus == null || aPlus.Point == null)
                            return null;
                        return "2";
                    }

                case GuidancePatternTypeEnum.AbCurve:
                    {
                        var abCurve = guidancePattern as AbCurve;
                        if (abCurve == null || abCurve.Shape == null || abCurve.Shape.Count < 1)
                            return null;
                        return "3";
                    }

                case GuidancePatternTypeEnum.CenterPivot:
                    {
                        var pivot = guidancePattern as CenterPivot;
                        if (pivot == null || pivot.Center == null)
                            return null;
                        return "4";
                    }

                case GuidancePatternTypeEnum.Spiral:
                    {
                        var spiral = guidancePattern as Spiral;
                        if (spiral == null || spiral.Shape == null)
                            return null;
                        return "5";
                    }
            }
            return null;
        }