openjump-gis / openjump

OpenJUMP, the Open Source GIS with more than one trick in its kangaroo pocket, takes the leap from svn to git. join the effort!
http://openjump.org
GNU General Public License v2.0
28 stars 14 forks source link

CADTools - Drawing Blocks throws NPEs #56

Closed ma15569 closed 1 year ago

ma15569 commented 1 year ago

PlugIn: CADTools

Bug description: It is not possible to draw a good 50% of the embedded blocks this which throw null point exceptions.

It seems that blocks made by simple polygons or multipolygons with no holes can be drawn. Blocks made by the previous geometries with holes not.

Blocks displayed by CADTools are stored into Lib/Ext/VertexImages folder (blocks are used by CadPlan Vertex Images plugin too) and they are simple WKT files

ma15569 commented 1 year ago

OpenJUMP-Portable-20220823-r5135[6899249]-PLUS

Just a reminder to explain the bug and define the last test

CadTools: the bug affects blocks made by polygons with holes (for instance bore_01 or geology_05. It does not ot affect blocks made by polygons without holes (for instance geology_01) or multipolygons (geology_03)

Vertex Synbology the same: the bug affects shapes (symbols) made by polygons with holes (for instance bore_01 or geology_05. It does not ot affect blocks made by polygons without holes (for instance geology_01) or multipolygons (geology_03)

Both CadTools and Vertex Synbology define the geometries/shapes reading WKT files in lib/ext/VertexImages folder

edeso commented 1 year ago

Peppe,

let me refer you to my answers on the sf.net ticket, https://sourceforge.net/p/jump-pilot/bugs/522/#1cb9

also i explicitly asked you not to open another one here, guess you didn't see that.

so again, works for me since rev5128 see bore01

if it still does not for you i will need more details. specifically

i will close the issue an sf.net assuming that we will stay here the for the issue being.

ma15569 commented 1 year ago

Hi Ede,

I started to test the errror with this java versions 1.8.0_311 and 1.8.0_341

This is the error stack from the log file when I try to load a project with ExtendedVertexSymbols (Vertex Image plugin) Read next message for CadTools plugin error

 (Null Pointer Exception)
[ERROR] 2022-08-25_06:56:04.390 java.lang.NullPointerException
java.lang.NullPointerException
    at com.vividsolutions.jump.workbench.ui.renderer.SimpleFeatureCollectionRenderer.paint(SimpleFeatureCollectionRenderer.java:27)
    at com.vividsolutions.jump.workbench.ui.renderer.SimpleFeatureCollectionRenderer.paint(SimpleFeatureCollectionRenderer.java:58)
    at com.vividsolutions.jump.workbench.ui.renderer.SimpleRenderer.copyTo(SimpleRenderer.java:74)
    at com.vividsolutions.jump.workbench.ui.renderer.FeatureCollectionRenderer.copyTo(FeatureCollectionRenderer.java:55)
    at com.vividsolutions.jump.workbench.ui.renderer.LayerRenderer.copyTo(LayerRenderer.java:93)
    at com.vividsolutions.jump.workbench.ui.renderer.RenderingManager.copyTo(RenderingManager.java:362)
    at com.vividsolutions.jump.workbench.ui.LayerViewPanel.paintComponent(LayerViewPanel.java:486)
ma15569 commented 1 year ago

I Ede, this is a description of the bug with java version "1.8.0_341" with CadTools

a) select the first icon to the left (Draw a block), select block bore_01 Everything is fine and the block is drawn with no errors as in picture of your message

b) select the second icon to the left (Draw an oriented block)

java.lang.NullPointerException
at com.vividsolutions.jump.workbench.plugin.AbstractPlugIn.execute(AbstractPlugIn.java:376)
at com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool.execute(AbstractCursorTool.java:640)
at org.openjump.advancedtools.block.DrawOrientedBlockTool.gestureFinished(DrawOrientedBlockTool.java:121)
at com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool.fireGestureFinished(AbstractCursorTool.java:621)
at org.openjump.core.ui.plugin.edittoolbox.cursortools.ConstrainedMultiClickTool.finishGesture(ConstrainedMultiClickTool.java:280)
at org.openjump.core.ui.plugin.edittoolbox.cursortools.ConstrainedMultiClickTool.mouseReleased(ConstrainedMultiClickTool.java:155)
at com.vividsolutions.jump.workbench.ui.cursortool.DelegatingTool.mouseReleased(DelegatingTool.java:105)
...

Note that, with the older java version 1.8.0_311, both a) and b) were generating errors

With OpenJUMP 1.16 no error were generating (I did this test just in case to have an history if there wers some changes)

I still think that the bug in CadTools and the one in VertexImagesas are related as they share some code on how to read WKT symbols, rotate and transform into geometries. I will not open another issue, maybe solving CadTools solves also VertexImage

Bets regards

edeso commented 1 year ago

a) select the first icon to the left (Draw a block), select block bore_01 Everything is fine and the block is drawn with no errors as in picture of your message

yes, this was fixed in my initial approach

b) select the second icon to the left (Draw an oriented block) SNIP

right, didn't try that one. the fix is identical and i'll tackle that soonish

Note that, with the older java version 1.8.0_311, both a) and b) were generating errors

With OpenJUMP 1.16 no error were generating (I did this test just in case to have an history if there wers some changes)

according to my debugging the cause lies in the upgraded jts 1.19 . for some reason some symbols fail the geometry validity test. as they are only symbols, deactivatiing the need for validity solves the issue.

I still think that the bug in CadTools and the one in VertexImagesas are related as they share some code on how to read WKT symbols, rotate and transform into geometries. I will not open another issue, maybe solving CadTools solves also VertexImage

wrt. VertexSymbols. please try to create a new project with VertexSymbol decorations in OJ2. we lost old OJ1.x project compatibility as it seems in that regard.

edeso commented 1 year ago

hey @ma15569

pls test the next snapshot. https://sourceforge.net/projects/jump-pilot/files/OpenJUMP2_snapshots/

the issue should be fixed now. if so pls close this issue . thx!

ma15569 commented 1 year ago

The bug is solved for CADTools Blocks plugin. I close this issue