mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-24 16:55:22 +03:00
Initial build
This commit is contained in:
parent
924c974473
commit
397e840e5a
2 changed files with 100 additions and 70 deletions
|
@ -15,7 +15,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.setNumber = function (data) {
|
||||
number = data;
|
||||
};
|
||||
|
||||
|
||||
self.getLayerNumber = function () {
|
||||
return layerNumber;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.setLayerNumber = function (data) {
|
||||
layerNumber = data;
|
||||
};
|
||||
|
||||
|
||||
self.getPoiNumber = function () {
|
||||
return poiNumber;
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.setPoiNumber = function (data) {
|
||||
poiNumber = data;
|
||||
};
|
||||
|
||||
|
||||
self.isUsed = function () {
|
||||
return isUsed;
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.setUsed = function (data) {
|
||||
isUsed = data;
|
||||
};
|
||||
|
||||
|
||||
self.isAttached = function () {
|
||||
return isAttached;
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.getLon = function () {
|
||||
return lon;
|
||||
};
|
||||
|
||||
|
||||
self.getLonMap = function () {
|
||||
return lon / 10000000;
|
||||
};
|
||||
|
@ -63,7 +63,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.getLat = function () {
|
||||
return lat;
|
||||
};
|
||||
|
||||
|
||||
self.getLatMap = function () {
|
||||
return lat / 10000000;
|
||||
};
|
||||
|
@ -71,55 +71,55 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.setLat = function (data) {
|
||||
lat = data;
|
||||
};
|
||||
|
||||
|
||||
self.getAction = function () {
|
||||
return action;
|
||||
};
|
||||
|
||||
|
||||
self.setAction = function (data) {
|
||||
action = data;
|
||||
};
|
||||
|
||||
|
||||
self.getAlt = function () {
|
||||
return alt;
|
||||
};
|
||||
|
||||
|
||||
self.setAlt = function (data) {
|
||||
alt = data;
|
||||
};
|
||||
|
||||
|
||||
self.getP1 = function () {
|
||||
return p1;
|
||||
};
|
||||
|
||||
|
||||
self.setP1 = function (data) {
|
||||
p1 = data;
|
||||
};
|
||||
|
||||
|
||||
self.getP2 = function () {
|
||||
return p2;
|
||||
};
|
||||
|
||||
|
||||
self.setP2 = function (data) {
|
||||
p2 = data;
|
||||
};
|
||||
|
||||
|
||||
self.getP3 = function () {
|
||||
return p3;
|
||||
};
|
||||
|
||||
|
||||
self.setP3 = function (data) {
|
||||
p3 = data;
|
||||
};
|
||||
|
||||
|
||||
self.getEndMission = function () {
|
||||
return endMission;
|
||||
};
|
||||
|
||||
|
||||
self.setEndMission = function (data) {
|
||||
endMission = data;
|
||||
};
|
||||
|
||||
|
||||
self.getAttachedId = function () {
|
||||
return attachedId;
|
||||
};
|
||||
|
@ -127,7 +127,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.setAttachedId = function (data) {
|
||||
attachedId = data;
|
||||
};
|
||||
|
||||
|
||||
self.getAttachedNumber = function () {
|
||||
return attachedNumber;
|
||||
};
|
||||
|
@ -135,16 +135,21 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.setAttachedNumber = function (data) {
|
||||
attachedNumber = data;
|
||||
};
|
||||
|
||||
|
||||
self.getElevation = async function (globalSettings) {
|
||||
let elevation;
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/List?points='+self.getLatMap()+','+self.getLonMap()+'&heights=ellipsoid&key='+globalSettings.mapApiKey);
|
||||
const myJson = await response.json();
|
||||
const myJson = await response.json();
|
||||
elevation = myJson.resourceSets[0].resources[0].elevations[0];
|
||||
}
|
||||
else {
|
||||
elevation = "NA";
|
||||
const response = await fetch('https://api.opentopodata.org/v1/aster30m?locations='+self.getLatMap()+','+self.getLonMap());
|
||||
const myJson = await response.json();
|
||||
elevation = myJson.results[0].elevation;
|
||||
if (elevation == null) {
|
||||
elevation = "N/A";
|
||||
}
|
||||
}
|
||||
return elevation;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue