2011/3/17 Benoît Thiébault <[email protected]>:
> 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...

If you look at the api and javadoc for the two classes it should be
clear why the two cannot be the same:
DerivedCRS is a superclass of ProjectedCRS, it has less restrictions
and requirements than its subclass.

There is support in geotools to have a DerivedCRS be at the same time
ProjectedCRS, because the
getConversionFromBase returns a plain Projection, not a chain or
Projection and AffineTransform.

I think you could develop yourself a custom class that builds the
chain and still makes it implement
the Projection interface, if you do you can develop a
DerivedProjectedCRS on top of it.

Though generally speaking it's better if you don't make any assumption
on the nature of the
CoordinateReferenceSystem in your code... anyways, you have a choice,
either fix your code or build
the missing support classes that allow you to keep the code in place

Cheers
Andrea

-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313
mob:    +39 333 8128928

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

------------------------------------------------------------------------------
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

Reply via email to