Skip to content

Commit f628760

Browse files
committed
Completed class templates for logo display
1 parent f3286b3 commit f628760

File tree

5 files changed

+178
-3
lines changed

5 files changed

+178
-3
lines changed

examples/BasicExample.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ requirejs(['./WorldWindShim',
5454
// WorldWindow UI layers.
5555
{layer: new WorldWind.CompassLayer(), enabled: true},
5656
{layer: new WorldWind.CoordinatesDisplayLayer(wwd), enabled: true},
57-
{layer: new WorldWind.ViewControlsLayer(wwd), enabled: true}
57+
{layer: new WorldWind.ViewControlsLayer(wwd), enabled: true},
58+
{layer: new WorldWind.WorldWindLogoLayer(), enabled: true}
5859
];
5960

6061
for (var l = 0; l < layers.length; l++) {

images/worldwind-logo.png

20 KB
Loading

src/WorldWind.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc
298298
'./ogc/wmts/WmtsCapabilities',
299299
'./layer/WmtsLayer',
300300
'./ogc/wmts/WmtsLayerCapabilities',
301+
'./shapes/WorldWindLogo',
302+
'./layer/WorldWindLogoLayer',
301303
'./WorldWindow',
302304
'./WorldWindowController',
303305
'./util/WWMath',
@@ -576,6 +578,8 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc
576578
WmtsCapabilities,
577579
WmtsLayer,
578580
WmtsLayerCapabilities,
581+
WorldWindLogo,
582+
WorldWindLogoLayer,
579583
WorldWindow,
580584
WorldWindowController,
581585
WWMath,
@@ -592,10 +596,10 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc
592596
var WorldWind = {
593597
/**
594598
* The WorldWind version number.
595-
* @default "0.9.0"
599+
* @default "0.11.0"
596600
* @constant
597601
*/
598-
VERSION: "0.9.0",
602+
VERSION: "0.11.0",
599603

600604
// PLEASE KEEP THE ENTRIES BELOW IN ALPHABETICAL ORDER
601605
/**
@@ -1094,6 +1098,8 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc
10941098
WorldWind['WWMath'] = WWMath;
10951099
WorldWind['WWMessage'] = WWMessage;
10961100
WorldWind['WWUtil'] = WWUtil;
1101+
WorldWind['WorldWindLogo'] = WorldWindLogo;
1102+
WorldWind['WorldWindLogoLayer'] = WorldWindLogoLayer;
10971103
WorldWind['WorldWindow'] = WorldWindow;
10981104
WorldWind['WorldWindowController'] = WorldWindowController;
10991105

@@ -1106,6 +1112,8 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc
11061112
* <li><code>baseUrl</code>: The URL of the directory containing the WorldWind Library and its resources.</li>
11071113
* <li><code>layerRetrievalQueueSize</code>: The number of concurrent tile requests allowed per layer. The default is 16.</li>
11081114
* <li><code>coverageRetrievalQueueSize</code>: The number of concurrent tile requests allowed per elevation coverage. The default is 16.</li>
1115+
* <li><code>worldWindLogoPlacement</code>: An {@link Offset} to place the official WorldWind logo. The default is a 7px margin inset from the upper left corner of the screen.</li>
1116+
* <li><code>worldWindLogoAlignment</code>: An {@link Offset} to align the WorldWind logo relative to its placement position. The default is the upper left corner of the logo.</li>
11091117
* <li><code>bingLogoPlacement</code>: An {@link Offset} to place a Bing logo attribution. The default is a 7px margin inset from the lower right corner of the screen.</li>
11101118
* <li><code>bingLogoAlignment</code>: An {@link Offset} to align the Bing logo relative to its placement position. The default is the lower right corner of the logo.</li>
11111119
* </ul>

src/layer/WorldWindLogoLayer.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright 2003-2006, 2009, 2017, 2020 United States Government, as represented
3+
* by the Administrator of the National Aeronautics and Space Administration.
4+
* All rights reserved.
5+
*
6+
* The NASAWorldWind/WebWorldWind platform is licensed under the Apache License,
7+
* Version 2.0 (the "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License
9+
* at http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software distributed
12+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
14+
* specific language governing permissions and limitations under the License.
15+
*
16+
* NASAWorldWind/WebWorldWind also contains the following 3rd party Open Source
17+
* software:
18+
*
19+
* ES6-Promise – under MIT License
20+
* libtess.js – SGI Free Software License B
21+
* Proj4 – under MIT License
22+
* JSZip – under MIT License
23+
*
24+
* A complete listing of 3rd Party software notices and licenses included in
25+
* WebWorldWind can be found in the WebWorldWind 3rd-party notices and licenses
26+
* PDF found in code directory.
27+
*/
28+
/**
29+
* @exports WorldWindLogoLayer
30+
*/
31+
define([
32+
'../shapes/WorldWindLogo',
33+
'../layer/RenderableLayer'
34+
],
35+
function (WorldWindLogo,
36+
RenderableLayer) {
37+
"use strict";
38+
39+
/**
40+
* Constructs a WorldWind logo layer.
41+
* @alias WorldWindLogoLayer
42+
* @constructor
43+
* @augments RenderableLayer
44+
* @classdesc Displays the WorldWind Logo.
45+
*/
46+
var WorldWindLogoLayer = function () {
47+
RenderableLayer.call(this, "WorldWindLogo");
48+
49+
this._worldWindLogo = new WorldWindLogo(null, null);
50+
51+
this.addRenderable(this._worldWindLogo);
52+
};
53+
54+
WorldWindLogoLayer.prototype = Object.create(RenderableLayer.prototype);
55+
56+
Object.defineProperties(WorldWindLogoLayer.prototype, {
57+
/**
58+
* The logo to display.
59+
* @type {WorldWindLogo}
60+
* @default {@link WorldWindLogo}
61+
* @memberof WorldWindLogoLayer.prototype
62+
*/
63+
worldWindLogo: {
64+
get: function () {
65+
return this._worldWindLogo;
66+
},
67+
set: function (worldWindLogo) {
68+
if (worldWindLogo && worldWindLogo instanceof WorldWindLogo) {
69+
this.removeAllRenderables();
70+
this.addRenderable(worldWindLogo);
71+
this._worldWindLogo = worldWindLogo;
72+
}
73+
}
74+
}
75+
});
76+
77+
return WorldWindLogoLayer;
78+
});

src/shapes/WorldWindLogo.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* Copyright 2003-2006, 2009, 2017, 2020 United States Government, as represented
3+
* by the Administrator of the National Aeronautics and Space Administration.
4+
* All rights reserved.
5+
*
6+
* The NASAWorldWind/WebWorldWind platform is licensed under the Apache License,
7+
* Version 2.0 (the "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License
9+
* at http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software distributed
12+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
14+
* specific language governing permissions and limitations under the License.
15+
*
16+
* NASAWorldWind/WebWorldWind also contains the following 3rd party Open Source
17+
* software:
18+
*
19+
* ES6-Promise – under MIT License
20+
* libtess.js – SGI Free Software License B
21+
* Proj4 – under MIT License
22+
* JSZip – under MIT License
23+
*
24+
* A complete listing of 3rd Party software notices and licenses included in
25+
* WebWorldWind can be found in the WebWorldWind 3rd-party notices and licenses
26+
* PDF found in code directory.
27+
*/
28+
/**
29+
* @exports Compass
30+
*/
31+
define([
32+
'../error/ArgumentError',
33+
'../util/Logger',
34+
'../util/Offset',
35+
'../shapes/ScreenImage'
36+
],
37+
function (ArgumentError,
38+
Logger,
39+
Offset,
40+
ScreenImage) {
41+
"use strict";
42+
43+
/**
44+
* Constructs a WorldWind logo attribution.
45+
* @alias WorldWindLogo
46+
* @constructor
47+
* @augments ScreenImage
48+
* @classdesc Displays the official WorldWind logo in the WorldWindow. Its position is specified in WorldWind's configuration.
49+
* @param {Offset} screenOffset The offset indicating the image's placement on the screen. If null or undefined
50+
* the compass is placed at the position stated in WorldWind's configuration.
51+
* Use [the image offset property]{@link ScreenImage#imageOffset} to position the image relative to the
52+
* screen point.
53+
* @param {String} imagePath The URL of the image to display. If null or undefined, a default logo image is used.
54+
*/
55+
var WorldWindLogo = function (screenOffset, imagePath) {
56+
57+
var sOffset = screenOffset ? screenOffset
58+
: new Offset(WorldWind.configuration.worldWindLogoAlignment),
59+
iPath = imagePath ? imagePath : WorldWind.configuration.baseUrl + "images/worldwind-logo.png";
60+
61+
ScreenImage.call(this, sOffset, iPath);
62+
63+
// Must set the configured image offset after calling the constructor above.
64+
65+
if (!screenOffset) {
66+
this.imageOffset = new Offset(WorldWind.configuration.worldWindLogoAlignment);
67+
}
68+
};
69+
70+
WorldWindLogo.prototype = Object.create(ScreenImage.prototype);
71+
72+
WorldWindLogo.prototype.render = function (dc) {
73+
74+
// // Capture the navigator's heading and tilt and apply it to the compass' screen image.
75+
// this.imageRotation = dc.navigator.heading;
76+
// this.imageTilt = dc.navigator.tilt;
77+
78+
// var t = this.getActiveTexture(dc);
79+
// if (t) {
80+
// this.imageScale = this.size * dc.currentGlContext.drawingBufferWidth / t.imageWidth;
81+
// }
82+
83+
ScreenImage.prototype.render.call(this, dc);
84+
};
85+
86+
return WorldWindLogo;
87+
})
88+
;

0 commit comments

Comments
 (0)