Skip to content

Commit

Permalink
fixed undefined variables
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmtech committed Apr 28, 2017
1 parent 590db74 commit 55ba182
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 45 deletions.
44 changes: 24 additions & 20 deletions src/browser/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,21 @@ Browser.prototype.updateUI = function(key) {


Browser.prototype.setConfigParam = function(key, value, ignoreCore) {
var map = this.getMap();

switch (key) {
case 'pos':
case 'position':
this.config.position = value;
if (this.map) {
this.map.setPosition(this.config.position);
if (map) {
map.setPosition(this.config.position);
}
break;

case 'view':
this.config.view = value;
if (this.map) {
this.map.setView(this.config.view);
if (map) {
map.setView(this.config.view);
}
break;

Expand Down Expand Up @@ -352,7 +354,7 @@ Browser.prototype.setConfigParam = function(key, value, ignoreCore) {
case 'inertia': this.config.inertia = utils.validateNumberArray(value, 3, [0,0,0], [0.99, 0.99, 0.99], [0.85, 0.9, 0.7]); break;
case 'rotate':
this.config.autoRotate = utils.validateNumber(value, Number.NEGATIVEINFINITY, Number.POSITIVEINFINITY, 0);
if (this.map && this.autopilot) {
if (map && this.autopilot) {
this.autopilot.setAutorotate(this.config.autoRotate);
}
break;
Expand All @@ -364,31 +366,33 @@ Browser.prototype.setConfigParam = function(key, value, ignoreCore) {
];
}

if (this.map && this.autopilot) {
if (map && this.autopilot) {
this.autopilot.setAutorotate(this.config.autoRotate);
}
break;
}

if (ignoreCore) {
if ((key.indexOf('map') == 0 || key.indexOf('mario') == 0 || key.indexOf('authorization') == 0) && this.core.getMap()) {
this.core.getMap().setConfigParam(key, value);
if ((key.indexOf('map') == 0 || key.indexOf('mario') == 0 || key.indexOf('authorization') == 0) && map) {
map.setConfigParam(key, value);
}

if (key.indexOf('renderer') == 0) {
this.core.getRenderer().setConfigParam(key, value);
map.setConfigParam(key, value);
}
}
};


Browser.prototype.getConfigParam = function(key) {
var map = this.getMap();

switch (key) {
case 'pos':
case 'position':

if (this.map) {
this.map.getPosition();
if (map) {
map.getPosition();
} else {
return this.config.position;
}
Expand All @@ -397,8 +401,8 @@ Browser.prototype.getConfigParam = function(key) {

case 'view':

if (this.map) {
return this.map.getView();
if (map) {
return map.getView();
} else {
return this.config.view;
}
Expand Down Expand Up @@ -433,15 +437,15 @@ Browser.prototype.getConfigParam = function(key) {
case 'pan': return this.config.autoPan;
}

if (ignoreCore) {
if (key.indexOf('map') == 0 && this.core.getMap()) {
return this.core.getMap().getConfigParam(key, value);
}
//if (ignoreCore) {
if (key.indexOf('map') == 0 && map) {
return map.getConfigParam(key);
}

if (key.indexOf('renderer') == 0) {
return this.core.getRenderer().getConfigParam(key, value);
}
if (key.indexOf('renderer') == 0) {
return map.getConfigParam(key);
}
//}
};


Expand Down
2 changes: 1 addition & 1 deletion src/browser/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ BrowserInterface.prototype.setParam = function(key, value) {


BrowserInterface.prototype.getParam = function(key) {
return this.getConfigParam(key, value);
return this.getConfigParam(key);
};


Expand Down
2 changes: 1 addition & 1 deletion src/browser/ui/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ UI.prototype.setControlVisible = function(id, state) {

UI.prototype.getControlVisible = function(id) {
if (this.controls[id] != null) {
this.controls[id].getVisible(state);
this.controls[id].getVisible();
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ Core.prototype.getConfigParam = function(key) {
return this.config.inspector;
} else {
if (key.indexOf('map') == 0 && this.getMap() != null) {
return this.getMap().getConfigParam(key, value);
return this.getMap().getConfigParam(key);
}

if (key.indexOf('renderer') == 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/core/map/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import MapBoundLayer_ from './bound-layer';
import MapCredit_ from './credit';
import MapPosition_ from './position';
import MapRefFrame_ from './refframe';
import MapView_ from './view';
import MapSrs_ from './srs';
import MapSurface_ from './surface';
import MapVirtualSurface_ from './virtual-surface';
Expand All @@ -13,6 +14,7 @@ var MapPosition = MapPosition_;
var MapCredit = MapCredit_;
var MapBoundLayer = MapBoundLayer_;
var MapRefFrame = MapRefFrame_;
var MapView = MapView_;
var MapSrs = MapSrs_;
var MapSurface = MapSurface_;
var MapVirtualSurface = MapVirtualSurface_;
Expand Down
4 changes: 2 additions & 2 deletions src/core/map/draw-tiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,11 @@ MapDrawTiles.prototype.updateTileRenderCommands = function(tile, submeshes) {
};


MapDrawTiles.prototype.updateTileBoundsDirectly = function(preventLoad, priority) {
/*MapDrawTiles.prototype.updateTileBoundsDirectly = function(preventLoad, priority) {
if (tile.surfaceMesh.isReady(preventLoad, priority) && !preventLoad) {
this.updateTileBounds(tile, tile.surfaceMesh.submeshes);
}
};
};*/


MapDrawTiles.prototype.updateTileBounds = function(tile, submeshes) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/map/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ MapInterface.prototype.getSurfaceInfo = function(surfaceId) {


MapInterface.prototype.getSrses = function() {
return this.map.getSrses(surfaceId);
return this.map.getSrses();
};


Expand Down Expand Up @@ -294,7 +294,7 @@ MapInterface.prototype.setConfigParam = function(key, value) {


MapInterface.prototype.getConfigParam = function(key) {
return this.map.getConfigParam(key, value);
return this.map.getConfigParam(key);
};


Expand Down
2 changes: 2 additions & 0 deletions src/core/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import MapView_ from './view';
import MapVirtualSurface_ from './virtual-surface';
import MapSurfaceTree_ from './surface-tree';
import MapResourceTree_ from './resource-tree';
import MapSrs_ from './srs';
import MapCache_ from './cache';
import MapCamera_ from './camera';
import MapConfig_ from './config';
Expand All @@ -27,6 +28,7 @@ var MapView = MapView_;
var MapVirtualSurface = MapVirtualSurface_;
var MapSurfaceTree = MapSurfaceTree_;
var MapResourceTree = MapResourceTree_;
var MapSrs = MapSrs_;
var MapCache = MapCache_;
var MapCamera = MapCamera_;
var MapConfig = MapConfig_;
Expand Down
4 changes: 2 additions & 2 deletions src/core/map/metatile.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ MapMetatile.prototype.applyMetatatileBitplanes = function() {
for (var i = 0; i < 1; i++) {
if (this.flagPlanes[i]) {

bitplane = this.flagPlanes[i];
var bitplane = this.flagPlanes[i];

for (var y = 0; y < this.sizey; y++) {
for (var x = 0; x < this.sizex; x++) {
Expand All @@ -368,7 +368,7 @@ MapMetatile.prototype.applyMetatatileBitplanes = function() {
MapMetatile.prototype.applyMetatanodeBitplanes = function(x, y) {
for (var i = 0; i < 1; i++) {
if (this.flagPlanes[i]) {
bitplane = this.flagPlanes[i];
var bitplane = this.flagPlanes[i];
var byteIndex = this.sizex * y + x;
var bitIndex = byteIndex & 7;
var bitMask = 1 << bitIndex;
Expand Down
2 changes: 1 addition & 1 deletion src/core/map/render-slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ MapRenderSlots.prototype.setRenderSlotEnabled = function(id, state) {


MapRenderSlots.prototype.getRenderSlotEnabled = function(id) {
var index = this.getRenderSlotIndex(id2);
var index = this.getRenderSlotIndex(id);
if (index != -1) {
return this.renderSlots[index].enabled;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/map/srs.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ MapSrs.prototype.getFinalHeight = function(coords) {
MapSrs.prototype.getGeoidGridDelta = function(coords, original) {
if (this.geoidGridMap != null && this.isGeoidGridReady()) {
//get cooords in geoidGrid space
mapCoords = this.proj4(this.srsProj4, this.geoidGrid.srsProj4, [coords[0], coords[1]]);
var mapCoords = this.proj4(this.srsProj4, this.geoidGrid.srsProj4, [coords[0], coords[1]]);

//get image coords
var px = mapCoords[0] - this.geoidGrid.extents.ll[0];
Expand Down
6 changes: 3 additions & 3 deletions src/core/map/surface-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var MapSurfaceTree = function(map, freeLayer, freeLayerSurface) {
this.freeLayer = freeLayer;
this.freeLayerSurface = freeLayerSurface;
this.metaBinaryOrder = this.map.referenceFrame.params.metaBinaryOrder;
this.initialized = false;
//this.initialized = false;
//this.geocent = !this.map.getNavigationSrs().isProjected();

this.surfaceTree = new MapSurfaceTile(this.map, null, this.rootId);
Expand Down Expand Up @@ -41,15 +41,15 @@ MapSurfaceTree.prototype.kill = function() {
};


MapSurfaceTree.prototype.init = function() {
/*MapSurfaceTree.prototype.init = function() {
var url = this.map.url.makeUrl(surface.metaUrl, {lod:result[0], ix:result[1], iy:result[2] }); //result???
map.loader.load(url, metatile.load.bind(metatile, url));
this.metatileTree.load();
this.surfaceTree.metatile = 1;
this.initialized = true;
};
};*/


MapSurfaceTree.prototype.findSurfaceTile = function(id) {
Expand Down
9 changes: 0 additions & 9 deletions src/core/map/surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,6 @@ MapSurface.prototype.getNavUrl = function(id, skipBaseUrl) {
};


MapSurface.prototype.getNavTemplate = function(id, skipBaseUrl) {
if (this.navUrl.indexOf('//') != -1){
return this.navUrl;
} else {
this.map.url.baseUrl + url;
}
};


MapSurface.prototype.getMeshUrl = function(id, skipBaseUrl) {
return this.map.url.makeUrl(this.meshUrl, {lod:id[0], ix:id[1], iy:id[2] }, null, skipBaseUrl);
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ RendererInterface.prototype.setConfigParam = function(key, value) {


RendererInterface.prototype.getConfigParam = function(key) {
return this.renderer.getConfigParam(key, value);
return this.renderer.getConfigParam(key);
};


Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ Renderer.prototype.saveScreenshot = function(output, filename, filetype) {
window.URL.revokeObjectURL(url);
}, 0);
} if (output == 'tab') {
window.open(canvas.toDataURL('image/' + type));
window.open(canvas.toDataURL('image/' + filetype));
}

return imageData;
Expand Down

0 comments on commit 55ba182

Please sign in to comment.