{this.renderLayers(this.props.layers)}
diff --git a/web/client/localConfig.json b/web/client/localConfig.json
index f164d79c96..0e25a81f2e 100644
--- a/web/client/localConfig.json
+++ b/web/client/localConfig.json
@@ -12,6 +12,15 @@
"ignoreMobileCss": true,
"useAuthenticationRules": true,
"themePrefix": "ms2",
+ "defaultMapOptions": {
+ "cesium": {
+ "terrainProvider": {
+ "type": "cesium",
+ "url": "https://assets.agi.com/stk-terrain/world",
+ "requestVertexNormals": true
+ }
+ }
+ },
"authenticationRules": [{
"urlPattern": ".*geostore.*",
"method": "basic"
diff --git a/web/client/plugins/Map.jsx b/web/client/plugins/Map.jsx
index 1ad394b0d0..6ad1fa7bce 100644
--- a/web/client/plugins/Map.jsx
+++ b/web/client/plugins/Map.jsx
@@ -14,6 +14,7 @@ const Spinner = require('react-spinkit');
require('./map/css/map.css');
const Message = require('../components/I18N/Message');
+const ConfigUtils = require('../utils/ConfigUtils');
const {isString} = require('lodash');
let plugins;
/**
@@ -122,6 +123,7 @@ const MapPlugin = React.createClass({
loadingError: React.PropTypes.string,
tools: React.PropTypes.array,
options: React.PropTypes.object,
+ mapOptions: React.PropTypes.object,
toolsOptions: React.PropTypes.object,
actions: React.PropTypes.object,
features: React.PropTypes.array
@@ -135,6 +137,7 @@ const MapPlugin = React.createClass({
loadingSpinner: true,
tools: ["measurement", "locate", "overview", "scalebar", "draw", "highlight"],
options: {},
+ mapOptions: {},
toolsOptions: {
measurement: {},
locate: {},
@@ -183,6 +186,10 @@ const MapPlugin = React.createClass({
}
return tool[this.props.mapType] || tool;
},
+ getMapOptions() {
+ return this.props.mapOptions && this.props.mapOptions[this.props.mapType] ||
+ ConfigUtils.getConfigProp("defaultMapOptions") && ConfigUtils.getConfigProp("defaultMapOptions")[this.props.mapType];
+ },
renderLayers() {
const projection = this.props.map.projection || 'EPSG:3857';
return this.props.layers.map((layer, index) => {
@@ -224,6 +231,7 @@ const MapPlugin = React.createClass({
return (
{this.renderLayers()}
diff --git a/web/client/utils/cesium/ClickUtils.js b/web/client/utils/cesium/ClickUtils.js
new file mode 100644
index 0000000000..fd20d75849
--- /dev/null
+++ b/web/client/utils/cesium/ClickUtils.js
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2017, GeoSolutions Sas.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+var Cesium = require('../../libs/cesium');
+const getCartesian = function(viewer, event) {
+ if (event.position !== null) {
+ const scene = viewer.scene;
+ const ellipsoid = scene._globe.ellipsoid;
+ const cartesian = scene._camera.pickEllipsoid(event.position, ellipsoid);
+ return cartesian;
+ }
+};
+const getMouseXYZ = (viewer, event) => {
+ var scene = viewer.scene;
+ if (!event.position) {
+ return null;
+ }
+ const ray = viewer.camera.getPickRay(event.position);
+ const position = viewer.scene.globe.pick(ray, viewer.scene);
+ const ellipsoid = scene._globe.ellipsoid;
+ if (Cesium.defined(position)) {
+ const cartographic = ellipsoid.cartesianToCartographic(position);
+ // const height = cartographic.height;
+ const cartesian = getCartesian(viewer, event);
+ if (cartesian) {
+ cartographic.height = scene._globe.getHeight(cartographic);
+ cartographic.cartesian = cartesian;
+ cartographic.position = position;
+ }
+ return cartographic;
+ }
+ return null;
+};
+
+const getMouseTile = (viewer, event) => {
+ const scene = viewer.scene;
+ if (!event.position) {
+ return null;
+ }
+ const ray = viewer.camera.getPickRay(event.position);
+ return viewer.scene.globe.pickTile(ray, scene);
+};
+
+module.exports = {
+ getMouseXYZ,
+ getMouseTile
+};