IEEE.org
|
IEEE Xplore Digital Library
|
IEEE Standards
|
IEEE Spectrum
|
More Sites
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Open at RIT
My Conservation Life
Conservation360
Commits
500f6e92
Commit
500f6e92
authored
Jan 30, 2020
by
jedjas12
Browse files
Testing the negative logic
parent
688d99dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
salesforce/my-conservation-life/force-app/main/default/lwc/geoQuery/geoQuery.js
View file @
500f6e92
...
...
@@ -78,14 +78,33 @@ export default class GeoQuery extends LightningElement {
// If you zoom out far enough the world map will start to repeat accross the screan and leaflet
// will return longitudes like 190 degrees for what would technicall be -170
let
mlat
=
(((
coord
.
lat
+
90
)
%
180
)
-
90
);
let
mlon
=
(((
coord
.
lng
+
180
)
%
360
)
-
180
);
if
(
coord
.
lat
>=
0
){
//Works for positive
this
.
mlat
=
(((
coord
.
lat
+
180
)
%
360
)
-
180
);
//TODO
}
else
if
(
coord
.
lat
<
0
){
let
absmlat
=
Math
.
abs
(
coord
.
lng
);
console
.
log
(
`YOLO:
${
absmlat
}
`
);
this
.
mlat
=
(((
absmlat
+
180
)
%
360
)
-
180
);
this
.
mlat
*=-
1
;
}
// let mlat = (((coord.lat + 90) % 180) - 90);
if
(
coord
.
lng
>=
0
){
//Works for positive
this
.
mlon
=
(((
coord
.
lng
+
180
)
%
360
)
-
180
);
//TODO
}
else
if
(
coord
.
lng
<
0
){
let
absmlon
=
Math
.
abs
(
coord
.
lng
);
this
.
mlon
=
(((
absmlon
+
180
)
%
360
)
-
180
);
this
.
mlon
*=-
1
;
}
// Remember where the user actually clicked so we can put the markers in the correct spot
let
latOff
=
Math
.
trunc
(
coord
.
lat
/
90
);
let
lonOff
=
Math
.
trunc
(
coord
.
lng
/
180
);
console
.
log
(
`Translates to lat:
${
mlat
}
lat offset:
${
latOff
}
lon:
${
mlon
}
lon offset:
${
lonOff
}
`
);
console
.
log
(
`Translates to lat:
${
this
.
mlat
}
lat offset:
${
latOff
}
lon:
${
this
.
mlon
}
lon offset:
${
lonOff
}
`
);
// radius in meters
let
rad
=
100000
;
...
...
@@ -102,8 +121,8 @@ export default class GeoQuery extends LightningElement {
// where the user clicked... this should go in a controller module and is only
// here because I was hacking this together for a demo
const
distanceURL
=
new
URL
(
DISTANCE_URL
);
distanceURL
.
searchParams
.
append
(
'
latitude
'
,
`
${
mlat
}
`
);
distanceURL
.
searchParams
.
append
(
'
longitude
'
,
`
${
mlon
}
`
);
distanceURL
.
searchParams
.
append
(
'
latitude
'
,
`
${
this
.
mlat
}
`
);
distanceURL
.
searchParams
.
append
(
'
longitude
'
,
`
${
this
.
mlon
}
`
);
distanceURL
.
searchParams
.
append
(
'
radiusMeters
'
,
`
${
rad
}
`
);
console
.
log
(
'
Getting:
'
+
distanceURL
.
href
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment