Hi Michael, Of course you can :-)
I need a ProjectedCRS because I have to pass a ProjectedCRS to a helper class of my application. This helper class stores the current GeodeticCRS and ProjectedCRS and if the user changes the projection system, it tells all its listeners to convert their coordinates to the new projection. Of course, I could in this helper class store only CoordinatesReferenceSystem objects, but this would have an impact on a lot of code... Moreover, I prefer using ProjectedCRS than CoordinatesReferenceSystem in order to prevent too many casts. This problem is really blocking for me right now and I would be very pleased to find an answer... Ben Le 17 mars 2011 à 06:38, Michael Bedward a écrit : > Hi Ben, > > It doesn't look like anyone has an easy answer for this one - unless > this bump flushes one out. > > Can I ask you why it is important to have a ProjectedCRS rather than > working with the DefaultDerivedCRS ? > > Michael > > > 2011/3/11 Benoît Thiébault <[email protected]>: >> Hi everyone, >> >> I have created a DefaultDerivedCRS that is a rotation of a ProjectedCRS >> (called selectedCRS) like this: >> >>> CoordinateReferenceSystem transformedCRS = selectedCRS; >>> >>> if (getAngleRadians() != 0.0) { >>> // Create the rotation transform >>> final AffineTransform rotation = new AffineTransform(); >>> rotation.rotate(getAngleRadians(), getRotationProjCenter().x, >>> getRotationProjCenter().y); >>> >>> // Creates the math transform >>> final MathTransform transform = ProjectiveTransform.create(rotation); >>> >>> // Sets the new CRS name >>> String crsName = selectedCRS.getName().toString(); >>> if (getAngleRadians() != 0) { >>> final DecimalFormat formatter = new DecimalFormat("#.##"); >>> final String rotationText = >>> formatter.format(Math.toDegrees(getAngleRadians())); >>> crsName += " / Rotation: " + rotationText + "°"; >>> } >>> >>> // Rotates the CRS >>> transformedCRS = new DefaultDerivedCRS(crsName, selectedCRS, transform, >>> selectedCRS.getCoordinateSystem()); >> >> My problem is that this method is expected to return a ProjectedCRS and if I >> simply cast the DefaultDerivedCRS to ProjectedCRS, I get a >> ClassCastException. >> >> How can I create such a rotated ProjectedCRS from another ProjectedCRS ? >> >> Kind regards, >> Ben >> >> ---- >> Dr Benoît Thiébault >> Project Manager >> >> Artenum Toulouse - Science & Groupware >> http://www.artenum.com >> >> Bâtiment Calfocenter >> 10, rue Marguerite Long >> 31 320 Castanet Tolosan >> Phone: +33 (0)5 62 19 32 22 >> >> >> ------------------------------------------------------------------------------ >> Colocation vs. Managed Hosting >> A question and answer guide to determining the best fit >> for your organization - today and in the future. >> http://p.sf.net/sfu/internap-sfd2d >> _______________________________________________ >> Geotools-gt2-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> ---- Dr Benoît Thiébault Project Manager Artenum Toulouse - Science & Groupware http://www.artenum.com Bâtiment Calfocenter 10, rue Marguerite Long 31 320 Castanet Tolosan Phone: +33 (0)5 62 19 32 22 ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
