On Tue, Apr 7, 2009 at 9:27 AM, Rodolphe QUEMERAIS < [email protected]> wrote:
> Thanks a lot. This works fine !!! > > But I didn't use any MathTransfrom. Actually, I picked 2 points : > Coordinate world = getContext().pixelToWorld(e.x-1, e.y-1); > Coordinate world2 = getContext().pixelToWorld(e.x+1, e.y+1); > and created to envelope : > Envelope env = new Envelope(world, world2); > and the selection worked fine. > > My second question why do we have to do any operation with Mathtransform as > > getContext().pixelToWorld(...) do the transformation. > Dis I miss something You need to understand the big picture. There are 3 frames of reference in uDig: - THe Screen - The Map - The layer The Screen is always different from the map because the map takes place in the world. Often -180:180,-90:90. So there is a pixelToWOrld transform (and the opposite) to translate between the screen and the equivalent place in the world. Next is the layer. The layer could be in the same projection as the map but that is not a requirement. So if you set a selection on a layer the selection must be in the projection of the layer. There is some work in the pipeline to simplify that but that is the case at the moment. That is why you need a transformation from screen to map then from map to layer. NO idea if I came close to answering your email but hopefully that helps in some way Jesse
_______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel
