Well, I do it, but It don't work, I'm very stuck in this, because I'm new in
GIS. I need to select just a polygon and not a line, because the system
which I want to make is a "Building Locator" (Or something else, I hope
you'll understand what I mean), I send you my full prototype.

I replace this:
        Point screenPoint = evt.getPoint();
        Rectangle screenRect = new Rectangle(
                screenPoint.x - 2,
                screenPoint.y - 2,
                1,
                1);
        AffineTransform pixel2crs =
mJmapFrame.getMapPane().getScreenToWorldTransform();
        Rectangle2D creRect =
pixel2crs.createTransformedShape(screenRect).getBounds2D();
        ReferencedEnvelope mBbox = new ReferencedEnvelope(
                creRect,
                mJmapFrame.getMapContext().getCoordinateReferenceSystem());
        Filter mFilter = mFilterFactory.intersects(
                mFilterFactory.property(mGeomName),
                mFilterFactory.literal(mBbox));
For this:
        Point screenPoint = evt.getPoint();
                Filter mFilter = mFilterFactory.intersects(
                mFilterFactory.property(mGeomName),
                mFilterFactory.literal(screenPoint));

Sorry for my nescience... xD
-----------

2010/5/19 Michael Bedward <[email protected]>

> Hi Amador,
>
> > Hi guys, I'm following some tutorial about GeoTools, in the selection lab
> > the author use a rectangle to the selection, but It's no very precise, so
> I
> > wonder, Can I use pixel or point to perform selection in a poligon?
> > I hope you can help me.
>
> Certainly. The example uses a rectangle because it catches points and
> lines as well as polygons and keeps the tutorial code simple. For
> polygons, you can use a point instead of a rectangle in the
> "intersects" filter to get better precision.
>
> > PD: Sorry for my spanglish, I'm learning english... xD
>
> Your spanglish is a lot better than my (non-existent) spanish :-)
>
> Michael
>



-- 
TSU. Amador Cuenca

Attachment: selection.java
Description: Binary data

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

_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to