Revision 11009 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleTextSymbol.java

View differences:

SimpleTextSymbol.java
59 59
			Geometry geo = FConverter.java2d_to_jts(shp);
60 60

  
61 61
			if (geo == null) {
62
				return;
62
//				return;
63 63
			}
64 64

  
65 65
			Point pJTS = geo.getCentroid();
......
182 182
		this.rotation = rotation;
183 183
	}
184 184

  
185
	public FShape getTextWrappingShape(Graphics2D g, AffineTransform affineTransform, FShape targetSymbolShape ) {
185
	/**
186
	 * Returns an FShape which represents a rectangle containing the text in
187
	 * <b>screen</b> units.
188
	 */
189
	public FShape getTextWrappingShape(Graphics2D g, /*AffineTransform affineTransform,*/ FShape targetSymbolShape ) {
186 190
		// assuming FShape is a point with the starting position of the text
187 191
		Font font = getFont();
188 192

  
189 193
		FontRenderContext frc = g.getFontRenderContext();
190 194

  
191 195
		GlyphVector gv = font.createGlyphVector(frc, text);
192
		FPoint2D p = (FPoint2D) targetSymbolShape;
193
		p.transform(affineTransform);
196
		Point2D p = null;
197

  
198
		switch (targetSymbolShape.getShapeType()) {
199
		case FShape.POINT:
200
			FPoint2D fp=(FPoint2D) targetSymbolShape;
201
			p = new Point2D.Double(fp.getX(),fp.getY());
202
			break;
203
		case FShape.LINE:
204
			PathLength pathLen = new PathLength(targetSymbolShape);
205

  
206
			// if (pathLen.lengthOfPath() < width / mT.getScaleX()) return;
207
			float midDistance = pathLen.lengthOfPath() / 2;
208
			p = pathLen.pointAtLength(midDistance);
209
			break;
210
		case FShape.POLYGON:
211
			Geometry geo = FConverter.java2d_to_jts(targetSymbolShape);
212

  
213
			if (geo == null) {
214
				return null;
215
			}
216

  
217
			Point pJTS = geo.getCentroid();
218

  
219
			if (pJTS != null) {
220
				FShape pLabel = FConverter.jts_to_java2d(pJTS);
221
				p= new Point2D.Double(((FPoint2D) pLabel).getX(),
222
						((FPoint2D) pLabel).getY());
223
			}
224
			break;
225
		}
226

  
227

  
228
		/*p.transform(affineTransform);*/
194 229
		Shape shape = gv.getOutline((float) p.getX(), (float) p.getY());
195 230

  
196 231
		FShape myFShape = new FPolygon2D(new GeneralPathX(shape.getBounds2D()));

Also available in: Unified diff