Revision 41124

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/text/impl/SimpleTextSymbol.java
89 89
	private static final String FIELD_HALO_WIDTH = "haloWidth";
90 90

  
91 91
	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
92
	
93
	/*
94
	 * This value must be get using getText() if the 'null'
95
	 * value has to prevented
96
	 */
92 97
	private String text = "";
93 98
	private Font font;
94 99
	
......
127 132
		g.rotate(rotation);
128 133
		
129 134
		if (isDrawWithHalo()) {
130
			char[] charText = new char[text.length()];
135
			char[] charText = new char[getText().length()];
131 136
			getText().getChars(0, charText.length, charText, 0);
132 137
			GlyphVector glyph = font.layoutGlyphVector(frc, charText, 0, charText.length, Font.LAYOUT_NO_LIMIT_CONTEXT);
133 138
			g.setColor(getHaloColor());
......
158 163
			}
159 164
			g.setFont(getFont());
160 165
		    FontMetrics fm = g.getFontMetrics();
161
		    Rectangle2D rect = fm.getStringBounds(text, g);
166
		    Rectangle2D rect = fm.getStringBounds(getText(), g);
162 167
		    double width = rect.getWidth();
163 168
		    double height = rect.getHeight();
164 169
		    double rWidth = r.getWidth();
......
239 244
	}
240 245

  
241 246
	public String getText() {
242
		return text;
247
	    if (text == null) {
248
	        return "";
249
	    } else {
250
	        return text;
251
	    }
243 252
	}
244 253

  
245 254
	public Font getFont() {
......
305 314
	 */
306 315
	public Geometry getTextWrappingShape(org.gvsig.fmap.geom.primitive.Point p) {
307 316
		Font font = getFont();
308
		GlyphVector gv = font.createGlyphVector(frc, text);
317
		GlyphVector gv = font.createGlyphVector(frc, getText());
309 318

  
310 319
		Shape shape = gv.getOutline((float) p.getX(), (float) p.getY());
311 320
		Geometry myFShape;

Also available in: Unified diff