Skip to content

Commit

Permalink
geosolutions-it#9241 Longitudinal profile tool
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Jun 28, 2023
1 parent 8e12671 commit dd6b090
Show file tree
Hide file tree
Showing 44 changed files with 3,363 additions and 15 deletions.
1 change: 1 addition & 0 deletions build/docma-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
"web/client/plugins/LayerInfo.jsx",
"web/client/plugins/Locate.jsx",
"web/client/plugins/Login.jsx",
"web/client/plugins/LongitudinalProfileTool.jsx",
"web/client/plugins/Map.jsx",
"web/client/plugins/MapCatalog.jsx",
"web/client/plugins/MapEditor.jsx",
Expand Down
1 change: 1 addition & 0 deletions docs/developer-guide/maps-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ The `symbolizer` could be of following `kinds`:
| `size` | size of the icon | x | x |
| `opacity` | opacity of the icon | x | x |
| `rotate` | rotation of the icon | x | x |
| `anchor` | array of values defined in fractions [0 to 1] | x | x |
| `msBringToFront` | this boolean will allow setting the **disableDepthTestDistance** value for the feature. This would | | x |
| `msHeightReference` | reference to compute the distance of the point geometry, one of **none**, **ground** or **clamp** | | x |
| `msHeight` | height of the point, the original geometry is applied if undefined | | x |
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"@turf/convex": "6.5.0",
"@turf/difference": "6.5.0",
"@turf/great-circle": "5.1.5",
"@turf/helpers": "6.5.0",
"@turf/inside": "4.1.0",
"@turf/line-intersect": "4.1.0",
"@turf/point-on-surface": "4.1.0",
Expand Down Expand Up @@ -173,6 +174,7 @@
"draft-js-plugins-editor": "2.1.1",
"draft-js-side-toolbar-plugin": "3.0.1",
"draftjs-to-html": "0.8.4",
"dxf-parser": "1.1.2",
"element-closest": "2.0.2",
"embed-video": "2.0.4",
"es6-object-assign": "1.1.0",
Expand All @@ -184,6 +186,7 @@
"git-revision-webpack-plugin": "5.0.0",
"history": "4.6.1",
"html-to-draftjs": "npm:@geosolutions/[email protected]",
"html-to-image": "1.11.11",
"html2canvas": "0.5.0-beta4",
"immutable": "4.0.0-rc.12",
"intersection-observer": "0.7.0",
Expand Down Expand Up @@ -217,6 +220,7 @@
"object-fit-images": "3.2.4",
"ogc-schemas": "2.6.1",
"ol": "5.3.0",
"pdfmake": "0.2.7",
"pdfviewer": "0.3.2",
"plotly.js-cartesian-dist": "2.5.1",
"prop-types": "15.7.2",
Expand Down
139 changes: 139 additions & 0 deletions web/client/actions/__tests__/longitudinalPfofile-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* Copyright 2022, 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.
*/
import expect from "expect";

import {CONTROL_DOCK_NAME} from '../../plugins/longitudinalProfile/constants';
import {SET_CONTROL_PROPERTY} from "../controls";
import {
ADD_PROFILE_DATA,
addProfileData,
CHANGE_DISTANCE,
CHANGE_GEOMETRY,
CHANGE_REFERENTIAL,
changeDistance,
changeGeometry,
changeReferential,
closeDock,
initialized,
INITIALIZED,
loading,
LOADING,
openDock,
setupPlugin,
SETUP,
TEAR_DOWN,
tearDown,
TOGGLE_MAXIMIZE,
TOGGLE_MODE,
toggleMaximize,
toggleMode
} from "../longitudinalProfile";

describe('Test correctness of the actions', () => {
it('setup', () => {
const config = {configProp1: 'example', configProp2: 'test'};
const action = setupPlugin(config);
expect(action).toExist();
expect(action.type).toBe(SETUP);
expect(action.config).toEqual(config);
});

it('initialized', () => {
const action = initialized();
expect(action).toExist();
expect(action.type).toBe(INITIALIZED);
});

it('tearDown', () => {
const action = tearDown();
expect(action).toExist();
expect(action.type).toBe(TEAR_DOWN);
});

it('openDock', () => {
const action = openDock();
expect(action).toExist();
expect(action.type).toBe(SET_CONTROL_PROPERTY);
expect(action.control).toBe(CONTROL_DOCK_NAME);
expect(action.property).toBe('enabled');
expect(action.value).toBe(true);
});

it('closeDock', () => {
const action = closeDock();
expect(action).toExist();
expect(action.type).toBe(SET_CONTROL_PROPERTY);
expect(action.control).toBe(CONTROL_DOCK_NAME);
expect(action.property).toBe('enabled');
expect(action.value).toBe(false);
});

it('toggleMode - no mode passed', () => {
const action = toggleMode();
expect(action).toExist();
expect(action.type).toBe(TOGGLE_MODE);
expect(action.mode).toBe(undefined);
});

it('toggleMode - mode passed', () => {
const action = toggleMode('draw');
expect(action).toExist();
expect(action.type).toBe(TOGGLE_MODE);
expect(action.mode).toBe('draw');
});

it('addProfileData', () => {
const infos = { prop1: true, prop2: 10, prop3: 'test'};
const points = [[[1, 2, 5], [2, 3, 5]]];
const projection = 'EPSG:3857';
const action = addProfileData(infos, points, projection);
expect(action).toExist();
expect(action.type).toBe(ADD_PROFILE_DATA);
expect(action.infos).toEqual(infos);
expect(action.points[0]).toEqual(points[0]);
expect(action.points[1]).toEqual(points[1]);
expect(action.projection).toEqual(projection);
});

it('loading', () => {
const action = loading(true);
expect(action).toExist();
expect(action.type).toBe(LOADING);
expect(action.state).toBe(true);
});

it('changeReferential', () => {
const action = changeReferential('ref2');
expect(action).toExist();
expect(action.type).toBe(CHANGE_REFERENTIAL);
expect(action.referential).toBe('ref2');
});

it('changeDistance', () => {
const action = changeDistance(200);
expect(action).toExist();
expect(action.type).toBe(CHANGE_DISTANCE);
expect(action.distance).toBe(200);
});

it('changeGeometry', () => {
const geometry = { point: [2, 5], center: [1, 1]};
const action = changeGeometry(geometry);
expect(action).toExist();
expect(action.type).toBe(CHANGE_GEOMETRY);
expect(action.geometry).toExist();
expect(action.geometry.point).toEqual([2, 5]);
expect(action.geometry.center).toEqual([1, 1]);
});

it('toggleMaximize', () => {
const action = toggleMaximize();
expect(action).toExist();
expect(action.type).toBe(TOGGLE_MAXIMIZE);
});
});
Loading

0 comments on commit dd6b090

Please sign in to comment.