コード例 #1
0
        private List <RxCellLookup> ImportRatesFromTreatmentZones(GridDescriptor gridDescriptor, IEnumerable <ISOTreatmentZone> treatmentZones, List <int> productIds, RasterGridPrescription prescription)
        {
            var rates = new List <RxCellLookup>();

            foreach (var treatmentZoneCode in gridDescriptor.TreatmentZoneCodes)
            {
                ISOTreatmentZone treatmentZone = treatmentZones.FirstOrDefault(t => t.TreatmentZoneCode == treatmentZoneCode);
                if (treatmentZone == null)
                {
                    return(null);
                }

                var lookup = new RxCellLookup {
                    RxRates = new List <RxRate>()
                };
                foreach (ISOProcessDataVariable pdv in treatmentZone.ProcessDataVariables)
                {
                    if (!string.IsNullOrEmpty(pdv.ProductIdRef))
                    {
                        int?productID = TaskDataMapper.InstanceIDMap.GetADAPTID(pdv.ProductIdRef);
                        if (productID.HasValue)
                        {
                            lookup.RxRates.Add(PrescriptionMapper.ImportAndConvertRate(productID.Value, pdv, prescription));
                        }
                    }
                }

                rates.Add(lookup);
            }

            return(rates);
        }
コード例 #2
0
        public VectorPrescription ImportVectorPrescription(ISOTask task, WorkItem workItem)
        {
            VectorPrescription vectorRx = new VectorPrescription();

            ImportSharedPrescriptionProperties(task, workItem, vectorRx);
            vectorRx.RxShapeLookups = new List <RxShapeLookup>();
            foreach (ISOTreatmentZone treatmentZone in task.TreatmentZones)
            {
                RxShapeLookup shapeLookup = new RxShapeLookup();

                //Rates
                shapeLookup.Rates = new List <RxRate>();
                foreach (ISOProcessDataVariable pdv in treatmentZone.ProcessDataVariables)
                {
                    int?productID = TaskDataMapper.InstanceIDMap.GetADAPTID(pdv.ProductIdRef);
                    if (productID.HasValue)
                    {
                        shapeLookup.Rates.Add(PrescriptionMapper.ImportAndConvertRate(productID.Value, pdv, vectorRx));
                    }
                }

                //Shapes
                PolygonMapper polygonMapper = new PolygonMapper(TaskDataMapper);
                shapeLookup.Shape          = new MultiPolygon();
                shapeLookup.Shape.Polygons = polygonMapper.ImportPolygons(treatmentZone.Polygons).ToList();

                //Add to the collection
                vectorRx.RxShapeLookups.Add(shapeLookup);
            }

            return(vectorRx);
        }