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.
2626 updates measure tool (geosolutions-it#2701)
* Fix geosolutions-it#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
Showing
22 changed files
with
1,023 additions
and
164 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 |
---|---|---|
@@ -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"); | ||
}); | ||
|
||
}); |
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
Oops, something went wrong.