@Override
	public Geometry getGeometry() {
		if(geometry!=null){
			return geometry;
		}
		render();
		GeometryFactory gf = Helper.getGeometryFactory();
		Geometry[] geometries = new Geometry[textPath.getNumberOfChars()];
		LinkedList<Point> characterCentroids = new LinkedList<Point>();
		for(int charnum=0; charnum<textPath.getNumberOfChars(); charnum++){
			try {
				SVGRect textBox = textPath.getExtentOfChar(charnum);
				Coordinate[] labelCorners = new Coordinate[5];
				labelCorners[0] = new Coordinate(textBox.getX(), textBox.getY());
				labelCorners[1] = new Coordinate(textBox.getX() + textBox.getWidth(),
						textBox.getY());
				labelCorners[2] = new Coordinate(textBox.getX() + textBox.getWidth(),
						textBox.getY() + textBox.getHeight());
				labelCorners[3] = new Coordinate(textBox.getX(), textBox.getY()
						+ textBox.getHeight());
				labelCorners[4] = labelCorners[0];
				geometries[charnum]=gf.createPolygon(gf.createLinearRing(labelCorners), null);
				characterCentroids.add(geometries[charnum].getCentroid());
			} catch (DOMException e){
				throw new FalloffException("Label longer than space available along line", e);
			}
		}
		// Fail for labels in tight bends
		if(characterCentroids.size()>2){
			Point firstPoint = characterCentroids.getFirst();
			Point secondPoint = characterCentroids.get(1);
			double lastAngle = (180*Math.atan((secondPoint.getY()-firstPoint.getY())/(secondPoint.getX()-firstPoint.getX())))/Math.PI;
			for(int pointIter=1; pointIter<characterCentroids.size()-1; pointIter++){
				firstPoint = characterCentroids.get(pointIter);
				secondPoint = characterCentroids.get(pointIter+1);
				double currentAngle = (180*Math.atan((secondPoint.getY()-firstPoint.getY())/(secondPoint.getX()-firstPoint.getX())))/Math.PI;
				if(Math.abs(lastAngle-currentAngle)>80){
					throw new TightBendException("Label occurred in tight bend.");
				}
			}
		}
		GeometryCollection gc = gf.createGeometryCollection(geometries);
		geometry = gc.convexHull();
		return geometry;
	}