Skip to content

Commit

Permalink
Fix gmf examples
Browse files Browse the repository at this point in the history
  • Loading branch information
llienher committed May 3, 2018
1 parent 479231c commit 102964f
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 57 deletions.
18 changes: 9 additions & 9 deletions contribs/gmf/examples/mobilemeasure.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
ng-model="ctrl.measurePointActive">Point</a>
</div>
<div
gmf-mobile-measure-length=""
gmf-mobile-measure-length-active="ctrl.measureLengthActive"
gmf-mobile-measure-length-precision="2"
gmf-mobile-measure-length-map="::ctrl.map">
gmf-mobile-measurelength=""
gmf-mobile-measurelength-active="ctrl.measureLengthActive"
gmf-mobile-measurelength-precision="2"
gmf-mobile-measurelength-map="::ctrl.map">
</div>
<div
gmf-mobile-measure-point=""
gmf-mobile-measure-point-active="ctrl.measurePointActive"
gmf-mobile-measure-point-coordinateDecimals="2"
gmf-mobile-measure-point-layersconfig="::ctrl.measurePointLayersConfig"
gmf-mobile-measure-point-map="::ctrl.map">
gmf-mobile-measurepoint=""
gmf-mobile-measurepoint-active="ctrl.measurePointActive"
gmf-mobile-measurepoint-coordinateDecimals="2"
gmf-mobile-measurepoint-layersconfig="::ctrl.measurePointLayersConfig"
gmf-mobile-measurepoint-map="::ctrl.map">
</div>

