Skip to content

Commit

Permalink
Added the feature to display on maps all subordinate locations and pe…
Browse files Browse the repository at this point in the history
…rsons of the selected hierarchy of locations (fix #601)
  • Loading branch information
Serg-Norseman committed Oct 25, 2024
1 parent b2c201f commit fd63ba1
Show file tree
Hide file tree
Showing 37 changed files with 329 additions and 85 deletions.
2 changes: 2 additions & 0 deletions locales/Afrikaans.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Belarusian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Chinese Simplified.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Dutch.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/English.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Hungarian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Icelandic.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Japanese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Kazakh (Cyrillic).lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Portuguese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Serbian (Latin).lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/Spanish.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/czech.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/french.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/german.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
1 change: 1 addition & 0 deletions locales/help_enu/gkhHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>Change log</h1>

<p>
<b>??.??.2024 [v2.32.0 &amp; v3.8.0]</b><ul>
<li>Added the feature to display on maps all subordinate locations and persons of the selected hierarchy of locations.
<li>Added mode for displaying parents' ages in tree diagrams.
<li>Added an option to simplify the form of woman single surnames in extended mode (output without brackets if there are no other surnames).
<li>Added protection against problems with folders in Windows if the file name has a space before the extension.
Expand Down
1 change: 1 addition & 0 deletions locales/help_rus/gkhHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>История версий</h1>

<p>
<b>??.??.2024 [v2.32.0 &amp; v3.8.0]</b><ul>
<li>Добавлена возможность выводить на карты все подчиненные места и персоны выбранной иерархии мест.
<li>Добавлен режим отображения возрастов родителей в диаграммах деревьев.
<li>Добавлена опция упрощения формы единственных фамилий женщин в расширенном режиме (вывод без скобок, если других фамилий нет).
<li>Добавлена защита от проблем с папками в Windows, если в имени файла перед расширением есть пробел.
Expand Down
2 changes: 2 additions & 0 deletions locales/italian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/polish.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
2 changes: 2 additions & 0 deletions locales/russian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Архив не указан
997=Возраст родителей
998=Простая форма единственных фамилий
999=Карта мест
1000=Карта персон
2 changes: 2 additions & 0 deletions locales/ukrainian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,5 @@
996=Repository is not specified
997=Age of parents
998=Simple form of single surnames
999=Map of places
1000=Map of persons
56 changes: 56 additions & 0 deletions projects/GKCore/GKCore/Controllers/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using BSLib;
using GDModel;
Expand All @@ -28,6 +30,7 @@
using GKCore.Design.Views;
using GKCore.Interfaces;
using GKCore.Lists;
using GKCore.Maps;
using GKCore.Names;
using GKCore.Operations;
using GKCore.Options;
Expand Down Expand Up @@ -1444,5 +1447,58 @@ public static void ShowMedia(IBaseWindow baseWin, GDMMultimediaRecord mediaRec,
}
}
}

public static void ShowMap(IBaseWindow baseWin, List<GeoPoint> fixedPoints = null)
{
var mapsWin = AppHost.Container.Resolve<IMapsViewerWin>(baseWin);
if (fixedPoints != null) {
mapsWin.ShowFixedPoints(fixedPoints);
}
AppHost.Instance.ShowWindow(mapsWin);
}

public static void ShowMap_Sub(IBaseWindow baseWin, GDMLocationRecord locRec)
{
var tree = baseWin.Context.Tree;
var subLinks = new HashSet<GDMLocationRecord>();
GKUtils.GetLocationRecursiveSubordinateLinks(tree, locRec, subLinks, true);

var geoPoints = new List<GeoPoint>();
foreach (var location in subLinks) {
string locName = GKUtils.GetRecordName(tree, location, false);
var mapPt = location.Map;
geoPoints.Add(new GeoPoint(mapPt.Lati, mapPt.Long, locName));
}

ShowMap(baseWin, geoPoints);
}

