Skip to content

Commit

Permalink
Merge pull request #4868 from camptocamp/fix-oeedit
Browse files Browse the repository at this point in the history
 Fix the JSTS OpenLayers link
  • Loading branch information
sbrunner committed May 3, 2019
2 parents b09f88a + 9c36bd6 commit a4bb62b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,12 @@ gh-pages: .build/python-venv.timestamp
--app 'Desktop application' apps/desktop.html 'The desktop example application for GeoMapFish.' \
--app 'Alternate mobile application' apps/mobile_alt.html 'An alternate mobile example application for GeoMapFish.' \
--app 'Alternate desktop application' apps/desktop_alt.html 'An alternate desktop example application for GeoMapFish.' \
--app 'Object editing viewer' apps/oeview.html 'An example application for viewing an object.' \
--app 'Object editing editor' apps/oeedit.html 'An example application for editing an object.' \
--app 'Object editing viewer' \
'apps/oeview.html?objectediting_geomtype=MultiPolygon&objectediting_id=Test&objectediting_layer=112&objectediting_theme=ObjectEditing&objectediting_property=name&tree_groups=ObjectEditing' \
'An example application for viewing an object.' \
--app 'Object editing editor' \
'apps/oeedit.html?objectediting_geomtype=MultiPolygon&objectediting_id=Test&objectediting_layer=112&objectediting_theme=ObjectEditing&objectediting_property=name&tree_groups=ObjectEditing' \
'An example application for editing an object.' \
$< $(GMF_EXAMPLES_HTML_FILES) > $@

.build/test-check-example/%.check.timestamp: test/check-example/%.html \
Expand Down
25 changes: 16 additions & 9 deletions contribs/gmf/src/objectediting/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ import * as olBase from 'ol/index.js';
import olCollection from 'ol/Collection.js';
import * as olEvents from 'ol/events.js';
import olFormatGeoJSON from 'ol/format/GeoJSON.js';
import olGeomMultiPolygon from 'ol/geom/MultiPolygon.js';
import Point from 'ol/geom/Point.js';
import LineString from 'ol/geom/LineString.js';
import LinearRing from 'ol/geom/LinearRing.js';
import Polygon from 'ol/geom/Polygon.js';
import MultiPoint from 'ol/geom/MultiPoint.js';
import MultiLineString from 'ol/geom/MultiLineString.js';
import MultiPolygon from 'ol/geom/MultiPolygon.js';
import GeometryCollection from 'ol/geom/GeometryCollection.js';
import olLayerImage from 'ol/layer/Image.js';
import olLayerTile from 'ol/layer/Tile.js';
import olInteractionModify from 'ol/interaction/Modify.js';
Expand All @@ -35,12 +42,8 @@ import olStyleFill from 'ol/style/Fill.js';
import olStyleStroke from 'ol/style/Stroke.js';
import olStyleStyle from 'ol/style/Style.js';

import {OL3Parser} from 'jsts/io';
const jsts = {
io: {
OL3Parser,
},
};
import OL3Parser from 'jsts/io/OL3Parser.js';
import 'jsts/monkey.js';


/**
Expand Down Expand Up @@ -313,7 +316,11 @@ exports.Controller = function($scope, $timeout, gettextCatalog,
* @type {!jsts.io.OL3Parser}
* @private
*/
this.jstsOL3Parser_ = new jsts.io.OL3Parser();
this.jstsOL3Parser_ = new OL3Parser(undefined, {
geom: {
Point, LineString, LinearRing, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryCollection
}
});

/**
* The state of the feature determines whether the next 'save' request
Expand Down Expand Up @@ -795,7 +802,7 @@ exports.Controller.prototype.handleModifyInteractionModifyEnd_ = function(
) {
let geometry = this.feature.getGeometry();

if (geometry instanceof olGeomMultiPolygon) {
if (geometry instanceof MultiPolygon) {
const jstsGeom = this.jstsOL3Parser_.read(geometry);
const jstsBuffered = jstsGeom.buffer(0);
geometry = ngeoUtils.toMulti(this.jstsOL3Parser_.write(jstsBuffered));
Expand Down

0 comments on commit a4bb62b

Please sign in to comment.