Пример #1
0
        public void Test_GetPointsFrame()
        {
            CoordsRect coordsRect = PlacesLoader.GetPointsFrame(null);

            Assert.AreEqual(0.0d, coordsRect.MinLon);
            Assert.AreEqual(0.0d, coordsRect.MinLat);
            Assert.AreEqual(0.0d, coordsRect.MaxLon);
            Assert.AreEqual(0.0d, coordsRect.MaxLat);

            ExtList <GeoPoint> mapPoints = new ExtList <GeoPoint>();

            mapPoints.Add(new GeoPoint(11, 13, "pt1"));
            mapPoints.Add(new GeoPoint(22, 25, "pt1"));
            coordsRect = PlacesLoader.GetPointsFrame(mapPoints);
            Assert.AreEqual(13.0d, coordsRect.MinLon);
            Assert.AreEqual(11.0d, coordsRect.MinLat);
            Assert.AreEqual(25.0d, coordsRect.MaxLon);
            Assert.AreEqual(22.0d, coordsRect.MaxLat);

            mapPoints.Clear();
            mapPoints.Add(new GeoPoint(21, 21, "pt1"));
            coordsRect = PlacesLoader.GetPointsFrame(mapPoints);
            Assert.AreEqual(1.0d, coordsRect.MinLon);
            Assert.AreEqual(1.0d, coordsRect.MinLat);
            Assert.AreEqual(41.0d, coordsRect.MaxLon);
            Assert.AreEqual(41.0d, coordsRect.MaxLat);
        }
Пример #2
0
        //Загружает список фигур из указанного файла
        public void LoadFromFile(string fname)
        {
            try
            {
                FileStream   fs    = File.OpenRead(fname);
                BinaryReader binrr = new BinaryReader(fs);

                //запрещаем события
                shapelist.Silent = true;

                while (fs.Position < fs.Length)
                {
                    Shape s = Shape.LoadBinary(binrr, GetDeleateContainer());
                    if (s != null)
                    {
                        shapelist.Add(s);
                    }
                }

                //разрешаем события
                shapelist.Silent = false;

                binrr.Close();
                fs.Close();
            }
            catch (Exception exc)
            {
                onException("Ошибка при чтении файла, проверьте формат", exc.Message);
                shapelist.Clear();
            }
            finally
            {
                shapelist_modificated = false;
            }
        }
        public ConversationEntry AddConversation()
        {
            ConversationEntry result = new ConversationEntry();

            fConversations.Add(result);
            return(result);
        }
Пример #4
0
        protected override void PrepareText()
        {
            if (fLinks)
            {
                fLinksList.Clear();

                HyperLink curLink = null;
                for (int row = 0; row < fLines.Count; row++)
                {
                    string text = fLines[row];
                    if (text.Length < 1)
                    {
                        continue;
                    }

                    int idx = 0;
                    while (idx < text.Length)
                    {
                        char c = text[idx];
                        if (c == '@')
                        {
                            if (curLink == null)
                            {
                                curLink        = new HyperLink();
                                curLink.Row    = row;
                                curLink.Kind   = LK_INDEP;
                                curLink.SymBeg = idx;
                                fLinksList.Add(curLink);
                            }
                            else
                            {
                                curLink.SymEnd = idx;
                                curLink        = null;
                            }
                        }
                        idx++;
                    }

                    if (curLink != null)
                    {
                        curLink.SymEnd = text.Length - 1;
                        curLink.Kind   = LK_FIRST;

                        curLink        = new HyperLink();
                        curLink.Row    = row + 1;
                        curLink.Kind   = LK_SECOND;
                        curLink.SymBeg = 0;
                        fLinksList.Add(curLink);
                    }
                }
            }
        }
Пример #5
0
        public LBItem Add(string S, object aData)
        {
            Changing();

            int lev;

            if (fParentItem == null)
            {
                lev = 0;
            }
            else
            {
                lev = fParentItem.Level + 1;
            }

            LBItem Result = new LBItem(fOwner, lev);

            Result.Text       = S;
            Result.Data       = aData;
            Result.List       = this;
            Result.ImageIndex = -1;
            fList.Add(Result);
            if (Sorted)
            {
                Sort();
            }
            fOwner.Reset(true);
            Changed();
            return(Result);
        }
        public ArticulateSegment Add()
        {
            ArticulateSegment result = CreateSegment();

            fSegments.Add(result);
            return(result);
        }
