forked from geosolutions-it/MapStore2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
geosolutions-it#9241 Longitudinal profile tool
- Loading branch information
Showing
44 changed files
with
3,363 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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", | ||
|
@@ -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", | ||
|
@@ -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", | ||
|
139 changes: 139 additions & 0 deletions
139
web/client/actions/__tests__/longitudinalPfofile-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |
Oops, something went wrong.