Hello everyone
I am new to OpenJump. While trying to get familiar with the code and concepts
I encountered the following:
I have a coordinate object that I want to test against a polygon but the obvious does not come out to be true the point in clearly within the polygon but it comes out as disjoint.
Any Ideas? Am I doing this wrong? is this a bug?
========================================================== the code
private boolean isOutside(Coordinate coordinate) {
       GeometryFactory factory = new GeometryFactory();
       Geometry pt= factory.createPoint(coordinate);
Collection selectedFeatures = getPanel().getSelectionManager().getFeaturesWithSelectedItems();
       Iterator it=selectedFeatures.iterator();
       boolean isOut=false;
       for(;it.hasNext() ;){
Geometry candidate = ((Polygon) ((Feature)it.next()).getGeometry()).getBoundary(); isOut= isOut? isOut : candidate.disjoint(pt);
           System.out.println("the point \n\t"+pt+"\n and the poly\n\t");
for (int vrt=0;vrt<candidate.getCoordinates().length;vrt++) System.out.println(candidate.getCoordinates()[vrt]);
           System.out.println("   within   "+candidate.within(pt));
           System.out.println("   contains   "+candidate.contains(pt));
           System.out.println("   disjoint   "+candidate.disjoint(pt));
           System.out.println("  intersects    "+candidate.intersects(pt));
           System.out.println("  coveredBy    "+candidate.coveredBy(pt));
           System.out.println("   covers   "+candidate.covers(pt));
           System.out.println("  crosses    "+candidate.crosses(pt));
           System.out.println("  distance    "+candidate.distance(pt));
           System.out.println("  relate    "+candidate.relate(pt));
       }
       return isOut;
   }

========================================================== the result

the point
   POINT (-100.7811212841775 33.94749761587596)
and the poly
(-100.78480760459135, 33.943991600185065, NaN)
(-100.78480349304893, 33.95118453608152, NaN)
(-100.77605691043526, 33.95105437192414, NaN)
(-100.7760610219777, 33.943861436027674, NaN)
(-100.78480760459135, 33.943991600185065, NaN)
  within   false
  contains   false
  disjoint   true
 intersects    false
 coveredBy    false
  covers   false
 crosses    false
 distance    0.003560480224060094
 relate    FF1FFF0F2
_______________________________________________
jump-users mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jump-users

Reply via email to