Пример #7
0
        public TopicEntry AddTopic()
        {
            TopicEntry result = new TopicEntry();

            fTopics.Add(result);
            return(result);
        }
Пример #8
0
        public bool BuildFile(CheckedListBox.CheckedItemCollection checkedItems)
        {
            ExtList list = new ExtList();

            _projectOptions.Extensions = list;

            foreach (Ext fileExt in checkedItems)
            {
                list.Add(fileExt);
            }

            if ((_projectFile == null) || "".Equals(_projectTitle) ||
                "".Equals(_basedir) || list.Count == 0)
            {
                return(false);
            }

            _projectOptions.SaveOptions();
            BuildProjectFile();

            FileInfo legacy = ProjectBuildFile;

            if (legacy != null && legacy.Exists)
            {
                legacy.Delete();
            }

            return(true);
        }
        public Segment Add()
        {
            Segment result = CreateSegment();

            fSegments.Add(result);
            return(result);
        }
        public int Add(string text, int width)
        {
            LBColumnTitle ct = new LBColumnTitle();

            ct.Text  = text;
            ct.Width = width;
            return(fList.Add(ct));
        }
Пример #11
0
        public static ExtList <PatriarchObj> GetPatriarchsList(IBaseContext context,
                                                               int gensMin, bool datesCheck)
        {
            ExtList <PatriarchObj> patList = new ExtList <PatriarchObj>(true);

            IProgressController progress = AppHost.Progress;

            progress.ProgressInit(LangMan.LS(LSID.LSID_PatSearch), context.Tree.RecordsCount);

            GKUtils.InitExtCounts(context.Tree, -1);
            try
            {
                int num = context.Tree.RecordsCount;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMRecord rec = context.Tree[i];

                    if (rec is GEDCOMIndividualRecord)
                    {
                        GEDCOMIndividualRecord iRec = rec as GEDCOMIndividualRecord;

                        var parts = GKUtils.GetNameParts(iRec);

                        int birthDate = context.FindBirthYear(iRec);
                        int descGens  = GKUtils.GetDescGenerations(iRec);

                        bool res = (iRec.ChildToFamilyLinks.Count == 0);
                        res = (res && iRec.Sex == GEDCOMSex.svMale);
                        res = (res && /*nf != "" && nf != "?" &&*/ parts.Name != "" && parts.Name != "?");
                        res = (res && descGens >= gensMin);

                        if (datesCheck)
                        {
                            res = (res && birthDate != 0);
                        }

                        if (res)
                        {
                            PatriarchObj pObj = new PatriarchObj();
                            pObj.IRec             = iRec;
                            pObj.BirthYear        = birthDate;
                            pObj.DescendantsCount = GKUtils.GetDescendantsCount(iRec) - 1;
                            pObj.DescGenerations  = descGens;
                            patList.Add(pObj);
                        }
                    }

                    progress.ProgressStep();
                }
            }
            finally
            {
                progress.ProgressDone();
            }

            return(patList);
        }
Пример #12
0
        public int AddPoint(double latitude, double longitude, string hint)
        {
            BeginUpdate();
            GeoPoint pt  = new GeoPoint(latitude, longitude, hint);
            int      res = fMapPoints.Add(pt);

            EndUpdate();

            return(res);
        }
Пример #13
0
        ///
        /// <param name="dx"> </param>
        /// <param name="dy"> </param>
        /// <param name="dir"> </param>
        /// <param name="state"> value of {@code DoorState}
        /// @return </param>
        public Door AddDoor(int dx, int dy, int dir, int state)
        {
            Door result = new Door();

            result.X     = dx;
            result.Y     = dy;
            result.Dir   = dir;
            result.State = state;
            fDoorList.Add(result);
            return(result);
        }
Пример #14
0
        public bool AddMember(CreatureEntity member)
        {
            bool result = false;

            if (member != null && fList.Count < 10 && IndexOfMember(member) < 0)
            {
                fList.Add(member);
                result = true;
            }
            return(result);
        }
Пример #15
0
        public void Test_CopyPoints()
        {
            var mapBrowser = Substitute.For <IMapBrowser>();

            Assert.Throws(typeof(ArgumentNullException), () => { PlacesLoader.CopyPoints(mapBrowser, null, true); });

            var gmapPoints = new ExtList <GeoPoint>();

            gmapPoints.Add(new GeoPoint(0, 0, "test"));
            PlacesLoader.CopyPoints(mapBrowser, gmapPoints, true);
        }
