Skip to content

Commit c47deb1

Browse files
committed
Remove WorldWindow dependency from Camera. Move transformations between Camera and LookAt to WorldWindow.
1 parent 834910e commit c47deb1

File tree

21 files changed

+313
-370
lines changed

21 files changed

+313
-370
lines changed

apps/Explorer/Explorer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ define(['../../src/WorldWind',
6767
var lookAt = new WorldWind.LookAt();
6868
lookAt.position.latitude = 30;
6969
lookAt.position.longitude = -(180 / 12) * ((new Date()).getTimezoneOffset() / 60);
70-
this.wwd.camera.setFromLookAt(lookAt);
70+
this.wwd.cameraFromLookAt(lookAt);
7171

7272
this.goToBox = new GoToBox(this.wwd);
7373
this.layersPanel = new LayersPanel(this.wwd);

apps/NEO/NEO.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ define(['../../src/WorldWind',
6464
var lookAt = new WorldWind.LookAt();
6565
lookAt.position.latitude = 30;
6666
lookAt.position.longitude = -(180 / 12) * ((new Date()).getTimezoneOffset() / 60);
67-
this.wwd.camera.setFromLookAt(lookAt);
67+
this.wwd.cameraFromLookAt(lookAt);
6868

6969
this.timeSeriesPlayer = new TimeSeriesPlayer(this.wwd);
7070
this.projectionMenu = new ProjectionMenu(this.wwd);

apps/SentinelWMTS/SentinelWMTS.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ define(['../../src/WorldWind',
8484
lookAt.position.latitude = 48.86;
8585
lookAt.position.longitude = 2.37;
8686
lookAt.range = 5e4;
87-
this.wwd.camera.setFromLookAt(lookAt);
87+
this.wwd.cameraFromLookAt(lookAt);
8888

8989
// Create controllers for the user interface elements.
9090
new GoToBox(wwd);

apps/SubSurface/SubSurface.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ define(['../../src/WorldWind',
6767
var lookAt = new WorldWind.LookAt();
6868
lookAt.position.latitude = 30;
6969
lookAt.position.longitude = -(180 / 12) * ((new Date()).getTimezoneOffset() / 60);
70-
this.wwd.camera.setFromLookAt(lookAt);
70+
this.wwd.cameraFromLookAt(lookAt);
7171

7272
this.goToBox = new GoToBox(this.wwd);
7373
this.layersPanel = new LayersPanel(this.wwd);

apps/USGSSlabs/USGSSlabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ define(['../../src/WorldWind',
7878
var lookAt = new WorldWind.LookAt();
7979
lookAt.position.latitude = 30;
8080
lookAt.position.longitude = -(180 / 12) * ((new Date()).getTimezoneOffset() / 60);
81-
this.wwd.camera.setFromLookAt(lookAt);
81+
this.wwd.cameraFromLookAt(lookAt);
8282

8383
// Establish the shapes and the controllers to handle picking.
8484
this.setupPicking();

apps/USGSWells/USGSWells.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ define(['../../src/WorldWind',
9191
lookAt.range = 1400;
9292
lookAt.heading = 90;
9393
lookAt.tilt = 60;
94-
this.wwd.camera.setFromLookAt(lookAt);
94+
this.wwd.cameraFromLookAt(lookAt);
9595

9696
// Establish the shapes and the controllers to handle picking.
9797
this.setupPicking();

examples/Canyon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ requirejs(['./WorldWindShim'],
2222
var wwd = new WorldWind.WorldWindow("canvasOne");
2323
var camera = wwd.camera;
2424
var lookAt = new WorldWind.LookAt();
25-
camera.getAsLookAt(lookAt);
25+
wwd.cameraAsLookAt(lookAt);
2626
var layers = [
2727
{layer: new WorldWind.BMNGLayer(), enabled: true},
2828
{layer: new WorldWind.BingAerialWithLabelsLayer(null), enabled: true},

examples/Views.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ requirejs(['./WorldWindShim',
2424
var wwd = new WorldWind.WorldWindow("canvasOne");
2525
var camera = wwd.camera;
2626
var lookAt = new WorldWind.LookAt();
27-
camera.getAsLookAt(lookAt);
27+
wwd.cameraAsLookAt(lookAt);
2828
var layers = [
2929
{layer: new WorldWind.BMNGLayer(), enabled: true},
3030
{layer: new WorldWind.BingAerialWithLabelsLayer(null), enabled: true},
@@ -127,7 +127,7 @@ requirejs(['./WorldWindShim',
127127
rangeSlider.slider("disable");
128128
altitudeSlider.slider("enable");
129129
} else {
130-
camera.getAsLookAt(lookAt);
130+
wwd.cameraAsLookAt(lookAt);
131131
pos = lookAt.position;
132132
view = lookAt;
133133
rangeSlider.slider("enable");
@@ -138,7 +138,7 @@ requirejs(['./WorldWindShim',
138138
pos = camera.position;
139139
view = camera;
140140
} else {
141-
camera.getAsLookAt(lookAt);
141+
wwd.cameraAsLookAt(lookAt);
142142
pos = lookAt.position;
143143
view = lookAt;
144144
}
@@ -150,7 +150,7 @@ requirejs(['./WorldWindShim',
150150
view.roll = rollSlider.slider("value");
151151
if (selectedViewType === "LookAt") {
152152
lookAt.range = rangeSlider.slider("value");
153-
camera.setFromLookAt(lookAt);
153+
wwd.cameraFromLookAt(lookAt);
154154
}
155155
}
156156
updateControls(pos, view);
@@ -159,7 +159,7 @@ requirejs(['./WorldWindShim',
159159

160160
window.setInterval(function () {
161161
var pos, view;
162-
camera.getAsLookAt(lookAt);
162+
wwd.cameraAsLookAt(lookAt);
163163
if (currentViewType === "Camera") {
164164
pos = camera.position;
165165
view = camera;

performance/DeepPickingPerformance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ requirejs(['../src/WorldWind',
6969
var lookAt = new WorldWind.LookAt();
7070
lookAt.position = new WorldWind.Position(44.2, -94.12, 0);
7171
lookAt.range = 625000;
72-
wwd.camera.setFromLookAt(lookAt);
72+
wwd.cameraFromLookAt(lookAt);
7373

7474
// Satellite image footprints
7575
var footprints = [];

src/BasicWorldWindowController.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ define([
252252
lookAt.position.longitude += forwardDegrees * sinHeading + sideDegrees * cosHeading;
253253
this.lastPoint.set(tx, ty);
254254
this.applyLookAtLimits(lookAt);
255-
this.wwd.camera.setFromLookAt(lookAt);
255+
this.wwd.cameraFromLookAt(lookAt);
256256
this.wwd.redraw();
257257
}
258258
};
@@ -295,7 +295,7 @@ define([
295295

296296
// Transform the original view's modelview matrix to account for the gesture's change.
297297
var modelview = Matrix.fromIdentity();
298-
lookAt.computeViewingTransform(globe, modelview);
298+
this.wwd.lookAtToViewingTransform(lookAt, modelview);
299299
modelview.multiplyByTranslation(point2[0] - point1[0], point2[1] - point1[1], point2[2] - point1[2]);
300300

301301
// Compute the globe point at the screen center from the perspective of the transformed view.
@@ -314,7 +314,7 @@ define([
314314
lookAt.tilt = params.tilt;
315315
lookAt.roll = params.roll;
316316
this.applyLookAtLimits(lookAt);
317-
this.wwd.camera.setFromLookAt(lookAt);
317+
this.wwd.cameraFromLookAt(lookAt);
318318
this.wwd.redraw();
319319
}
320320
};
@@ -338,7 +338,7 @@ define([
338338
lookAt.heading = this.beginLookAt.heading + headingDegrees;
339339
lookAt.tilt = this.beginLookAt.tilt + tiltDegrees;
340340
this.applyLookAtLimits(lookAt);
341-
this.wwd.camera.setFromLookAt(lookAt);
341+
this.wwd.cameraFromLookAt(lookAt);
342342
this.wwd.redraw();
343343
}
344344
};
@@ -357,7 +357,7 @@ define([
357357
var lookAt = this.lookAt;
358358
lookAt.range = this.beginLookAt.range / scale;
359359
this.applyLookAtLimits(lookAt);
360-
this.wwd.camera.setFromLookAt(lookAt);
360+
this.wwd.cameraFromLookAt(lookAt);
361361
this.wwd.redraw();
362362
}
363363
}
@@ -379,7 +379,7 @@ define([
379379
lookAt.heading -= rotation - this.lastRotation;
380380
this.lastRotation = rotation;
381381
this.applyLookAtLimits(lookAt);
382-
this.wwd.camera.setFromLookAt(lookAt);
382+
this.wwd.cameraFromLookAt(lookAt);
383383
this.wwd.redraw();
384384
}
385385
};
@@ -399,14 +399,14 @@ define([
399399
var lookAt = this.lookAt;
400400
lookAt.tilt = this.beginTilt + tiltDegrees;
401401
this.applyLookAtLimits(lookAt);
402-
this.wwd.camera.setFromLookAt(lookAt);
402+
this.wwd.cameraFromLookAt(lookAt);
403403
this.wwd.redraw();
404404
}
405405
};
406406

407407
// Intentionally not documented.
408408
BasicWorldWindowController.prototype.handleWheelEvent = function (event) {
409-
var lookAt = this.wwd.camera.getAsLookAt(this.lookAt);
409+
var lookAt = this.wwd.cameraAsLookAt(this.lookAt);
410410
// Normalize the wheel delta based on the wheel delta mode. This produces a roughly consistent delta across
411411
// browsers and input devices.
412412
var normalizedDelta;
@@ -426,7 +426,7 @@ define([
426426
// Apply the scale to this view's properties.
427427
lookAt.range *= scale;
428428
this.applyLookAtLimits(lookAt);
429-
this.wwd.camera.setFromLookAt(lookAt);
429+
this.wwd.cameraFromLookAt(lookAt);
430430
this.wwd.redraw();
431431
};
432432

@@ -470,9 +470,9 @@ define([
470470
* @ignore
471471
*/
472472
BasicWorldWindowController.prototype.applyLimits = function () {
473-
var lookAt = this.wwd.camera.getAsLookAt(this.lookAt);
473+
var lookAt = this.wwd.cameraAsLookAt(this.lookAt);
474474
this.applyLookAtLimits(lookAt);
475-
this.wwd.camera.setFromLookAt(lookAt);
475+
this.wwd.cameraFromLookAt(lookAt);
476476
};
477477

478478
/**
@@ -481,7 +481,7 @@ define([
481481
* @ignore
482482
*/
483483
BasicWorldWindowController.prototype.gestureDidBegin = function () {
484-
this.wwd.camera.getAsLookAt(this.beginLookAt);
484+
this.wwd.cameraAsLookAt(this.beginLookAt);
485485
this.lookAt.copy(this.beginLookAt);
486486
};
487487

0 commit comments

Comments
 (0)