//Сохраняет список фигур в указанный файл public void SaveToFile(string fname) { try { FileStream fs = File.Create(fname); BinaryWriter binwr = new BinaryWriter(fs); foreach (Shape shape in shapelist) { shape.SaveBinary(binwr); } binwr.Close(); fs.Close(); } catch (Exception exc) { onException("Ошибка при записи файла, проверьте доступность файла", exc.Message); shapelist.Clear(); } finally { shapelist_modificated = false; } }
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); }
public void Clear() { for (int i = fConversations.Count - 1; i >= 0; i--) { DeleteConversation(i); } fConversations.Clear(); }
public void Clear() { for (int i = fTopics.Count - 1; i >= 0; i--) { DeleteTopic(i); } fTopics.Clear(); }
public void SelectPlaces() { GDMIndividualRecord ind = null; bool condBirth = false; bool condDeath = false; bool condResidence = false; if (fView.TotalRadio.Checked) { condBirth = fView.BirthCheck.Checked; condDeath = fView.DeathCheck.Checked; condResidence = fView.ResidenceCheck.Checked; } else if (fView.SelectedRadio.Checked && (fView.PersonsCombo.SelectedIndex >= 0)) { ind = (fView.PersonsCombo.GetSelectedTag <GDMIndividualRecord>()); } fView.MapBrowser.ShowLines = (ind != null && fView.LinesVisibleCheck.Checked); fMapPoints.Clear(); int num = fPlaces.Count; for (int i = 0; i < num; i++) { MapPlace place = fPlaces[i]; if (place.Points.Count < 1) { continue; } int num2 = place.PlaceRefs.Count; for (int j = 0; j < num2; j++) { var placeRef = place.PlaceRefs[j]; GDMCustomEvent evt = placeRef.Event; var evtType = evt.GetTagType(); bool checkEventType = (condBirth && evtType == GEDCOMTagType.BIRT) || (condDeath && evtType == GEDCOMTagType.DEAT) || (condResidence && evtType == GEDCOMTagType.RESI); if ((ind != null && (placeRef.Owner == ind)) || checkEventType) { PlacesLoader.AddPoint(fMapPoints, place.Points[0], placeRef); } } } if (ind != null) { // sort points by date fMapPoints.QuickSort(MapPointsCompare); } PlacesLoader.CopyPoints(fView.MapBrowser, fMapPoints, ind != null); }
public void Clear() { Changing(); for (int i = fList.Count - 1; i >= 0; i--) { ((LBItem)fList[i]).Dispose(); } fList.Clear(); Changed(); }
private void btnSelectPlaces_Click(object sender, EventArgs e) { GEDCOMIndividualRecord ind = null; bool condBirth = false; bool condDeath = false; bool condResidence = false; if (radTotal.Checked) { condBirth = chkBirth.Checked.GetValueOrDefault(); condDeath = chkDeath.Checked.GetValueOrDefault(); condResidence = chkResidence.Checked.GetValueOrDefault(); } else if (radSelected.Checked && (cmbPersons.SelectedIndex >= 0)) { GKComboItem item = (GKComboItem)cmbPersons.Items[cmbPersons.SelectedIndex]; ind = (item.Tag as GEDCOMIndividualRecord); } fMapBrowser.ShowLines = (ind != null && chkLinesVisible.Checked.GetValueOrDefault()); fMapPoints.Clear(); int num = fPlaces.Count; for (int i = 0; i < num; i++) { MapPlace place = fPlaces[i]; if (place.Points.Count < 1) { continue; } int num2 = place.PlaceRefs.Count; for (int j = 0; j < num2; j++) { GEDCOMCustomEvent evt = place.PlaceRefs[j].Event; if ((ind != null && (evt.Parent == ind)) || (condBirth && evt.Name == "BIRT") || (condDeath && evt.Name == "DEAT") || (condResidence && evt.Name == "RESI")) { PlacesLoader.AddPoint(fMapPoints, place.Points[0], place.PlaceRefs[j]); } } } if (ind != null) { // sort points by date fMapPoints.QuickSort(MapPointsCompare); } PlacesLoader.CopyPoints(fMapBrowser, fMapPoints, ind != null); }
public void SelectPlaces() { GEDCOMIndividualRecord ind = null; bool condBirth = false; bool condDeath = false; bool condResidence = false; if (fView.TotalRadio.Checked) { condBirth = fView.BirthCheck.Checked; condDeath = fView.DeathCheck.Checked; condResidence = fView.ResidenceCheck.Checked; } else if (fView.SelectedRadio.Checked && (fView.PersonsCombo.SelectedIndex >= 0)) { ind = (fView.PersonsCombo.SelectedTag as GEDCOMIndividualRecord); } fView.MapBrowser.ShowLines = (ind != null && fView.LinesVisibleCheck.Checked); fMapPoints.Clear(); int num = fPlaces.Count; for (int i = 0; i < num; i++) { MapPlace place = fPlaces[i]; if (place.Points.Count < 1) { continue; } int num2 = place.PlaceRefs.Count; for (int j = 0; j < num2; j++) { GEDCOMCustomEvent evt = place.PlaceRefs[j].Event; if ((ind != null && (evt.Parent == ind)) || (condBirth && evt.Name == "BIRT") || (condDeath && evt.Name == "DEAT") || (condResidence && evt.Name == "RESI")) { PlacesLoader.AddPoint(fMapPoints, place.Points[0], place.PlaceRefs[j]); } } } if (ind != null) { // sort points by date fMapPoints.QuickSort(MapPointsCompare); } PlacesLoader.CopyPoints(fView.MapBrowser, fMapPoints, ind != null); }
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); } } } }
public void Clear() { /*int i = this.FList.Count - 1; * if (i >= 0) * { * do * { * (this.FList[i] as TAttribute).Dispose(); * i--; * } * while (i != -1); * }*/ fList.Clear(); }
public void Clear() { fList.Clear(); }
public void ClearPoints() { ClearAll(); fMapPoints.Clear(); }
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); } }
private void PlacesLoad() { try { IProgressController progress = AppHost.Progress; fMapBrowser.InitMap(); //cmbPersons.BeginUpdate(); //tvPlaces.BeginUpdate(); tvPlaces.DataStore = null; progress.ProgressInit(LangMan.LS(LSID.LSID_LoadingLocations), fTree.RecordsCount); try { fPlaces.Clear(); cmbPersons.Items.Clear(); //cmbPersons.Sorted = false; cmbPersons.Items.Add(new GKComboItem(LangMan.LS(LSID.LSID_NotSelected), null)); int num = fTree.RecordsCount; for (int i = 0; i < num; i++) { GEDCOMRecord rec = fTree[i]; bool res = rec is GEDCOMIndividualRecord && IsSelected(rec); if (res) { GEDCOMIndividualRecord ind = rec as GEDCOMIndividualRecord; int pCnt = 0; int num2 = ind.Events.Count; for (int j = 0; j < num2; j++) { GEDCOMCustomEvent ev = ind.Events[j]; if (ev.Place.StringValue != "") { AddPlace(ev.Place, ev); pCnt++; } } if (pCnt > 0) { cmbPersons.Items.Add(new GKComboItem(GKUtils.GetNameString(ind, true, false) + " [" + pCnt.ToString() + "]", ind)); } } progress.ProgressStep(); } fBaseRoot.Expanded = true; //ExpandAll(); //cmbPersons.Sorted = true; btnSelectPlaces.Enabled = true; } finally { progress.ProgressDone(); //tvPlaces.EndUpdate(); //cmbPersons.EndUpdate(); tvPlaces.DataStore = fBaseRoot; } } catch (Exception ex) { Logger.LogWrite("MapsViewerWin.PlacesLoad(): " + ex.Message); } }
public void Clear() { Changing(); fList.Clear(); Changed(); }
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(); } }
public void ClearPoints() { gm_ClearPoints(); fMapPoints.Clear(); }
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); } }
public void ClearPoints() { fObjects.Clear(); fMapPoints.Clear(); }
public void ClearDoors() { fDoorList.Clear(); }
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(); } }