Ejemplo n.º 1
0
        public void SetLocation(FactLocation loc, int level)
        {
            this.Text = "Individuals & Families with connection to " + loc.ToString();
            level     = Math.Min(loc.Level, level); // if location level isn't as detailed as level on tab use location level
            IEnumerable <Individual> listInd = ft.GetIndividualsAtLocation(loc, level);
            SortableBindingList <IDisplayIndividual> dsInd = new SortableBindingList <IDisplayIndividual>();

            foreach (Individual i in listInd)
            {
                dsInd.Add(i);
            }
            dgIndividuals.DataSource = dsInd;
            SortIndividuals();

            IEnumerable <Family> listFam = ft.GetFamiliesAtLocation(loc, level);
            SortableBindingList <IDisplayFamily> dsFam = new SortableBindingList <IDisplayFamily>();

            foreach (Family f in listFam)
            {
                dsFam.Add(f);
            }
            dgFamilies.DataSource = dsFam;
            SortFamilies();
            splitContainer.Panel2Collapsed = false;
            UpdateStatusCount();
        }
Ejemplo n.º 2
0
        void BuildMap()
        {
            if (isloading)
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            clusters.Clear();
            dgFacts.DataSource = null;
            List <IDisplayFact> displayFacts            = new List <IDisplayFact>();
            List <Individual>   list                    = new List <Individual>();
            List <Tuple <FactLocation, int> > locations = new List <Tuple <FactLocation, int> >();

            foreach (TreeNode node in tvPlaces.SelectedNodes)
            {
                Tuple <FactLocation, int> location = new Tuple <FactLocation, int>((FactLocation)node.Tag, node.Level);
                list.AddRange(ft.GetIndividualsAtLocation(location.Item1, location.Item2));
                locations.Add(location);
            }
            if (list.Count == 0)
            {
                Cursor = Cursors.Default;
                RefreshClusters();
                return;
            }
            int count = 0;

            progressbar.Visible = true;
            progressbar.Maximum = list.Count;
            foreach (Individual ind in list)
            {
                foreach (DisplayFact dispfact in ind.AllGeocodedFacts)
                {
                    foreach (Tuple <FactLocation, int> location in locations)
                    {
                        if (dispfact.Location.CompareTo(location.Item1, location.Item2) == 0)
                        {
                            displayFacts.Add(dispfact);
                            MapLocation loc = new MapLocation(ind, dispfact.Fact, dispfact.FactDate);
                            loc.AddFeatureDataRow(clusters.FactLocations);
                            break;
                        }
                    }
                }
                progressbar.Value = ++count;
                txtCount.Text     = $"Processed {count} Individuals from list of {list.Count}";
                Application.DoEvents();
            }
            progressbar.Visible = false;
            txtCount.Text       = $"Downloading map tiles and computing clusters for {displayFacts.Count} facts. Please wait";
            Application.DoEvents();
            dgFacts.DataSource = new SortableBindingList <IDisplayFact>(displayFacts);

            Envelope expand = mh.GetExtents(clusters.FactLocations);

            mapBox1.Map.ZoomToBox(expand);
            mapBox1.ActiveTool = SharpMap.Forms.MapBox.Tools.Pan;
            RefreshClusters();
            txtCount.Text = $"{dgFacts.RowCount} Geolocated fact(s) displayed";
            Cursor        = Cursors.Default;
        }