-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtrack.js
56 lines (44 loc) · 1.27 KB
/
track.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
function Track() {
// Identification
this.label = '';
this.latitude = 0;
this.longitude = 0;
this.coarse = 0;
this.distance = 0;
this.fix = -1;
this.altitude = -1;
// Graphic objects
this.gDraw = new createjs.Container();
this.gLabel = new createjs.Text("", "normal 10px Courier", PLANE_TEXT_COLOR);
this.gLabel.x = 0;
this.gLabel.y = 0;
this.gLabel.lineHeight = 9;
this.gLabelConnector = new createjs.Shape();
this.gBox = new createjs.Shape();
this.gBox.graphics.setStrokeStyle(1).beginStroke(PLANE_BODY_COLOR).dr(0,0,6,6);
this.gTail = new createjs.Shape();
this.gDraw.addChild(this.gBox, this.gTail, this.gLabel, this.gLabelConnector);
// Graphic data
this.x = (Math.random() * 1000);
this.gDraw.x = this.x;
this.y = (Math.random() * 500);
this.gDraw.y = this.y;
this.connectorX = 25;
this.connectorY = -5;
}
Track.prototype.setX = function ( x ) {
this.x = x;
this.gDraw.x = x;
}
Track.prototype.setY = function ( y ) {
this.y = y;
this.gDraw.y = y;
}
Track.prototype.setFix = function (f) {
this.fix = f;
this.latitude = fixes[f].latitude;
this.longitude = fixes[f].longitude;
}
Track.prototype.setAltitude = function (a) {
this.altitude = a;
}