Ejemplo n.º 1
0
        private void showStatistics()
        {
            GraphValues.Clear();


            double tempDouble, maxValue = 0;

            for (int i = 0; i < StatisticalRelocations.Count; i++)
            {
                foreach (Report report in ShownReports)
                {
                    if (report.ClusterIdNumber == i)
                    {
                        tempDouble = report.GetCoordinate().GetDistanceTo(StatisticalRelocation[i]);
                        if (tempDouble > maxValue)
                        {
                            maxValue = tempDouble / 1000;
                        }
                    }
                }
                GraphValues.Add(maxValue);
            }
        }
Ejemplo n.º 2
0
        private void fetchReport(int reportId)
        {
            //showKMeansResult();

            foreach (Report rep in ShownReports)
            {
                if (rep.ReportID == reportId)
                {
                    SelectedReport.Address         = rep.Address;
                    SelectedReport.FallingTime     = rep.FallingTime;
                    SelectedReport.LatLongLocation = rep.LatLongLocation;
                    SelectedReport.NumberOfBooms   = rep.NumberOfBooms;
                    SelectedReport.ReporterID      = rep.ReporterID;
                    SelectedReport.ReportID        = rep.ReportID;
                    SelectedReport.Updated         = rep.Updated;



                    Reporter tempRep = FactoryDal.GetDal().GetReporter(SelectedReport.ReporterID);

                    Reporter.LatLongReporterLocation = tempRep.LatLongReporterLocation;
                    Reporter.ReporterAddress         = tempRep.ReporterAddress;
                    Reporter.ReporterID             = tempRep.ReporterID;
                    Reporter.ReporterName           = tempRep.ReporterName;
                    Reporter.ReporterProfilePicture = tempRep.ReporterProfilePicture;

                    GraphValues.Clear();


                    double distance = 0;
                    for (int i = 0; i < StatisticalRelocations.Count; i++)
                    {
                        if (rep.ClusterIdNumber == i)

                        {
                            try
                            {
                                Idal          dal      = FactoryDal.GetDal();
                                UpdatedReport upReport = dal.GetUpdatedReport(rep.ReportID);
                                double        lon      = getLong(upReport.NewCoordinates);
                                double        lat      = getLat(upReport.NewCoordinates);
                                GeoCoordinate g        = new GeoCoordinate(lat, lon);

                                distance = g.GetDistanceTo(StatisticalRelocation[i]) / 1000;

                                string[] latLong = upReport.NewCoordinates.ToString().Split(',');

                                Details1 = ReverseGeoCoding(latLong[0], latLong[1]);

                                string[] latLong2 = StatisticalRelocations[i].ToString().Split(',');

                                Details2 = ReverseGeoCoding(latLong2[0], latLong2[1]);

                                SelectedReport.Details1 = details1;
                                SelectedReport.Details2 = details2;
                            }
                            catch (Exception)
                            {
                                MessageBox.Show("The report hasn't been updated, \n please update the report first!");
                                //throw new Exception("The report not updated \n please update the report first");
                            }
                        }
                    }
                    GraphValues.Add(distance);
                    GraphValues.Add(distance);
                }
            }
        }