Skip to content

Commit

Permalink
Fix Polygonizer error due to super constructor transpilation issues (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornharrtell authored Sep 15, 2018
1 parent 067e3ad commit fe4e335
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/org/locationtech/jts/planargraph/DirectedEdge.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ DirectedEdge.constructor_ = function () {
this._edgeDirection = null;
this._quadrant = null;
this._angle = null;
let from = arguments[0], to = arguments[1], directionPt = arguments[2], edgeDirection = arguments[3];
this._from = from;
this._to = to;
this._edgeDirection = edgeDirection;
this._p0 = from.getCoordinate();
this._p1 = directionPt;
var dx = this._p1.x - this._p0.x;
var dy = this._p1.y - this._p0.y;
this._quadrant = Quadrant.quadrant(dx, dy);
this._angle = Math.atan2(dy, dx);
if (arguments.length === 0) {} else if (arguments.length === 4) {
let from = arguments[0], to = arguments[1], directionPt = arguments[2], edgeDirection = arguments[3];
this._from = from;
this._to = to;
this._edgeDirection = edgeDirection;
this._p0 = from.getCoordinate();
this._p1 = directionPt;
var dx = this._p1.x - this._p0.x;
var dy = this._p1.y - this._p0.y;
this._quadrant = Quadrant.quadrant(dx, dy);
this._angle = Math.atan2(dy, dx);
}
};
22 changes: 22 additions & 0 deletions test/manual/operation/polygonize/Polygonizer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import expect from 'expect.js'

import Coordinate from 'org/locationtech/jts/geom/Coordinate'
import GeometryFactory from 'org/locationtech/jts/geom/GeometryFactory'
import WKTReader from 'org/locationtech/jts/io/WKTReader'
import Polygonizer from 'org/locationtech/jts/operation/polygonize/Polygonizer'

describe('Polygonizer', function () {
it('Basic Polygonizer test', function () {
let reader = new WKTReader();
let lineString = reader.read('LINESTRING (30 10, 40 40, 20 40, 10 20, 30 10)');

var polygonizer = new Polygonizer();
expect(polygonizer).to.be.ok();

polygonizer.add(lineString);
var polygons = polygonizer.getPolygons();
var count = polygons.size();

expect(count).to.be(1);
})
})

0 comments on commit fe4e335

Please sign in to comment.