Search in sources :

Example 26 with SVGElement

use of net.sf.latexdraw.parser.svg.SVGElement in project latexdraw by arnobl.

the class SVGRectangular method initRectangle.

/**
 * Initialises the rectangle using an SVGGElement provided by a latexdraw SVG document.
 * @param elt The source element.
 * @throws IllegalArgumentException If the given element is null or not valid.
 */
void initRectangle(final SVGGElement elt, final boolean withTransformation) {
    final SVGElement elt2 = getLaTeXDrawElement(elt, null);
    if (elt == null || !(elt2 instanceof SVGRectElement)) {
        throw new IllegalArgumentException();
    }
    setSVGLatexdrawParameters(elt);
    setSVGRectParameters((SVGRectElement) elt2);
    setSVGShadowParameters(getLaTeXDrawElement(elt, LNamespace.XML_TYPE_SHADOW));
    setSVGDbleBordersParameters(getLaTeXDrawElement(elt, LNamespace.XML_TYPE_DBLE_BORDERS));
    if (withTransformation) {
        applyTransformations(elt);
    }
}
Also used : SVGRectElement(net.sf.latexdraw.parser.svg.SVGRectElement) SVGElement(net.sf.latexdraw.parser.svg.SVGElement)

Example 27 with SVGElement

use of net.sf.latexdraw.parser.svg.SVGElement in project latexdraw by arnobl.

the class TestSVGBase method produceOutputShapeFrom.

@Override
public T produceOutputShapeFrom(final T sh) {
    final SVGElement elt = factory.createSVGElement(sh, doc);
    doc.getFirstChild().appendChild(elt);
    return (T) factory.createShape(elt);
}
Also used : SVGSVGElement(net.sf.latexdraw.parser.svg.SVGSVGElement) SVGElement(net.sf.latexdraw.parser.svg.SVGElement)

Aggregations

SVGElement (net.sf.latexdraw.parser.svg.SVGElement)27 SVGGElement (net.sf.latexdraw.parser.svg.SVGGElement)20 Point (net.sf.latexdraw.model.api.shape.Point)13 SVGPolygonElement (net.sf.latexdraw.parser.svg.SVGPolygonElement)5 SVGTextElement (net.sf.latexdraw.parser.svg.SVGTextElement)4 List (java.util.List)3 ShapeFactory (net.sf.latexdraw.model.ShapeFactory)3 SVGAttributes (net.sf.latexdraw.parser.svg.SVGAttributes)3 SVGCircleElement (net.sf.latexdraw.parser.svg.SVGCircleElement)3 SVGDefsElement (net.sf.latexdraw.parser.svg.SVGDefsElement)3 SVGDocument (net.sf.latexdraw.parser.svg.SVGDocument)3 SVGRectElement (net.sf.latexdraw.parser.svg.SVGRectElement)3 LNamespace (net.sf.latexdraw.util.LNamespace)3 NotNull (org.jetbrains.annotations.NotNull)3 Point2D (java.awt.geom.Point2D)2 Color (net.sf.latexdraw.model.api.shape.Color)2 SVGLineElement (net.sf.latexdraw.parser.svg.SVGLineElement)2 SVGParserUtils (net.sf.latexdraw.parser.svg.SVGParserUtils)2 SVGPathElement (net.sf.latexdraw.parser.svg.SVGPathElement)2 Collectors (java.util.stream.Collectors)1