Exemple #1
0
        public GuidanceGroup ImportGuidanceGroup(ISOGuidanceGroup isoGuidanceGroup)
        {
            GuidanceGroup adaptGroup = new GuidanceGroup();

            //ID
            ImportIDs(adaptGroup.Id, isoGuidanceGroup.GuidanceGroupId);

            //Description
            adaptGroup.Description = isoGuidanceGroup.GuidanceGroupDesignator;

            //Patterns
            if (isoGuidanceGroup.GuidancePatterns.Any())
            {
                GuidancePatternMapper patternMapper = new GuidancePatternMapper(TaskDataMapper);
                adaptGroup.GuidancePatternIds = patternMapper.ImportGuidancePatterns(isoGuidanceGroup.GuidancePatterns).Select(p => p.Id.ReferenceId).ToList();
            }

            //Boundaries
            if (isoGuidanceGroup.BoundaryPolygons != null)
            {
                PolygonMapper polygonMapper = new PolygonMapper(TaskDataMapper);
                adaptGroup.BoundingPolygon          = new MultiPolygon();
                adaptGroup.BoundingPolygon.Polygons = new List <Polygon>();
                adaptGroup.BoundingPolygon.Polygons.AddRange(polygonMapper.ImportBoundaryPolygons(isoGuidanceGroup.BoundaryPolygons));
            }

            return(adaptGroup);
        }
Exemple #2
0
        public ISOGuidanceGroup ExportGuidanceGroup(GuidanceGroup adaptGuidanceGroup)
        {
            ISOGuidanceGroup isoGroup = new ISOGuidanceGroup();

            //ID
            string id = adaptGuidanceGroup.Id.FindIsoId() ?? GenerateId();

            isoGroup.GuidanceGroupId = id;
            ExportIDs(adaptGuidanceGroup.Id, id);

            //Designator
            isoGroup.GuidanceGroupDesignator = adaptGuidanceGroup.Description;

            //Patterns
            if (adaptGuidanceGroup.GuidancePatternIds.Any())
            {
                List <GuidancePattern> patterns = new List <GuidancePattern>();
                foreach (int adaptID in adaptGuidanceGroup.GuidancePatternIds)
                {
                    GuidancePattern adaptPattern = DataModel.Catalog.GuidancePatterns.SingleOrDefault(p => p.Id.ReferenceId == adaptID);
                    if (adaptPattern != null)
                    {
                        patterns.Add(adaptPattern);
                    }
                }
                GuidancePatternMapper patternMapper = TaskDataMapper.GuidancePatternMapper;
                isoGroup.GuidancePatterns = patternMapper.ExportGuidancePatterns(patterns).ToList();
            }

            //Boundaries
            if (adaptGuidanceGroup.BoundingPolygon != null)
            {
                PolygonMapper polygonMapper = new PolygonMapper(TaskDataMapper);
                isoGroup.BoundaryPolygons = polygonMapper.ExportMultipolygon(adaptGuidanceGroup.BoundingPolygon, ISOPolygonType.Other).ToList();
            }

            return(isoGroup);
        }