Thanksyou, I use you example and I reach my goal!. is there any description on the way OJ project is organized for development?
I mean who is working on what.. I'd like to give some contribution even if I'm a newbee on java. For example I need a lot to manage 3D geometry and even if OJ is, after GRASS the best opensource tool for 3D there are still some basic lacks. Some examples: - postgis plugin doesn't support 3D (also shptopgsql doesn't) I need OGR for it. - some tool like move geometry drops Z and so on I'd like to make a revision on code for some of them. Someone is already working on these aspects? luca luca marletta www.beopen.it On Wed, Dec 9, 2009 at 9:51 AM, Nils Kuhn <nils.k...@bws-gmbh.de> wrote: > 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: > > public boolean execute(final PlugInContext context) throws Exception > { > reportNothingToUndoYet(context); > new CopySelectedItemsPlugIn().execute(context); > > Layer[] selectedLayers = > context.getLayerNamePanel().getSelectedLayers(); > > FeatureSchema featureSchema = new FeatureSchema(); > featureSchema.addAttribute("GEOMETRY", AttributeType.GEOMETRY); > featureSchema.addAttribute(LAYER, AttributeType.STRING); > //add all attributes from selected layers > for (int i=0; i<selectedLayers.length; i++) { > FeatureSchema schema = > selectedLayers[i].getFeatureCollectionWrapper() > .getFeatureSchema(); > for (int j=0; j<schema.getAttributeCount(); j++) { > String name = schema.getAttributeName(j); > if (!featureSchema.hasAttribute(name)) { > featureSchema.addAttribute(name, > schema.getAttributeType(name)); > } else if (schema.getAttributeType(name) > != featureSchema.getAttributeType(name)) { > featureSchema.addAttribute(name > > +getAttributeTypeChar(schema.getAttributeType(name)), > schema.getAttributeType(name)); > > } > } > } > > FeatureDataset featureDataset = new FeatureDataset(featureSchema); > > Collection selectedCategories = > context.getLayerNamePanel().getSelectedCategories(); > Layer newLayer = context.addLayer(selectedCategories.isEmpty() > ? StandardCategoryNames.RESULT > : selectedCategories.iterator().next().toString(), "Combined", > featureDataset); > > newLayer.setFeatureCollectionModified(true).setEditable(true); > Map attributeToStyleMap = new HashMap(); > ColorScheme colorScheme = ColorScheme.create("Set 3 > (ColorBrewer)"); > for (int i=0; i<selectedLayers.length; i++) { > Layer layer = selectedLayers[i]; > Collection features = > layer.getFeatureCollectionWrapper().getFeatures(); > newLayer.getFeatureCollectionWrapper().addAll( > conform(features,featureSchema, layer.getName())); > attributeToStyleMap.put(layer.getName(), new > BasicStyle(colorScheme.next())); > } > > newLayer.getBasicStyle().setEnabled(false); > ColorThemingStyle themeStyle = new ColorThemingStyle(LAYER, > attributeToStyleMap, new BasicStyle(Color.gray)); > themeStyle.setEnabled(true); > newLayer.addStyle(themeStyle); > ColorThemingStyle.get(newLayer).setEnabled(true); > newLayer.removeStyle(ColorThemingStyle.get(newLayer)); > ColorThemingStyle.get(newLayer).setEnabled(true); > newLayer.getBasicStyle().setEnabled(false); > > return true; > } > > regards, > Larry > > On Tue, Dec 8, 2009 at 10:54 AM, luca marletta <lucama...@gmail.com> wrote: >> >> Hi All, >> first tanks for the new openjump 1.3.1!! >> >> This my question: >> >> Can some one give me an suggestion which way I can apply a color >> scheme for each feature based on a field. I mean the same effect that >> from theme panel but programmaticaly. >> >> I'm working on a plugin for check polygon and I'd like to see the >> result immediately by colors. >> >> I need an indication for some class or some piece of code. >> >> Thanks a lot >> >> luca >> >> luca marletta >> www.beopen.it >> >> >> ------------------------------------------------------------------------------ >> 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 > > > > -- > Larry Becker > Integrated Systems Analysts, Inc. > > ________________________________ > ------------------------------------------------------------------------------ > 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 > > > -- > 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 > > ------------------------------------------------------------------------------ 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