Exemplo n.º 1
0
        public ISOLineString ExportLinearRing(LinearRing ring, ISOLineStringType lsgType)
        {
            ISOLineString lineString = new ISOLineString();

            lineString.LineStringType = lsgType;

            ISOPointType pointType = ISOPointType.Other;

            switch (lsgType)
            {
            case ISOLineStringType.PolygonExterior:
            case ISOLineStringType.PolygonInterior:
                pointType = ISOPointType.PartfieldReference;
                break;

            case ISOLineStringType.GuidancePattern:
                pointType = ISOPointType.GuidancePoint;
                break;

            case ISOLineStringType.Flag:
                pointType = ISOPointType.Flag;
                break;

            case ISOLineStringType.Obstacle:
                pointType = ISOPointType.Obstacle;
                break;
            }

            PointMapper pointMapper = new PointMapper(TaskDataMapper);

            lineString.Points = pointMapper.ExportPoints(ring.Points, pointType).ToList();
            return(lineString);
        }
Exemplo n.º 2
0
        public IEnumerable <ISOPoint> ExportPoints(IEnumerable <Point> adaptPoints, ISOPointType pointType)
        {
            List <ISOPoint> points = new List <ISOPoint>();

            foreach (Point adaptPoint in adaptPoints)
            {
                ISOPoint point = ExportPoint(adaptPoint, pointType);
                points.Add(point);
            }
            return(points);
        }
Exemplo n.º 3
0
        public ISOPoint ExportPoint(Point adaptPoint, ISOPointType pointType)
        {
            ISOPoint point = new ISOPoint();

            point.PointEast  = Convert.ToDecimal(adaptPoint.X);
            point.PointNorth = Convert.ToDecimal(adaptPoint.Y);
            if (adaptPoint.Z.HasValue)
            {
                point.PointUp = (int)(adaptPoint.Z);
            }
            point.PointType = pointType;
            return(point);
        }
Exemplo n.º 4
0
        public ISOLineString ExportLinearRing(LinearRing ring, ISOLineStringType lsgType)
        {
            ISOLineString lineString = new ISOLineString(TaskDataMapper.Version);

            lineString.LineStringType = lsgType;

            ISOPointType pointType = ISOPointType.Other;

            if (TaskDataMapper.Version > 3)
            {
                switch (lsgType)
                {
                case ISOLineStringType.PolygonExterior:
                case ISOLineStringType.PolygonInterior:
                    pointType = ISOPointType.PartfieldReference;
                    break;

                case ISOLineStringType.GuidancePattern:
                    pointType = ISOPointType.GuidancePoint;
                    break;

                case ISOLineStringType.Flag:
                    pointType = ISOPointType.Flag;
                    break;

                case ISOLineStringType.Obstacle:
                    pointType = ISOPointType.Obstacle;
                    break;
                }
            }
            else if (lineString.LineStringType == ISOLineStringType.Flag)
            {
                //Flag & Other (default) are the only 2 options for version 3
                pointType = ISOPointType.Flag;
            }

            PointMapper pointMapper = new PointMapper(TaskDataMapper);

            lineString.Points = pointMapper.ExportPoints(ring.Points, pointType).ToList();
            return(lineString);
        }
Exemplo n.º 5
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);
        }