Пример #16
0
        private void AddPlace(GEDCOMPlace place, GEDCOMCustomEvent placeEvent)
        {
            try
            {
                GEDCOMLocationRecord locRec = place.Location.Value as GEDCOMLocationRecord;

                string placeName = (locRec != null) ? locRec.LocationName : place.StringValue;

                var      node = FindTreeNode(placeName);
                MapPlace mapPlace;

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

                    node = new GKTreeNode(placeName, mapPlace);
                    fBaseRoot.Children.Add(node);

                    if (locRec == null)
                    {
                        AppHost.Instance.RequestGeoCoords(placeName, mapPlace.Points);

                        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);
                            node.Children.Add(new GKTreeNode(ptTitle, pt));
                        }
                    }
                    else
                    {
                        GeoPoint pt = new GeoPoint(locRec.Map.Lati, locRec.Map.Long, placeName);
                        mapPlace.Points.Add(pt);

                        string ptTitle = pt.Hint + string.Format(" [{0:0.000000}, {1:0.000000}]", pt.Latitude, pt.Longitude);
                        node.Children.Add(new GKTreeNode(ptTitle, pt));
                    }
                }
                else
                {
                    mapPlace = (((GKTreeNode)node).Tag as MapPlace);
                }

                mapPlace.PlaceRefs.Add(new PlaceRef(placeEvent));
            } catch (Exception ex) {
                Logger.LogWrite("MapsViewerWin.AddPlace(): " + ex.Message);
            }
        }
Пример #17
0
        private static TreeCell AddCell(ExtList <TreeCell> row, GEDCOMIndividualRecord iRec, CellKind cellKind)
        {
            TreeCell result = new TreeCell();

            result.ColIndex = row.Add(result);
            result.Kind     = cellKind;
            result.Rec      = iRec;
            result.Row      = row;
            if (iRec != null)
            {
                result.Name = iRec.GetPrimaryFullName();
            }
            return(result);
        }
Пример #18
0
        public int Add(int id, int value)
        {
            int idx = IndexOf(id);

            if (idx >= 0)
            {
                Attribute item = fList[idx];
                item.AValue += value;
            }
            else
            {
                Attribute item = new Attribute(id, value);
                idx = fList.Add(item);
            }
            return(idx);
        }
Пример #19
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);
            }
        }
Пример #20
0
        public static void AddPoint(ExtList <GeoPoint> mapPoints, GeoPoint gmPt, PlaceRef placeRef)
        {
            GeoPoint pt;
            int      num = mapPoints.Count;

            for (int i = 0; i < num; i++)
            {
                pt = mapPoints[i];
                if (pt.Hint == gmPt.Hint)
                {
                    return;
                }
            }

            pt      = new GeoPoint(gmPt.Latitude, gmPt.Longitude, gmPt.Hint);
            pt.Date = placeRef.Date;
            mapPoints.Add(pt);
        }
