This commit is contained in:
2020-11-13 19:58:09 +00:00
parent 9c7e759167
commit 3029ead3b2
4 changed files with 82 additions and 14 deletions

View File

@@ -2,8 +2,6 @@
@@@@@@@@@@@@@@@ ROADMAP STAGE 6 - "REALITY" All in on porting over all the real objects from v7
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
TODO: .net 5 is out!
https://devblogs.microsoft.com/dotnet/announcing-net-5-0/?utm_source=dotnet-website&utm_medium=banner&utm_campaign=blog-banner
todo: Uifielddatatype Phone and TimeSpan support at client, translation keys etc
ay-customize.vue

View File

@@ -540,17 +540,82 @@ export default {
//
//
viewGeoLocation: function(obj) {
if (!obj.latitude || !obj.longitude) {
throw new Error("View map: missing latitude or longitude, can't view");
//TODO: url escape parameters!!
//TODO: query by address
/*
{
pointname: m.vm.obj.name,
latitude: m.vm.obj.latitude,
longitude: m.vm.obj.longitude,
address: m.vm.obj.address || m.vm.obj.postAddress,
city: m.vm.obj.city || m.vm.obj.postCity,
region: m.vm.obj.region || m.vm.obj.postRegion,
country: m.vm.obj.country || m.vm.obj.postCountry,
postCode: m.vm.obj.postCode
}
*/
let hasGeo = obj.latitude || obj.longitude;
let hasAddress =
obj.address ||
obj.city ||
objectHash.region ||
obj.country ||
obj.postCode;
if (!hasGeo && !hasAddress) {
throw new Error(
"View map: missing address and latitude / longitude nothing to view"
);
}
let mapUrl =
window.$gz.store.state.userOptions.mapUrlTemplate ||
"https://www.google.com/maps/search/?api=1&query={aylatitude},{aylongitude}";
mapUrl = mapUrl.split("{aylatitude}").join(obj.latitude);
mapUrl = mapUrl.split("{aylongitude}").join(obj.longitude);
if (obj.pointname) {
mapUrl = mapUrl.split("{aypointname}").join(obj.pointname);
let mapUrl = window.$gz.store.state.userOptions.mapUrlTemplate;
let geoMapUrl = null;
let addressMapUrl = null;
if (!mapUrl || mapUrl == "") {
//no preset map url, default to google, favor geo coordinates
if (obj.latitude && obj.longitude) {
geoMapUrl =
"https://www.google.com/maps/search/?api=1&query={aylatitude},{aylongitude}";
} else {
//default to address search
addressMapUrl =
"https://www.google.com/maps/search/?api=1&query={ayaddress}";
}
} else {
//we have a pre-set map url, parse it and split it and extract them
//favor first one if multiple supported map types
mapUrls = [mapUrl];
if (mapUrl.includes("<|>")) {
mapUrls = mapUrl.split("<|>");
}
mapUrls.array.forEach(z => {
if (!geoMapUrl && z.includes("{aylatitude}")) {
geoMapUrl = z;
}
if (!addressMapUrl && z.includes("{ayaddress}")) {
addressMapUrl = z;
}
});
}
//decide which map to use here, favor geocode
if (hasGeo && geoMapUrl) {
//geo view
mapUrl = mapUrl.split("{aylatitude}").join(obj.latitude);
mapUrl = mapUrl.split("{aylongitude}").join(obj.longitude);
if (obj.pointname) {
mapUrl = mapUrl.split("{aypointname}").join(obj.pointname);
}
} else if (hasAddress && addressMapUrl) {
} else {
throw new Error(
"View map: error - no matching mapurl / address / geo coordinates set for display, nothing to view"
);
}
if (window.open(mapUrl, "map") == null) {
throw new Error(
"Problem displaying map in new window. Browser must allow pop-ups to view maps; check your browser setting"

View File

@@ -937,7 +937,12 @@ async function clickHandler(menuItem) {
window.$gz.util.viewGeoLocation({
pointname: m.vm.obj.name,
latitude: m.vm.obj.latitude,
longitude: m.vm.obj.longitude
longitude: m.vm.obj.longitude,
address: m.vm.obj.address || m.vm.obj.postAddress,
city: m.vm.obj.city || m.vm.obj.postCity,
region: m.vm.obj.region || m.vm.obj.postRegion,
country: m.vm.obj.country || m.vm.obj.postCountry,
postCode: m.vm.obj.postCode
});
break;
default:

View File

@@ -177,12 +177,12 @@ export default {
{
name: "Bing",
value:
"https://bing.com/maps/default.aspx?cp={aylatitude}~{aylongitude}&lvl=17&style=r&sp=point.{aylatitude}_{aylongitude}_{aypointname}"
"https://bing.com/maps/default.aspx?where1={ayaddress}<|>https://bing.com/maps/default.aspx?cp={aylatitude}~{aylongitude}&lvl=17&style=r&sp=point.{aylatitude}_{aylongitude}_{aypointname}"
},
{
name: "Google",
value:
"https://www.google.com/maps/search/?api=1&query={aylatitude},{aylongitude}"
"https://www.google.com/maps/search/?api=1&query={ayaddress}<|>https://www.google.com/maps/search/?api=1&query={aylatitude},{aylongitude}"
},
{
name: "MapQuest",