I think that is a problem with JMapPane; should not effect the actual removing 
of a feature.

Note you may have a better experiencing using featureStore to remove the 
feature using a filter (specifically a feature id based filter).

Jody

On 18/06/2010, at 10:09 PM, JenR wrote:

> 
> Hello all,
> 
> I build a simple application using GeoTools. I want to show a floor of a
> building, with red dots on each floor representing people.
> Each person is a SimpleFeature with a position and an attribute (id). Each
> floor is a FeatureCollection.
> When a person changes floors, I want to delete the SimpleFeature from the
> old floor (FeatureCollection, and add the SimpleFeature to the new floor.
> 
> The moment I call the FeatureCollection.remove(Feature) function (or even
> the .clear() function), I get the following error:
> 
> Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException:
> java.lang.IllegalArgumentException: Bad ordinates at dimension 0.
>        at org.geotools.swing.JMapPane.setFullExtent(JMapPane.java:1005)
>        at org.geotools.swing.JMapPane.layerChanged(JMapPane.java:961)
>        at
> org.geotools.map.DefaultMapContext.fireMapLayerListListenerLayerChanged(DefaultMapContext.java:1030)
>        at
> org.geotools.map.DefaultMapContext.access$000(DefaultMapContext.java:63)
>        at
> org.geotools.map.DefaultMapContext$1.fireAsListEvent(DefaultMapContext.java:101)
>        at
> org.geotools.map.DefaultMapContext$1.layerChanged(DefaultMapContext.java:79)
>        at
> org.geotools.map.DefaultMapLayer.fireMapLayerListenerLayerChanged(DefaultMapLayer.java:539)
>        at
> org.geotools.map.DefaultMapLayer$1.changed(DefaultMapLayer.java:84)
>        at
> org.geotools.data.FeatureListenerManager.fireEvent(FeatureListenerManager.java:434)
>        at
> org.geotools.data.FeatureListenerManager.fireFeaturesRemoved(FeatureListenerManager.java:470)
>        at
> org.geotools.data.collection.CollectionDataStore$FeatureCollectionListener.collectionChanged(CollectionDataStore.java:219)
>        at
> org.geotools.feature.DefaultFeatureCollection.fireChange(DefaultFeatureCollection.java:152)
>        at
> org.geotools.feature.DefaultFeatureCollection.fireChange(DefaultFeatureCollection.java:157)
>        at
> org.geotools.feature.DefaultFeatureCollection.remove(DefaultFeatureCollection.java:422)
>        at com.mycompany.vooruitmaven.App.removeMobileNode(App.java:436)
>        at com.mycompany.vooruitmaven.App.setMobilePosition(App.java:397)
>        at com.mycompany.vooruitmaven.Client.actionPerformed(Client.java:95)
>        at javax.swing.Timer.fireActionPerformed(Timer.java:271)
>        at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
>        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
>        at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
>        at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
>        at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
>        at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
>        at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
>        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> Caused by: java.lang.IllegalArgumentException: Bad ordinates at dimension 0.
>        at
> org.geotools.geometry.GeneralEnvelope.checkCoordinates(GeneralEnvelope.java:335)
>        at
> org.geotools.geometry.GeneralEnvelope.<init>(GeneralEnvelope.java:192)
>        at org.geotools.referencing.CRS.transform(CRS.java:1381)
>        at
> org.geotools.geometry.jts.ReferencedEnvelope.transform(ReferencedEnvelope.java:629)
>        at
> org.geotools.geometry.jts.ReferencedEnvelope.transform(ReferencedEnvelope.java:584)
>        at
> org.geotools.map.DefaultMapContext.getLayerBounds(DefaultMapContext.java:701)
>        at org.geotools.swing.JMapPane.setFullExtent(JMapPane.java:1003)
>        ... 26 more
> 
> 
> Before I remove the SimpleFeature, I check if the FeatureCollection
> containts the SimpleFeature, and only if that returns true, I try to remove
> it.
> 
> I googled this error and found nothing, can somebody help me with this?
> -- 
> View this message in context: 
> http://osgeo-org.1803224.n2.nabble.com/Can-t-remove-SimpleFeature-from-FeatureCollection-tp5195006p5195006.html
> Sent from the geotools-devel mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate 
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
> lucky parental unit.  See the prize list and enter to win: 
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to