Hello Simone

Martin Desruisseaux a écrit :
> Martin Desruisseaux a écrit :
>> org.geotools.coverage.grid.GeneralGridGeometry
>> ----------------------------------------------
>> [...snip...]
>>
>>   - reverse
>>   - swapXY
>>   - getEnvelope(GridRange, MathTransform, CoordinateReferenceSystem, boolean)
>>   - getTransform(GridRange, Envelope, boolean[], boolean, boolean)
> 
> [...snip...]
> 
> Can I turn back those methods as private ones?


After a harder look to the existing Geotools code, I noticed that

   GeneralGridGeometry.swapXY(CoordinateSystem)

is used outside its GeneralGridGeometry class. However I don't think that we 
should. I saw 'swapXY' used in various places like GridCoverageRenderer in 
order 
to determine which one of

   AffineTransform.getScaleX() or
   AffineTransform.getShearY()

methods should be invoked. But the AffineTransform may be an arbitrary 
transform 
specified by the user, and using 'GeneralGridGeometry.swapXY' in 
GridCoverageRenderer will work only if the user created his AffineTransform 
using the same heuristic rules than 'GeneralGridGeometry.swapXY'. We really 
have 
no garantee of that.

A more rigourous approach is to determine the "swapXY" state by inspection of 
the user-supplied AffineTransform, instead of invoking the heuristic 
'GeneralGridGeometry.swapXY' method. I added a new method in my local copy (not 
yet commited to SVN):

     XAffineTransform.getSwapXY(AffineTransform)

which returns the "swapXY" state just by affine transform inspection, which can 
be any user-supplied transform. I will wait for your okay before to commit this 
code. If you are okay, I would like to replace all invocation of:

     GeneralGridGeometry.swapXY(CoordinateSystem)

by

     XAffineTransform.getSwapXY(AffineTransform)

were applicable, and turn back the GeneralGridGeometry.swapXY method to package 
private access. This method was not public because I was fearing that public 
access would lead to usage in inapropriate context, which seems to be what 
happen in practice.

Would it be okay for you?

        Regards,

                Martin

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to