Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed May 15, 2018
1 parent e62a9bd commit 69fb5de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions web/client/components/map/leaflet/MeasurementSupport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ class MeasurementSupport extends React.Component {
this.lastLayer = evt.layer;

let feature = this.lastLayer && this.lastLayer.toGeoJSON() || {};
let newFeature = feature;
if (this.props.measurement.geomType === 'LineString') {
newFeature = assign({}, feature, {
feature = assign({}, feature, {
geometry: assign({}, feature.geometry, {
coordinates: transformLineToArcs(feature.geometry.coordinates)
})
Expand All @@ -63,10 +62,10 @@ class MeasurementSupport extends React.Component {
if (this.props.measurement.geomType === 'Point') {
let pos = this.drawControl._marker.getLatLng();
let point = {x: pos.lng, y: pos.lat, srs: 'EPSG:4326'};
let newMeasureState = assign({}, this.props.measurement, {point: point, feature: newFeature});
let newMeasureState = assign({}, this.props.measurement, {point: point, feature});
this.props.changeMeasurementState(newMeasureState);
} else {
let newMeasureState = assign({}, this.props.measurement, {feature: newFeature});
let newMeasureState = assign({}, this.props.measurement, {feature});
this.props.changeMeasurementState(newMeasureState);
}
if (this.props.measurement.lineMeasureEnabled && this.lastLayer) {
Expand Down
5 changes: 2 additions & 3 deletions web/client/components/map/openlayers/MeasurementSupport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,8 @@ class MeasurementSupport extends React.Component {
}
const geojsonFormat = new ol.format.GeoJSON();
let feature = reprojectGeoJson(geojsonFormat.writeFeatureObject(this.sketchFeature.clone()), this.props.map.getView().getProjection().getCode(), "EPSG:4326");
let newFeature = feature;
if (this.props.measurement.geomType === 'LineString') {
newFeature = assign({}, feature, {
feature = assign({}, feature, {
geometry: assign({}, feature.geometry, {
coordinates: transformLineToArcs(feature.geometry.coordinates)
})
Expand All @@ -292,7 +291,7 @@ class MeasurementSupport extends React.Component {
bearing: this.props.measurement.geomType === 'Bearing' ? bearing : 0,
lenUnit: this.props.measurement.lenUnit,
areaUnit: this.props.measurement.areaUnit,
feature: newFeature
feature
}
);
this.props.changeMeasurementState(newMeasureState);
Expand Down

0 comments on commit 69fb5de

Please sign in to comment.