Hi Johannes, Yo have an example of using ColorThemingAttribute in
CombineSelectedLayersPlugIn In the code, I can't see anything special to activate the new colors. In the script sample (see Ede's message), I had to add a wc.layerViewPanel.repaint(); after applying the style (or do a pan or a zoom to repaint the view) Don't know if it can help in your case, Michaël Le 27/05/2015 14:59, Johannes Kröger a écrit :
Hi everyone, I am using Version 1.8.0, rev 4164. In the code of a plugin I am writing I defined a FeatureDataset with an attribute "number" with integer values from 0 to 2. I added that FD to a layer. Now I want to style the layer by that attribute. From various ancient mailing list threads and random guessing I ended up with this: layer.getBasicStyle().setEnabled(false); layer.addStyle(new ColorThemingStyle("number", CollectionUtil.createMap( new Object[]{ 0, new BasicStyle(Color.blue), 1, new BasicStyle(Color.orange), 2, new BasicStyle(Color.red)}), new BasicStyle(Color.green) //default ) ); layer.getStyle(ColorThemingStyle.class).setEnabled(true); layer.fireAppearanceChanged(); This should assign blue to features where the "number" is 0, orange to those with 1 etc. When I run this plugin within OpenJUMP, the features in the map are displayed in a grey color, not the colors I assigned. Once I open and directly "OK"-close the "Change Styles"-dialog of the layer, the style I defined in the code is used. So, what am I missing? I already tried appending this without success: context.getLayerManager().fireLayerChanged(layer, LayerEventType.APPEARANCE_CHANGED); Is this even the right approach? I got it mostly from http://lists.refractions.net/pipermail/jump-users/2004-August/001352.html If someone feels generous, I would also be highly interested in a basic example of using a ranged style. I got as far as knowing that I would need to use Range but have no idea how to do that or how to apply it. Thanks, Hannes ------------------------------------------------------------------------------ _______________________________________________ Jump-pilot-devel mailing list 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