-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpcars_map_raw.js
181 lines (131 loc) · 4.61 KB
/
pcars_map_raw.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
class pcars_map_raw extends pcars_map {
// example function header
/*
* param {string}
* param {object}
* param {int}
*
* return {string} true if all is fine, false if something went wrong
*/
/* constructor()
*
* param {string}
* param {string} HTML ID
* param {array}
* return {boolean} true if all is fine, false if something went wrong
*/
constructor(sMaptype, sMapHtmlId, aMapSettings, ) {
super(); // get functions from basic class
this.aRawData = null; // array of RAW data
this.sContentContainerId = "map";
this.sContentElementId = "RawInner";
this.iCurNumberElements = 0;
this.iMaxInnerElements = 10;
// set Raw Data CSS styles
CSSClsChg.setStyle(
'.RawDataBox {\n' +
'border: none; \n' +
'padding: 5px; \n' +
'font: 10px/12px sans-serif; \n' +
'width: 99%; \n' +
'height: 95%; \n' +
'overflow: scroll; \n' +
'}\n');
CSSClsChg.setStyle(
'::-webkit-scrollbar {\n' +
'width: 12px; \n' +
'height: 12px; \n' +
'}\n');
CSSClsChg.setStyle(
'::-webkit-scrollbar-track {\n' +
'box-shadow: inset 0 0 10px #c2d5ed; \n' +
'border-radius: 10px; \n' +
'}\n');
CSSClsChg.setStyle(
'::-webkit-scrollbar-thumb {\n' +
'background: #666; \n' +
'box-shadow: inset 0 0 6px rgba(0,0,0,0.5); \n' +
'}\n');
CSSClsChg.setStyle(
'::-webkit-scrollbar-thumb:hover {\n' +
'background: #7bac10; \n' +
'}\n');
}
/* overwrites function with google specific call
*
* param {object} TrackObj
* return {boolean} true if all is fine, false if something went wrong
*/
init_map( newTrackObj, aSensorDataLOCAL ){
var sInnerHTML = '<h1>Raw Data ( max entries:' + this.iMaxInnerElements + ' ) </h1>' ;
sInnerHTML += '<div id="OutputRaw" class="RawDataBox">';
sInnerHTML += '</div>';
HTMLCTRL.ChangeHtmlContentByID( '#'+this.sContentContainerId, sInnerHTML);
// Pause button
$( '#OutputRaw' ).html( '<div><input type="button" title="Pause appending data to RAW output" id="cbRawDataAppending" value="Pause" style="background-color:#dddddd; width:50px"></input></div>' );
$('#cbRawDataAppending').click(function () {
//Method with Button
var data = this;
if(data.value === "Pause"){
StopRawDataAppending = true;
data.value = "Start";
data.title = "Append new RAW data";
data.style.borderStyle = 'inset';
}else{
StopRawDataAppending = false;
data.value = "Pause";
data.title = "Pause appending RAW data";
data.style.borderStyle = 'outset';
}
});
}
/*
* destroy/clean/reset
*
* {boolean} true if was reset/cleaned, false if something went wrong
*/
destroyMap(){
$('#'+this.sContentContainerId).remove();
return false;
}
/* overwrites function with google specific call
*
* param {object} Track
* param {object} Map
* param {string} id of the current track
* return {boolean} true if all is fine, false if something went wrong
*/
changeMapSettings(newTrackObj, mapobj, trackid){
}
/* overwrites function with raw specific call
*
* param {array} array of Markers informations
* return {boolean} true if everything went fine, false in case of ignore update etc.
*/
updateMarker(aMarkerObject){
if (StopRawDataAppending == true){
return false
}
if ( this.iCurNumberElements > this.iMaxInnerElements){
//clear inner elements
$('#'+this.sContentContainerId).empty();
// re-init structure
this.init_map();
// reset counter
this.iCurNumberElements = 0;
}
//append
$('#OutputRaw').append(this._getFormatInnerRawData(aMarkerObject));
//increas counter for elements
this.iCurNumberElements++;
}
/* internal function to format Marker data for output in textbox
*
*/
_getFormatInnerRawData(aMarkerObject){
var sInnerElement = '<div id="' + this.sContentElementId + '">';
sInnerElement += JSON.stringify(aMarkerObject);
sInnerElement += '</div>';
return sInnerElement;
}
}