Search in sources :

Example 1 with SVGDocument

use of net.sf.latexdraw.parsers.svg.SVGDocument in project latexdraw by arnobl.

the class TestSVGDocument method testSVGDocument2.

@Test
public void testSVGDocument2() {
    SVGDocument doc = new SVGDocument();
    assertNotNull(doc.getFirstChild());
    assertNotNull(doc.getLastChild());
    assertNull(doc.getDocumentURI());
}
Also used : SVGDocument(net.sf.latexdraw.parsers.svg.SVGDocument) MalformedSVGDocument(net.sf.latexdraw.parsers.svg.MalformedSVGDocument) Test(org.junit.Test)

Example 2 with SVGDocument

use of net.sf.latexdraw.parsers.svg.SVGDocument in project latexdraw by arnobl.

the class TestSVGDocument method testSVGDocument.

@Test
public void testSVGDocument() throws MalformedSVGDocument, URISyntaxException, IOException {
    SVGDocument doc = new SVGDocument(new URI("src/test/resources/test.svg"));
    assertNotNull(doc.getFirstChild());
    assertNotNull(doc.getLastChild());
}
Also used : SVGDocument(net.sf.latexdraw.parsers.svg.SVGDocument) MalformedSVGDocument(net.sf.latexdraw.parsers.svg.MalformedSVGDocument) URI(java.net.URI) Test(org.junit.Test)

Example 3 with SVGDocument

use of net.sf.latexdraw.parsers.svg.SVGDocument in project latexdraw by arnobl.

the class TestSVGDocument method testIsEqualNode.

@Test
public void testIsEqualNode() {
    SVGDocument doc = new SVGDocument();
    assertTrue(doc1.isEqualNode(doc));
    assertFalse(doc1.isEqualNode(null));
    assertFalse(doc1.isEqualNode(doc2));
}
Also used : SVGDocument(net.sf.latexdraw.parsers.svg.SVGDocument) MalformedSVGDocument(net.sf.latexdraw.parsers.svg.MalformedSVGDocument) Test(org.junit.Test)

Example 4 with SVGDocument

use of net.sf.latexdraw.parsers.svg.SVGDocument in project latexdraw by arnobl.

the class TestSVGNodeList method setUp.

@Before
public void setUp() {
    doc = new SVGDocument();
    list = new SVGNodeList();
}
Also used : SVGNodeList(net.sf.latexdraw.parsers.svg.SVGNodeList) SVGDocument(net.sf.latexdraw.parsers.svg.SVGDocument) Before(org.junit.Before)

Example 5 with SVGDocument

use of net.sf.latexdraw.parsers.svg.SVGDocument in project latexdraw by arnobl.

the class SVGDot method toSVG.

@Override
public SVGElement toSVG(final SVGDocument doc) {
    if (doc == null) {
        return null;
    }
    final SVGElement root = new SVGGElement(doc);
    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE + ':' + LNamespace.XML_TYPE, LNamespace.XML_TYPE_DOT);
    root.setAttribute(SVGAttributes.SVG_ID, getSVGID());
    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE + ':' + LNamespace.XML_SIZE, String.valueOf(shape.getDiametre()));
    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE + ':' + LNamespace.XML_DOT_SHAPE, shape.getDotStyle().getPSTToken());
    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE + ':' + LNamespace.XML_POSITION, shape.getPosition().getX() + " " + shape.getPosition().getY());
    ViewFactory.INSTANCE.createView(shape).ifPresent(vdot -> JFXToSVG.INSTANCE.shapesToElements(vdot.getChildren(), doc).forEach(elt -> root.appendChild(elt)));
    setSVGRotationAttribute(root);
    return root;
}
Also used : SVGPointsParser(net.sf.latexdraw.parsers.svg.parsers.SVGPointsParser) Point2D(java.awt.geom.Point2D) ViewFactory(net.sf.latexdraw.view.jfx.ViewFactory) ShapeFactory(net.sf.latexdraw.models.ShapeFactory) CSSColors(net.sf.latexdraw.parsers.svg.CSSColors) SVGDocument(net.sf.latexdraw.parsers.svg.SVGDocument) SVGElement(net.sf.latexdraw.parsers.svg.SVGElement) DotStyle(net.sf.latexdraw.models.interfaces.shape.DotStyle) List(java.util.List) Color(net.sf.latexdraw.models.interfaces.shape.Color) LNamespace(net.sf.latexdraw.util.LNamespace) JFXToSVG(net.sf.latexdraw.view.jfx.JFXToSVG) IDot(net.sf.latexdraw.models.interfaces.shape.IDot) SVGGElement(net.sf.latexdraw.parsers.svg.SVGGElement) BadaboomCollector(net.sf.latexdraw.badaboom.BadaboomCollector) SVGAttributes(net.sf.latexdraw.parsers.svg.SVGAttributes) SVGGElement(net.sf.latexdraw.parsers.svg.SVGGElement) SVGElement(net.sf.latexdraw.parsers.svg.SVGElement)

Aggregations

SVGDocument (net.sf.latexdraw.parsers.svg.SVGDocument)12 MalformedSVGDocument (net.sf.latexdraw.parsers.svg.MalformedSVGDocument)5 Before (org.junit.Before)5 URI (java.net.URI)3 List (java.util.List)3 ShapeFactory (net.sf.latexdraw.models.ShapeFactory)3 SVGAttributes (net.sf.latexdraw.parsers.svg.SVGAttributes)3 SVGElement (net.sf.latexdraw.parsers.svg.SVGElement)3 SVGGElement (net.sf.latexdraw.parsers.svg.SVGGElement)3 Test (org.junit.Test)3 Point2D (java.awt.geom.Point2D)2 Collectors (java.util.stream.Collectors)2 SVGPointsParser (net.sf.latexdraw.parsers.svg.parsers.SVGPointsParser)2 LNamespace (net.sf.latexdraw.util.LNamespace)2 Collections (java.util.Collections)1 Stream (java.util.stream.Stream)1 Group (javafx.scene.Group)1 Node (javafx.scene.Node)1 Color (javafx.scene.paint.Color)1 ClosePath (javafx.scene.shape.ClosePath)1