Exemplo n.º 1
0
 private void AddLineToMap(MyPoint3D p1, MyPoint3D p2)
 {
     VM.LineVM l = new VM.LineVM();
     l.Locations = new LocationCollection();
     l.Locations.Add(p1.ToGeo().ToLocation());
     l.Locations.Add(p2.ToGeo().ToLocation());
     GuidanceLines.Add(l);
 }
Exemplo n.º 2
0
        void doAllFields()
        {
            if (selectedField == null)
            {
                if (Fields.Count > 0)
                {
                    selectedField = Fields.First();
                }
            }

            GuidanceLines.Clear();
            Swathes.Clear();
            AnalysisResult.Clear();
            foreach (var poly in Fields)
            {
                PointExtension.LocalLatitude = poly.Locations.Min(p => p.Latitude);

                var geoPolygon = new List <GeoPoint>();
                foreach (var p in poly.Locations)
                {
                    geoPolygon.Add(p.ToGeoPoint());
                }

                List <MyPoint3D> cartPolygon = new List <MyPoint3D>();
                foreach (var p in poly.Locations)
                {
                    cartPolygon.Add(p.ToGeoPoint().ToCart());
                }

                var lineDef = LineDefinition.GetBestLine(cartPolygon);
                var res     = AnalyzeFieldAndShowSwaths(poly, lineDef);
                if (double.IsNaN(res.AppliedArea))
                {
                    continue;
                }
                res.AppliedArea = res.AppliedArea / 10000;
                res.FieldArea   = res.FieldArea / 10000;
                //res.Savings = (res.AppliedArea - res.FieldArea) * CostHa;
                res.SectionSaving = (res.AppliedArea - res.FieldArea) * CostHa * (1 - 1.0 / NumberOfSections);
                res.SectionLoss   = (res.AppliedArea - res.FieldArea) * CostHa - res.SectionSaving;
                res.FieldName     = (AnalysisResult.Count + 1).ToString();
                AnalysisResult.Add(res);
            }
            AppliedArea   = AnalysisResult.Sum(r => r.AppliedArea);
            FieldArea     = AnalysisResult.Sum(r => r.FieldArea);
            SectionSaving = AnalysisResult.Sum(r => r.SectionSaving);
            SectionLoss   = AnalysisResult.Sum(r => r.SectionLoss);

            double totalNozzleSaving = (AppliedArea - FieldArea) * CostHa * (1 - 1.0 / NumberOfNozzles);

            NozzleSaving = totalNozzleSaving - SectionSaving;
            NozzleLoss   = (AppliedArea - FieldArea) * CostHa - totalNozzleSaving;

            SectionPaybackHa = SectionControlPrice / (SectionSaving / AppliedArea);
            NozzlePaybackHa  = (NozzleControlPrice - SectionControlPrice) / (NozzleSaving / AppliedArea);
        }
Exemplo n.º 3
0
 private void AddHeadLandToMap(List <MyPoint3D> headLand)
 {
     VM.LineVM line = new LineVM();
     line.Locations = new LocationCollection();
     foreach (var p in headLand)
     {
         line.Locations.Add(p.ToGeo().ToLocation());
     }
     GuidanceLines.Add(line);
 }
Exemplo n.º 4
0
        void processField()
        {
            PointExtension.LocalLatitude = selectedField.Locations.Min(p => p.Latitude);
            LineDefinition lineDef_AB = LineDefinition.GetLineDefinition(flagA.Location.ToGeoPoint().ToCart(), flagB.Location.ToGeoPoint().ToCart());

            GuidanceLines.Clear();
            Swathes.Clear();
            AnalysisResult res = AnalyzeFieldAndShowSwaths(selectedField, lineDef_AB);

            AppliedArea = res.AppliedArea / 10000;
            FieldArea   = res.FieldArea / 10000;
            //Savings = (res.AppliedArea - res.FieldArea) / 10000 * CostHa;
            SectionSaving = (res.AppliedArea - res.FieldArea) / 10000 * CostHa * (1 - 1.0 / NumberOfSections);
            SectionLoss   = (res.AppliedArea - res.FieldArea) / 10000 * CostHa - SectionSaving;

            double totalNozzleSaving = (res.AppliedArea - res.FieldArea) / 10000 * CostHa * (1 - 1.0 / NumberOfNozzles);

            NozzleSaving = totalNozzleSaving - SectionSaving;
            NozzleLoss   = (res.AppliedArea - res.FieldArea) / 10000 * CostHa - totalNozzleSaving;

            SectionPaybackHa = SectionControlPrice / (SectionSaving / AppliedArea);
            NozzlePaybackHa  = (NozzleControlPrice - SectionControlPrice) / (NozzleSaving / AppliedArea);
        }