Пример #21
0
        /// <summary>
        /// 获取排行表。我的排行从扩展属性dataExt获取
        /// </summary>
        /// <param name="statItemType">统计项</param>
        /// <param name="dateRange">日期范围</param>
        /// <param name="startDate">开始日期,仅当dateRange为0时才生效(即其他)</param>
        /// <param name="endDate">结束日期,仅当dateRange为0时才生效(即其他)</param>
        /// <returns></returns>
        public ExtList <RankItemDto> GetWorkRank(StatItemTypeEnum statItemType, DateRangeEnum dateRange, string startDate, string endDate)
        {
            if (!QueryDto.CheckDateRange(dateRange, startDate, endDate, out var dateS, out var dateE))
            {
                return(app.ThrowException <ExtList <RankItemDto> >("日期范围无效", AppExceptionType.ParameterError));
            }

            var query = statItemType switch
            {
                StatItemTypeEnum.InputHouse => GetHouseQuery(true, dateS, dateE),
                StatItemTypeEnum.MlsHouse => GetMLSHouseQuery(true, dateS, dateE),
                StatItemTypeEnum.InputDemnd => GetDemandQuery(true, dateS, dateE),
                StatItemTypeEnum.Telephone => GetContactTelephoneQuery(true, dateS, dateE),
                StatItemTypeEnum.CallMe => GetContactCallMeQuery(true, dateS, dateE),
                StatItemTypeEnum.Contact => GetContactTelephoneQuery(true, dateS, dateE),// 联络默认就是去电
                StatItemTypeEnum.Brower => GetBrowerQuery(true, dateS, dateE),
                StatItemTypeEnum.Share => GetShareQuery(true, dateS, dateE),
                StatItemTypeEnum.Concerned => GetConcernedQuery(true, dateS, dateE),
                StatItemTypeEnum.VisitUser => GetVisitUserQuery(true, dateS, dateE),
            };

            if (query == null)
            {
                return(app.ThrowException <ExtList <RankItemDto> >("功能暂未实现"));
            }
            Lib.StopwatchLog.RecordElapsedMilliseconds("query");

            var list = new ExtList <RankItemDto>();
            Dictionary <long, UserInfo> userPhoneNumberList = db.CurrentCorpUserPhoneNumberList;

            if (statItemType == StatItemTypeEnum.CallMe)
            {
                list.AddRange(query.OrderByDescending(o => o.Value).Select(x => new RankItemDto {
                    Value = x.Value, User = new UserInfo {
                        UserId = long.Parse(x.Code)
                    }
                }));
            }
            else
            {
                list.AddRange(query.OrderByDescending(o => o.Value).Select(x => new RankItemDto {
                    Value = x.Value, User = new UserInfo {
                        UserId = (int)x.ID
                    }
                }));
            }
            Lib.StopwatchLog.RecordElapsedMilliseconds("list");

            var userInfoList = db.CurrentCorpUserInfoList;
            var index        = 1;

            foreach (var item in list)
            {
                item.RankIndex = index++;

                if (statItemType == StatItemTypeEnum.CallMe)
                {
                    item.User = userPhoneNumberList[item.User.UserId];
                }
                else
                {
                    item.User = userInfoList.GetValueOrDefault((int)item.User.UserId, item.User);
                }
            }
            var rankUserIdList  = list.Select(x => x.User.UserId).ToList();
            var nonRankUserList = userInfoList.Where(x => !rankUserIdList.Contains(x.Key)).ToList();

            foreach (var user in nonRankUserList)
            {
                list.Add(new RankItemDto()
                {
                    RankIndex = index++, User = user.Value, Value = 0
                });
            }

            Lib.StopwatchLog.RecordElapsedMilliseconds("userinfo");

            // 我的排行
            list.DataExt = list.FirstOrDefault(x => x.User.UserId == app.User.UserID) ?? new RankItemDto()
            {
                User = userInfoList.GetValueOrDefault(app.User.UserID, new UserInfo()
                {
                    UserId    = app.User.UserID,
                    UserName  = app.User.UserName,
                    AvatarUrl = app.User.AvatarUrl
                })
            };

            Lib.StopwatchLog.WriteLog();
            return(list);
        }
Пример #22
0
        public void Test_Common()
        {
            using (ExtList <object> list = new ExtList <object>(true))
            {
                Assert.IsNotNull(list);
            }

            using (ExtList <object> list = new ExtList <object>())
            {
                Assert.IsNotNull(list);
                Assert.AreEqual(0, list.Count);

                Assert.Throws(typeof(ListException), () => { list[-1] = null; });

                object obj  = new object();
                object obj1 = new object();

                list.Add(obj);
                Assert.AreEqual(1, list.Count);
                Assert.AreEqual(obj, list[0]);
                Assert.AreEqual(0, list.IndexOf(obj));

                list.Delete(0);
                Assert.AreEqual(0, list.Count);

                list.Add(obj);
                Assert.AreEqual(obj, list.Extract(obj));

                list.Insert(0, obj);

                list[0] = obj;
                Assert.AreEqual(obj, list[0]);

                list.Add(null);
                Assert.AreEqual(2, list.Count);
                Assert.AreEqual(null, list[1]);
                list[1] = obj1;
                Assert.AreEqual(obj1, list[1]);

                list[1] = null;
                Assert.AreEqual(2, list.Count);
                list.Pack();
                Assert.AreEqual(1, list.Count);

                list.Remove(obj);
                Assert.AreEqual(0, list.Count);

                Assert.AreEqual(false, list.OwnsObjects);

                list.OwnsObjects = true;
                Assert.AreEqual(true, list.OwnsObjects);

                list.Clear();
                list.Add(obj);
                list.Add(obj1);
                Assert.AreEqual(obj, list[0]);
                Assert.AreEqual(obj1, list[1]);
                list.Exchange(0, 1);
                Assert.AreEqual(obj, list[1]);
                Assert.AreEqual(obj1, list[0]);
            }

            using (ExtList <ValItem> list = new ExtList <ValItem>())
            {
                Assert.IsNotNull(list);

                list.Add(new ValItem(5));
                list.Add(new ValItem(1));
                list.Add(new ValItem(17));
                list.Add(new ValItem(4));

                list.QuickSort(CompareItems);

                list.MergeSort(CompareItems);
            }
        }