public static void ShowMap_Indi(IBaseWindow baseWin, GDMLocationRecord locRec)
{
var tree = baseWin.Context.Tree;
var subLinks = new HashSet<GDMLocationRecord>();
GKUtils.GetLocationRecursiveSubordinateLinks(tree, locRec, subLinks, true);

var locName = new StringBuilder();

var geoPoints = new List<GeoPoint>();
foreach (var location in subLinks) {
var individualRecords = new HashSet<GDMIndividualRecord>();
GKUtils.GetLocationIndividuals(tree, location, individualRecords);

locName.AppendLine(GKUtils.GetRecordName(tree, location, false));
var mapPt = location.Map;

foreach (var iRec in individualRecords) {
string iName = GKUtils.GetRecordName(tree, iRec, false);
locName.AppendLine(iName);
}

geoPoints.Add(new GeoPoint(mapPt.Lati, mapPt.Long, locName.ToString()));
locName.Clear();
}

ShowMap(baseWin, geoPoints);
}
}
}
11 changes: 9 additions & 2 deletions projects/GKCore/GKCore/Controllers/BaseWinController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ public void SelectSummaryLink(IHyperView sender, string linkName)
ApplyFilter(GDMRecordType.rtIndividual, listMan);
fView.ShowRecordsTab(GDMRecordType.rtIndividual);
}
} else if (linkName.StartsWith(GKData.INFO_HREF_LOC_SUB)) {
string xref = linkName.Remove(0, GKData.INFO_HREF_LOC_SUB.Length);
var locRec = fContext.Tree.FindXRef<GDMLocationRecord>(xref);
if (locRec != null) BaseController.ShowMap_Sub(fView, locRec);
} else if (linkName.StartsWith(GKData.INFO_HREF_LOC_INDI)) {
string xref = linkName.Remove(0, GKData.INFO_HREF_LOC_INDI.Length);
var locRec = fContext.Tree.FindXRef<GDMLocationRecord>(xref);
if (locRec != null) BaseController.ShowMap_Indi(fView, locRec);
} else if (linkName.StartsWith(GKData.INFO_HREF_EXPAND_ASSO)) {
GKUtils.ExpandExtInfo(fContext, sender, linkName);
} else {
Expand Down Expand Up @@ -1277,8 +1285,7 @@ public void SendMail()

public void ShowMap()
{
var mapsWin = AppHost.Container.Resolve<IMapsViewerWin>(fView);
AppHost.Instance.ShowWindow(mapsWin);
BaseController.ShowMap(fView);
}

public async void ShowOrganizer()
Expand Down
22 changes: 19 additions & 3 deletions projects/GKCore/GKCore/Controllers/MapsViewerWinController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand All @@ -23,11 +23,11 @@
using BSLib;
using GDModel;
using GDModel.Providers.GEDCOM;
using GKCore.Design;
using GKCore.Design.Controls;
using GKCore.Design.Views;
using GKCore.Interfaces;
using GKCore.Maps;
using GKCore.Design;
using GKCore.Design.Views;

namespace GKCore.Controllers
{
Expand All @@ -54,6 +54,22 @@ public MapsViewerWinController(IMapsViewerWin view, List<GDMRecord> selectedPers
fSelectedPersons = selectedPersons;
}

public void ShowFixedPoints(IEnumerable<GeoPoint> points)
{
var mapBrowser = fView.MapBrowser;
mapBrowser.ShowLines = false;
mapBrowser.BeginUpdate();
try {
mapBrowser.ClearPoints();
foreach (var pt in points) {
mapBrowser.AddPoint(pt);
}
} finally {
mapBrowser.EndUpdate();
}
mapBrowser.ZoomToBounds();
}

public override void UpdateView()
{
}
Expand Down
8 changes: 8 additions & 0 deletions projects/GKCore/GKCore/Controllers/PartialViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ public void SelectSummaryLink(IHyperView sender, string linkName)
iFilter.SourceRef = rec.XRef;
ApplyFilter(GDMRecordType.rtIndividual, listMan);
}
} else if (linkName.StartsWith(GKData.INFO_HREF_LOC_SUB)) {
string xref = linkName.Remove(0, GKData.INFO_HREF_LOC_SUB.Length);
var locRec = fBase.Context.Tree.FindXRef<GDMLocationRecord>(xref);
if (locRec != null) BaseController.ShowMap_Sub(fBase, locRec);
} else if (linkName.StartsWith(GKData.INFO_HREF_LOC_INDI)) {
string xref = linkName.Remove(0, GKData.INFO_HREF_LOC_INDI.Length);
var locRec = fBase.Context.Tree.FindXRef<GDMLocationRecord>(xref);
if (locRec != null) BaseController.ShowMap_Indi(fBase, locRec);
} else if (linkName.StartsWith(GKData.INFO_HREF_EXPAND_ASSO)) {
GKUtils.ExpandExtInfo(fBase.Context, sender, linkName);
} else {
Expand Down
4 changes: 2 additions & 2 deletions projects/GKCore/GKCore/Design/Controls/IMapBrowser.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand All @@ -19,7 +19,6 @@
*/

using System.Collections.Generic;
using GKCore.Design.Controls;
using GKCore.Maps;

namespace GKCore.Design.Controls
Expand All @@ -34,6 +33,7 @@ public interface IMapBrowser : IBaseControl
IList<GeoPoint> MapPoints { get; }

int AddPoint(double latitude, double longitude, string hint);
int AddPoint(GeoPoint pt);
void ClearPoints();
void DeletePoint(int index);
void BeginUpdate();
Expand Down
6 changes: 5 additions & 1 deletion projects/GKCore/GKCore/Design/Views/IMapsViewerWin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand All @@ -18,8 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

using System.Collections.Generic;
using GKCore.Design.Controls;
using GKCore.Interfaces;
using GKCore.Maps;

namespace GKCore.Design.Views
{
Expand All @@ -37,5 +39,7 @@ public interface IMapsViewerWin : IWindow
IRadioButton SelectedRadio { get; }

ITVNode FindTreeNode(string place);

void ShowFixedPoints(IEnumerable<GeoPoint> points);
}
}
2 changes: 2 additions & 0 deletions projects/GKCore/GKCore/GKData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public static class GKData
public const string INFO_HREF_VIEW = "view_";
public const string INFO_HREF_FILTER_INDI = "filter_indi_by_";
public const string INFO_HREF_EXPAND_ASSO = "expand_asso_";
public const string INFO_HREF_LOC_SUB = "map_loc_sub_";
public const string INFO_HREF_LOC_INDI = "map_loc_indi_";

#if OS_LINUX || OS_FREEBSD
public const string DEF_FONT = "Noto Sans";
Expand Down
Loading

0 comments on commit fd63ba1

Please sign in to comment.