Ok Martin I got a couple of improvments for tiling but  now I have a
suggestion for improving the equals method on general envelope. What
do you think about this one?



/**
         * Compares the specified object with this envelope for equality.
         */
        public boolean equals(final Object object) {
                if (object != null && object.getClass().equals(getClass())) {
                        final GeneralEnvelope that = (GeneralEnvelope) object;
                        if (this.getDimension() != that.getDimension())
                                return false;
                        final int dim = this.getDimension();
                        double firstLength;
                        double secondLength;
                        double firstCoord;
                        double secondCoord;
                        final int length = ordinates.length;
                        for (int i = 0; i < length; i++) {

                                // check lengths
                                firstLength = Math.abs(ordinates[(i + dim) % 
length]
                                                - ordinates[i]);
                                secondLength = Math.abs(that.ordinates[(i + 
dim) % length]
                                                - that.ordinates[i]);
                                if (Math.abs((firstLength - secondLength)
                                                / Math.min(firstLength, 
secondLength)) > EPS)
                                        return false;
                                
                                //coords
                                firstCoord=ordinates[(i + dim) % dim];
                                secondCoord=ordinates[(i + dim) % dim];
                                if (Math.abs((firstCoord - secondCoord)
                                                / Math.min(firstLength, 
secondLength)) > EPS)
                                        return false;

                        }
                        return Utilities.equals(this.crs, that.crs);
                }
                return false;
        }


Simone.

On 3/6/06,
Martin Desruisseaux <[EMAIL PROTECTED]> wrote:
> Simone Giannecchini a écrit :
> >> * If the image was already tiled, preserve the tiling.
> >
> > Mmmmh, I have to check again, since I do not see where you do this.
>
> In ImageUtilities at line 120:
>
> if (image.getNumXTiles()==1 && image.getNumYTiles()==1) {
>     // ... Computes a new tiling.
> }
>
>
> > My question now is more precise. How should I feed the method public
> > static Dimension toTileSize(final Dimension size)  from Imageutilies?
> > Should I give width, height of image to tile? If so how can you check
> > if the image is already tiled?
>
> Yes, you give image width and height to this method. But this is not the 
> method that check if the
> image is already tiled. Actually, most of the time you should not use this 
> method. You should use
>
>     ImageLayout layout = ImageUtilities.getImageLayout(theImage);
>
> instead. The returned image layout will contains the tile size, among other 
> informations.
>
>        Martin.
>


--
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
Simone Giannecchini
Software Engineer
Freelance Consultant

http://simboss.wordpress.com/

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to