コード例 #1
0
        public void Expand(ITVNode node)
        {
            TreeNode treeNode = node as TreeNode;

            if (treeNode != null)
            {
                treeNode.ExpandAll();
            }
        }
コード例 #2
0
        public void Expand(ITVNode node)
        {
            GKTreeNode treeNode = node as GKTreeNode;

            if (treeNode != null)
            {
                treeNode.Expanded = true;
            }
        }
コード例 #3
0
        public ITVNode AddNode(ITVNode parent, string name, object tag)
        {
            var node = new GKTreeNode(name, tag);

            if (parent == null)
            {
                fRootNode.Children.Add(node);
            }
            else
            {
                ((GKTreeNode)parent).Children.Add(node);
            }
            return(node);
        }
コード例 #4
0
        public ITVNode AddNode(ITVNode parent, string name, object tag)
        {
            var node = new GKTreeNode(name, tag);

            if (parent == null)
            {
                Control.Nodes.Add(node);
            }
            else
            {
                ((GKTreeNode)parent).Nodes.Add(node);
            }
            return(node);
        }
コード例 #5
0
        private void AddPlace(GDMPlace place, GDMCustomEvent placeEvent)
        {
            try {
                GDMLocationRecord locRec    = place.Location.Value as GDMLocationRecord;
                string            placeName = (locRec != null) ? locRec.LocationName : place.StringValue;

                ITVNode  node = fView.FindTreeNode(placeName);
                MapPlace mapPlace;

                if (node == null)
                {
                    mapPlace      = new MapPlace();
                    mapPlace.Name = placeName;
                    fPlaces.Add(mapPlace);

                    node = fView.PlacesTree.AddNode(fBaseRoot, placeName, mapPlace);

                    if (locRec == null)
                    {
                        PlacesCache.Instance.GetPlacePoints(placeName, mapPlace.Points);
                    }
                    else
                    {
                        GeoPoint pt = new GeoPoint(locRec.Map.Lati, locRec.Map.Long, placeName);
                        mapPlace.Points.Add(pt);
                    }

                    int num = mapPlace.Points.Count;
                    for (int i = 0; i < num; i++)
                    {
                        GeoPoint pt      = mapPlace.Points[i];
                        string   ptTitle = pt.Hint + string.Format(" [{0:0.000000}, {1:0.000000}]", pt.Latitude, pt.Longitude);
                        fView.PlacesTree.AddNode(node, ptTitle, pt);
                    }
                }
                else
                {
                    mapPlace = (node.Tag as MapPlace);
                }

                mapPlace.PlaceRefs.Add(new PlaceRef(placeEvent));
            } catch (Exception ex) {
                Logger.LogWrite("MapsViewerWin.AddPlace(): " + ex.Message);
            }
        }
コード例 #6
0
        public void CheckGroups()
        {
            IProgressController      progress      = AppHost.Progress;
            List <List <GDMRecord> > treeFragments = TreeTools.SearchTreeFragments(fBase.Context.Tree, progress);

            fView.LogChart.Clear();
            fView.GroupsTree.BeginUpdate();
            try {
                fView.GroupsTree.Clear();

                int num = treeFragments.Count;
                for (int i = 0; i < num; i++)
                {
                    var groupRecords = treeFragments[i];

                    int     cnt       = groupRecords.Count;
                    int     groupNum  = (i + 1);
                    ITVNode groupItem = fView.GroupsTree.AddNode(null,
                                                                 groupNum.ToString() + " " + LangMan.LS(LSID.LSID_Group).ToLower() + " (" + cnt.ToString() + ")", null);

                    for (int j = 0; j < cnt; j++)
                    {
                        var iRec = (GDMIndividualRecord)groupRecords[j];

                        string pn = GKUtils.GetNameString(iRec, true, false);
                        if (iRec.Patriarch)
                        {
                            pn = "(*) " + pn;
                        }
                        pn = string.Join(" ", pn, "[", iRec.XRef, "]");

                        fView.GroupsTree.AddNode(groupItem, pn, iRec);
                    }

                    fView.GroupsTree.Expand(groupItem);
                    fView.LogChart.AddFragment(cnt);
                }
            } finally {
                treeFragments.Clear();
                fView.GroupsTree.EndUpdate();
            }
        }
コード例 #7
0
        public void LoadPlaces()
        {
            try {
                PlacesCache.Instance.Load();

                IProgressController progress = AppHost.Progress;
                GDMTree             tree     = fBase.Context.Tree;

                fView.MapBrowser.InitMap();

                fView.PersonsCombo.BeginUpdate();
                fView.PlacesTree.BeginUpdate();
                progress.ProgressInit(LangMan.LS(LSID.LSID_LoadingLocations), tree.RecordsCount);
                try {
                    fBaseRoot = fView.PlacesTree.AddNode(null, LangMan.LS(LSID.LSID_RPLocations), null);

                    fPlaces.Clear();
                    var personValues = new StringList();

                    int num = tree.RecordsCount;
                    for (int i = 0; i < num; i++)
                    {
                        GDMRecord rec = tree[i];
                        bool      res = rec is GDMIndividualRecord && IsSelected(rec);

                        if (res)
                        {
                            GDMIndividualRecord ind = rec as GDMIndividualRecord;
                            int pCnt = 0;

                            int num2 = ind.Events.Count;
                            for (int j = 0; j < num2; j++)
                            {
                                GDMCustomEvent ev = ind.Events[j];
                                if (ev.Place.StringValue != "")
                                {
                                    AddPlace(ev.Place, ev);
                                    pCnt++;
                                }
                            }

                            if (pCnt > 0)
                            {
                                personValues.AddObject(GKUtils.GetNameString(ind, true, false) + " [" + pCnt.ToString() + "]", ind);
                            }
                        }

                        progress.ProgressStep();
                    }

                    fView.PlacesTree.Expand(fBaseRoot);

                    personValues.Sort();
                    fView.PersonsCombo.Clear();
                    fView.PersonsCombo.AddItem(LangMan.LS(LSID.LSID_NotSelected), null);
                    fView.PersonsCombo.AddStrings(personValues);

                    fView.SelectPlacesBtn.Enabled = true;
                } finally {
                    progress.ProgressDone();
                    fView.PlacesTree.EndUpdate();
                    fView.PersonsCombo.EndUpdate();

                    PlacesCache.Instance.Save();
                }
            } catch (Exception ex) {
                Logger.LogWrite("MapsViewerWin.PlacesLoad(): " + ex.Message);
            }
        }