Пример #23
0
        public static void TreeSync(GDMTree mainTree, string fileName, TextBox logText)
        {
            logText.Clear();

            GDMTree              extTree  = new GDMTree();
            GDMXRefReplacer      repMap   = new GDMXRefReplacer();
            ExtList <SyncRecord> syncList = new ExtList <SyncRecord>(true);

            try {
                var gedcomProvider = new GEDCOMProvider(extTree);
                gedcomProvider.LoadFromFile(fileName);

                extTree.Header.Clear();

                for (int i = 0, num = extTree.RecordsCount; i < num; i++)
                {
                    GDMRecord rec = extTree[i];
                    syncList.Add(new SyncRecord {
                        MasterRecord  = null,
                        UpdateRecord  = rec,
                        State         = SyncState.ssUndefined,
                        UpdateOldXRef = "",
                        UpdateNewXRef = ""
                    });
                }

                for (int i = 0, num = syncList.Count; i < num; i++)
                {
                    SyncRecord syncRec = syncList[i];

                    GDMRecord rec = mainTree.FindUID(syncRec.UpdateRecord.UID);

                    if (rec != null)
                    {
                        syncRec.MasterRecord = rec;
                        syncRec.State        = SyncState.ssHasMaster;
                    }
                    else
                    {
                        syncRec.State = SyncState.ssNoMaster;
                        rec           = extTree.Extract(extTree.IndexOf(syncRec.UpdateRecord));
                        string newXRef = mainTree.XRefIndex_NewXRef(rec);
                        repMap.AddXRef(rec, rec.XRef, newXRef);
                        rec.XRef = newXRef;
                        rec.ResetOwner(mainTree);
                        mainTree.AddRecord(rec);
                    }
                }

                for (int i = 0, num = repMap.Count; i < num; i++)
                {
                    GDMRecord rec = repMap[i].Rec;
                    rec.ReplaceXRefs(repMap);
                }

                for (int i = 0, num = extTree.RecordsCount; i < num; i++)
                {
                    GDMRecord rec = extTree[i];
                    rec.ReplaceXRefs(repMap);
                }

                for (int i = 0, num = syncList.Count; i < num; i++)
                {
                    SyncRecord syncRec = syncList[i];
                    if (syncRec.State == SyncState.ssHasMaster)
                    {
                        GDMRecord rec = extTree.Extract(extTree.IndexOf(syncRec.UpdateRecord));
                        rec.XRef = mainTree.XRefIndex_NewXRef(rec);
                        rec.ResetOwner(mainTree);
                        mainTree.AddRecord(rec);
                        string backUID = syncRec.MasterRecord.UID;
                        syncRec.UpdateRecord.MoveTo(syncRec.MasterRecord, true);
                        syncRec.MasterRecord.UID = backUID;
                        mainTree.DeleteRecord(rec);
                    }
                }

                logText.AppendText("Sync finished\r\n");
            } finally {
                syncList.Dispose();
                repMap.Dispose();
                extTree.Dispose();
            }
        }
