}).always(function() { try { configuration.bingMapsKey = terria.configParameters.bingMapsKey ? terria.configParameters.bingMapsKey : configuration.bingMapsKey; viewState.searchState.locationSearchProviders = [ new BingMapsSearchProviderViewModel({ terria: terria, key: configuration.bingMapsKey }), new GazetteerSearchProviderViewModel({terria}), new GnafSearchProviderViewModel({terria}) ]; // Automatically update Terria (load new catalogs, etc.) when the hash part of the URL changes. updateApplicationOnHashChange(terria, window); updateApplicationOnMessageFromParentWindow(terria, window); //temp var createAustraliaBaseMapOptions = require('terriajs/lib/ViewModels/createAustraliaBaseMapOptions'); var createGlobalBaseMapOptions = require('terriajs/lib/ViewModels/createGlobalBaseMapOptions'); var selectBaseMap = require('terriajs/lib/ViewModels/selectBaseMap'); // Create the various base map options. var australiaBaseMaps = createAustraliaBaseMapOptions(terria); var globalBaseMaps = createGlobalBaseMapOptions(terria, configuration.bingMapsKey); var allBaseMaps = australiaBaseMaps.concat(globalBaseMaps); selectBaseMap(terria, allBaseMaps, 'Positron (Light)', true); // Add the disclaimer, if specified if (defined(terria.configParameters.globalDisclaimer)) { var disclaimer = terria.configParameters.globalDisclaimer; if (defined(disclaimer.enabled) && disclaimer.enabled) { var message = ''; /* disabling the dev disclaimer for the UX testing if (location.hostname.indexOf('nationalmap.gov.au') === -1) { message += fs.readFileSync(__dirname + '/lib/Views/DevelopmentDisclaimer.html', 'utf8'); } */ message += require('./lib/Views/GlobalDisclaimer.html'); var options = { title: defined(disclaimer.title) ? disclaimer.title : 'Disclaimer', confirmText: 'I Agree', width: 600, height: 550, message: message, hideUi: true }; viewState.notifications.push(options); } } render(terria, allBaseMaps, viewState); } catch (e) { console.error(e); console.error(e.stack); } });
}).always(function() { try { configuration.bingMapsKey = terria.configParameters.bingMapsKey ? terria.configParameters.bingMapsKey : configuration.bingMapsKey; viewState.searchState.locationSearchProviders = [ new BingMapsSearchProviderViewModel({ terria: terria, key: configuration.bingMapsKey }), new GazetteerSearchProviderViewModel({terria}), new GNAFSearchProviderViewModel({terria}) ]; // Automatically update Terria (load new catalogs, etc.) when the hash part of the URL changes. updateApplicationOnHashChange(terria, window); updateApplicationOnMessageFromParentWindow(terria, window); //temp var createAustraliaBaseMapOptions = require('terriajs/lib/ViewModels/createAustraliaBaseMapOptions'); var createGlobalBaseMapOptions = require('terriajs/lib/ViewModels/createGlobalBaseMapOptions'); var selectBaseMap = require('terriajs/lib/ViewModels/selectBaseMap'); // Create the various base map options. var australiaBaseMaps = createAustraliaBaseMapOptions(terria); var globalBaseMaps = createGlobalBaseMapOptions(terria, configuration.bingMapsKey); var allBaseMaps = australiaBaseMaps.concat(globalBaseMaps); selectBaseMap(terria, allBaseMaps, 'Positron (Light)', true); let render = () => { const StandardUserInterface = require('terriajs/lib/ReactViews/StandardUserInterface/StandardUserInterface.jsx'); ReactDOM.render(<StandardUserInterface terria={terria} allBaseMaps={allBaseMaps} viewState={viewState} version={version} />, document.getElementById('ui')); }; if (process.env.NODE_ENV === "development") { window.viewState = viewState; } if (module.hot && process.env.NODE_ENV !== "production") { // Support hot reloading of components // and display an overlay for runtime errors const renderApp = render; const renderError = (error) => { const RedBox = require('redbox-react'); console.error(error); console.error(error.stack); ReactDOM.render( <RedBox error={error} />, document.getElementById('ui') ); }; render = () => { try { renderApp(); } catch (error) { renderError(error); } }; module.hot.accept('terriajs/lib/ReactViews/StandardUserInterface/StandardUserInterface.jsx', () => { setTimeout(render); }); } render(); } catch (e) { console.error(e); console.error(e.stack); } });
}).always(function() { configuration.bingMapsKey = terria.configParameters.bingMapsKey ? terria.configParameters.bingMapsKey : configuration.bingMapsKey; // Automatically update Terria (load new catalogs, etc.) when the hash part of the URL changes. updateApplicationOnHashChange(terria, window); updateApplicationOnMessageFromParentWindow(terria, window); // Create the map/globe. TerriaViewer.create(terria, { developerAttribution: terria.configParameters.developerAttribution }); // We'll put the entire user interface into a DOM element called 'ui'. var ui = document.getElementById('ui'); // Create the various base map options. var australiaBaseMaps = createAustraliaBaseMapOptions(terria); var globalBaseMaps = createGlobalBaseMapOptions(terria, configuration.bingMapsKey); var allBaseMaps = australiaBaseMaps.concat(globalBaseMaps); var initialBaseMap = terria.configParameters.initialBaseMap || 'Bing Maps Aerial with Labels'; selectBaseMap(terria, allBaseMaps, initialBaseMap, true); // Create the Settings / Map panel. var settingsPanel = SettingsPanelViewModel.create({ container: ui, terria: terria, isVisible: false, baseMaps: allBaseMaps }); var brandBarElements = defaultValue(terria.configParameters.brandBarElements, [ '', '<a target="_blank" href="http://terria.io"><img src="images/terria_logo.png" height="52" title="Version: {{ version }}" /></a>', '' ]); brandBarElements = brandBarElements.map(function(s) { return s.replace(/\{\{\s*version\s*\}\}/, version);}); // Create the brand bar. BrandBarViewModel.create({ container: ui, elements: brandBarElements }); // Create the menu bar. MenuBarViewModel.create({ container: ui, terria: terria, items: [ // Add a Tools menu that only appears when "tools=1" is present in the URL. createToolsMenuItem(terria, ui), new MenuBarItemViewModel({ label: 'Add data', tooltip: 'Add your own data to the map.', svgPath: svgPlus, svgPathWidth: 11, svgPathHeight: 12, callback: function() { AddDataPanelViewModel.open({ container: ui, terria: terria }); } }), new MenuBarItemViewModel({ label: 'Base Maps', tooltip: 'Change the map mode (2D/3D) and base map.', svgPath: svgWorld, svgPathWidth: 17, svgPathHeight: 17, observableToToggle: knockout.getObservable(settingsPanel, 'isVisible') }), new MenuBarItemViewModel({ label: 'Share', tooltip: 'Share your map with others.', svgPath: svgShare, svgPathWidth: 11, svgPathHeight: 13, callback: function() { SharePopupViewModel.open({ container: ui, terria: terria }); } })/*, new MenuBarItemViewModel({ label: 'Related Maps', tooltip: 'View other maps in the NationalMap family.', svgPath: svgRelated, svgPathWidth: 14, svgPathHeight: 13, callback: function() { PopupMessageViewModel.open(ui, { title: 'Related Maps', message: require('./lib/Views/RelatedMaps.html'), width: 600, height: 430 }); } })*/ ] }); // Create the lat/lon/elev and distance widgets. LocationBarViewModel.create({ container: ui, terria: terria, mapElement: document.getElementById('cesiumContainer') }); DistanceLegendViewModel.create({ container: ui, terria: terria, mapElement: document.getElementById('cesiumContainer') }); // Create the navigation controls. NavigationViewModel.create({ container: ui, terria: terria }); // Create the animation controls. AnimationViewModel.create({ container: document.getElementById('cesiumContainer'), terria: terria, mapElementsToDisplace: [ 'cesium-widget-credits', 'leaflet-control-attribution', 'distance-legend', 'location-bar' ] }); var nowViewingTab = new NowViewingTabViewModel({ nowViewing: terria.nowViewing }); var isSmallScreen = document.body.clientWidth <= 700 || document.body.clientHeight <= 420; // Create the explorer panel. ExplorerPanelViewModel.create({ container: ui, terria: terria, mapElementToDisplace: 'cesiumContainer', isOpen: !isSmallScreen && !terria.userProperties.hideExplorerPanel, tabs: [ new DataCatalogTabViewModel({ catalog: terria.catalog }), nowViewingTab, new SearchTabViewModel({ searchProviders: [ new CatalogItemNameSearchProviderViewModel({ terria: terria }), new BingMapsSearchProviderViewModel({ terria: terria, key: configuration.bingMapsKey }), new GazetteerSearchProviderViewModel({ terria: terria }) ] }) ] }); // Create the feature information popup. var featureInfoPanel = FeatureInfoPanelViewModel.create({ container: ui, terria: terria }); // Handle the user dragging/dropping files onto the application. DragDropViewModel.create({ container: ui, terria: terria, dropTarget: document, allowDropInitFiles: true, allowDropDataFiles: true, validDropElements: ['ui', 'cesiumContainer'], invalidDropClasses: ['modal-background'] }); // Add a popup that appears the first time a catalog item is enabled, // calling the user's attention to the Now Viewing tab. NowViewingAttentionGrabberViewModel.create({ container: ui, terria: terria, nowViewingTabViewModel: nowViewingTab }); // Make sure only one panel is open in the top right at any time. MutuallyExclusivePanels.create({ panels: [ settingsPanel, featureInfoPanel ] }); MapProgressBarViewModel.create({ container: document.getElementById('cesiumContainer'), terria: terria }); document.getElementById('loadingIndicator').style.display = 'none'; });
}).always(function() { try { configuration.bingMapsKey = terria.configParameters.bingMapsKey ? terria.configParameters.bingMapsKey : configuration.bingMapsKey; viewState.searchState.locationSearchProviders = [ new BingMapsSearchProviderViewModel({ terria: terria, key: configuration.bingMapsKey }), new GazetteerSearchProviderViewModel({terria}), new GnafSearchProviderViewModel({terria}) ]; // Automatically update Terria (load new catalogs, etc.) when the hash part of the URL changes. updateApplicationOnHashChange(terria, window); updateApplicationOnMessageFromParentWindow(terria, window); //temp var createAustraliaBaseMapOptions = require('terriajs/lib/ViewModels/createAustraliaBaseMapOptions'); var createGlobalBaseMapOptions = require('terriajs/lib/ViewModels/createGlobalBaseMapOptions'); var selectBaseMap = require('terriajs/lib/ViewModels/selectBaseMap'); // Create the various base map options. var australiaBaseMaps = createAustraliaBaseMapOptions(terria); var globalBaseMaps = createGlobalBaseMapOptions(terria, configuration.bingMapsKey); var allBaseMaps = australiaBaseMaps.concat(globalBaseMaps); selectBaseMap(terria, allBaseMaps, 'Bing Maps Aerial with Labels', true); if (terria.configParameters.openAddData) { viewState.openAddData(); } // Show a modal disclaimer before user can do anything else. if (defined(terria.configParameters.globalDisclaimer)) { var globalDisclaimer = terria.configParameters.globalDisclaimer; var hostname = window.location.hostname; if (globalDisclaimer.enableOnLocalhost || hostname.indexOf('localhost') === -1) { var message = ''; // Sometimes we want to show a preamble if the user is viewing a site other than the official production instance. // This can be expressed as a devHostRegex ("any site starting with staging.") or a negative prodHostRegex ("any site not ending in .gov.au") if (defined(globalDisclaimer.devHostRegex) && hostname.match(globalDisclaimer.devHostRegex) || defined(globalDisclaimer.prodHostRegex) && !hostname.match(globalDisclaimer.prodHostRegex)) { message += require('./lib/Views/DevelopmentDisclaimerPreamble.html'); } message += require('./lib/Views/GlobalDisclaimer.html'); var options = { title: (globalDisclaimer.title !== undefined) ? globalDisclaimer.title : 'Warning', confirmText: (globalDisclaimer.buttonTitle || "Ok"), width: 600, height: 550, message: message, horizontalPadding : 100 }; viewState.notifications.push(options); } } render(terria, allBaseMaps, viewState); } catch (e) { console.error(e); console.error(e.stack); } });