Skip to content

Commit

Permalink
Port RectangleIntersects
Browse files Browse the repository at this point in the history
Upgrade to Jasmine 2.0 and fix test cases
  • Loading branch information
bjornharrtell committed Aug 12, 2014
1 parent af5ed2a commit ee6493f
Show file tree
Hide file tree
Showing 16 changed files with 652 additions and 201 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
2014-xx-xx: Version 0.14.0
2014-08-12: Version 0.14.0

Ported isRectangle (#152, #154, #156)
Ported MinimumDiameter and MinimumBoundingCircle (#160)
LineSegment completed port (#159)

Expand Down
12 changes: 6 additions & 6 deletions build/build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh
jsbuild full.cfg -v -o ../lib -j jsts.js
tar -cvf jsts-0.13.3.tar ../src ../doc ../lib ../examples ../src ../license.txt ../authors.txt ../ChangeLog ../README.md
rm jsts-0.13.3.tar.gz
gzip -9 jsts-0.13.3.tar
tar -cvf jsts-0.14.0.tar ../src ../doc ../lib ../examples ../src ../license.txt ../authors.txt ../ChangeLog ../README.md
rm jsts-0.14.0.tar.gz
gzip -9 jsts-0.14.0.tar
mkdir tmp
cd tmp
tar xvfz ../jsts-0.13.3.tar.gz
rm ../jsts-0.13.3.zip
zip -r -9 ../jsts-0.13.3.zip *
tar xvfz ../jsts-0.14.0.tar.gz
rm ../jsts-0.14.0.zip
zip -r -9 ../jsts-0.14.0.zip *
cd ..
rm tmp -rf
366 changes: 231 additions & 135 deletions lib/jsts.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"javascript.util": "~0.10.0"
},
"devDependencies": {
"jasmine-node": "~1.3.0"
"jasmine-node": "~1.14.5"
},
"directories": {
"lib": "./src",
Expand Down
4 changes: 3 additions & 1 deletion src/jsts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/** @namespace */
jsts = {
version: '0.13.4',
version: '0.14.0',
/** @namespace */
algorithm: {
/** @namespace */
Expand Down Expand Up @@ -59,6 +59,8 @@ jsts = {
},
/** @namespace */
polygonize: {},
/** @namespace */
predicate: {},
/** @namespace */
relate: {},
/** @namespace */
Expand Down
4 changes: 2 additions & 2 deletions src/jsts/geom/Geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,10 @@ jsts.geom.Geometry.prototype.intersects = function(g) {

// optimization for rectangle arguments
if (this.isRectangle()) {
return RectangleIntersects.intersects(this, g);
return jsts.operation.predicate.RectangleIntersects.intersects(this, g);
}
if (g.isRectangle()) {
return RectangleIntersects.intersects(g, this);
return jsts.operation.predicate.RectangleIntersects.intersects(g, this);
}
// general case
return this.relate(g).isIntersects();
Expand Down
46 changes: 46 additions & 0 deletions src/jsts/geom/util/ShortCircuitedGeometryVisitor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* Copyright (c) 2011 by The Authors.
* Published under the LGPL 2.1 license.
* See /license-notice.txt for the full text of the license notice.
* See /license.txt for the full text of the license.
*/

/**
* Port source:
* /jts/jts/java/src/com/vividsolutions/jts/geom/util/ShortCircuitedGeometryVisitor.java
* Revision: 707
*/

(function() {

/**
* A visitor to {@link Geometry} componets, which
* allows short-circuiting when a defined condition holds.
*
* @version 1.7
*/
jsts.geom.util.ShortCircuitedGeometryVisitor = function() {

};

jsts.geom.util.ShortCircuitedGeometryVisitor.prototype.isDone = false;

jsts.geom.util.ShortCircuitedGeometryVisitor.prototype.applyTo = function(geom) {
for (var i = 0; i < geom.getNumGeometries() && ! this.isDone; i++) {
var element = geom.getGeometryN(i);
if (! (element instanceof jsts.geom.GeometryCollection)) {
this.visit(element);
if (this.isDone()) {
this.isDone = true;
return;
}
}
else
this.applyTo(element);
}
}

jsts.geom.util.ShortCircuitedGeometryVisitor.prototype.visit = function(element) {};

jsts.geom.util.ShortCircuitedGeometryVisitor.prototype.isDone = function() {};

})();
Loading

0 comments on commit ee6493f

Please sign in to comment.