forked from WorldWindLabs/Quake-Hunter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorldPoint.js
61 lines (42 loc) · 1.58 KB
/
WorldPoint.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* Created by gagaus on 7/29/16.
*/
define(['./worldwind.min'],
function(WorldWind) {
"use strict";
var WorldPoint = function (wwd) {
this.wwd = wwd;
function update3D(WorldCoordinates) {
this.Long = WorldCoordinates[0];
this.Lati = WorldCoordinates[1];
this.Alti = WorldCoordinates[2];
}
function update2D(pixelCoordinates) {
this.X = pixelCoordinates.X;
this.Y = pixelCoordinates.Y;
}
this.update3Dfrom2D = function (x, y) {
var pickList = wwd.pick(wwd.canvasCoordinates(x, y));
this.X = x;
this.Y = y;
this.Long = pickList.objects[0].position.longitude;
this.Lati = pickList.objects[0].position.latitude;
this.Alti = pickList.objects[0].position.altitude;
};
this.setLong = function(value) {
this.Long = value
};
this.setLati = function (value) {
this.Lati = value
};
function update2Dfrom3D(x, y) {
var pickList = wwd.pick(wwd.canvasCoordinates(x, y));
this.X = pixelCoordinates.X;
this.Y = pixelCoordinates.Y;
this.Long = pickList.objects[0].position.longitude;
this.Lati = pickList.objects[0].position.latitude;
this.Alti = pickList.objects[0].position.altitude;
}
};
return WorldPoint;
});