Hi Luca, here is another example: public boolean execute(PlugInContext context) throws Exception{ this.reportNothingToUndoYet(context); Layer lyr=context.getLayerManager().getLayer("yourLayerName"); //getting the ColorThemingStyle from the layer ColorThemingStyle colorThemingStyle = ColorThemingStyle.get(lyr); //defining the field on which the ColorThemingStyle is based colorThemingStyle.setAttributeName("yourFieldName"); //creating an invisible BasicStyle and making it the DefaultStyle of the ColorThemingStyle BasicStyle defStyle = new BasicStyle(); defStyle.setAlpha(255); colorThemingStyle.setDefaultStyle(defStyle); //as an example creating some BasicStyles BasicStyle basStyle1 = new BasicStyle(); basStyle1.setFillColor(new Color(255,255,153)); basStyle1.setLineColor(new Color(178,178,107)); basStyle1.setLineWidth(1); BasicStyle basStyle2 = new BasicStyle(); basStyle2.setFillColor(new Color(255,99,75)); basStyle2.setLineColor(new Color(178,69,52)); basStyle2.setLineWidth(1); BasicStyle basStyle3 = new BasicStyle(); basStyle3.setFillColor(new Color(127,201,127)); basStyle3.setLineColor(new Color(88,140,88)); basStyle3.setLineWidth(1); BasicStyle basStyle4 = new BasicStyle(); basStyle4.setFillColor(new Color(0,153,0)); basStyle4.setLineColor(new Color(0,107,0)); basStyle4.setLineWidth(1);; basStyle4.setFillPattern(WKTFillPattern.createVerticalHorizontalStripePattern(2, 2, false, true)); basStyle4.setRenderingFillPattern(true); BasicStyle basStyle6 = new BasicStyle(); basStyle6.setFillColor(new Color(0,0,0)); basStyle6.setLineColor(new Color(0,0,0)); basStyle6.setLineWidth(1); basStyle6.setFillPattern(WKTFillPattern.createDiagonalStripePattern(2, 2, true, false)); basStyle6.setRenderingFillPattern(true); //creating a HashMap and making it the AttributeValueToBasicStyleMap of the ColorThemingStyle //(referencing the values in the field set above to a BasicStyle) HashMap<Integer,BasicStyle> attributeToStyleMap = new HashMap<Integer,BasicStyle>(); attributeToStyleMap.put(1, basStyle1); attributeToStyleMap.put(2, basStyle2); attributeToStyleMap.put(3, basStyle3); attributeToStyleMap.put(4, basStyle4); attributeToStyleMap.put(6, basStyle6); colorThemingStyle.setAttributeValueToBasicStyleMap(attributeToStyleMap); //creating a HashMap and making it the AttributeValueToLabelMap of the ColorThemingStyle //(referencing the values in the field set above to a Label) HashMap<Integer,String> attributeToLabelMap = new HashMap<Integer,String>(); attributeToLabelMap.put(1, "firstLabel"); attributeToLabelMap.put(2, "secondLabel"); attributeToLabelMap.put(3, "thirdLabel"); attributeToLabelMap.put(4, "fourthLabel"); attributeToLabelMap.put(6, "fifthLabel"); colorThemingStyle.setAttributeValueToLabelMap(attributeToLabelMap); //disable the BasicStyle and enable the ColorThemingStyle of the layer colorThemingStyle.setEnabled(true); lyr.getBasicStyle().setEnabled(false); lyr.fireAppearanceChanged(); bolRueck=true; } Larry Becker schrieb: Here is an example: -- Dipl.-Biol. Nils Kuhn Email: nils.k...@bws-gmbh.de Fon: +49 (0)40 - 23 16 65-26 Fax: +49 (0)40 - 23 16 65-01 BWS GmbH Gotenstraße 14 D-20097 Hamburg Sitz der Gesellschaft: Hamburg Amtsgericht Hamburg: HRB 87830 Geschäftsführer: Dipl.-Geol. Robert Dési Dipl.-Geogr. Hydr. Lutz Krob ************************************************************************************************************* HINWEIS: Diese E-Mail und beigefügte Dateien dienen nur der Vorabstimmung und stellen keine rechtswirksame Willenserklärungen oder Beratungsleistungen dar. Es können keine Haftungsansprüche gegenüber der BWS GmbH geltend gemacht werden. Alle rechtswirksamen Äußerungen (Verträge, Stellungnahmen, Berechnungen, Vermerke etc.) erhalten Sie von uns in schriftlicher Form und gegebenenfalls auf separatem Datenträger. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte den Absender und vernichten Sie diese E-Mail. Unerlaubtes Kopieren und Weiterleiten dieser E-Mail sind nicht gestattet. ************************************************************************************************************* |
------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev
_______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel