Stefan, the original authors probably created the API with some afterthought and accidentally i agree w/ them. OJ layers are merely responsible to render their data into the layerview. if you want more you ask the layer to give you the featcol or the datasource to work w/.
this is clean and efficient and i see no argument invalidating that so far. ..ede On 26.01.2016 13:15, Stefan Steiniger wrote: > Hey, > > i think some of the stuff is quite usefull and even having it in Layer > class... > for an OJ programmer who knows clases etc., probabky not the right place, but > for someone who writes scripts (python, bash, etc) this is the obvious place > to > get to know layer properties. > > Of course i don't know how many do scripting with OJ, but... > > cheers, > > stefan > > ------ Originalnachricht ------ > *Von: * > *Datum: *26.01.2016 8:22 > *An: *OpenJump develop and use; > *Betreff:*Re: [JPP-Devel] Add some useful methods on Layer.class and > RasterImageLayer.class > > Peppe, > > > first of all while i commend your drive i really think that API > changes/additions this deep in CORE should be discussed first and committed > only after. > this is unless you > - are absolutely sure what you are doing ;) > and > - know how to revert the commit cleanly (keeping revisions) > > further comments in the text below > > On 26.01.2016 07:26, Giuseppe Aruta wrote: >> Hi Ede, Michael, Jukka, Stefan and others >> I added some simple boolean ans String methods on >> com.vividsolutions.jump.workbench.model.Layer class and >> org.openjump.core.rasterimage.RasterImageLayer class >> I ask you to give a look and your opinion, these methods should cover many >> aspects and can be used for future development. >> I would like to know if >> a) those methods are in the right place > > no. > > 1. Layer is the oldest layer representation in OJ (when it only suppported > vectors), but not the most basic, that is Layerable or the implementor > AbstractLayerable (which can be used to implement nearly anything as an OJ > layerable) > > 2. it mixes up functionality. you ask the layer about things that are and > should only be known to it's feature collection or datasource. > > 3. you are (mostly) implementing functionality that is already there. if you > want to know what type a layer is you check out what it is instanceof or ask > it's datasource. > check out eg. how > ReferencedImagesLayer extends Layer extends AbstractLayerable implements > Layerable > so if you want to know if you deal with an ReferencedImagesLayer use > *instanceof*. > > OJ layers keep the way the handle their data private, so there is no way to > generalize handling of say images (totally different implementation between > RasterImageLayer & ReferencedImageLayer) today. > if you want functionality like that consider > a) inserting a generalized interface class with the functions you need eg. > ImageLayer extends AbstractLayerable and have both extend from that > b) implement an interface eg. ImageLayer in both that defines functions you > need for generalized image handling > >> b) if they are really efficient ( i might loose some aspects) > > what do you mean by this? > >> on Layer class: >> >> 1) isTemporaryLayer() Defines all Layer which datasource is null or Layer >> which are saved into a TEMP folder (those layers are created by Sextante if >> the Sextante option "save as temporary file" is activated) > > why is this actually needed? if the the data is needed between runs, after an > OJ restart, it should not be saved in temp in the first place. > >> 2) isModifiedLayer() == is FeatureCollectionModified > > well, this depends on the type of layer, but should probably be set like > visible, editable etc. in AbstractLayerable, for implementers to override at > will > >> 3) isVectorLayer() Defines all layer excluding images (and datastores >> >> 4) isImageLayer() Defines all image loaded by Layer.class (hope so) >> >> 5) isMultipleImagesLayer() Defines a Layer with multiple image >> >> 6) isDataStoreLayer() should be defines all Datastore layers. I am not sure >> about this part of the code > > see ,my point 3. above > >> 7) isSystemLayer() Defines layer like Fence and Measure, which should be >> considered as "System" layers > > what do we need that for? > >> 8) isCadLayer() Something I test to work with DXF files, Only layers with >> COLOR and TEXT attributes > > probably point 3. again > >> 9) isMixedGeometryTypes() Should check if the Layer has mixed geometry types >> >> 10) isEmpy() Should defines if the Layer has an empty feature collection >> >> 11) String getGeometryType(). returns the geometry types of the layer > > can be retrieved already by getting the featurecollection > >> 12) String getFilePath() return the path of a Layer, eg. >> C:/folder/file.shp. If the file is stored into a TEMP folder it returns a >> warning message (see point 1) > > ask the layer's datasource > >> for RasterImageLayers: >> >> 1) isTemporaryLayer() defines if RasterImageLayer file is stored into a >> TEMP folder >> >> 12) String getFilePath() return the path of a Layer, eg. >> C:/folder/file.tif. If the file is stored into a TEMP folder it returns a >> warning message (see point 1) >> >> waiting for your opinion >> > > afaiac this smells like a complete revert. sorry :)) ..ede > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > > > > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel