private void writePolygonElement(IXMLElement parent, SVGPathFigure f) throws IOException { IXMLElement elem = parent.createElement("area"); if (writePolyAttributes(elem, f, new GrowStroke((float) (getStrokeTotalWidth(f) / 2d), (float) getStrokeTotalWidth(f)). createStrokedShape(f.getChild(0).getBezierPath()) )) { parent.addChild(elem); } }
private void writeEllipseElement(IXMLElement parent, SVGEllipseFigure f) throws IOException { IXMLElement elem = parent.createElement("area"); Rectangle2D.Double r = f.getBounds(); double grow = getPerpendicularHitGrowth(f); Ellipse2D.Double ellipse = new Ellipse2D.Double(r.x - grow, r.y - grow, r.width + grow, r.height + grow); if (writeCircleAttributes(elem, f, ellipse)) { parent.addChild(elem); } }
private void writeLineElement(IXMLElement parent, SVGPathFigure f) throws IOException { IXMLElement elem = parent.createElement("area"); if (writePolyAttributes(elem, f, new GrowStroke((float) (getStrokeTotalWidth(f) / 2d), (float) getStrokeTotalWidth(f)). createStrokedShape(new Line2D.Double( f.getStartPoint(), f.getEndPoint() )))) { parent.addChild(elem); } }
private void writeTextAreaElement(IXMLElement parent, SVGTextAreaFigure f) throws IOException { IXMLElement elem = parent.createElement("AREA"); Rectangle2D.Double rect = f.getBounds(); double grow = getPerpendicularHitGrowth(f); rect.x -= grow; rect.y -= grow; rect.width += grow; rect.height += grow; if (writeRectAttributes(elem, f, rect)) { parent.addChild(elem); } }
private void writePathElement(IXMLElement parent, SVGPathFigure f) throws IOException { GrowStroke growStroke = new GrowStroke((float) (getStrokeTotalWidth(f) / 2d), (float) getStrokeTotalWidth(f)); BasicStroke basicStroke = new BasicStroke((float) getStrokeTotalWidth(f)); for (Figure child : f.getChildren()) { SVGBezierFigure bezier = (SVGBezierFigure) child; IXMLElement elem = parent.createElement("area"); if (bezier.isClosed()) { writePolyAttributes(elem, f, growStroke. createStrokedShape(bezier.getBezierPath()) ); } else { writePolyAttributes(elem, f, basicStroke. createStrokedShape(bezier.getBezierPath()) ); } parent.addChild(elem); } }
private void writeRectElement(IXMLElement parent, SVGRectFigure f) throws IOException { IXMLElement elem = parent.createElement("AREA"); boolean isContained; if (f.getArcHeight() == 0 && f.getArcWidth() == 0) { Rectangle2D.Double rect = f.getBounds(); double grow = getPerpendicularHitGrowth(f); rect.x -= grow; rect.y -= grow; rect.width += grow; rect.height += grow; isContained = writeRectAttributes(elem, f, rect); } else { isContained = writePolyAttributes(elem, f, new GrowStroke((float) (getStrokeTotalWidth(f) / 2d), (float) getStrokeTotalWidth(f)). createStrokedShape(new RoundRectangle2D.Double( f.getX(), f.getY(), f.getWidth(), f.getHeight(), f.getArcWidth(), f.getArcHeight() ))); } if (isContained) { parent.addChild(elem); } }
private void writeImageElement(IXMLElement parent, SVGImageFigure f) { IXMLElement elem = parent.createElement("area"); Rectangle2D.Double rect = f.getBounds(); writeRectAttributes(elem, f, rect); parent.addChild(elem); }