Sorry, I forgot the file

________________________________
 Da: Giuseppe Aruta <giuseppe_ar...@yahoo.it>
A: OpenJump develop and use <jump-pilot-devel@lists.sourceforge.net> 
Inviato: Sabato 9 Giugno 2012 12:34
Oggetto: Re: [JPP-Devel] What changed on OJ PlugIn management?
 

Thanks Michael,
I have already modified the measure tools plugin 
(http://sourceforge.net/projects/opensit/files/Openjump/PlugIn/MeasureExtension/)
 and it works with new OJ NB
I hope I can upgrade Spanish and Italian translations of Oj and other plugIns 
before August.

I saw that colorchooser plugin from Skyjump is a new candidate plugin for next 
OJ 1.6 realizes 
(http://sourceforge.net/apps/mediawiki/jump-pilot/index.php?title=OpenJUMP_Roadmap)
There are some modification to do on BasicStyle plugin, made by Larry - That I 
made to OJ Jufre.
I attached to this mail the modified BasicStyle file: if you give a look at it 
you can easely check all modifications. 
Actually I don't have an access to repository so I ask you if you modify the 
original BasicStyle on NB so that we can experiment the colorchooser plugin 
(stored 
here: http://sourceforge.net/projects/opensit/files/Openjump/PlugIn/colorchooser/)

regards

Giuseppe

________________________________
 Da: Michaël Michaud <michael.mich...@free.fr>
A: jump-pilot-devel@lists.sourceforge.net 
Inviato: Venerdì 8 Giugno 2012 22:24
Oggetto: Re: [JPP-Devel] What changed on OJ PlugIn management?
 

Hi Peppe,

the most complete method is at line 464
addMainMenuItem(PlugIn plugin, String[] menuPath, JMenuItem
    menuItem, EnableCheck enableCheck, int pos)

most other addMainMenuItem methods (if not all) are convenience
    methods calling that one.

There are some legacy one taking a PlugIn as first parameter
addMainMenuPlugin(PlugIn plugin...)

and the new ones taking AbstractUiPlugIn as second parameter
addMainMenuPlugin(String[] path, AbstractUiPlugIn plugin...)

Hope that helps,

Michaël



Le 08/06/2012 20:54, Giuseppe Aruta a écrit : 
HI Ede,
>which  addMenuItem method is more similar to addMainMenuItemWithJava14Fix()? 
>Giuseppe
>
>
>
>________________________________
> Da: Giuseppe Aruta <giuseppe_ar...@yahoo.it>
>A: OpenJump develop and use <jump-pilot-devel@lists.sourceforge.net> 
>Inviato: Venerdì 8 Giugno 2012 19:26
>Oggetto: Re: [JPP-Devel] What changed on OJ PlugIn management?
> 
>
>Thanks Ede,
>I will change it 
>Giuseppe
>
>
>
>________________________________
> Da: "edgar.sol...@web.de" <edgar.sol...@web.de>
>A: OpenJump develop and use <jump-pilot-devel@lists.sourceforge.net> 
>Inviato: Venerdì 8 Giugno 2012 19:01
>Oggetto: Re: [JPP-Devel] What changed on OJ PlugIn management?
> 
>addMainMenuItemWithJava14Fix() was only used
                      internally and retired since then. you should use
                      one of the new not deprecated addMenuItem methods
                      instead.
>
>..ede
>
>On 08.06.2012 18:47, Giuseppe Aruta wrote:
>> Hi all,
>> I am going back to OJ world and yesterday. An
                      tried to recover lost time in translation and
                      programmin.
>>  I tried to work with my measurement plugin 
>>(http://sourceforge.net/projects/opensit/files/Openjump/PlugIn/MeasureExtension/)
>> on a NB Open JUMP installation.
>> 
>> I had this error message:
>> 
>> java.lang.NoSuchMethodError:
com.vividsolutions.jump.workbench.ui.plugin.FeatureInstaller.addMainMenuItemWithJava14Fix(Lcom/vividsolutions/jump/workbench/plugin/PlugIn;[Ljava/lang/String;Ljava/lang/String;ZLjavax/swing/Icon;Lcom/vividsolutions/jump/workbench/plugin/EnableCheck;)V
>> at
it.geoarbores.openjump.measure.plugins.CalculateDistanceSegmentPlugIn.initialize(CalculateDistanceSegmentPlugIn.java:27)
>> at
it.geoarbores.openjump.measure.MeasureExtension.configure(MeasureExtension.java:49)
>> at
com.vividsolutions.jump.workbench.plugin.PlugInManager.loadConfigurations(PlugInManager.java:127)
>> at
com.vividsolutions.jump.workbench.plugin.PlugInManager.load(PlugInManager.java:117)
>> at
com.vividsolutions.jump.workbench.JUMPWorkbench.main(JUMPWorkbench.java:388)
>> at
com.vividsolutions.jump.workbench.JUMPWorkbench.main(JUMPWorkbench.java:343)
>> 
>> well, something has changed, I think, on
                      plugin managenet.
>> Can soembody give me some hint?
>> 
>> thanks
>> 
>> Giuseppe
>> 
>> 
>> 
>>
------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways
                      today's security and 
>> threat landscape has changed and how IT
                      managers can respond. Discussions 
>> will include endpoint security, mobile
                      security and the latest in malware 
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> 
>> 
>> 
>>
                      _______________________________________________
>> Jump-pilot-devel mailing list
>> Jump-pilot-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>------------------------------------------------------------------------------
>Live Security Virtual Conference
>Exclusive live event will cover all the ways
                      today's security and 
>threat landscape has changed and how IT managers
                      can respond. Discussions 
>will include endpoint security, mobile security
                      and the latest in malware 
>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>_______________________________________________
>Jump-pilot-devel mailing list
>Jump-pilot-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>
>------------------------------------------------------------------------------
>Live Security Virtual Conference
>Exclusive live event will cover all the ways today's
            security and 
>threat landscape has changed and how IT managers can
            respond. Discussions 
>will include endpoint security, mobile security and the
            latest in malware 
>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>_______________________________________________
>Jump-pilot-devel mailing list
>Jump-pilot-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>
>
>
>------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>_______________________________________________
Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
/*
 * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
 * for visualizing and manipulating spatial features with geometry and 
attributes.
 *
 * Copyright (C) 2003 Vivid Solutions
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * For more information, contact:
 *
 * Vivid Solutions
 * Suite #1A
 * 2328 Government Street
 * Victoria BC  V8T 5G5
 * Canada
 *
 * (250)385-6040
 * www.vividsolutions.com
 */
package com.vividsolutions.jump.workbench.ui.renderer.style;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Stroke;
import java.awt.geom.NoninvertibleTransformException;
import java.util.List;

import org.openjump.util.SLDImporter.StrokeFillStyle;

import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.util.Assert;
import com.vividsolutions.jump.I18N;
import com.vividsolutions.jump.feature.Feature;
import com.vividsolutions.jump.util.StringUtil;
import com.vividsolutions.jump.workbench.model.Layer;
import com.vividsolutions.jump.workbench.ui.GUIUtil;
import com.vividsolutions.jump.workbench.ui.Viewport;


public class BasicStyle implements Style, StrokeFillStyle {
        public static final String RGB_ATTRIBUTE_NAME = "R_G_B";
    private boolean renderingFill = true;
    private boolean renderingLine = true;
    private boolean renderingLinePattern = false;
    private boolean renderingFillPattern = false;

                public static final Color       DEFAULT_FILL_COLOR  = new 
Color(0, 0, 0, 255);
                public static final Color       DEFAULT_LINE_COLOR  = 
DEFAULT_FILL_COLOR;
                public static final BasicStroke DEFAULT_FILL_STROKE = new 
BasicStroke(1);

    //The important thing here is the initial alpha. [Jon Aquino]
    private Color fillColor = DEFAULT_FILL_COLOR;
    private Color lineColor = DEFAULT_LINE_COLOR;

    private BasicStroke lineStroke;
    private Stroke fillStroke = DEFAULT_FILL_STROKE;
    private boolean enabled = true;
    private String linePattern = "3";

    private boolean renderingVertices = true;
    
    
    private Paint fillPattern;

    public BasicStyle(Color fillColor) {
        setFillColor(fillColor);
        setLineColor(Layer.defaultLineColor(fillColor));
        setLineWidth(1);
    }

    public BasicStyle() {
        this(Color.black);
    }

    public boolean isRenderingFillPattern() {
        return renderingFillPattern;
    }

    public BasicStyle setRenderingFillPattern(boolean renderingFillPattern) {
        this.renderingFillPattern = renderingFillPattern;
        return this;
    }

    public Paint getFillPattern() {
        return fillPattern;
    }

    /**
     * Remember to call #setRenderingFillPattern(true).
     */
    public BasicStyle setFillPattern(Paint fillPattern) {
        this.fillPattern = fillPattern;
        if (fillPattern instanceof BasicFillPattern) {
            ((BasicFillPattern) fillPattern).setColor(this.fillColor);
        }        
        return this;
    }

    public String getLinePattern() {
        return linePattern;
    }

    public boolean getRenderingVertices() {
        return renderingVertices;
    }

    public void setRenderingVertices(boolean renderingVertices) {
        this.renderingVertices = renderingVertices;
    }
    
    /**
     * The actual dash pattern used internally will be the given dash pattern
     * multiplied by the line length. Remember to call 
#setRenderingLinePattern(true).
     * @param linePattern e.g. "5,2,3,2"
     */
    public BasicStyle setLinePattern(String linePattern) {
        this.linePattern = linePattern;
        lineStroke = createLineStroke(lineStroke.getLineWidth());
        return this;
    }

    public void initialize(Layer layer) {
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public boolean isEnabled() {
        return enabled;
    }

       
    public void paint(Feature f, Graphics2D g, Viewport viewport)
    throws NoninvertibleTransformException {

        ///////////////////////
        //  Begin OLD lines  
        ////////////////////// 
        /*
        if (!renderingVertices && f.getGeometry() instanceof Point) {
            return;
        }
        */
       ////////////////////////
       //  End OLD lines
       ////////////////////////


       /////////////////////////////////////
       //  Begin NEW lines for colorchooser
       /////////////////////////////////////

        Color fillColor = this.fillColor;
        Color lineColor = this.lineColor;
        Color featureColor = getFeatureColor(f);
        
        if (featureColor != null)
        {
                fillColor = featureColor;
                lineColor = featureColor.darker();
        }
    
        if (!renderingVertices && f.getGeometry() instanceof Point) {
        return;
         }
      /////////////////////////////////////
      // End NEW lines for colorchooser
      /////////////////////////////////////


          
        StyleUtil.paint(f.getGeometry(), g, viewport, renderingFill,
            fillStroke,
            (renderingFillPattern && (fillPattern != null)) ? fillPattern
                                                            : fillColor,
            renderingLine, lineStroke, lineColor);
    }

    
    
    
    
    public Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            Assert.shouldNeverReachHere();

            return null;
        }
    }

    public boolean isRenderingFill() {
        return renderingFill;
    }

    public boolean isRenderingLine() {
        return renderingLine;
    }

    public boolean isRenderingLinePattern() {
        return renderingLinePattern;
    }

    public void setRenderingFill(boolean renderingFill) {
        this.renderingFill = renderingFill;
    }

    public void setRenderingLine(boolean renderingLine) {
        this.renderingLine = renderingLine;
    }

    public BasicStyle setRenderingLinePattern(boolean renderingLinePattern) {
        this.renderingLinePattern = renderingLinePattern;
        lineStroke = createLineStroke(lineStroke.getLineWidth());
        return this;
    }

    public void setFillColor(Color fillColor) {
        setFillColor(fillColor, getAlpha());
    }
    
    private BasicStyle setFillColor(Color fillColor, int alpha) {
        this.fillColor = GUIUtil.alphaColor(fillColor, alpha);
        if (fillPattern instanceof BasicFillPattern) {
            ((BasicFillPattern) fillPattern).setColor(this.fillColor);
        }
        return this;
    }

    public void setLineColor(Color lineColor) {
        this.lineColor = GUIUtil.alphaColor(lineColor, getAlpha());
    }

    public void setLineWidth(int lineWidth) {
        //Don't use BasicStroke.JOIN_ROUND or JOIN_BEVEL -- when the line
        //width is 1, one of the corners will not be drawn. [Jon Aquino]
        lineStroke = createLineStroke(lineWidth);
    }

    private BasicStroke createLineStroke(float lineWidth) {
        return (renderingLinePattern && (linePattern.trim().length() != 0) &&
        (lineWidth > 0))
        ? new BasicStroke(lineWidth, BasicStroke.CAP_BUTT,
            BasicStroke.JOIN_BEVEL, 1.0f, toArray(linePattern, lineWidth), 0)
        : new BasicStroke(lineWidth, BasicStroke.CAP_BUTT,
            BasicStroke.JOIN_BEVEL);
    }

    public static float[] toArray(String linePattern, float lineWidth) {
        List strings = StringUtil.fromCommaDelimitedString(linePattern);
        float[] array = new float[strings.size()];

        for (int i = 0; i < strings.size(); i++) {
            String string = (String) strings.get(i);
            array[i] = Float.parseFloat(string) * lineWidth;

            if (array[i] <= 0) {
                throw new 
IllegalArgumentException(I18N.get("ui.renderer.style.BasicStyle.negative-dash-length"));
            }
        }
        return array;
    }

    /**
     * @return 0-255 (255 is opaque)
     */
    public int getAlpha() {
        return fillColor.getAlpha();
    }

    public Color getFillColor() {
        return GUIUtil.alphaColor(fillColor, 255);
    }

    public Color getLineColor() {
        return GUIUtil.alphaColor(lineColor, 255);
    }

    public int getLineWidth() {
        return (int) lineStroke.getLineWidth();
    }

    /**
     * @param alpha 0-255 (255 is opaque)
     */
    public void setAlpha(int alpha) {
        setFillColor(fillColor, alpha);
        lineColor = GUIUtil.alphaColor(lineColor, alpha);
    }

    public BasicStroke getLineStroke() {
        return lineStroke;
    }

       /////////////////////////////////////
       //  Begin NEW lines for colorchooser
       /////////////////////////////////////


    /**
     * Looks for an Attriubte field that contains the RGB color code and returns
     * it or null if the RGB hex string is empty or ill-formed. 
     * @param    f   the <code>Feature</code> containing the RGB 
     *                  Attribute to be parsed.
     * @return   the <code>Color</code> represented by the R_B_G hex value with 
     *           the current Alpha value inserted.
     *           Warning: returns null in many "normal" cases.
     */
     public Color getFeatureColor(Feature f)
     {
        if(f.getSchema().hasAttribute(RGB_ATTRIBUTE_NAME))
        {
                String colorStr = (String)f.getAttribute(RGB_ATTRIBUTE_NAME);
                
                if ((colorStr != null) && (colorStr.trim().length() == 6))
                {
                        try
                        {
                                int r = 
Integer.parseInt(colorStr.substring(0,2), 16);
                                int g = 
Integer.parseInt(colorStr.substring(2,4), 16);
                                int b = 
Integer.parseInt(colorStr.substring(4,6), 16);
                                return new Color(r, g, b, getAlpha());
                        }
                        catch (NumberFormatException ex)
                        {
                                return null;
                        }
                }
        }
        
        return null;
     }
     
      /////////////////////////////////////
      // End NEW lines for colorchooser
      /////////////////////////////////////


 }


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to