logging to debug

This commit is contained in:
portree_kid 2020-04-25 21:36:05 +02:00
parent bd0e45440c
commit 4cc5e1913d
3 changed files with 29 additions and 29 deletions

View File

@ -28,16 +28,16 @@ L.ParkingSpot = L.Circle.extend({
updateMiddleMarker: function() { updateMiddleMarker: function() {
if (this.editEnabled()) { if (this.editEnabled()) {
try { try {
console.log("Update Middle ", this.editor.editLayer._layers[0]); console.debug("Update Middle ", this.editor.editLayer._layers[0]);
var o = this.editor.editLayer._layers; var o = this.editor.editLayer._layers;
console.log(o); console.debug(o);
for (var key in o) { for (var key in o) {
if (o.hasOwnProperty(key)) { if (o.hasOwnProperty(key)) {
console.log(key, o[key]); console.debug(key, o[key]);
console.log(this.editor._resizeLatLng.__vertex==o[key]); console.debug(this.editor._resizeLatLng.__vertex==o[key]);
// console.log(this.editor._resizeLatLng.__vertex._icon); // console.debug(this.editor._resizeLatLng.__vertex._icon);
console.log(o[key] == this.direction); console.debug(o[key] == this.direction);
if (this.editor._resizeLatLng.__vertex!=o[key] && if (this.editor._resizeLatLng.__vertex!=o[key] &&
o[key] != this.direction) { o[key] != this.direction) {
o[key].setLatLng(this.getLatLng()); o[key].setLatLng(this.getLatLng());
@ -47,11 +47,11 @@ L.ParkingSpot = L.Circle.extend({
//Object.values(o); //Object.values(o);
/* /*
.forEach(vertex => { .forEach(vertex => {
console.log(this.editor._resizeLatLng.__vertex==vertex); console.debug(this.editor._resizeLatLng.__vertex==vertex);
}); });
*/ */
} catch (error) { } catch (error) {
console.log(error); console.error(error);
} }
} }
}, },
@ -83,7 +83,7 @@ L.ParkingSpot = L.Circle.extend({
const output = counts.reduce((prev, curr) => Math.abs(curr - this._mRadius) < Math.abs(prev - this._mRadius) ? curr : prev); const output = counts.reduce((prev, curr) => Math.abs(curr - this._mRadius) < Math.abs(prev - this._mRadius) ? curr : prev);
console.log(output); console.debug(output);
this._mRadius = output; this._mRadius = output;
this.options.attributes.radius = this._mRadius; this.options.attributes.radius = this._mRadius;
this.direction.setLatLngs([start, end]); this.direction.setLatLngs([start, end]);
@ -101,8 +101,8 @@ L.ParkingSpot = L.Circle.extend({
}, },
addListeners: function () { addListeners: function () {
this.on('editable:drawing:move', function (event) { this.on('editable:drawing:move', function (event) {
console.log("Move : ", event); console.debug("Move : ", event);
console.log("Move : ", event.latlng); console.debug("Move : ", event.latlng);
// Is it the edit vertex (Middle) moving? // Is it the edit vertex (Middle) moving?
if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){ if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){
event.target.setLatLng(event.latlng); event.target.setLatLng(event.latlng);
@ -116,11 +116,11 @@ L.ParkingSpot = L.Circle.extend({
}); });
/* /*
this.on('editable:vertex:drag', function (event) { this.on('editable:vertex:drag', function (event) {
console.log("Drag : ", event); console.debug("Drag : ", event);
}); });
*/ */
this.on('click', function (event) { this.on('click', function (event) {
console.log("Click : " + event.target); console.debug("Click : " + event.target);
store.default.dispatch('setParking', event.target.options.attributes); store.default.dispatch('setParking', event.target.options.attributes);
this.select(); this.select();
this.unwatch = store.default.watch( this.unwatch = store.default.watch(
@ -140,7 +140,7 @@ L.ParkingSpot = L.Circle.extend({
); );
}); });
this.on('editable:vertex:clicked', function (event) { this.on('editable:vertex:clicked', function (event) {
console.log(this.featureLookup[event.vertex.glueindex]); console.debug(this.featureLookup[event.vertex.glueindex]);
if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){ if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){
event.vertex._icon.style['background-color'] = 'red'; event.vertex._icon.style['background-color'] = 'red';
store.default.dispatch('setParking', event.target.options.attributes); store.default.dispatch('setParking', event.target.options.attributes);
@ -215,10 +215,10 @@ L.ParkingSpot = L.Circle.extend({
element.updateMiddle(); element.updateMiddle();
} }
} else if (element instanceof L.Editable.VertexMarker) { } else if (element instanceof L.Editable.VertexMarker) {
console.log(element); console.debug(element);
element.setLatLng(event.latlng); element.setLatLng(event.latlng);
element.latlngs.forEach((latlng, index) => { element.latlngs.forEach((latlng, index) => {
console.log(latlng); console.debug(latlng);
if (latlng.__vertex === element) { if (latlng.__vertex === element) {
latlng.update(event.latlng); latlng.update(event.latlng);
} }
@ -266,7 +266,7 @@ airlineCodes="VIR,KAL,DAL,KLM" />
//circle.attributes = { type: n.attr('type'), name: n.attr('name'), radius: Number(n.attr('radius')), airlineCodes: n.attr('airlineCodes'), heading: Number(n.attr('heading')) }; //circle.attributes = { type: n.attr('type'), name: n.attr('name'), radius: Number(n.attr('radius')), airlineCodes: n.attr('airlineCodes'), heading: Number(n.attr('heading')) };
$.each( n.attrs, function( key, value ) { $.each( n.attrs, function( key, value ) {
console.log( '$', circle.id, key , value); console.debug( '$', circle.id, key , value);
if(isNaN(value)) if(isNaN(value))
circle.options.attributes[ key ] = value; circle.options.attributes[ key ] = value;

View File

@ -191,7 +191,7 @@ exports.readGroundnetXML = function (fDir, icao, force) {
polyline._latlngs[1].attributes[key] = Number(value); polyline._latlngs[1].attributes[key] = Number(value);
}); });
$.each(n.attrs, function (key, value) { $.each(n.attrs, function (key, value) {
console.log(key + "\t" + value); console.debug(key + "\t" + value);
if (isNaN(value)) if (isNaN(value))
polyline.options.attributes[key] = value; polyline.options.attributes[key] = value;

View File

@ -86,7 +86,7 @@ function bezier(line, icao, layerGroup, currentFeature) {
for (let index = 0; index < points.length; index++) { for (let index = 0; index < points.length; index++) {
const element = points[index]; const element = points[index];
if (element[0] === "NaN") { if (element[0] === "NaN") {
console.log(control); console.debug(control);
} }
currentFeature.slice(-1)[0].push(element); currentFeature.slice(-1)[0].push(element);
} }
@ -105,7 +105,7 @@ function bezier(line, icao, layerGroup, currentFeature) {
for (let index = 0; index < points.length; index++) { for (let index = 0; index < points.length; index++) {
const element = points[index]; const element = points[index];
if (element[0] === "NaN") { if (element[0] === "NaN") {
console.log(control); console.debug(control);
} }
currentFeature.slice(-1)[0].push(element); currentFeature.slice(-1)[0].push(element);
} }
@ -276,7 +276,7 @@ module.exports.readPavement = function (f, icao, cb) {
// console.log('Ignored:', line); // console.log('Ignored:', line);
} }
}).on('error', function (err) { }).on('error', function (err) {
console.log(err); console.error(err);
lr.close(); lr.close();
}).on('close', function () { }).on('close', function () {
console.log("End"); console.log("End");
@ -295,7 +295,7 @@ var scanMethods = {
1: (line, icao) => { 1: (line, icao) => {
// console.log('Airport:', line); // console.log('Airport:', line);
if (line[4] === icao) { if (line[4] === icao) {
console.log('Airport:', line); console.debug('Airport:', line);
module.exports.isScanning = true; module.exports.isScanning = true;
} else { } else {
module.exports.isScanning = false; module.exports.isScanning = false;
@ -304,7 +304,7 @@ var scanMethods = {
// Runway // Runway
100: (line, icao, layerGroup) => { 100: (line, icao, layerGroup) => {
if (module.exports.isScanning) { if (module.exports.isScanning) {
console.log('Runway ', line); console.debug('Runway ', line);
var point1 = new LatLonEllipsoidal(Number(line[9]), Number(line[10])); var point1 = new LatLonEllipsoidal(Number(line[9]), Number(line[10]));
var point2 = new LatLonEllipsoidal(Number(line[18]), Number(line[19])); var point2 = new LatLonEllipsoidal(Number(line[18]), Number(line[19]));
@ -379,7 +379,7 @@ var scanMethods = {
111: (line, icao, layerGroup, currentFeature) => { 111: (line, icao, layerGroup, currentFeature) => {
if (!module.exports.isScanning) if (!module.exports.isScanning)
return; return;
console.log(line); console.debug(line);
var previous = currentFeature.slice(-1)[0].slice(-1)[0]; var previous = currentFeature.slice(-1)[0].slice(-1)[0];
if (previous !== undefined && if (previous !== undefined &&
previous !== null && previous !== null &&
@ -397,14 +397,14 @@ var scanMethods = {
if (!module.exports.isScanning) { if (!module.exports.isScanning) {
return; return;
} }
console.log(line); console.debug(line);
return bezier(line, icao, layerGroup, currentFeature); return bezier(line, icao, layerGroup, currentFeature);
}, },
113: (line, icao, layerGroup, currentFeature) => { 113: (line, icao, layerGroup, currentFeature) => {
if (!module.exports.isScanning) { if (!module.exports.isScanning) {
return; return;
} }
console.log(line); console.debug(line);
currentFeature.slice(-1)[0].push([line[1], line[2]]); currentFeature.slice(-1)[0].push([line[1], line[2]]);
currentFeature.push([]); currentFeature.push([]);
exports.bezierPoint = null; exports.bezierPoint = null;
@ -415,7 +415,7 @@ var scanMethods = {
if (!module.exports.isScanning) { if (!module.exports.isScanning) {
return; return;
} }
console.log(line); console.debug(line);
bezier(line, icao, layerGroup, currentFeature); bezier(line, icao, layerGroup, currentFeature);
currentFeature.push([]); currentFeature.push([]);
exports.bezierPoint = null; exports.bezierPoint = null;
@ -425,7 +425,7 @@ var scanMethods = {
115: (line, icao, layerGroup, currentFeature) => { 115: (line, icao, layerGroup, currentFeature) => {
if (!module.exports.isScanning) if (!module.exports.isScanning)
return; return;
console.log(line); console.debug(line);
if (exports.bezierPoint !== null) { if (exports.bezierPoint !== null) {
bezier(line, icao, layerGroup, currentFeature); bezier(line, icao, layerGroup, currentFeature);
} }
@ -439,7 +439,7 @@ var scanMethods = {
116: (line, icao, layerGroup, currentFeature) => { 116: (line, icao, layerGroup, currentFeature) => {
if (!module.exports.isScanning) if (!module.exports.isScanning)
return; return;
console.log(line); console.debug(line);
currentFeature = bezier(line, icao, layerGroup, currentFeature); currentFeature = bezier(line, icao, layerGroup, currentFeature);
createLineString(currentFeature); createLineString(currentFeature);
exports.bezierPoint = null; exports.bezierPoint = null;