Exemple #1
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);
        }
Exemple #2
0
        private void AddSwathToMap(MyPoint3D p1, MyPoint3D p2, double width)
        {
            VM.PolygonVM polygon = new VM.PolygonVM();
            polygon.Fill         = new SolidColorBrush(Colors.Blue);
            polygon.Fill.Opacity = 0.3;
            polygon.Locations    = new LocationCollection();

            MyPoint3D n  = (p2 - p1).Normalize();
            MyPoint3D np = new MyPoint3D(n.Y, -n.X, 0);

            polygon.Locations.Add((p1 + (np * (width / 2))).ToGeo().ToLocation());
            polygon.Locations.Add((p2 + (np * (width / 2))).ToGeo().ToLocation());
            polygon.Locations.Add((p2 - (np * (width / 2))).ToGeo().ToLocation());
            polygon.Locations.Add((p1 - (np * (width / 2))).ToGeo().ToLocation());

            Swathes.Add(polygon);
        }
Exemple #3
0
        private void AddOuterSwathToMap(List <MyPoint3D> boundary, List <MyPoint3D> innerBoundary)
        {
            VM.PolygonVM polygon = new VM.PolygonVM();
            polygon.Fill         = new SolidColorBrush(Colors.Blue);
            polygon.Fill.Opacity = 0.3;
            polygon.Locations    = new LocationCollection();
            foreach (var p in boundary)
            {
                polygon.Locations.Add(p.ToGeo().ToLocation());
            }
            polygon.Locations.Add(polygon.Locations.First());

            polygon.Locations.Add(innerBoundary.First().ToGeo().ToLocation());
            for (int i = innerBoundary.Count - 1; i >= 0; i--)
            {
                polygon.Locations.Add(innerBoundary[i].ToGeo().ToLocation());
            }

            Swathes.Add(polygon);
        }
Exemple #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);
        }