But not a *good* reason! 8^) For obvious reasons... ! Larry Becker wrote: > Hi Martin, > > Thanks for the fix. Assuming you meant "why OJ is testing for validity on > a delete", the answer may be because it makes the code simpler. Not the > best reason, but it is a reason. :-) > > regards, > Larry > > On Tue, Mar 23, 2010 at 10:52 AM, Martin Davis <mbda...@refractions.net>wrote: > > >> Yes, POINT EMPTY is valid. This is a bug in JTS. I'll fix this today. >> Thanks, Michael! >> >> One thing that doesn't make sense to me is why JTS is testing for >> validity on a delete? Surely it's safe to NOT do this, even for Undo? >> >> >> Michaël Michaud wrote: >> >>> Hi Martin, all, >>> >>> Finally, I think the problem could be a consistency problem in JTS. >>> JTS accepts empty Points, empty LineStrings and empty Polygons created >>> >> with >> >>> factory.createPoint(null) -> POINT EMPTY >>> factory.createLineString(null) -> LINESTRING EMPTY >>> factory.createPolygon(null,null) -> POLYGON EMPTY >>> >>> empty LineString and empty Polygon, which hold an empty >>> CoordinateSequence are seen as valid Geometries >>> >>> on the other hand, empty Point, which also holds an empty >>> CoordinateSequence throws an exception while tested for its validity >>> The reason is Point.isValid() does not test its CoordinateSequence but >>> tests the validity of Point.getCoordinate(), which returns a null in >>> this case. >>> >>> Could you confirm POINT EMPTY should be considered as a valid Geometry ? >>> >>> Michaël >>> >>> Stefan Steiniger a écrit : >>> >>> >>>> Hei, >>>> >>>> so by looking on the JUMP code, >>>> >>>> deleting always creates a null geometry: >>>> com.vividsolutions.jump.workbench.ui.GeometryEditor.remove(Geometry g, >>>> Geometry itemToRemove) >>>> >>>> calls >>>> >>>> >>>> >> com.vividsolutions.jump.workbench.ui.GeometryEditor.createNullGeometry(Class >> >>>> geometryClass) >>>> >>>> so, we could do the change in createNullGeometry() [though I don't >>>> really like the idea here to create an empty GeometryCollection is >>>> Michael did for the other positions] or in >>>> >>>> >>>> >> com.vividsolutions.jump.workbench.ui.EditTransaction.proposedGeometriesValid() >> >>>> by catching null geometries here and not checking them. >>>> >>>> or.. of course... both. >>>> >>>> any suggestions by you Larry, Michael, Martin? >>>> Probably the second solution is best? >>>> >>>> >>>> ohh.. @Martin, actually, if that only happens for point geometries >>>> now... what is with the other geometry.isValid operations... why don't >>>> they return an error if null geomtries are created? >>>> >>>> stefan >>>> >>>> Martin Davis wrote: >>>> >>>> >>>> >>>>> Ah, yes, right. This was a bug fix introduced in JTS 1.11, to ensure >>>>> that Point.isValid checked for invalid (eg NaN) coordinates. >>>>> >>>>> In general, the contract for IsValid does not support "null" being >>>>> passed as in input argument. OJ should not be trying to determine the >>>>> validity of a null geometry - it needs to detect this situation and >>>>> >> make >> >>>>> its own decision about whether null is valid or not. >>>>> >>>>> So I think the way you'd sum this up is that a bug in JTS 1.10 masked a >>>>> bug in OJ. >>>>> >>>>> Larry, I think your fix should take care of this in OJ. If it were me >>>>> >> I >> >>>>> would encapsulate that logic in a general-purpose utility method called >>>>> something like GeometryUtil.isValidOrNull(Geometry g). That gives a >>>>> single functionality point for the design decision to allow nulls as >>>>> valid geometry, in case it needs to be changed in the future. >>>>> >>>>> Larry Becker wrote: >>>>> >>>>> >>>>> >>>>>> I see that prior versions of JTS Point.isValid() didn't call >>>>>> IsValidOP.isValid(). It just returned trure. >>>>>> >>>>>> Stepping though the debugger, isValid is throwing an NPE when it does >>>>>> >> the >> >>>>>> getCoordinate(). >>>>>> >>>>>> public boolean isValid() { >>>>>> if (! IsValidOp.isValid(getCoordinate())) >>>>>> return false; >>>>>> return true; >>>>>> } >>>>>> >>>>>> Larry >>>>>> >>>>>> On Mon, Mar 22, 2010 at 3:58 PM, Larry Becker <becker.la...@gmail.com >>>>>> >>> wrote: >>> >>>>>> >>>>>> >>>>>> >>>>>>> There are no changes in the SVN history for several months before 24 >>>>>>> February that seem relevant. I made a bunch of changes to rendering >>>>>>> >> and >> >>>>>>> such, but nothing related to EditTransactions. >>>>>>> >>>>>>> I happened to have a copy of OJ dated 22 February and it does not >>>>>>> >> have the >> >>>>>>> delete point problem. Can't say for sure when it started though. >>>>>>> >>>>>>> Larry >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, Mar 22, 2010 at 3:48 PM, Larry Becker < >>>>>>> >> becker.la...@gmail.com>wrote: >> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Hi Michaël, >>>>>>>> >>>>>>>> Yes, I am using the latest SVN version. You can do the test >>>>>>>> >> yourself in >> >>>>>>>> a few minutes. >>>>>>>> >>>>>>>> I just checked and SkyJUMP and OJ both have identical code to >>>>>>>> >> handle >> >>>>>>>> deleting selected items, except for the changes Michaël made to >>>>>>>> EditTransaction and the JTS version. Those changes were made in >>>>>>>> >> March. >> >>>>>>>> SkyJUMP does not have the problem yet. >>>>>>>> >>>>>>>> @Stefan, what are the changes for null geometries that you spoke >>>>>>>> >> of? >> >>>>>>>> Larry >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> 2010/3/22 Michaël Michaud <michael.mich...@free.fr> >>>>>>>> >>>>>>>> Hi Stefan and others, >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Did you check OJ with the svn code. >>>>>>>>> I have fixed EditTransaction a few days ago. >>>>>>>>> Fo a reason, in the EditTrasaction process, two methods created a >>>>>>>>> Point(null,null,0) geometry. >>>>>>>>> This geometry did not throw NPE... until JTS 1.11 >>>>>>>>> I replaced Point(null,null,0) by an empty GeometryCollection. >>>>>>>>> Hope it does the trick. >>>>>>>>> >>>>>>>>> Miichaël >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> Hei, >>>>>>>>>> >>>>>>>>>> I haven't found the time to look into it, but I got this error >>>>>>>>>> >> report >> >>>>>>>>>> from Bernd: >>>>>>>>>> >>>>>>>>>> the issue is that he can not delete point features in existing >>>>>>>>>> >> projects >> >>>>>>>>>> or even just created tets layers. (must have been introduced to >>>>>>>>>> >> the NB >> >>>>>>>>>> after Feb 24th) >>>>>>>>>> >>>>>>>>>> ava.lang.NullPointerException >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> com.vividsolutions.jts.operation.valid.IsValidOp.isValid(IsValidOp.java:62) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >> com.vividsolutions.jts.geom.Point.isValid(Point.java:117) >> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> com.vividsolutions.jump.workbench.ui.EditTransaction.proposedGeometriesValid(EditTransaction.java:315) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> com.vividsolutions.jump.workbench.ui.EditTransaction.commit(EditTransaction.java:256) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> com.vividsolutions.jump.workbench.ui.EditTransaction.commit(EditTransaction.java:235) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> com.vividsolutions.jump.workbench.ui.plugin.DeleteSelectedItemsPlugIn.execute(DeleteSelectedItemsPlugIn.java:99) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> com.vividsolutions.jump.workbench.plugin.AbstractPlugIn$1.actionPerformed(AbstractPlugIn.java:130) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> com.vividsolutions.jump.workbench.ui.WorkbenchFrame$24.keyPressed(WorkbenchFrame.java:1142) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> com.vividsolutions.jump.workbench.ui.WorkbenchFrame$9.keyPressed(WorkbenchFrame.java:353) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >> java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:233) >> >>>>>>>>>> at >>>>>>>>>> >> java.awt.Component.processKeyEvent(Component.java:6221) >> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> javax.swing.JComponent.processKeyEvent(JComponent.java:2801) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at java.awt.Component.processEvent(Component.java:6040) >>>>>>>>>> at java.awt.Container.processEvent(Container.java:2041) >>>>>>>>>> at >>>>>>>>>> >> java.awt.Component.dispatchEventImpl(Component.java:4630) >> >>>>>>>>>> at >>>>>>>>>> >> java.awt.Container.dispatchEventImpl(Container.java:2099) >> >>>>>>>>>> at java.awt.Component.dispatchEvent(Component.java:4460) >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668) >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> at >>>>>>>>>> >> java.awt.Component.dispatchEventImpl(Component.java:4502) >> >>>>>>>>>> at >>>>>>>>>> >> java.awt.Container.dispatchEventImpl(Container.java:2099) >> >>>>>>>>>> at java.awt.Window.dispatchEventImpl(Window.java:2475) >>>>>>>>>> at java.awt.Component.dispatchEvent(Component.java:4460) >>>>>>>>>> at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) >>>>>>>>>> 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) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> ------------------------------------------------------------------------------ >> >>>>>>>>> >>>>>>>>> >>>>>>>>>> Download Intel® Parallel Studio Eval >>>>>>>>>> Try the new software tools for yourself. Speed compiling, find >>>>>>>>>> >> bugs >> >>>>>>>>>> proactively, and fine-tune applications for parallel performance. >>>>>>>>>> See why Intel Parallel Studio got high marks during beta. >>>>>>>>>> http://p.sf.net/sfu/intel-sw-dev >>>>>>>>>> _______________________________________________ >>>>>>>>>> Jump-pilot-devel mailing list >>>>>>>>>> Jump-pilot-devel@lists.sourceforge.net >>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> ------------------------------------------------------------------------------ >> >>>>>>>>> Download Intel® Parallel Studio Eval >>>>>>>>> Try the new software tools for yourself. Speed compiling, find bugs >>>>>>>>> proactively, and fine-tune applications for parallel performance. >>>>>>>>> See why Intel Parallel Studio got high marks during beta. >>>>>>>>> http://p.sf.net/sfu/intel-sw-dev >>>>>>>>> _______________________________________________ >>>>>>>>> Jump-pilot-devel mailing list >>>>>>>>> Jump-pilot-devel@lists.sourceforge.net >>>>>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>> >> ------------------------------------------------------------------------ >> >>>>>> >> ------------------------------------------------------------------------------ >> >>>>>> Download Intel® Parallel Studio Eval >>>>>> Try the new software tools for yourself. Speed compiling, find bugs >>>>>> proactively, and fine-tune applications for parallel performance. >>>>>> See why Intel Parallel Studio got high marks during beta. >>>>>> http://p.sf.net/sfu/intel-sw-dev >>>>>> >>>>>> >> ------------------------------------------------------------------------ >> >>>>>> _______________________________________________ >>>>>> Jump-pilot-devel mailing list >>>>>> Jump-pilot-devel@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>>>> >>>>>> >>>>>> >>>>>> >> ------------------------------------------------------------------------------ >> >>>> Download Intel® Parallel Studio Eval >>>> Try the new software tools for yourself. Speed compiling, find bugs >>>> proactively, and fine-tune applications for parallel performance. >>>> See why Intel Parallel Studio got high marks during beta. >>>> http://p.sf.net/sfu/intel-sw-dev >>>> _______________________________________________ >>>> Jump-pilot-devel mailing list >>>> Jump-pilot-devel@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>> >>>> >>>> >>>> >>>> >>> >>> >> ------------------------------------------------------------------------------ >> >>> Download Intel® Parallel Studio Eval >>> Try the new software tools for yourself. Speed compiling, find bugs >>> proactively, and fine-tune applications for parallel performance. >>> See why Intel Parallel Studio got high marks during beta. >>> http://p.sf.net/sfu/intel-sw-dev >>> _______________________________________________ >>> Jump-pilot-devel mailing list >>> Jump-pilot-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>> >>> >>> >> -- >> Martin Davis >> Senior Technical Architect >> Refractions Research, Inc. >> (250) 383-3022 >> >> >> >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Jump-pilot-devel mailing list >> Jump-pilot-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >> > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ------------------------------------------------------------------------ > > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >
-- Martin Davis Senior Technical Architect Refractions Research, Inc. (250) 383-3022 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel