Thanks Hal,

We have changed our shapefile implementation recently and we don't get that
much feedback from our tutorials. ExtractBoundsFilterVisitor should be
going through your request and sorting out a bounding box (so it can use
the spatial index to short list a number of features for closer review of
the geometries).

I have added your issue to JIRA: https://jira.codehaus.org/browse/GEOT-4722



Jody Garnett


On Fri, Feb 28, 2014 at 4:32 AM, Hal Mirsky <[email protected]> wrote:

> Hello,
>
> While running the SelectionLab example with 11-RC1, I get a null pointer
> exception when I use the 'select tool' to click on a feature.
> Specifically, the exception is raised on the call to
> selectedFeatures.features(); I've traced it to the
> ExtractBoundsFilterVisitor.visit function returning null.  Does this look
> like a bug?
>
>
>
> // from SelectionLab.java:
>
>
>
>      AffineTransform screenToWorld = mapFrame
> .getMapPane().getScreenToWorldTransform();
>
>      Rectangle2D worldRect =
> screenToWorld.createTransformedShape(screenRect).getBounds2D();
>
>      ReferencedEnvelope bbox = *new* ReferencedEnvelope(
>
>              worldRect,
>
>              mapFrame
> .getMapPane().getMapContent().getCoordinateReferenceSystem());
>
>
>
>      /*
>
>       * Create a Filter to select features that intersect with
>
>       * the bounding box
>
>       */
>
>      Filter filter = ff.intersects(ff.property(geometryAttributeName), ff
> .literal(bbox));
>
>
>
>      /*
>
>       * Use the filter to identify the selected features
>
>       */
>
>      *try* {
>
>          SimpleFeatureCollection selectedFeatures =
>
>                  featureSource.getFeatures(filter);
>
>
>
>          SimpleFeatureIterator iter = selectedFeatures.features();
>
>
>
>
>
>
>
> // from ExtractBoundsFilterVisitor
>
>        @Override
>
>        *public* Object visit(PropertyName expression, Object data) {
>
>               *return* *null*;
>
>        }
>
>
>
> Here's the stack trace:
>
>
>
> Mouse click at: DirectPosition2D[6349881.5871864, 2029348.2224553742]
>
> *java.lang.NullPointerException*
>
>        at
> org.geotools.data.shapefile.ShapefileFeatureSource.getReaderInternal(
> *ShapefileFeatureSource.java:237*)
>
>        at
> org.geotools.data.shapefile.ShapefileFeatureStore.getReaderInternal(
> *ShapefileFeatureStore.java:126*)
>
>        at org.geotools.data.store.ContentFeatureSource.getReader(
> *ContentFeatureSource.java:563*)
>
>        at org.geotools.data.store.ContentFeatureCollection.features(
> *ContentFeatureCollection.java:165*)
>
>        at com.aseg.StyleLab.SelectionLab.selectFeatures(
> *SelectionLab.java:217*)
>
>        at com.aseg.StyleLab.SelectionLab$1$1.onMouseClicked(
> *SelectionLab.java:161*)
>
>        at
> org.geotools.swing.event.DefaultMapMouseEventDispatcher.mouseClicked(
> *DefaultMapMouseEventDispatcher.java:99*)
>
>        at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
>
>        at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
>
>        at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
>
>        at java.awt.Component.processMouseEvent(Unknown Source)
>
> ...
>
>
>
> Thanks for any feedback,
>
> Hal
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to