Skip to content

Commit 0ad1eee

Browse files
committed
Merge branch 'master' into leaflet_draw_fixes
# Conflicts: # web/client/components/map/leaflet/DrawSupport.jsx
2 parents d6e2426 + 6dfd2e6 commit 0ad1eee

10 files changed

Lines changed: 1501 additions & 10 deletions

File tree

web/client/components/I18N/__tests__/LangSelector-test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('LangSelector', () => {
3636

3737
const opts = cmpDom.childNodes;
3838
const langs = {
39-
'Italiano': 'it-IT', 'English': 'en-US', 'Français': 'fr-FR', 'Deutsch': 'de-DE', 'Español': 'es-ES', "中文": "zh-ZH", 'Nederlands': 'nl-NL'};
39+
'Italiano': 'it-IT', 'English': 'en-US', 'Français': 'fr-FR', 'Deutsch': 'de-DE', 'Español': 'es-ES', "中文": "zh-ZH", 'Nederlands': 'nl-NL', 'Hrvatski': 'hr-HR'};
4040

4141
for (let i = 0; i < opts.length; i++) {
4242
lbl = opts[i].innerHTML;
393 Bytes
Loading

web/client/components/TOC/fragments/settings/__tests__/General-test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('test Layer Properties General module component', () => {
4444
expect(comp).toExist();
4545
const inputs = ReactTestUtils.scryRenderedDOMComponentsWithTag( comp, "input" );
4646
expect(inputs).toExist();
47-
expect(inputs.length).toBe(10);
47+
expect(inputs.length).toBe(11);
4848

4949
});
5050
it('tests Layer Properties Display component events', () => {
@@ -69,7 +69,7 @@ describe('test Layer Properties General module component', () => {
6969
expect(comp).toExist();
7070
const inputs = ReactTestUtils.scryRenderedDOMComponentsWithTag( comp, "input" );
7171
expect(inputs).toExist();
72-
expect(inputs.length).toBe(10);
72+
expect(inputs.length).toBe(11);
7373
ReactTestUtils.Simulate.change(inputs[0]);
7474
expect(spy.calls.length).toBe(1);
7575
});

web/client/components/map/leaflet/DrawSupport.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ class DrawSupport extends React.Component {
348348
fillColor: '#ffffff',
349349
fillOpacity: 0.2
350350
},
351+
showLength: false,
351352
repeatMode: true,
352353
icon: new L.DivIcon({
353354
iconSize: new L.Point(8, 8),
@@ -369,6 +370,8 @@ class DrawSupport extends React.Component {
369370
guidelineDistance: 5
370371
},
371372
allowIntersection: false,
373+
showLength: false,
374+
showArea: false,
372375
repeatMode: true,
373376
icon: new L.DivIcon({
374377
iconSize: new L.Point(8, 8),

web/client/components/map/leaflet/MeasurementSupport.jsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ L.getMeasureWithTreshold = (value, threshold, source, dest, precision, sourceLab
5353
* The value will be rounded as defined by the precision option object.
5454
* this override is necesary due to the customization on how the measure label is presented and for adding bearing support
5555
*/
56+
const originalReadableDistance = L.GeometryUtil.readableDistance;
5657

5758
L.GeometryUtil.readableDistance = (distance, isMetric, isFeet, isNauticalMile, precision, options) => {
59+
if (!options) {
60+
return originalReadableDistance.apply(null, arguments);
61+
}
5862
if (options.geomType === 'Bearing') {
5963
return options.bearing;
6064
}
61-
let p = L.Util.extend({}, defaultPrecision, precision);
65+
const p = L.Util.extend({}, defaultPrecision, precision);
6266
const {unit, label} = options.uom.length;
6367

6468
let distanceStr = L.GeometryUtil.formattedNumber(convertUom(distance, "m", unit), p[unit]) + ' ' + label;
@@ -79,11 +83,17 @@ L.GeometryUtil.readableDistance = (distance, isMetric, isFeet, isNauticalMile, p
7983
* this override is necesary due to the customization on how the area measure label is presented
8084
supporting also the square nautical miles and square feets
8185
*/
86+
87+
const originalReadableArea = L.GeometryUtil.readableArea;
88+
8289
L.GeometryUtil.readableArea = (area, isMetric, precision, options) => {
90+
if (!options) {
91+
return originalReadableArea.apply(null, arguments);
92+
}
8393
const {unit, label} = options.uom.area;
84-
let p = L.Util.extend({}, defaultPrecision, precision);
94+
const p = L.Util.extend({}, defaultPrecision, precision);
8595
let areaStr = L.GeometryUtil.formattedNumber(convertUom(area, "sqm", unit), p[unit]) + ' ' + label;
86-
if (options.useTreshold) { // this is done for retrocompatibility
96+
if (options.useTreshold) {
8797
if (isMetric) {
8898
areaStr = L.getMeasureWithTreshold(area, 1000000, "sqm", "sqkm", p, "m²", "km²");
8999
}
@@ -97,7 +107,12 @@ L.GeometryUtil.readableArea = (area, isMetric, precision, options) => {
97107
/**
98108
* this is need to pass custom options as uom, useTreshold to the readableArea function
99109
*/
110+
const originalGetMeasurementStringPolygon = L.Draw.Polygon.prototype._getMeasurementString;
111+
100112
L.Draw.Polygon.prototype._getMeasurementString = function() {
113+
if (!this.options.uom) {
114+
return originalGetMeasurementStringPolygon.apply(this, arguments);
115+
}
101116
let area = this._area;
102117
let measurementString = '';
103118
if (!area && !this.options.showLength) {
@@ -120,7 +135,12 @@ L.Draw.Polygon.prototype._getMeasurementString = function() {
120135
/**
121136
* this is need to pass custom options as uom, useTreshold, bearing to the readableDistance function
122137
*/
138+
const originalGetMeasurementStringPolyline = L.Draw.Polyline.prototype._getMeasurementString;
139+
123140
L.Draw.Polyline.prototype._getMeasurementString = function() {
141+
if (!this.options.uom) {
142+
return originalGetMeasurementStringPolyline.apply(this, arguments);
143+
}
124144
let currentLatLng = this._currentLatLng;
125145
let previousLatLng = this._markers[this._markers.length - 1].getLatLng();
126146
let distance;
@@ -140,6 +160,7 @@ L.Draw.Polyline.prototype._getMeasurementString = function() {
140160
};
141161
return L.GeometryUtil.readableDistance(distance, this.options.metric, this.options.feet, this.options.nautic, this.options.precision, opt);
142162
};
163+
143164
class MeasurementSupport extends React.Component {
144165
static displayName = 'MeasurementSupport';
145166

web/client/epics/__tests__/localconfig-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('localconfig Epics', () => {
2727
switch (action.type) {
2828
case SUPPORTED_LOCALES_REGISTERED:
2929
// 7 is the actual default number of locales
30-
expect(Object.keys(suppLocales).length).toBe(7);
30+
expect(Object.keys(suppLocales).length).toBe(8);
3131
break;
3232
default:
3333
expect(true).toBe(false);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"locale": "hr-HR",
3+
"messages": {
4+
"msgId0": "{name} je snimio/la {numPhotos, plural, =0 {niti jednu fotografiju} =1 {jednu fotografiju} other {# fotografija}} {takenDate, date, long}.",
5+
"htmlTest": "{name} {surname}",
6+
"about_title": "O aplikaciji...",
7+
"aboutLbl": "i",
8+
"about_p0-0": "MapStore 2 je framework za izgradnju web mapping aplikacija koristeći standardne mapping biblioteke kao što su",
9+
"about_p0-1": "i",
10+
"about_p1": "MapStore 2 ima nekoliko oglednih aplikacija:",
11+
"about_ul0_li0": "MapViewer je jednostavni preglednik predefiniranih karata (po izboru pohranjenih u bazi koristeći GeoStore)",
12+
"about_ul0_li1": "MapPublisher je razvijen za jednostavno i intuitivno kreiranje, spremanje i dijeljenje karata i kombinacija podataka dobivenih odabirom sadržaja koji dolaze iz standardnih izvora kao što su Google Maps i OpenStreetMap ili putem servisa koje pružaju organizacije koristeći otvorene protokole kao što su OGC WMS, WFS, WMTS ili TMS itd. Za više informacija provjerite",
13+
"about_h20": "Licenca",
14+
"about_p3": "MapStore 2 je slobodan softver otvorenoga koda, baziran je na OpenLayers 3, Leaflet i ReactJS bibiliotekama i licenciran je pod Simplified BSD License.",
15+
"about_p5-0": "Za više informacija posjetite",
16+
"about_a0": "ovu",
17+
"about_p5-1": "stranicu."
18+
}
19+
}

0 commit comments

Comments
 (0)