Skip to content

Commit

Permalink
Align master to c125_annotations (#2706)
Browse files Browse the repository at this point in the history
* Fix documentation issue (#2606)

* Fixes #2608: custom mapOptions are not saved with maps (#2609)

* Fix #2592 reorganized text widget into 1 page (#2614)

* Fixed sidegrid css  for different screen resolutions (#2616)

Fix #2593

* Fixes #2542 Custom template for GetFeatureInfo  (#2591)

* (Partial) Chinese language translation (#2643)

* add the Chinese langu

* Fixed chinese language implementation

* Added onlink handler to openlayers overlay layer (#2644)

* Fix #2623. Implemented table widget (#2635)

 - Externalized VirtualScroll functionalities to be reused
 - implemented wfsTable enhancer to support auto-data
   fetch/update with virtual scroll
 - Added to RequestBuilder sortBy and propertyName support
 - Add wfs to observable to reuse streams
 - Provided a getLayerJSONFeature (to extend) for a more rational usage
   of parameters ( old requests had to manage
   filterObj was containing sort and pagination options)
 - Set widgetContainer to be traggable only by header
   ( the cursor now changes where the widget is draggable)
 - Add sortable and defaultWidth options to FeatureGrid editor enhancer
 - Add support for columns resize, memorization and reset
 - tabular view of attribute selection

* Closes geosolutions-it/austrocontrol-C125#26 (#2632)

* Closes geosolutions-it/austrocontrol-C125#26

* Fixes on Mauro's comment

* Fixed split search pattern

* Counter widget (#2645)

* Fixes #2547: upgraded openlayers to 4.6.4 (#2646)

* Fixes #2547: upgraded openlayers to 4.6.4

* Fix for tests

* MousePosition degrees template via plugin props (#2648)

* MousePosition degrees template via plugin props

* Removed unused import

*  Fix #2615. Avoid widgets clear while saving (#2649)

* Fixes #2665 Add an action to force resize of Map component (#2666)

* Austro#31# (#2683)

* Fixes #2638

* Fixes #2639

* Fixes #2640

* Fixes #2569: upgrade of leaflet version to 1.3.1 (and related dependencies) (#2671)

* Fixing leaflet randomly failing test (#2697)

* Closes #2637 (#2698)

* Fixes #2703: openalayers WMTS layers ignore initial visibility (#2704)

* 2626 updates measure tool (#2701)

* Fix #2626 Updated measure tool

* revert on test file

* Made some changes, added arcs on leaflet

* made length formula and showlabel configurable

* fixed default config, added documentation

* fixed reducer default
  • Loading branch information
MV88 authored Mar 6, 2018
1 parent 147ba24 commit 45cad05
Show file tree
Hide file tree
Showing 229 changed files with 9,767 additions and 1,136 deletions.
74 changes: 74 additions & 0 deletions TableWidget.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright 2018, 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.
*/
const React = require('react');
const Message = require('../../I18N/Message');
const loadingState = require('../../misc/enhancers/loadingState');
const FeatureGrid = loadingState(({ describeFeatureType }) => !describeFeatureType)(require('../../data/featuregrid/FeatureGrid'));
const InfoPopover = require('./InfoPopover');

const WidgetContainer = require('./WidgetContainer');
const {
Glyphicon,
ButtonToolbar,
DropdownButton,
MenuItem
} = require('react-bootstrap');

const renderHeaderLeftTopItem = ({ title, description }) => {
return title || description ? <InfoPopover placement="top" title={title} text={description} /> : null;
};


module.exports = ({
id,
title,
description,
loading,
confirmDelete = false,
toggleTableView = () => { },
toggleDeleteConfirm = () => { },
exportCSV = () => { },
onEdit = () => { },
onDelete = () => { },
pageEvents = {
moreFeatures: () => {}
},
describeFeatureType,
features,
size,
pages,
pagination = {},
virtualScroll = true
}) =>
(<WidgetContainer
id={`widget-chart-${id}`}
title={title}
topLeftItems={renderHeaderLeftTopItem({ loading, title, description, toggleTableView })}
confirmDelete={confirmDelete}
onDelete={onDelete}
toggleDeleteConfirm={toggleDeleteConfirm}
topRightItems={<ButtonToolbar>
<DropdownButton pullRight bsStyle="default" className="widget-menu" title={<Glyphicon glyph="option-vertical" />} noCaret id="dropdown-no-caret">
<MenuItem onClick={() => toggleTableView()} eventKey="1"><Glyphicon glyph="features-grid" />&nbsp;<Message msgId="widgets.widget.menu.showChartData" /></MenuItem>
<MenuItem onClick={() => onEdit()} eventKey="3"><Glyphicon glyph="pencil" />&nbsp;<Message msgId="widgets.widget.menu.edit" /></MenuItem>
<MenuItem onClick={() => toggleDeleteConfirm(true)} eventKey="2"><Glyphicon glyph="trash" />&nbsp;<Message msgId="widgets.widget.menu.delete" /></MenuItem>
<MenuItem onClick={() => exportCSV({ title })} eventKey="4"><Glyphicon className="exportCSV" glyph="download" />&nbsp;<Message msgId="widgets.widget.menu.downloadData" /></MenuItem>
</DropdownButton>
</ButtonToolbar>}>
<FeatureGrid
pageEvents={pageEvents}
virtualScroll={virtualScroll}
features={features}
pages={pages}
size={size}
rowKey="id"
describeFeatureType={describeFeatureType}
pagination={pagination} />
</WidgetContainer>

);
9 changes: 9 additions & 0 deletions docma-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"web/client/components/mapcontrols/mouseposition/MousePosition.jsx",
"web/client/components/notifications/NotificationContainer.jsx",
"web/client/components/buttons/ToggleButton.jsx",
"web/client/components/data/identify/GeocodeViewer.jsx",
"web/client/components/data/identify/IdentifyContainer.jsx",
"web/client/components/data/query/AutocompleteField.jsx",
"web/client/components/map/leaflet/DrawSupport.jsx",
"web/client/components/plugins/PluginsContainer.jsx",
Expand All @@ -120,10 +122,17 @@
"web/client/components/mapcontrols/annotations/AnnotationsConfig.js",
"web/client/components/misc/enhancers/emptyState.jsx",
"web/client/components/misc/enhancers/tooltip.jsx",
"web/client/components/misc/panels/Accordion.jsx",
"web/client/components/misc/panels/DockablePanel.jsx",
"web/client/components/misc/panels/DockPanel.jsx",
"web/client/components/misc/panels/PanelHeader.jsx",
"web/client/components/misc/sidebar/Sidebar.jsx",
"web/client/components/misc/toolbar/Toolbar.jsx",
"web/client/components/misc/EmptyView.jsx",
"web/client/components/misc/ResizableModal.jsx",
"web/client/components/TOC/TOCItemsSettings.jsx",
"web/client/components/TOC/fragments/settings/FeatureInfo.jsx",
"web/client/components/TOC/fragments/settings/FeatureInfoEditor.jsx",

"web/client/actions/index.jsdoc",
"web/client/actions/controls.js",
Expand Down
23 changes: 23 additions & 0 deletions docs/developer-guide/local-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,26 @@ Set `selectedService` value to one of the ID of the services object ("Demo CSW S
<br>Be careful to use unique IDs
<br>Future implementations will try to detect the type from the url.
<br>newService is used internally as the starting object for an empty service.

<br>
<h4> Measure Tool configuration </h4>
Inside defaultState you can set lengthFormula, showLabel, uom:
- you can customize the formula used for length calculation from "haversine" or "vincenty" (default haversine)
- show or not the measurement label on the map after drawing a measurement (default true)
- set the default uom used for measure tool (default m and sqm)
<br>For the label you can chose whatever value you want.
<br>For the unit you can chose between:
- unit length values : ft, m, km, mi, nm standing for feets, meters, kilometers, miles, nautical miles
- unit area values : sqft, sqm, sqkm, sqmi, sqnm standing for square feets, square meters, square kilometers, square miles, square nautical miles

example:<br>
```
"measurement": {
"lengthFormula": "vincenty",
"showLabel": true,
"uom": {
"length": {"unit": "m", "label": "m"},
"area": {"unit": "sqm", "label": "m²"}
}
}
```
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"@mapbox/geojsonhint": "^2.0.1",
"@mapbox/togeojson": "0.16.0",
"@turf/bbox": "4.1.0",
"@turf/great-circle": "5.1.5",
"@turf/inside": "4.1.0",
"@turf/line-intersect": "4.1.0",
"@turf/polygon-to-linestring": "4.1.0",
Expand Down Expand Up @@ -112,19 +113,21 @@
"jsonix": "2.4.1",
"jszip": "3.1.5",
"keymirror": "0.1.1",
"leaflet": "0.7.7",
"leaflet-draw": "0.2.4",
"leaflet": "1.3.1",
"leaflet-draw": "1.0.2",
"leaflet-extra-markers": "1.0.6",
"leaflet-minimap": "3.3.1",
"leaflet-plugins": "https://github.com/Polyconseil/leaflet-plugins/tarball/master",
"leaflet-minimap": "3.6.0",
"leaflet-plugins": "3.0.2",
"leaflet.gridlayer.googlemutant": "0.6.4",
"leaflet-simple-graticule": "1.0.2",
"leaflet.locatecontrol": "0.45.1",
"leaflet.nontiledlayer": "1.0.3",
"leaflet.locatecontrol": "0.62.0",
"leaflet.nontiledlayer": "1.0.7",
"lodash": "4.16.6",
"moment": "2.13.0",
"node-geo-distance": "1.2.0",
"object-assign": "4.1.1",
"ogc-schemas": "2.6.1",
"openlayers": "4.0.1",
"openlayers": "4.6.4",
"pdfviewer": "0.3.2",
"proj4": "https://github.com/geosolutions-it/proj4js/tarball/mapstore2_fixes",
"prop-types": "15.6.0",
Expand Down Expand Up @@ -168,6 +171,7 @@
"react-sortable-items": "https://github.com/geosolutions-it/react-sortable-items/tarball/react15",
"react-spinkit": "2.1.2",
"react-swipeable-views": "0.12.2",
"react-textfit": "1.1.0",
"react-twitter-widgets": "1.3.0",
"react-widgets": "3.4.8",
"recharts": "0.22.4",
Expand All @@ -184,6 +188,7 @@
"turf-bbox": "3.0.10",
"turf-buffer": "3.0.10",
"turf-intersect": "3.0.10",
"turf-point": "2.0.1",
"turf-point-on-surface": "3.0.10",
"turf-union": "3.0.10",
"url": "0.10.3",
Expand All @@ -197,7 +202,7 @@
"cleandoc": "rimraf web/docs && rimraf web/client/mapstore/docs",
"doctest": "docma -c docma-config.json --dest web/client/mapstore/docs && echo documentation is accessible from the mapstore/docs path when running npm start",
"i18n": "node utility/translations/findMissingTranslations.js",
"postinstall": "node checkCesium.js",
"postinstall": "node checkCesium.js && rimraf node_modules/leaflet-simple-graticule/node_modules",
"clean": "rimraf ./web/client/dist",
"compile": "npm run clean && mkdirp ./web/client/dist && webpack --progress --config prod-webpack.config.js",
"analyze": "npm run clean && mkdirp ./web/client/dist && webpack --json | webpack-bundle-size-analyzer",
Expand Down
12 changes: 6 additions & 6 deletions project/custom/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>__PROJECTDESCRIPTION__</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.2.4/leaflet.draw.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.0.1/ol.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.4/ol.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/mapstore2.css">
<script src="https://maps.google.com/maps/api/js?v=3"></script>
<!--script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.10/proj4.js"></script-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.2.4/leaflet.draw.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.0.1/ol.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.4/ol.js"></script>
<script src="https://cesiumjs.org/releases/1.17/Build/Cesium/Cesium.js"></script>
<link rel="stylesheet" href="https://cesiumjs.org/releases/1.17/Build/Cesium/Widgets/widgets.css" />
<script src="libs/cesium-navigation/cesium-navigation.js"></script>
Expand Down
12 changes: 6 additions & 6 deletions project/standard/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>__PROJECTDESCRIPTION__</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.2.4/leaflet.draw.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.0.1/ol.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.4/ol.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maps.google.com/maps/api/js?v=3"></script>
<!--script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.10/proj4.js"></script-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.2.4/leaflet.draw.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.0.1/ol.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.4/ol.js"></script>
<script src="https://cesiumjs.org/releases/1.17/Build/Cesium/Cesium.js"></script>
<link rel="stylesheet" href="https://cesiumjs.org/releases/1.17/Build/Cesium/Widgets/widgets.css" />
<script src="MapStore2/web/client/libs/cesium-navigation/cesium-navigation.js"></script>
Expand Down
10 changes: 9 additions & 1 deletion web/client/actions/__tests__/map-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var {
UPDATE_VERSION,
INIT_MAP,
ZOOM_TO_EXTENT,
RESIZE_MAP,
creationError,
changeMapView,
clickOnMap,
Expand All @@ -31,7 +32,8 @@ var {
changeRotation,
updateVersion,
initMap,
zoomToExtent
zoomToExtent,
resizeMap
} = require('../map');

describe('Test correctness of the map actions', () => {
Expand Down Expand Up @@ -151,4 +153,10 @@ describe('Test correctness of the map actions', () => {
expect(retval).toExist();
expect(retval.type).toEqual(INIT_MAP);
});

it('resizeMap', () => {
const retval = resizeMap();
expect(retval).toExist();
expect(retval.type).toEqual(RESIZE_MAP);
});
});
62 changes: 62 additions & 0 deletions web/client/actions/__tests__/measurement-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2018, 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.
*/

const expect = require('expect');
const {
toggleMeasurement, CHANGE_MEASUREMENT_TOOL,
changeMeasurementState, CHANGE_MEASUREMENT_STATE,
changeUom, CHANGE_UOM,
changeGeometry, CHANGED_GEOMETRY
} = require('../measurement');
const feature = {type: "Feature", geometry: {
coordinates: [],
type: "LineString"
}};
const measureState = {
len: 84321231.123,
lengthFormula: "vincenty",
feature
};
describe('Test correctness of measurement actions', () => {

it('Test toggleMeasurement action creator', () => {
const retval = toggleMeasurement(measureState);
expect(retval).toExist();
expect(retval.type).toBe(CHANGE_MEASUREMENT_TOOL);
expect(retval.lengthFormula).toBe("vincenty");
});


it('Test changeMousePositionState action creator', () => {
const [uom, value, previousUom] = ["m", 42, {
length: {unit: 'km', label: 'km'},
area: {unit: 'sqm', label: 'm²'}
}];
const retval = changeUom(uom, value, previousUom);
expect(retval).toExist();
expect(retval.type).toBe(CHANGE_UOM);
expect(retval.uom).toBe("m");
expect(retval.value).toBe(42);
expect(retval.previousUom.length.label).toBe("km");
});

it('Test changeGeometry action creator', () => {

const retval = changeGeometry(feature);
expect(retval).toExist();
expect(retval.type).toBe(CHANGED_GEOMETRY);
expect(retval.feature.geometry.type).toBe("LineString");
});
it('Test changeMeasurementState action creator', () => {
const retval = changeMeasurementState(measureState);
expect(retval).toExist();
expect(retval.type).toBe(CHANGE_MEASUREMENT_STATE);
expect(retval.feature.geometry.type).toBe("LineString");
});

});
11 changes: 11 additions & 0 deletions web/client/actions/__tests__/widgets-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
NEW,
INSERT,
UPDATE,
UPDATE_PROPERTY,
DELETE,
CHANGE_LAYOUT,
EDIT,
Expand All @@ -27,6 +28,7 @@ const {
createWidget,
insertWidget,
updateWidget,
updateWidgetProperty,
deleteWidget,
changeLayout,
editWidget,
Expand Down Expand Up @@ -84,6 +86,15 @@ describe('Test correctness of the widgets actions', () => {
expect(retval.widget).toBe(widget);
expect(retval.target).toBe(DEFAULT_TARGET);
});
it('updateWidgetProperty', () => {
const retval = updateWidgetProperty("id", "key", "value");
expect(retval).toExist();
expect(retval.type).toBe(UPDATE_PROPERTY);
expect(retval.id).toBe("id");
expect(retval.key).toBe("key");
expect(retval.value).toBe("value");
expect(retval.target).toBe(DEFAULT_TARGET);
});
it('deleteWidget', () => {
const widget = {};
const retval = deleteWidget(widget);
Expand Down
11 changes: 10 additions & 1 deletion web/client/actions/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const CHANGE_ROTATION = 'CHANGE_ROTATION';
const CREATION_ERROR_LAYER = 'CREATION_ERROR_LAYER';
const UPDATE_VERSION = 'UPDATE_VERSION';
const INIT_MAP = 'INIT_MAP';
const RESIZE_MAP = 'RESIZE_MAP';

function creationError(options) {
return {
Expand Down Expand Up @@ -130,6 +131,12 @@ function initMap() {
};
}

function resizeMap() {
return {
type: RESIZE_MAP
};
}

module.exports = {
CHANGE_MAP_VIEW,
CLICK_ON_MAP,
Expand All @@ -145,6 +152,7 @@ module.exports = {
CREATION_ERROR_LAYER,
UPDATE_VERSION,
INIT_MAP,
RESIZE_MAP,
changeMapView,
clickOnMap,
changeMousePointer,
Expand All @@ -158,5 +166,6 @@ module.exports = {
zoomToPoint,
creationError,
updateVersion,
initMap
initMap,
resizeMap
};
Loading

0 comments on commit 45cad05

Please sign in to comment.