Revision 23749
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/operation/GeometryOperationNotSupportedException.java | ||
---|---|---|
3 | 3 |
import java.util.HashMap; |
4 | 4 |
import java.util.Map; |
5 | 5 |
|
6 |
import org.gvsig.tools.exception.BaseException; |
|
7 | 6 |
import org.gvsig.fmap.geom.type.GeometryType; |
7 |
import org.gvsig.tools.exception.BaseException; |
|
8 | 8 |
|
9 | 9 |
public class GeometryOperationNotSupportedException extends BaseException { |
10 | 10 |
|
... | ... | |
70 | 70 |
this.opCode = opCode; |
71 | 71 |
} |
72 | 72 |
|
73 |
/* |
|
74 |
* (non-Javadoc) |
|
75 |
* @see org.gvsig.exceptions.BaseException#values() |
|
76 |
*/ |
|
77 | 73 |
protected Map values() { |
78 | 74 |
HashMap map = new HashMap(); |
79 | 75 |
map.put("opCode", Integer.toString(opCode)); |
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/operation/GeometryOperationException.java | ||
---|---|---|
102 | 102 |
this.operationCode = operationCode; |
103 | 103 |
} |
104 | 104 |
|
105 |
/* |
|
106 |
* (non-Javadoc) |
|
107 |
* @see org.gvsig.exceptions.BaseException#values() |
|
108 |
*/ |
|
109 | 105 |
protected Map values() { |
110 | 106 |
HashMap map = new HashMap(); |
111 | 107 |
map.put("geometryType", new Integer(geometryType)); |
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/type/GeometryTypeNotSupportedException.java | ||
---|---|---|
95 | 95 |
} |
96 | 96 |
} |
97 | 97 |
|
98 |
/* |
|
99 |
* (non-Javadoc) |
|
100 |
* @see org.gvsig.exceptions.BaseException#values() |
|
101 |
*/ |
|
102 | 98 |
protected Map values() { |
103 | 99 |
HashMap map = new HashMap(); |
104 | 100 |
map.put("geomClassName", geomClassName); |
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/GeneralPathX.java | ||
---|---|---|
59 | 59 |
import java.awt.geom.Point2D; |
60 | 60 |
import java.awt.geom.Rectangle2D; |
61 | 61 |
import java.io.Serializable; |
62 |
import java.lang.reflect.InvocationTargetException; |
|
63 |
import java.lang.reflect.Method; |
|
62 | 64 |
import java.util.ArrayList; |
63 | 65 |
|
64 | 66 |
import org.cresques.cts.ICoordTrans; |
... | ... | |
103 | 105 |
*/ |
104 | 106 |
private static final long serialVersionUID = 1L; |
105 | 107 |
|
108 |
private static Method crossingsForPath = null; |
|
109 |
|
|
106 | 110 |
/** |
107 | 111 |
* An even-odd winding rule for determining the interior of |
108 | 112 |
* a path. |
... | ... | |
635 | 639 |
return false; |
636 | 640 |
} |
637 | 641 |
// int cross = sun.awt.geom.Curve.pointCrossingsForPath(getPathIterator(null), x, y); |
638 |
int cross = Curve.crossingsForPath(getPathIterator(null), x, y); |
|
642 |
// int cross = Curve.crossingsForPath(getPathIterator(null), x, y); |
|
643 |
int cross = curveCrossingsForPath(getPathIterator(null), x, y); |
|
639 | 644 |
if (windingRule == WIND_NON_ZERO) { |
640 | 645 |
return (cross != 0); |
641 | 646 |
} else { |
... | ... | |
643 | 648 |
} |
644 | 649 |
} |
645 | 650 |
|
651 |
private static int curveCrossingsForPath(PathIterator pathIterator, double x, double y) { |
|
652 |
|
|
653 |
if( crossingsForPath == null ) { |
|
654 |
Class curve = sun.awt.geom.Curve.class; |
|
655 |
|
|
656 |
try { |
|
657 |
crossingsForPath = curve.getMethod("pointCrossingsForPath", new Class[] { PathIterator.class, double.class, double.class }); |
|
658 |
} catch (SecurityException e) { |
|
659 |
throw new RuntimeException(e); |
|
660 |
} catch (NoSuchMethodException e) { |
|
661 |
try { |
|
662 |
crossingsForPath = curve.getMethod("crossingsForPath", new Class[] { PathIterator.class, double.class, double.class }); |
|
663 |
} catch (SecurityException e1) { |
|
664 |
throw new RuntimeException(e); |
|
665 |
} catch (NoSuchMethodException e1) { |
|
666 |
throw new RuntimeException(e); |
|
667 |
} |
|
668 |
} |
|
669 |
} |
|
670 |
try { |
|
671 |
return ((Integer) crossingsForPath.invoke(Curve.class, pathIterator, x,y)).intValue(); |
|
672 |
} catch (IllegalArgumentException e) { |
|
673 |
throw new RuntimeException(e); |
|
674 |
} catch (IllegalAccessException e) { |
|
675 |
throw new RuntimeException(e); |
|
676 |
} catch (InvocationTargetException e) { |
|
677 |
throw new RuntimeException(e); |
|
678 |
} |
|
679 |
} |
|
680 |
|
|
646 | 681 |
/** |
647 | 682 |
* Tests if the specified <code>Point2D</code> is inside the boundary |
648 | 683 |
* of this <code>Shape</code>. |
Also available in: Unified diff