This problem is also causing our geometryfactoryfinder to fail because it relies on finding a CRS using the equals comparator, which does not work. I've written a small test here that shows the error. Basically I create a CRS, then create a 2nd crs from the WKT of the first one. They are the same thing, but not the same object. Then I create 2 geometrybuilders with those crs's. When I try to use builder2 to build something from a builder1 object, it fails with a mismatchedreferencesystemexception.
public void testPrimFactCRS() throws UnsupportedOperationException, FactoryException { CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84; GeometryBuilder builder = new GeometryBuilder(crs); CoordinateReferenceSystem crs2 = CRS.parseWKT(crs.toWKT()); GeometryBuilder builder2 = new GeometryBuilder(crs2); // create a list of connected positions List<Position> dps = new ArrayList<Position>(); dps.add(builder.createDirectPosition( new double[] {20, 10} )); dps.add(builder.createDirectPosition( new double[] {40, 10} )); dps.add(builder.createDirectPosition( new double[] {50, 40} )); dps.add(builder.createDirectPosition( new double[] {30, 50} )); dps.add(builder.createDirectPosition( new double[] {10, 30} )); dps.add(builder.createDirectPosition( new double[] {20, 10} )); // create linestring from directpositions LineString line = builder.createLineString(dps); // create curvesegments from line ArrayList<CurveSegment> segs = new ArrayList<CurveSegment>(); segs.add(line); // Create list of OrientableCurves that make up the surface OrientableCurve curve = builder.createCurve(segs); List<OrientableCurve> orientableCurves = new ArrayList<OrientableCurve>(); orientableCurves.add(curve); // create the interior ring and a list of empty interior rings (holes) Ring extRing = builder2.createRing(orientableCurves); List<Ring> intRings = new ArrayList<Ring>(); // create the surfaceboundary from the rings SurfaceBoundary sb = builder2.createSurfaceBoundary(extRing, intRings); // create the surface Surface surface = builder2.createSurface(sb); } Graham. Martin Desruisseaux wrote: >Le mardi 11 septembre 2007 à 10:35 -0700, Jody Garnett a écrit : > > >>Other than this the two look very similar... it is absolutely killing me >>to have to cast to AbstractCRS in order to perform this check; we can do >>this in all the GeometryFactory methods but I cannot do it in client >>code - we need to figure out a way to make this functionality available >>through the interfaces. >> >> > >You means a way to invoke CRS.equalsIgnoreMetadata(...) without the >current requirement (in "equalsIgnoreMetadata" implementation) that both >CRS are GeoTools implementations? Yes I realize that we have a strong >limitation here. > >I see to possible approachs: > >1) Wraps non-geotools implementations into geotools ones under the > hood. Hopefully the cost would not be that high. > >2) Promote the current AbstractIdentifiedObject.equals(..., boolean) > method to GeoAPI. But I would be reluctant to do that since it > would require defining its behavior in the contract for every > IdentifiedObject subclasses, and can't pretend that we got them > right in GeoTools implementation. > > Martin > > > >------------------------------------------------------------------------- >This SF.net email is sponsored by: Microsoft >Defy all challenges. Microsoft(R) Visual Studio 2005. >http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >_______________________________________________ >Geotools-devel mailing list >Geotools-devel@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/geotools-devel > > -- Graham Davis Refractions Research Inc. [EMAIL PROTECTED] ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel