Revision 2696 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FSymbol.java

View differences:

FSymbol.java
58 58
import java.net.MalformedURLException;
59 59
import java.net.URI;
60 60
import java.net.URISyntaxException;
61
import java.util.ArrayList;
62
import java.util.List;
63
import java.util.StringTokenizer;
61 64

  
62 65
import javax.swing.ImageIcon;
63 66

  
......
86 89
	private Color m_FontColor;
87 90
	private float m_FontSize;
88 91
	private int rgb;
89

  
92
    
90 93
	/**
91 94
	 * Si <code>m_bUseFontSize</code> viene a false entonces m_FontSize viene
92 95
	 * en unidades de mapa (metros)
......
119 122
	public Color m_BackColor;
120 123
	public Paint m_BackFill;
121 124

  
125
    /**
126
     * Converts the comma-delimited string into a List of trimmed strings.
127
     *
128
     * @param linePattern a String with comma-delimited values
129
     * @param lineWidth DOCUMENT ME!
130
     *
131
     * @return a List of the Strings that were delimited by commas
132
     *
133
     * @throws IllegalArgumentException DOCUMENT ME!
134
     */
135
    public static float[] toArray(String linePattern, float lineWidth) {
136
        StringTokenizer st = new StringTokenizer(linePattern, ",");
137
        int numTokens = st.countTokens();
138

  
139
        float[] array = new float[numTokens];
140

  
141
        for (int i = 0; i < numTokens; i++) {
142
            String string = st.nextToken();
143
            array[i] = Float.parseFloat(string) * lineWidth;
144

  
145
            if (array[i] <= 0) {
146
                return null;
147
            }
148
        }
149

  
150
        return array;
151
    }
152

  
122 153
	/**
123 154
	 * Crea un nuevo FSymbol.
124 155
	 */
......
520 551
		symbol.m_LinePattern = xml.getStringProperty("m_LinePattern");
521 552

  
522 553
		//Ancho del stroke en float
523
		symbol.setStroke(new BasicStroke(xml.getFloatProperty("m_stroke")));
554
        float lineWidth = xml.getFloatProperty("m_stroke"); 
555
        if (symbol.m_LinePattern.compareTo("0") == 0)
556
        {
557
            symbol.setStroke(new BasicStroke(lineWidth));
558
        }
559
        else
560
        {
561
            symbol.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
562
                    BasicStroke.JOIN_BEVEL, 1.0f,
563
                        toArray(symbol.m_LinePattern, lineWidth), 0));
564
        }
524 565
        
525 566
		symbol.setSizeInPixels(xml.getBooleanProperty("m_bUseSize"));
526 567
		symbol.setAlingVert(xml.getIntProperty("m_AlingVert"));

Also available in: Unified diff