-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgetting-started-switch.js
executable file
·85 lines (74 loc) · 2.18 KB
/
getting-started-switch.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var mode = "equatorial";
// Create Mizar
var mizar = new Mizar({
canvas: "MizarCanvas",
configuration: {
positionTracker: {
element: "myPosTracker"
}
},
skyContext: {
coordinateSystem: { geoideName: Mizar.CRS.Equatorial },
continuousRendering: true
}
});
mizar.getActivatedContext().subscribe(Mizar.EVENT_MSG.LAYER_BACKGROUND_CHANGED, function (layer) {
document.getElementById("message").innerHTML = "background has changed: " + layer.name;
});
mizar.getActivatedContext().subscribe(Mizar.EVENT_MSG.LAYER_BACKGROUND_ADDED, function (layer) {
document.getElementById("message").innerHTML = "background has been added: " + layer.name;
});
mizar.getActivatedContext().subscribe(Mizar.EVENT_MSG.LAYER_ADDED, function (layer) {
document.getElementById("message").innerHTML = "added layer: " + layer.name;
});
mizar.getActivatedContext().subscribe(Mizar.EVENT_MSG.LAYER_REMOVED, function (layer) {
document.getElementById("message").innerHTML = "removed layer: " + layer.name;
});
$("#2mass").change(function () {
var mass = $(this).val();
var checked = document.getElementById("2mass").checked;
if (checked) {
mizar.addLayer({
name: mass,
type: Mizar.LAYER.Hips,
baseUrl: "http://alasky.u-strasbg.fr/2MASS/J/",
visible: true
});
} else {
var layer = mizar.getLayerByName(mass);
mizar.removeLayer(layer.ID);
}
});
mizar.createStats({ element: "fps", verbose: false });
var dssLayerID;
mizar.addLayer(
{
type: Mizar.LAYER.Hips,
baseUrl: "http://alasky.unistra.fr/DSS/DSSColor"
},
function (layerID) {
mizar.setBackgroundLayerByID(layerID);
dssLayerID = layerID;
}
);
var irisLayerID;
mizar.addLayer(
{
type: Mizar.LAYER.Hips,
baseUrl: "http://alasky.unistra.fr/IRISColor",
numberOfLevels: 1
},
function (layerID) {
irisLayerID = layerID;
}
);
window.onkeypress = function (event) {
if (mode === "equatorial") {
mizar.setBackgroundLayerByID(irisLayerID);
mode = "galactic";
} else {
mizar.setBackgroundLayerByID(dssLayerID);
mode = "equatorial";
}
//mizar.getActivatedContext().getTileManager().setFreeze(!mizar.getActivatedContext().getTileManager().getFreeze());
};