Skip to content

Commit

Permalink
Merge LithoSphere and Viewshed Tool
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Jun 16, 2021
2 parents ae1f06e + 8f2a742 commit 9a7245a
Show file tree
Hide file tree
Showing 33 changed files with 3,974 additions and 10,490 deletions.
651 changes: 502 additions & 149 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mmgis",
"version": "2.3.1",
"version": "2.4.0",
"description": "A web-based mapping and localization solution for science operation on planetary missions.",
"homepage": "build",
"repository": {
Expand Down Expand Up @@ -94,6 +94,7 @@
"jest-resolve": "24.9.0",
"jest-watch-typeahead": "0.4.2",
"jquery": "^3.5.1",
"lithosphere": "^1.0.0",
"mark.js": "^8.11.1",
"memorystore": "^1.6.2",
"mini-css-extract-plugin": "0.9.0",
Expand Down
Binary file added public/images/rovers/PerseveranceTopDown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/css/mmgis.css
Original file line number Diff line number Diff line change
Expand Up @@ -691,3 +691,7 @@ body {
background-color: #008321;
}
}

#_lithosphere_controls_topleft {
top: 40px !important;
}
6 changes: 3 additions & 3 deletions src/essence/Ancillary/QueryURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ var QueryURL = {
if (mapLat === undefined) mapLat = L_.Map_.map.getCenter().lat
if (mapZoom === undefined) mapZoom = L_.Map_.map.getZoom()

var globeCenter = L_.Globe_.getCenter()
var globeCenter = L_.Globe_.litho.getCenter()
if (globeLon === undefined) globeLon = globeCenter.lon
if (globeLat === undefined) globeLat = globeCenter.lat
if (globeZoom === undefined) globeZoom = L_.Globe_.zoom
if (globeZoom === undefined) globeZoom = L_.Globe_.litho.zoom

var viewerImg = L_.Viewer_.getLastImageId()
var viewerLoc = L_.Viewer_.getLocation()
Expand Down Expand Up @@ -283,7 +283,7 @@ var QueryURL = {
urlAppendage += '&globeZoom=' + globeZoom

//globeCamera
var orbit = L_.Globe_.getCameras().orbit
var orbit = L_.Globe_.litho.getCameras().orbit
var cam = orbit.camera
var con = orbit.controls

Expand Down
63 changes: 49 additions & 14 deletions src/essence/Basics/Formulae_/Formulae_.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import calls from '../../../pre/calls'
// often referred to as F_
var temp = new Float32Array(1)

// eslint-disable-next-line no-extend-native
Object.defineProperty(Object.prototype, 'getFirst', {
value: function () {
return this[Object.keys(this)[0]]
Expand Down Expand Up @@ -396,13 +397,20 @@ var Formulae_ = {
* @param {*} obj
* @param {*} keyArray
*/
getIn: function (obj, keyArray) {
if (keyArray == null) return null
getIn: function (obj, keyArray, notSetValue) {
// eslint-disable-next-line no-eq-null, eqeqeq
if (obj == null) return notSetValue != null ? notSetValue : null
// eslint-disable-next-line no-eq-null, eqeqeq
if (keyArray == null) return notSetValue != null ? notSetValue : null
if (typeof keyArray === 'string') keyArray = keyArray.split('.')
let object = Object.assign({}, obj)
for (let i = 0; i < keyArray.length; i++) {
if (object.hasOwnProperty(keyArray[i])) object = object[keyArray[i]]
else return null
}
for (let i = 0; i < keyArray.length; i++)
// eslint-disable-next-line no-prototype-builtins,no-eq-null, eqeqeq
if (object != null && object.hasOwnProperty(keyArray[i]))
object = object[keyArray[i]]
// eslint-disable-next-line no-eq-null, eqeqeq
else return notSetValue != null ? notSetValue : null

return object
},
getKeyByValue: function (obj, value) {
Expand Down Expand Up @@ -670,16 +678,18 @@ var Formulae_ = {
'Lazy depth traversal failed'
)
} else {
var newCoords = Object.assign(
[],
coords[i][j][k][l][m]
)
var newCoords =
Object.assign(
[],
coords[i][j][k][l][
m
]
)
var swap = newCoords[0]
newCoords[0] = newCoords[1]
newCoords[1] = swap
coords[i][j][k][l][
m
] = newCoords
coords[i][j][k][l][m] =
newCoords
}
}
} else {
Expand Down Expand Up @@ -1178,7 +1188,32 @@ var Formulae_ = {

return a
},

// From https://javascript.plainenglish.io/4-ways-to-compare-objects-in-javascript-97fe9b2a949c
isEqual(obj1, obj2, isSimple) {
if (isSimple) {
return JSON.stringify(obj1) === JSON.stringify(obj2)
} else {
let props1 = Object.getOwnPropertyNames(obj1)
let props2 = Object.getOwnPropertyNames(obj2)
if (props1.length != props2.length) {
return false
}
for (let i = 0; i < props1.length; i++) {
let prop = props1[i]
let bothAreObjects =
typeof obj1[prop] === 'object' &&
typeof obj2[prop] === 'object'
if (
(!bothAreObjects && obj1[prop] !== obj2[prop]) ||
(bothAreObjects &&
!Formulae_.isEqual(obj1[prop], obj2[prop]))
) {
return false
}
}
return true
}
},
scaleImageInHalf(image, width, height) {
var newWidth = Math.floor(width / 2)
var newHeight = Math.floor(height / 2)
Expand Down
Loading

0 comments on commit 9a7245a

Please sign in to comment.