Пример #24
0
        private void GenStep(PedigreePerson parent, GEDCOMIndividualRecord iRec, int level, int familyOrder)
        {
            if (iRec == null)
            {
                return;
            }

            PedigreePerson res = new PedigreePerson();

            res.Parent      = parent;
            res.IRec        = iRec;
            res.Level       = level;
            res.ChildIdx    = 0;
            res.FamilyOrder = familyOrder;
            fPersonList.Add(res);

            if (fOptions.PedigreeOptions.IncludeSources)
            {
                int num = iRec.SourceCitations.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMSourceRecord sourceRec = iRec.SourceCitations[i].Value as GEDCOMSourceRecord;
                    if (sourceRec == null)
                    {
                        continue;
                    }

                    string srcName = GKUtils.MergeStrings(sourceRec.Title);
                    if (srcName == "")
                    {
                        srcName = sourceRec.FiledByEntry;
                    }

                    int j = fSourceList.IndexOf(srcName);
                    if (j < 0)
                    {
                        j = fSourceList.Add(srcName);
                    }

                    res.Sources.Add((j + 1).ToString());
                }
            }

            if (fKind == PedigreeKind.pkAscend)
            {
                if (iRec.ChildToFamilyLinks.Count > 0)
                {
                    GEDCOMFamilyRecord family = iRec.ChildToFamilyLinks[0].Family;
                    if (fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        GEDCOMIndividualRecord prnt;

                        prnt = family.GetWife();
                        GenStep(res, prnt, level + 1, 1);

                        prnt = family.GetHusband();
                        GenStep(res, prnt, level + 1, 1);
                    }
                }
            }
            else
            {
                int num2 = iRec.SpouseToFamilyLinks.Count;
                for (int j = 0; j < num2; j++)
                {
                    GEDCOMFamilyRecord family = iRec.SpouseToFamilyLinks[j].Family;
                    if (!fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        continue;
                    }

                    family.SortChilds();

                    int num3 = family.Children.Count;
                    for (int i = 0; i < num3; i++)
                    {
                        GEDCOMIndividualRecord child = family.Children[i].Value as GEDCOMIndividualRecord;
                        GenStep(res, child, level + 1, i + 1);
                    }
                }
            }
        }
Пример #25
0
        private void WriteExcessFmt(PedigreePerson person)
        {
            fWriter.addParagraph(LangMan.LS(LSID.LSID_Sex) + ": " + GKUtils.SexStr(person.IRec.Sex), fTextFont);

            string st = GKUtils.GetLifeExpectancyStr(person.IRec);

            if (st != "?" && st != "")
            {
                fWriter.addParagraph(LangMan.LS(LSID.LSID_LifeExpectancy) + ": " + st, fTextFont);
            }

            GEDCOMIndividualRecord father, mother;
            GEDCOMFamilyRecord     fam = person.IRec.GetParentsFamily();

            if (fam == null)
            {
                father = null;
                mother = null;
            }
            else
            {
                father = fam.GetHusband();
                mother = fam.GetWife();
            }

            if (father != null)
            {
                fWriter.addParagraphLink(LangMan.LS(LSID.LSID_Father) + ": " + GKUtils.GetNameString(father, true, false) + " ", fTextFont, idLink(father), fLinkFont);
            }
            if (mother != null)
            {
                fWriter.addParagraphLink(LangMan.LS(LSID.LSID_Mother) + ": " + GKUtils.GetNameString(mother, true, false) + " ", fTextFont, idLink(mother), fLinkFont);
            }

            ExtList <PedigreeEvent> evList = new ExtList <PedigreeEvent>(true);

            try
            {
                int i;
                if (person.IRec.Events.Count > 0)
                {
                    fWriter.addParagraph(LangMan.LS(LSID.LSID_Events) + ":", fTextFont);

                    int num = person.IRec.Events.Count;
                    for (i = 0; i < num; i++)
                    {
                        GEDCOMCustomEvent evt = person.IRec.Events[i];
                        if (!(evt is GEDCOMIndividualAttribute) || fOptions.PedigreeOptions.IncludeAttributes)
                        {
                            evList.Add(new PedigreeEvent(person.IRec, evt));
                        }
                    }
                    WriteEventList(person, evList);
                }

                int num2 = person.IRec.SpouseToFamilyLinks.Count;
                for (i = 0; i < num2; i++)
                {
                    GEDCOMFamilyRecord family = person.IRec.SpouseToFamilyLinks[i].Family;
                    if (!fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        continue;
                    }

                    GEDCOMPointer sp;
                    string        unk;
                    if (person.IRec.Sex == GEDCOMSex.svMale)
                    {
                        sp  = family.Wife;
                        st  = LangMan.LS(LSID.LSID_Wife) + ": ";
                        unk = LangMan.LS(LSID.LSID_UnkFemale);
                    }
                    else
                    {
                        sp  = family.Husband;
                        st  = LangMan.LS(LSID.LSID_Husband) + ": ";
                        unk = LangMan.LS(LSID.LSID_UnkMale);
                    }

                    GEDCOMIndividualRecord irec = sp.Value as GEDCOMIndividualRecord;
                    string sps;
                    if (irec != null)
                    {
                        sps = st + GKUtils.GetNameString(irec, true, false) + GKUtils.GetPedigreeLifeStr(irec, fOptions.PedigreeOptions.Format) /* + this.idLink(this.FindPerson(irec))*/;
                    }
                    else
                    {
                        sps = st + unk;
                    }

                    fWriter.addParagraph(sps, fTextFont);

                    evList.Clear();
                    int childrenCount = family.Children.Count;
                    for (int j = 0; j < childrenCount; j++)
                    {
                        irec = (GEDCOMIndividualRecord)family.Children[j].Value;
                        evList.Add(new PedigreeEvent(irec, irec.FindEvent("BIRT")));
                    }
                    WriteEventList(person, evList);
                }
            }
            finally
            {
                evList.Dispose();
            }

            if (fOptions.PedigreeOptions.IncludeNotes && person.IRec.Notes.Count != 0)
            {
                fWriter.addParagraph(LangMan.LS(LSID.LSID_RPNotes) + ":", fTextFont);

                fWriter.beginList();

                int notesCount = person.IRec.Notes.Count;
                for (int i = 0; i < notesCount; i++)
                {
                    GEDCOMNotes note = person.IRec.Notes[i];
                    fWriter.addListItem(" " + GKUtils.MergeStrings(note.Notes), fTextFont);
                }

                fWriter.endList();
            }
        }
Пример #26
0
        public int AddPoint(double latitude, double longitude, string hint)
        {
            GeoPoint pt = new GeoPoint(latitude, longitude, hint);

            return(fMapPoints.Add(pt));
        }
Пример #27
0
        private void WriteExcessFmt(PedigreePerson person)
        {
            fWriter.AddParagraph(LangMan.LS(LSID.LSID_Sex) + ": " + GKUtils.SexStr(person.IRec.Sex), fTextFont);

            string st = GKUtils.GetLifeExpectancyStr(person.IRec);

            if (st != "?" && st != "")
            {
                fWriter.AddParagraph(LangMan.LS(LSID.LSID_LifeExpectancy) + ": " + st, fTextFont);
            }

            GDMIndividualRecord father, mother;

            fTree.GetParents(person.IRec, out father, out mother);

            if (father != null)
            {
                fWriter.AddParagraphLink(LangMan.LS(LSID.LSID_Father) + ": " + GKUtils.GetNameString(father, true, false) + " ", fTextFont, idLink(father), fLinkFont);
            }

            if (mother != null)
            {
                fWriter.AddParagraphLink(LangMan.LS(LSID.LSID_Mother) + ": " + GKUtils.GetNameString(mother, true, false) + " ", fTextFont, idLink(mother), fLinkFont);
            }

            var evList = new ExtList <PedigreeEvent>(true);

            try {
                int i;
                if (person.IRec.Events.Count > 0)
                {
                    fWriter.AddParagraph(LangMan.LS(LSID.LSID_Events) + ":", fTextFont);

                    int num = person.IRec.Events.Count;
                    for (i = 0; i < num; i++)
                    {
                        GDMCustomEvent evt = person.IRec.Events[i];
                        if (!(evt is GDMIndividualAttribute) || fOptions.PedigreeOptions.IncludeAttributes)
                        {
                            evList.Add(new PedigreeEvent(person.IRec, evt));
                        }
                    }
                    WriteEventList(person, evList);
                }

                int num2 = person.IRec.SpouseToFamilyLinks.Count;
                for (i = 0; i < num2; i++)
                {
                    GDMFamilyRecord family = fTree.GetPtrValue(person.IRec.SpouseToFamilyLinks[i]);
                    if (!fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        continue;
                    }

                    GDMIndividualRecord spRec;
                    string unk;
                    if (person.IRec.Sex == GDMSex.svMale)
                    {
                        spRec = fTree.GetPtrValue(family.Wife);
                        st    = LangMan.LS(LSID.LSID_Wife) + ": ";
                        unk   = LangMan.LS(LSID.LSID_UnkFemale);
                    }
                    else
                    {
                        spRec = fTree.GetPtrValue(family.Husband);
                        st    = LangMan.LS(LSID.LSID_Husband) + ": ";
                        unk   = LangMan.LS(LSID.LSID_UnkMale);
                    }

                    string sps;
                    if (spRec != null)
                    {
                        sps = st + GKUtils.GetNameString(spRec, true, false) + GKUtils.GetPedigreeLifeStr(spRec, fOptions.PedigreeOptions.Format) /* + this.idLink(this.FindPerson(irec))*/;
                    }
                    else
                    {
                        sps = st + unk;
                    }

                    fWriter.AddParagraph(sps, fTextFont);

                    evList.Clear();
                    int childrenCount = family.Children.Count;
                    for (int j = 0; j < childrenCount; j++)
                    {
                        GDMIndividualRecord child = fTree.GetPtrValue(family.Children[j]);
                        evList.Add(new PedigreeEvent(child, child.FindEvent(GEDCOMTagType.BIRT)));
                    }
                    WriteEventList(person, evList);
                }
            } finally {
                evList.Dispose();
            }

            if (fOptions.PedigreeOptions.IncludeNotes && person.IRec.Notes.Count != 0)
            {
                fWriter.AddParagraph(LangMan.LS(LSID.LSID_RPNotes) + ":", fTextFont);

                fWriter.BeginList();

                int notesCount = person.IRec.Notes.Count;
                for (int i = 0; i < notesCount; i++)
                {
                    GDMLines noteLines = fTree.GetNoteLines(person.IRec.Notes[i]);
                    fWriter.AddListItem(" " + GKUtils.MergeStrings(noteLines), fTextFont);
                }

                fWriter.EndList();
            }
        }
