Exemplo n.º 1
0
        public Feature MapAsSingleFeature(APlus guidancePatternAdapt)
        {
            Point point = PointMapper.MapPoint2Point(guidancePatternAdapt.Point, _properties.AffineTransformation);

            _featProps.Add("Heading", guidancePatternAdapt.Heading.ToString());
            return(new Feature(point, _featProps));
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public static void SetMinMax(this APlus aPlus, DrawingUtil drawingUtil)
        {
            var points = new List <Point> {
                aPlus.Point.ToUtm()
            };

            SetMinMax(drawingUtil, points);
        }
Exemplo n.º 4
0
        private static void WriteAplus(XmlWriter writer, APlus aPlus)
        {
            var line = new LineString {
                Points = new List <Point>()
            };

            line.Points.Add(aPlus.Point);

            ShapeWriter.WriteLine(writer, line, "5");
        }
Exemplo n.º 5
0
 private void ProcessAPlus(APlus aPlus)
 {
     var delta          = _drawingUtil.GetDelta();
     var projectedPoint = aPlus.Point;
 }
Exemplo n.º 6
0
        public ISOGuidancePattern ExportGuidancePattern(GuidancePattern adaptGuidancePattern)
        {
            ISOGuidancePattern gpn = new ISOGuidancePattern();

            //ID
            string gpnID = adaptGuidancePattern.Id.FindIsoId() ?? GenerateId();

            gpn.GuidancePatternId = gpnID;
            ExportIDs(adaptGuidancePattern.Id, gpnID);

            gpn.GuidancePatternDesignator = adaptGuidancePattern.Description;
            gpn.GuidancePatternType       = ExportGuidancePatternType(adaptGuidancePattern.GuidancePatternType);
            gpn.PropagationDirection      = ExportPropagationDirection(adaptGuidancePattern.PropagationDirection);
            gpn.Extension           = ExportExtension(adaptGuidancePattern.Extension);
            gpn.Heading             = ExportHeading(adaptGuidancePattern);
            gpn.GNSSMethod          = ExportGNSSMethod(adaptGuidancePattern.GpsSource.SourceType);
            gpn.HorizontalAccuracy  = (decimal)adaptGuidancePattern.GpsSource.HorizontalAccuracy.AsConvertedDouble("m");
            gpn.VerticalAccuracy    = (decimal)adaptGuidancePattern.GpsSource.VerticalAccuracy.AsConvertedDouble("m");
            gpn.OriginalSRID        = adaptGuidancePattern.OriginalEpsgCode;
            gpn.NumberOfSwathsLeft  = (uint?)adaptGuidancePattern.NumbersOfSwathsLeft;
            gpn.NumberOfSwathsRight = (uint?)adaptGuidancePattern.NumbersOfSwathsRight;

            //Pattern
            LineStringMapper lineStringMapper = new LineStringMapper(TaskDataMapper);

            switch (adaptGuidancePattern.GuidancePatternType)
            {
            case GuidancePatternTypeEnum.AbCurve:
                AbCurve curve = adaptGuidancePattern as AbCurve;
                gpn.LineString = lineStringMapper.ExportLineString(curve.Shape[0], ISOLineStringType.GuidancePattern);     //Only first linestring used.
                break;

            case GuidancePatternTypeEnum.AbLine:
                AbLine     abLine = adaptGuidancePattern as AbLine;
                LineString line   = new LineString {
                    Points = new List <Point>()
                };
                line.Points.Add(abLine.A);
                line.Points.Add(abLine.B);
                gpn.LineString = lineStringMapper.ExportLineString(line, ISOLineStringType.GuidancePattern);
                break;

            case GuidancePatternTypeEnum.APlus:
                APlus      aPlus     = adaptGuidancePattern as APlus;
                LineString aPlusLine = new LineString {
                    Points = new List <Point>()
                };
                aPlusLine.Points.Add(aPlus.Point);
                gpn.LineString = lineStringMapper.ExportLineString(aPlusLine, ISOLineStringType.GuidancePattern);
                break;

            case GuidancePatternTypeEnum.CenterPivot:
                PivotGuidancePattern pivot     = adaptGuidancePattern as PivotGuidancePattern;
                LineString           pivotLine = new LineString {
                    Points = new List <Point>()
                };
                pivotLine.Points.Add(pivot.Center);

                if (pivot.StartPoint != null)
                {
                    pivotLine.Points.Add(pivot.StartPoint);
                    if (pivot.EndPoint != null)
                    {
                        pivotLine.Points.Add(pivot.EndPoint);
                    }
                }
                gpn.LineString = lineStringMapper.ExportLineString(pivotLine, ISOLineStringType.GuidancePattern);
                //gpn.Radius = ?  //Not implemented
                //gpn.GuidancePatternOptions = ? //Not implemented
                break;

            case GuidancePatternTypeEnum.Spiral:
                Spiral spiral = adaptGuidancePattern as Spiral;
                gpn.LineString = lineStringMapper.ExportLineString(spiral.Shape, ISOLineStringType.GuidancePattern);
                break;
            }

            //Boundary
            if (adaptGuidancePattern.BoundingPolygon != null)
            {
                PolygonMapper polygonMapper = new PolygonMapper(TaskDataMapper);
                gpn.BoundaryPolygons = polygonMapper.ExportPolygons(adaptGuidancePattern.BoundingPolygon.Polygons, ISOPolygonType.Other).ToList();
            }

            return(gpn);
        }
Exemplo n.º 7
0
        public GuidancePattern ImportGuidancePattern(ISOGuidancePattern isoGuidancePattern)
        {
            GuidancePattern  pattern          = null;
            LineStringMapper lineStringMapper = new LineStringMapper(TaskDataMapper);
            PointMapper      pointMapper      = new PointMapper(TaskDataMapper);

            switch (isoGuidancePattern.GuidancePatternType)
            {
            case ISOGuidancePatternType.AB:
                pattern = new AbLine();
                AbLine abLine = pattern as AbLine;
                abLine.A = pointMapper.ImportPoint(isoGuidancePattern.LineString.Points.First());
                abLine.B = pointMapper.ImportPoint(isoGuidancePattern.LineString.Points.Last());
                break;

            case ISOGuidancePatternType.APlus:
                pattern = new APlus();
                APlus aPlus = pattern as APlus;
                aPlus.Point = pointMapper.ImportPoint(isoGuidancePattern.LineString.Points.First());
                break;

            case ISOGuidancePatternType.Curve:
                pattern = new AbCurve();
                AbCurve abCurve = pattern as AbCurve;
                abCurve.Shape = new List <LineString>()
                {
                    lineStringMapper.ImportLineString(isoGuidancePattern.LineString)
                };                                                                                                               //As with export, we only have 1 linestring.
                break;

            case ISOGuidancePatternType.Pivot:
                pattern = new PivotGuidancePattern();
                PivotGuidancePattern pivot = pattern as PivotGuidancePattern;
                pivot.Center = pointMapper.ImportPoint(isoGuidancePattern.LineString.Points.First());
                if (isoGuidancePattern.LineString.Points.Count == 3)
                {
                    pivot.StartPoint = pointMapper.ImportPoint(isoGuidancePattern.LineString.Points[1]);
                    pivot.EndPoint   = pointMapper.ImportPoint(isoGuidancePattern.LineString.Points[2]);
                }
                //Radius & GuidancePatternOptions not implemented in ADAPT
                break;

            case ISOGuidancePatternType.Spiral:
                pattern = new Spiral();
                Spiral spiral = pattern as Spiral;
                spiral.Shape = lineStringMapper.ImportLineString(isoGuidancePattern.LineString);
                break;
            }

            //ID
            ImportIDs(pattern.Id, isoGuidancePattern.GuidancePatternId);

            pattern.Description          = isoGuidancePattern.GuidancePatternDesignator;
            pattern.GuidancePatternType  = ImportGuidancePatternType(isoGuidancePattern.GuidancePatternType);
            pattern.PropagationDirection = ImportPropagationDirection(isoGuidancePattern.PropagationDirection);
            pattern.Extension            = ImportExtension(isoGuidancePattern.Extension);

            //Heading
            if (isoGuidancePattern.Heading.HasValue)
            {
                double heading = Convert.ToDouble(isoGuidancePattern.Heading.Value);
                if (pattern is AbLine)
                {
                    (pattern as AbLine).Heading = heading;
                }
                if (pattern is AbCurve)
                {
                    (pattern as AbCurve).Heading = heading;
                }
                if (pattern is APlus)
                {
                    (pattern as APlus).Heading = heading;
                }
            }

            pattern.GpsSource                    = new GpsSource();
            pattern.GpsSource.SourceType         = ImportGNSSMethod(isoGuidancePattern.GNSSMethod);
            pattern.GpsSource.HorizontalAccuracy = GetAccuracy(isoGuidancePattern.HorizontalAccuracy);
            pattern.GpsSource.VerticalAccuracy   = GetAccuracy(isoGuidancePattern.VerticalAccuracy);

            pattern.NumbersOfSwathsLeft  = (int?)(isoGuidancePattern.NumberOfSwathsLeft);
            pattern.NumbersOfSwathsRight = (int?)(isoGuidancePattern.NumberOfSwathsRight);
            pattern.OriginalEpsgCode     = isoGuidancePattern.OriginalSRID;

            return(pattern);
        }
Exemplo n.º 8
0
        public ISOLineString ExportGuidancePattern(GuidancePattern adaptGuidancePattern)
        {
            ISOLineString lineString = new ISOLineString(TaskDataMapper.Version);

            lineString.LineStringType = ISOLineStringType.GuidancePattern;

            PointMapper pointMapper = new PointMapper(TaskDataMapper);

            List <Point> adaptPoints;

            switch (adaptGuidancePattern.GuidancePatternType)
            {
            case GuidancePatternTypeEnum.AbCurve:
                AbCurve curve = adaptGuidancePattern as AbCurve;
                adaptPoints = curve.Shape[0].Points;     //Only first linestring used.
                break;

            case GuidancePatternTypeEnum.AbLine:
                AbLine abLine = adaptGuidancePattern as AbLine;
                adaptPoints = new List <Point>();
                adaptPoints.Add(abLine.A);
                adaptPoints.Add(abLine.B);
                break;

            case GuidancePatternTypeEnum.APlus:
                APlus aPlus = adaptGuidancePattern as APlus;
                adaptPoints = new List <Point>();
                adaptPoints.Add(aPlus.Point);
                break;

            case GuidancePatternTypeEnum.CenterPivot:
                PivotGuidancePattern pivot = adaptGuidancePattern as PivotGuidancePattern;
                adaptPoints = new List <Point>();
                lineString.Points.Add(pointMapper.ExportPoint(pivot.Center, ISOPointType.GuidanceReferenceCenter));

                if (pivot.DefinitionMethod == PivotGuidanceDefinitionEnum.PivotGuidancePatternStartEndCenter &&
                    pivot.StartPoint != null &&
                    pivot.EndPoint != null)
                {
                    adaptPoints.Add(pivot.StartPoint);
                    adaptPoints.Add(pivot.EndPoint);
                }
                break;

            case GuidancePatternTypeEnum.Spiral:
                Spiral spiral = adaptGuidancePattern as Spiral;
                adaptPoints = spiral.Shape.Points;
                break;

            default:
                return(null);
            }

            for (int i = 0; i < adaptPoints.Count; i++)
            {
                ISOPointType pointType = i == 0
                    ? ISOPointType.GuidanceReferenceA
                    : (i == adaptPoints.Count - 1
                        ? ISOPointType.GuidanceReferenceB
                        : ISOPointType.GuidancePoint);

                lineString.Points.Add(pointMapper.ExportPoint(adaptPoints[i], pointType));
            }

            return(lineString);
        }
        public GuidancePattern ImportGuidancePattern(ISOGuidancePattern isoGuidancePattern)
        {
            GuidancePattern pattern = null;

            switch (isoGuidancePattern.GuidancePatternType)
            {
            case ISOGuidancePatternType.AB:
                pattern = new AbLine();
                break;

            case ISOGuidancePatternType.APlus:
                pattern = new APlus();
                break;

            case ISOGuidancePatternType.Curve:
                pattern = new AbCurve();
                break;

            case ISOGuidancePatternType.Pivot:
                pattern = new PivotGuidancePattern();
                break;

            case ISOGuidancePatternType.Spiral:
                pattern = new Spiral();
                break;
            }

            //ID
            ImportIDs(pattern.Id, isoGuidancePattern.GuidancePatternId);

            pattern.Description          = isoGuidancePattern.GuidancePatternDesignator;
            pattern.GuidancePatternType  = ImportGuidancePatternType(isoGuidancePattern.GuidancePatternType);
            pattern.PropagationDirection = ImportPropagationDirection(isoGuidancePattern.PropagationDirection);
            pattern.Extension            = ImportExtension(isoGuidancePattern.Extension);

            //Heading
            if (isoGuidancePattern.Heading.HasValue)
            {
                double heading = Convert.ToDouble(isoGuidancePattern.Heading.Value);
                if (pattern is AbLine)
                {
                    (pattern as AbLine).Heading = heading;
                }
                if (pattern is AbCurve)
                {
                    (pattern as AbCurve).Heading = heading;
                }
                if (pattern is APlus)
                {
                    (pattern as APlus).Heading = heading;
                }
            }

            pattern.GpsSource                    = new GpsSource();
            pattern.GpsSource.SourceType         = ImportGNSSMethod(isoGuidancePattern.GNSSMethod);
            pattern.GpsSource.HorizontalAccuracy = GetAccuracy(isoGuidancePattern.HorizontalAccuracy);
            pattern.GpsSource.VerticalAccuracy   = GetAccuracy(isoGuidancePattern.VerticalAccuracy);

            pattern.NumbersOfSwathsLeft  = (int?)(isoGuidancePattern.NumberOfSwathsLeft);
            pattern.NumbersOfSwathsRight = (int?)(isoGuidancePattern.NumberOfSwathsRight);
            pattern.OriginalEpsgCode     = isoGuidancePattern.OriginalSRID;

            return(pattern);
        }