<p id="desc">
Expand Down
8 changes: 4 additions & 4 deletions contribs/gmf/examples/mobilemeasure.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ exports.MainController = function(gmfPermalink) {
* @type {Object.<string, gmf.mobile.measure.pointComponent.LayerConfig>}
* @export
*/
this.measurePointLayersConfig = {
'aster': {unit: 'm', decimals: 2},
'srtm': {unit: 'm'}
};
this.measurePointLayersConfig = [
{name: 'aster', unit: 'm', decimals: 2},
{name: 'srtm', unit: 'm'}
];

/**
* @type {boolean}
Expand Down
8 changes: 4 additions & 4 deletions contribs/gmf/examples/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ exports.MainController = function($scope, ngeoFeatureOverlayMgr) {
this.profileLine = null; // To reset the profile.
};

this.drawLine.on('drawstart', function() {
this.drawLine.on('drawstart', () => {
this.clear_();
}, this);
});

this.drawLine.on('drawend', function(e) {
this.drawLine.on('drawend', (e) => {
// Update the profile with the new geometry
this.profileLine = e.feature.getGeometry();
$scope.$digest();
}, this);
});
};


Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/disclaimer/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ exports.Controller_.prototype.unregisterLayer_ = function(layer) {
this.eventHelper_.clearListenerKey(layerUid);

// (2) Unregister existing layers in the group
layer.getLayers().forEach(this.unregisterLayer_, this);
layer.getLayers().forEach(layer => this.unregisterLayer_(layer));

} else {

Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/drawing/featureStyleComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import googAsserts from 'goog/asserts.js';
import * as olEvents from 'ol/events.js';
import olObject from 'ol/Object.js';
import {getChangeEventType} from 'ol/Object.js';
import ngeoFormatFeatureProperties from 'ngeo/format/FeatureProperties.js';

/** @suppress {extraRequire} */
Expand Down Expand Up @@ -162,7 +162,7 @@ exports.Controller_.prototype.handleFeatureSet_ = function(
keys.push(
olEvents.listen(
newFeature,
olObject.getChangeEventType(propName),
getChangeEventType(propName),
this.handleFeatureChange_,
this
)
Expand Down
8 changes: 4 additions & 4 deletions contribs/gmf/src/mobile/measure/lengthComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ngeoMiscFilters from 'ngeo/misc/filters.js';
import ngeoInteractionMeasureLengthMobile from 'ngeo/interaction/MeasureLengthMobile.js';
import ngeoMiscDecorate from 'ngeo/misc/decorate.js';
import * as olEvents from 'ol/events.js';
import olObject from 'ol/Object.js';
import {getChangeEventType} from 'ol/Object.js';
import olStyleFill from 'ol/style/Fill.js';
import olStyleRegularShape from 'ol/style/RegularShape.js';
import olStyleStroke from 'ol/style/Stroke.js';
Expand Down Expand Up @@ -223,7 +223,7 @@ exports.Controller_.prototype.init = function() {

olEvents.listen(
drawInteraction,
olObject.getChangeEventType('dirty'),
getChangeEventType('dirty'),
function() {
this.dirty = drawInteraction.getDirty();

Expand All @@ -239,7 +239,7 @@ exports.Controller_.prototype.init = function() {

olEvents.listen(
drawInteraction,
olObject.getChangeEventType('drawing'),
getChangeEventType('drawing'),
function() {
this.drawing = drawInteraction.getDrawing();
},
Expand All @@ -248,7 +248,7 @@ exports.Controller_.prototype.init = function() {

olEvents.listen(
drawInteraction,
olObject.getChangeEventType('valid'),
getChangeEventType('valid'),
function() {
this.valid = drawInteraction.getValid();
},
Expand Down
31 changes: 15 additions & 16 deletions contribs/gmf/src/mobile/measure/pointComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,22 +280,21 @@ exports.Controller_.prototype.translate = function(str) {
* - on deactivate, unlisten
* @private
*/
exports.Controller_.prototype.handleMeasureActiveChange_ =
function() {
if (this.measure.getActive()) {
const view = this.map.getView();
this.mapViewPropertyChangeEventKey_ = olEvents.listen(
view,
'propertychange',
this.ngeoDebounce_(
this.getMeasure_.bind(this), 300, /* invokeApply */ true),
this);
this.getMeasure_();
} else if (this.mapViewPropertyChangeEventKey_) {
olEvents.unlistenByKey(this.mapViewPropertyChangeEventKey_);
this.mapViewPropertyChangeEventKey_ = null;
}
};
exports.Controller_.prototype.handleMeasureActiveChange_ = function() {
if (this.measure.getActive()) {
const view = this.map.getView();
this.mapViewPropertyChangeEventKey_ = olEvents.listen(
view,
'propertychange',
this.ngeoDebounce_(
this.getMeasure_.bind(this), 300, /* invokeApply */ true),
this);
this.getMeasure_();
} else if (this.mapViewPropertyChangeEventKey_) {
olEvents.unlistenByKey(this.mapViewPropertyChangeEventKey_);
this.mapViewPropertyChangeEventKey_ = null;
}
};


/**
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/objectediting/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import olGeomMultiPolygon from 'ol/geom/MultiPolygon.js';
import olLayerImage from 'ol/layer/Image.js';
import olLayerTile from 'ol/layer/Tile.js';
import olInteractionModify from 'ol/interaction/Modify.js';
import olObject from 'ol/Object.js';
import {getChangeEventType} from 'ol/Object.js';
import olStyleCircle from 'ol/style/Circle.js';
import olStyleFill from 'ol/style/Fill.js';
import olStyleStroke from 'ol/style/Stroke.js';
Expand Down Expand Up @@ -677,7 +677,7 @@ exports.Controller.prototype.toggle_ = function(active) {
keys.push(
olEvents.listen(
this.feature,
olObject.getChangeEventType(this.feature.getGeometryName()),
getChangeEventType(this.feature.getGeometryName()),
this.handleFeatureGeometryChange_,
this
)
Expand Down
4 changes: 2 additions & 2 deletions src/filter/RuleHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ngeoRuleGeometry from 'ngeo/rule/Geometry.js';
import ngeoRuleRule from 'ngeo/rule/Rule.js';
import ngeoRuleSelect from 'ngeo/rule/Select.js';
import ngeoRuleText from 'ngeo/rule/Text.js';
import olFormatWFS from 'ol/format/WFS.js';
import {writeFilter} from 'ol/format/WFS.js';
import * as olFormatFilter from 'ol/format/filter.js';
import * as olArray from 'ol/array.js';

Expand Down Expand Up @@ -452,7 +452,7 @@ const exports = class {
let filterString = null;
const filter = this.createFilter(options);
if (filter) {
const filterNode = olFormatWFS.writeFilter(filter);
const filterNode = writeFilter(filter);
const xmlSerializer = new XMLSerializer();
filterString = xmlSerializer.serializeToString(filterNode);
}
Expand Down
4 changes: 2 additions & 2 deletions src/interaction/Modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ exports.prototype.setState_ = function() {
});

if (active && map) {
this.features_.forEach(() => this.addFeature_);
this.features_.forEach(feature => this.addFeature_(feature));
keys.push(
olEvents.listen(this.features_, 'add', this.handleFeaturesAdd_, this),
olEvents.listen(this.features_, 'remove', this.handleFeaturesRemove_, this)
);
} else {
keys.forEach(olEvents.unlistenByKey);
keys.length = 0;
this.features_.forEach(() => this.removeFeature_);
this.features_.forEach(feature => this.removeFeature_(feature));
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/interaction/ModifyCircle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as olExtent from 'ol/extent.js';
import olGeomCircle from 'ol/geom/Circle.js';
import olGeomLineString from 'ol/geom/LineString.js';
import olGeomPoint from 'ol/geom/Point.js';
import olGeomPolygon from 'ol/geom/Polygon.js';
import {fromCircle} from 'ol/geom/Polygon.js';
import olInteractionPointer, {handleEvent as pointerHandleEvent} from 'ol/interaction/Pointer.js';
import olLayerVector from 'ol/layer/Vector.js';
import olSourceVector from 'ol/source/Vector.js';
Expand Down Expand Up @@ -117,7 +117,7 @@ const exports = function(options) {
*/
this.features_ = options.features;

this.features_.forEach(() => this.addFeature_);
this.features_.forEach(feature => this.addFeature_(feature));
olEvents.listen(this.features_, 'add', this.handleFeatureAdd_, this);
olEvents.listen(this.features_, 'remove', this.handleFeatureRemove_, this);

Expand Down Expand Up @@ -343,7 +343,7 @@ exports.handleDragEvent_ = function(evt) {
* @type {ol.geom.Circle}
*/
const circle = new olGeomCircle(center, line.getLength());
const coordinates = olGeomPolygon.fromCircle(circle, 64).getCoordinates();
const coordinates = fromCircle(circle, 64).getCoordinates();
this.setGeometryCoordinates_(geometry, coordinates);


Expand Down
4 changes: 2 additions & 2 deletions src/interaction/Rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ exports.prototype.setActive = function(active) {
this.handleKeyUp_,
this
);
this.features_.forEach(() => this.addFeature_);
this.features_.forEach(feature => this.addFeature_(feature));
this.listenerKeys_.push(
olEvents.listen(this.features_, 'add', this.handleFeatureAdd_, this),
olEvents.listen(this.features_, 'remove', this.handleFeatureRemove_, this)
Expand All @@ -151,7 +151,7 @@ exports.prototype.setActive = function(active) {
} else {
this.listenerKeys_.forEach(olEvents.unlistenByKey);
this.listenerKeys_.length = 0;
this.features_.forEach(() => this.removeFeature_);
this.features_.forEach(feature => this.removeFeature_(feature));
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/interaction/Translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ exports.prototype.setState_ = function() {
const keys = this.listenerKeys_;

if (map && active && features) {
features.forEach(this.addFeature_, this);
features.forEach(feature => this.addFeature_(feature));
keys.push(
olEvents.listen(features, 'add', this.handleFeaturesAdd_, this),
olEvents.listen(features, 'remove', this.handleFeaturesRemove_, this)
Expand All @@ -160,7 +160,7 @@ exports.prototype.setState_ = function() {

keys.forEach(olEvents.unlistenByKey);
keys.length = 0;
features.forEach(this.removeFeature_, this);
features.forEach(feature => this.removeFeature_(feature));
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/map/FeatureOverlayMgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as olBase from 'ol/index.js';
import olLayerVector from 'ol/layer/Vector.js';
import * as olObj from 'ol/obj.js';
import olSourceVector from 'ol/source/Vector.js';
import olStyleStyle, {toFunction as toStyleFunction} from 'ol/style/Style.js';
import olStyleStyle, {toFunction as toStyleFunction, createDefaultStyle as olStyleDefaultFunction} from 'ol/style/Style.js';


/**
Expand Down Expand Up @@ -130,7 +130,7 @@ exports.prototype.getLayer = function() {
exports.prototype.getFeatureOverlay = function() {
const groupIndex = this.groups_.length;
this.groups_.push({
styleFunction: olStyleStyle.defaultFunction,
styleFunction: olStyleDefaultFunction,
features: {}
});
return new ngeoMapFeatureOverlay(this, groupIndex);
Expand Down
4 changes: 2 additions & 2 deletions src/rule/Geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import googAsserts from 'goog/asserts.js';
import ngeoFormatAttributeType from 'ngeo/format/AttributeType.js';
import ngeoRuleRule from 'ngeo/rule/Rule.js';
import olObject from 'ol/Object.js';
import {getChangeEventType} from 'ol/Object.js';
import * as olEvents from 'ol/events.js';
import olFeature from 'ol/Feature.js';
import olFormatGeoJSON from 'ol/format/GeoJSON.js';
Expand Down Expand Up @@ -62,7 +62,7 @@ const exports = class extends ngeoRuleRule {
this.listenerKeys.push(
olEvents.listen(
this.feature_,
olObject.getChangeEventType(this.feature.getGeometryName()),
getChangeEventType(this.feature.getGeometryName()),
this.handleFeatureGeometryChange_,
this
)
Expand Down

0 comments on commit 102964f

Please sign in to comment.