Пример #28
0
 public void Add(Ghost ghost)
 {
     fList.Add(ghost);
 }
Пример #29
0
        private void GenStep(PedigreePerson parent, GDMIndividualRecord iRec, int level, int familyOrder)
        {
            if (iRec == null)
            {
                return;
            }

            PedigreePerson res = new PedigreePerson();

            res.Parent      = parent;
            res.IRec        = iRec;
            res.Level       = level;
            res.ChildIdx    = 0;
            res.FamilyOrder = familyOrder;
            fPersonList.Add(res);

            if (fOptions.PedigreeOptions.IncludeSources)
            {
                int num = iRec.SourceCitations.Count;
                for (int i = 0; i < num; i++)
                {
                    var sourceRec = fTree.GetPtrValue <GDMSourceRecord>(iRec.SourceCitations[i]);
                    if (sourceRec == null)
                    {
                        continue;
                    }

                    int srcIndex = fSourceList.IndexOfObject(sourceRec);
                    if (srcIndex < 0)
                    {
                        string srcName  = sourceRec.ShortTitle;
                        string srcTitle = GKUtils.MergeStrings(sourceRec.Title.Lines);
                        if (!string.IsNullOrEmpty(srcName) && !string.IsNullOrEmpty(srcTitle))
                        {
                            srcName += "\n";
                        }
                        srcName += srcTitle;

                        srcIndex = fSourceList.AddObject(srcName, sourceRec);
                    }

                    res.Sources.Add((srcIndex + 1).ToString());
                }
            }

            if (fKind == PedigreeKind.Ascend)
            {
                if (iRec.ChildToFamilyLinks.Count > 0)
                {
                    GDMFamilyRecord family = fTree.GetPtrValue(iRec.ChildToFamilyLinks[0]);
                    if (fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        GDMIndividualRecord prnt;

                        prnt = fTree.GetPtrValue(family.Wife);
                        GenStep(res, prnt, level + 1, 1);

                        prnt = fTree.GetPtrValue(family.Husband);
                        GenStep(res, prnt, level + 1, 1);
                    }
                }
            }
            else
            {
                int num2 = iRec.SpouseToFamilyLinks.Count;
                for (int j = 0; j < num2; j++)
                {
                    GDMFamilyRecord family = fTree.GetPtrValue(iRec.SpouseToFamilyLinks[j]);
                    if (!fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        continue;
                    }

                    fBase.Context.ProcessFamily(family);

                    int num3 = family.Children.Count;
                    for (int i = 0; i < num3; i++)
                    {
                        GDMIndividualRecord child = fTree.GetPtrValue(family.Children[i]);
                        GenStep(res, child, level + 1, i + 1);
                    }
                }
            }
        }