Jukka, nothing to worry, my mind was w/ GeoJSON still and the only possibility to add an empty geom there is to use GeometryCollection because of the constraints i described.
my bad ..ede On 15.11.2016 11:16, Rahkonen Jukka (MML) wrote: > Hi, > > What do you mean? You did lot of work with empty geometries two years ago. In > December 1st, 2014 I answered you, probably after the final tests > > "Hi Ede, > > All this seems to work perfectly now: > - Different empty geometries are visualized with corresponding icons > - All kind of empty geometries can be saved into JUMP jml and FME GML and > returned as they were. > - Empty geometries in shapefiles are handled in a reasonable way: > - "Extract layers by geometry type" extracts empty points to a point > layer, empty linestrings to a linestring layer etc. > - Empty geometries which are read from a shapefile are marked to be empty > geometries of the same type as the not-empty geometries. A point shapefile > brings empty points, a line shapefile empty multilinestrings and a polygon > shape empty multipolygons. Because shapefiles do not make much difference > between simple and multivariants this is just right." > > -Jukka- > > -----Alkuperäinen viesti----- > Lähettäjä: edgar.sol...@web.de [mailto:edgar.sol...@web.de] > Lähetetty: 15. marraskuuta 2016 12:11 > Vastaanottaja: Rahkonen Jukka (MML) <jukka.rahko...@maanmittauslaitos.fi>; > OpenJump develop and use <jump-pilot-devel@lists.sourceforge.net> > Aihe: Re: [JPP-Devel] SVN: [5185] > core/trunk/src/com/vividsolutions/jump/workbench/ui/ LayerNameRenderer.java > > GeometryCollection is afaik the only possibility to have an empty geometry as > all other geom types require either coordinates or sub geoms per definition. > > ..ede > > On 15.11.2016 11:06, Rahkonen Jukka (MML) wrote: >> Hi, >> >> DB Query plugin is attaching a fake GEOMETRYCOLLECTION EMPTY to all the >> lines without a real geometry. For my purposes it has been a good solution >> but I can’t say if it suits for other use cases. >> >> -Jukka Rahkonen- >> >> Stefan Steiniger wrote: >> >> >> Hi, >> >> i used empty geomcollection so far, to have something there... I am not sure >> how much work it would be to introduce a new table/data layer without a >> geometry - as i am not sure if OJ is designed for that. Simplest may be to >> copy and make the field invisible for now. >> >> Perhaps Michaël has a better idea about the possibility to throw out the >> geom. >> >> >> >> cheers, >> >> stefan >> >> >> ------ Originalnachricht ------ >> Von: >> Datum: 14.11.2016 9:45 >> An: OpenJump develop and use; >> Betreff:Re: [JPP-Devel] SVN: [5185] >> core/trunk/src/com/vividsolutions/jump/workbench/ui/ LayerNameRenderer.java >> >> i guess the cleanest solution would be a new layer class eg. DataLayer, that >> simply does not allow adding/editing geometries or does not even have a >> geometry attribute. >> >> >> >> in the 2nd case you would probably need a new featurecollection w/o a >> geometry column as well and the whole thing would throw some exceptions here >> and there, as OJ expects geometries in featurecollections, but apart from >> that it would be clean and the renderer would not need to monitor geom >> changes at all. >> >> >> >> ..ede >> >> >> >> On 14.11.2016 10:39, Giuseppe Aruta wrote: >> >>> Thanks Michael Ede >> >>> Indeed I came across (as a side relative problem ) working on Saxtante. >> >>> Sextante allows to work on Table files while Oj not. We can take advance of >> >>> the Sextante table algorithms allowing Sextante to decode the vector >> >>> layers, with all features with empty geometries (see for instance loading >> >>> .csv on auto mode) as tables (I already added added into Sextante binding a >> >>> Boolean method that allows to decode these files). >> >>> I wondered if users would also have benefit to visualize that a table is >> >>> loaded into OJ workbench, with a table icon. >> >>> I will check other solutions. Thanks for the hint. >> >>> Peppe >> >>> >> >>> Il 13/Nov/2016 23:21, "Michaël Michaud" ha >> >>> scritto: >> >>> >> >>>> Hi Peppe, >> >>>> >> >>>> Seel also my answer on 2016-10-29. >> >>>> >> >>>> TreeLayerNamePanel has a listener, but to avoid a featureCollection scan >> >>>> after each change >> >>>> you probably need to keep a cache in the Layer as suggested by Ede, and >> >>>> use the Layer's >> >>>> listener to update the cache every time a feature is added, removed or >> >>>> changed >> >>>> >> >>>> Michaël >> >>>> >> >>>> >> >>>> Le 13/11/2016 à 19:51, edgar.sol...@web.de<mailto:edgar.sol...@web.de> a >>>> écrit : >> >>>>> thanks.. how about implementing the caching/listener approach if you >> >>>> like to have icon? ..ede >> >>>>> >> >>>>> On 13.11.2016 18:57, Giuseppe Aruta wrote: >> >>>>>> Ok Ede, I didn't know it. I will revert the change. >> >>>>>> Thanks again >> >>>>>> Peppe >> >>>>>> >> >>>>>> Il 13/Nov/2016 18:48, ha scritto: >> >>>>>> >> >>>>>>> Peppe, >> >>>>>>> >> >>>>>>> NACK.. this is going to get very slow for huge datasets containing >> >>>> empty >> >>>>>>> geoms only, as it is run on every redraw of the layer tree. please >> >>>> cache >> >>>>>>> the state and use a layer change listener or else users will complain >> >>>> about >> >>>>>>> a frozen OJ some time in the future and we will have a hard time to >> >>>>>>> pinpoint the reason, again ;) >> >>>>>>> >> >>>>>>> ..ede >> >>>>>>> >> >>>>>>> On 13.11.2016 18:41, >>>>>>> jump-pilot-...@lists.sourceforge.net<mailto:jump-pilot-...@lists.sourceforge.net> >>>>>>> wrote: >> >>>>>>>> Revision: 5185 >> >>>>>>>> http://sourceforge.net/p/jump-pilot/code/5185 >> >>>>>>>> Author: ma15569 >> >>>>>>>> Date: 2016-11-13 17:41:37 +0000 (Sun, 13 Nov 2016) >> >>>>>>>> Log Message: >> >>>>>>>> ----------- >> >>>>>>>> The layer tree shows a table icon for layers that have features with >> >>>>>>> empty geometries >> >>>>>>>> Modified Paths: >> >>>>>>>> -------------- >> >>>>>>>> core/trunk/src/com/vividsolutions/jump/workbench/ >> >>>>>>> ui/LayerNameRenderer.java >> >>>>>>>> Modified: core/trunk/src/com/vividsolutions/jump/workbench/ >> >>>>>>> ui/LayerNameRenderer.java >> >>>>>>>> =================================================================== >> >>>>>>>> --- core/trunk/src/com/vividsolutions/jump/workbench/ >> >>>> ui/LayerNameRenderer.java >> >>>>>>> 2016-11-13 17:21:20 UTC (rev 5184) >> >>>>>>>> +++ core/trunk/src/com/vividsolutions/jump/workbench/ >> >>>> ui/LayerNameRenderer.java >> >>>>>>> 2016-11-13 17:41:37 UTC (rev 5185) >> >>>>>>>> @@ -36,6 +36,7 @@ >> >>>>>>>> import java.awt.Rectangle; >> >>>>>>>> import java.io.File; >> >>>>>>>> import java.util.Iterator; >> >>>>>>>> +import java.util.List; >> >>>>>>>> >> >>>>>>>> import javax.swing.DefaultListCellRenderer; >> >>>>>>>> import javax.swing.Icon; >> >>>>>>>> @@ -54,9 +55,11 @@ >> >>>>>>>> import org.openjump.core.rasterimage.RasterImageLayer; >> >>>>>>>> >> >>>>>>>> import com.vividsolutions.jts.geom.Envelope; >> >>>>>>>> +import com.vividsolutions.jts.geom.Geometry; >> >>>>>>>> import com.vividsolutions.jump.I18N; >> >>>>>>>> import com.vividsolutions.jump.feature.Feature; >> >>>>>>>> import com.vividsolutions.jump.feature.FeatureCollection; >> >>>>>>>> +import com.vividsolutions.jump.feature.FeatureCollectionWrapper; >> >>>>>>>> import com.vividsolutions.jump.io.datasource.DataSourceQuery; >> >>>>>>>> import com.vividsolutions.jump.util.StringUtil; >> >>>>>>>> import com.vividsolutions.jump.workbench.JUMPWorkbench; >> >>>>>>>> @@ -118,6 +121,7 @@ >> >>>>>>>> private ImageIcon rasterIcon = IconLoader.icon("map_13.png"); >> >>>>>>>> private ImageIcon sextante_rasterIcon = >> >>>> IconLoader.icon("mapSv2_13. >> >>>>>>> png"); >> >>>>>>>> private ImageIcon sextante_rasterIcon2 = >> >>>>>>> IconLoader.icon("mapSv2_13bw.png"); >> >>>>>>>> + private ImageIcon table_Icon = IconLoader.icon("Table.gif"); >> >>>>>>>> private final static String LAYER_NAME = I18N >> >>>>>>>> .get("org.openjump.core.ui.plugin.layer. >> >>>>>>> LayerPropertiesPlugIn.Layer-Name"); >> >>>>>>>> private final static String FILE_NAME = >> >>>>>>> I18N.get("ui.MenuNames.FILE"); >> >>>>>>>> @@ -379,6 +383,12 @@ >> >>>>>>>> .getFeatureCollectionWrapper().size() > 1 ? >> >>>>>>> multiRasterIcon >> >>>>>>>> : rasterIcon); >> >>>>>>>> imageLabel.setVisible(true); >> >>>>>>>> + } else if (showColorPanel && layerable instanceof Layer >> >>>>>>>> + && isTable((Layer) layerable)) { >> >>>>>>>> + //Show a table icon if the Layer has features with empty >> >>>>>>> geometries >> >>>>>>>> + imageLabel.setIcon(table_Icon); >> >>>>>>>> + imageLabel.setVisible(true); >> >>>>>>>> + >> >>>>>>>> } else if (showColorPanel && layerable instanceof Layer) { >> >>>>>>>> colorPanel.init((Layer) layerable, isSelected, >> >>>>>>>> list.getBackground(), >> >>>> list.getSelectionBackground()) >> >>>>>>> ; >> >>>>>>>> @@ -1022,4 +1032,27 @@ >> >>>>>>>> && bgc.equals(p.getBackground()) && p.isOpaque(); >> >>>>>>>> return !colorMatchOrOpaque && super.isOpaque(); >> >>>>>>>> } >> >>>>>>>> + >> >>>>>>>> + /* >> >>>>>>>> + * [Giuseppe Aruta 11.2016] . True if all the layer geometries >> >>>> are >> >>>>>>> empty >> >>>>>>>> + * (Geometrycollection empty). Workaround to decode table files >> >>>>>>> (like .csv or .dbf) >> >>>>>>>> + * so that they are loaded in Sextante as table >> >>>>>>>> + */ >> >>>>>>>> + public static boolean isTable(Layer layer) { >> >>>>>>>> + FeatureCollectionWrapper featureCollection = layer >> >>>>>>>> + .getFeatureCollectionWrapper(); >> >>>>>>>> + List featureList = featureCollection.getFeatures(); >> >>>>>>>> + Geometry nextGeo = null; >> >>>>>>>> + for (@SuppressWarnings("unchecked") >> >>>>>>>> + Iterator i = >> >>>> featureList.iterator(); >> >>>>>>> i >> >>>>>>>> + .hasNext();) { >> >>>>>>>> + Feature feature = (Feature) i.next(); >> >>>>>>>> + nextGeo = feature.getGeometry(); >> >>>>>>>> + } >> >>>>>>>> + if (!featureCollection.isEmpty() && nextGeo.isEmpty()) { >> >>>>>>>> + return true; >> >>>>>>>> + } else { >> >>>>>>>> + return false; >> >>>>>>>> + } >> >>>>>>>> + } >> >>>>>>>> } >> >>>>>>>> \ No newline at end of file >> >>>>>>>> >> >>>>>>>> >> >>>>>>>> ------------------------------------------------------------ >> >>>>>>> ------------------ >> >>>>>>>> Developer Access Program for Intel Xeon Phi Processors >> >>>>>>>> Access to Intel Xeon Phi processor-based developer platforms. >> >>>>>>>> With one year of Intel Parallel Studio XE. >> >>>>>>>> Training and support from Colfax. >> >>>>>>>> Order your platform today. http://sdm.link/xeonphi >> >>>>>>>> _______________________________________________ >> >>>>>>>> Jump-pilot-devel mailing list >> >>>>>>>> Jump-pilot-devel@lists.sourceforge.net<mailto:Jump-pilot-devel@lists.sourceforge.net> >> >>>>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >>>>>>>> >> >>>>>>> ------------------------------------------------------------ >> >>>>>>> ------------------ >> >>>>>>> Developer Access Program for Intel Xeon Phi Processors >> >>>>>>> Access to Intel Xeon Phi processor-based developer platforms. >> >>>>>>> With one year of Intel Parallel Studio XE. >> >>>>>>> Training and support from Colfax. >> >>>>>>> Order your platform today. http://sdm.link/xeonphi >> >>>>>>> _______________________________________________ >> >>>>>>> Jump-pilot-devel mailing list >> >>>>>>> Jump-pilot-devel@lists.sourceforge.net<mailto:Jump-pilot-devel@lists.sourceforge.net> >> >>>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >>>>>>> >> >>>>>> >> >>>>>> >> >>>>>> ------------------------------------------------------------ >> >>>> ------------------ >> >>>>>> Developer Access Program for Intel Xeon Phi Processors >> >>>>>> Access to Intel Xeon Phi processor-based developer platforms. >> >>>>>> With one year of Intel Parallel Studio XE. >> >>>>>> Training and support from Colfax. >> >>>>>> Order your platform today. http://sdm.link/xeonphi >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> _______________________________________________ >> >>>>>> Jump-pilot-devel mailing list >> >>>>>> Jump-pilot-devel@lists.sourceforge.net<mailto:Jump-pilot-devel@lists.sourceforge.net> >> >>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >>>>>> >> >>>>> ------------------------------------------------------------ >> >>>> ------------------ >> >>>>> Developer Access Program for Intel Xeon Phi Processors >> >>>>> Access to Intel Xeon Phi processor-based developer platforms. >> >>>>> With one year of Intel Parallel Studio XE. >> >>>>> Training and support from Colfax. >> >>>>> Order your platform today. http://sdm.link/xeonphi >> >>>>> _______________________________________________ >> >>>>> Jump-pilot-devel mailing list >> >>>>> Jump-pilot-devel@lists.sourceforge.net<mailto:Jump-pilot-devel@lists.sourceforge.net> >> >>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >>>>> >> >>>> >> >>>> >> >>>> ------------------------------------------------------------ >> >>>> ------------------ >> >>>> Developer Access Program for Intel Xeon Phi Processors >> >>>> Access to Intel Xeon Phi processor-based developer platforms. >> >>>> With one year of Intel Parallel Studio XE. >> >>>> Training and support from Colfax. >> >>>> Order your platform today. http://sdm.link/xeonphi >> >>>> _______________________________________________ >> >>>> Jump-pilot-devel mailing list >> >>>> Jump-pilot-devel@lists.sourceforge.net<mailto:Jump-pilot-devel@lists.sourceforge.net> >> >>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >>>> >> >>> >> >>> >> >>> >> >>> ------------------------------------------------------------------------------ >> >>> Developer Access Program for Intel Xeon Phi Processors >> >>> Access to Intel Xeon Phi processor-based developer platforms. >> >>> With one year of Intel Parallel Studio XE. >> >>> Training and support from Colfax. >> >>> Order your platform today. http://sdm.link/xeonphi >> >>> >> >>> >> >>> >> >>> _______________________________________________ >> >>> Jump-pilot-devel mailing list >> >>> Jump-pilot-devel@lists.sourceforge.net<mailto:Jump-pilot-devel@lists.sourceforge.net> >> >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >>> >> >> >> >> ------------------------------------------------------------------------------ >> >> Developer Access Program for Intel Xeon Phi Processors >> >> Access to Intel Xeon Phi processor-based developer platforms. >> >> With one year of Intel Parallel Studio XE. >> >> Training and support from Colfax. >> >> Order your platform today. http://sdm.link/xeonphi >> >> _______________________________________________ >> >> Jump-pilot-devel mailing list >> >> Jump-pilot-devel@lists.sourceforge.net<mailto:Jump-pilot-devel@lists.sourceforge.net> >> >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> ------------------------------------------------------------------------------ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel