Examples of SVGSVGElement


Examples of net.sf.latexdraw.parsers.svg.SVGSVGElement


  @Test
  public void testVersion() throws MalformedSVGDocument {
    node.setAttribute(SVGAttributes.SVG_VERSION, "1.1"); //$NON-NLS-1$
    SVGSVGElement e = new SVGSVGElement(node, null);
    assertEquals(e.getVersion(), "1.1"); //$NON-NLS-1$
  }
View Full Code Here

Examples of net.sf.latexdraw.parsers.svg.SVGSVGElement



  @Test
  public void testAdoptNode() {
    SVGSVGElement elt = new SVGSVGElement(doc2);

    try {
      doc1.adoptNode(null);
      fail();
    }
    catch(DOMException e){ /* ok */ }

    try {
      doc1.adoptNode(new SVGComment("", doc2)); //$NON-NLS-1$
      fail();
    }
    catch(DOMException e){ /* ok */ }

    doc1.adoptNode(elt);
    assertEquals(doc1, elt.getOwnerDocument());
    assertEquals(doc1.getFirstChild(), elt);
  }
View Full Code Here

Examples of net.sf.latexdraw.parsers.svg.SVGSVGElement

     */
    private SVGDocument toSVG(final IDrawing drawing, final double incr) {
      // Creation of the SVG document.
      final List<IShape> shapes;
      final SVGDocument doc     = new SVGDocument();
      final SVGSVGElement root   = doc.getFirstChild();
      final SVGGElement g     = new SVGGElement(doc);
      SVGElement elt;

      if(onlySelection)
        shapes  = drawing.getSelection().getShapes();
      else shapes = drawing.getShapes();

      root.appendChild(g);
      root.setAttribute("xmlns:"+LNamespace.LATEXDRAW_NAMESPACE, LNamespace.LATEXDRAW_NAMESPACE_URI);//$NON-NLS-1$
      root.appendChild(new SVGDefsElement(doc));

      try {
            for(final IShape sh : shapes) {
              // For each shape an SVG element is created.
              elt = SVGShapesFactory.INSTANCE.createSVGElement(sh, doc);
              if(elt!=null)
                g.appendChild(elt);
              setProgress((int)Math.min(100., getProgress()+incr));
            }
      }catch(final Exception ex) { BadaboomCollector.INSTANCE.add(ex); }
      // Setting SVG attributes to the created document.
      root.setAttribute(SVGAttributes.SVG_VERSION, "1.1");//$NON-NLS-1$
      root.setAttribute(SVGAttributes.SVG_BASE_PROFILE, "full");//$NON-NLS-1$

      return doc;
    }
View Full Code Here

Examples of net.sf.latexdraw.parsers.svg.SVGSVGElement

      // Creation of the SVG document.
      final Instrument[] instruments   = ui.getInstruments();
      final double incr        = 100./(drawing.size() + instruments.length + ui.getPresentations().size());
      final SVGDocument doc       = toSVG(drawing, incr);
      final SVGMetadataElement meta  = new SVGMetadataElement(doc);
      final SVGSVGElement root     = doc.getFirstChild();
      final SVGElement metaLTD    = (SVGElement)doc.createElement(LNamespace.LATEXDRAW_NAMESPACE+':'+SVGElements.SVG_METADATA);

      // Creation of the SVG meta data tag.
      meta.appendChild(metaLTD);
      root.appendChild(meta);

      if(saveParameters) {
        // The parameters of the instruments are now saved.
        for(final Instrument instrument : instruments) {
          instrument.save(false, LNamespace.LATEXDRAW_NAMESPACE, doc, metaLTD);
View Full Code Here

Examples of org.vectomatic.dom.svg.impl.SVGSVGElement

   * the document resulting from the parse
   * @throws ParserException
   * if the document is not well-formed or is not SVG
   */
  public static final OMSVGSVGElement parse(String rawSvg) throws ParserException {
    SVGSVGElement elt = impl.parse(rawSvg);
    if (!SVGConstants.SVG_NAMESPACE_URI.equals(DOMHelper.getNamespaceURI(elt))) {
      throw new ParserException(ParserException.Type.NotSvg, "Invalid root element: {" + DOMHelper.getNamespaceURI(elt) + "}" + elt.getTagName());
    }
    return new OMSVGSVGElement(elt);
  }
View Full Code Here

Examples of org.w3c.dom.svg.SVGSVGElement

     */
    public void renderSVGArea(SVGArea area) {
        int x = this.currentXPosition;
        int y = this.currentYPosition;
        Document doc = area.getSVGDocument();
        SVGSVGElement svg = ((SVGDocument)doc).getRootElement();
        int w = (int)(svg.getWidth().getBaseVal().getValue() * 1000);
        int h = (int)(svg.getHeight().getBaseVal().getValue() * 1000);
        float sx = 1, sy = -1;
        int xOffset = x, yOffset = y;

        /*
         * Clip to the svg area.
View Full Code Here

Examples of org.w3c.dom.svg.SVGSVGElement

            if (href.indexOf(":") == -1)
                href = "file:" + href;
            FopImage img = FopImageFactory.Make(href);
            if (img != null) {
                if (img instanceof SVGImage) {
                    SVGSVGElement svg =
                        ((SVGImage)img).getSVGDocument().getRootElement();
                    renderSVG(fontState, svg, (int)x * 1000, (int)y * 1000);
                } else {
                    printBMP(img, (int)x, (int)y, (int)width, (int)height);
                }
View Full Code Here

Examples of org.w3c.dom.svg.SVGSVGElement

    public void renderSVGArea(SVGArea area) {
        if (debug)
            System.out.println("TXTRenderer.renderSVGArea(" + area + ")");
        int x = this.currentAreaContainerXPosition;
        int y = this.currentYPosition;
        SVGSVGElement svg =
            ((SVGDocument)area.getSVGDocument()).getRootElement();
        int w = (int)(svg.getWidth().getBaseVal().getValue() * 1000);
        int h = (int)(svg.getHeight().getBaseVal().getValue() * 1000);

        // currentStream.add("ET\n");
        /*
         * Clip to the svg area.
         * Note: To have the svg overlay (under) a text area then use
View Full Code Here

Examples of org.w3c.dom.svg.SVGSVGElement

        if (!(document instanceof SVGOMDocument)) {
            throw new TranscoderException(Messages.formatMessage("notsvg",
                    null));
        }
        SVGDocument svgDoc = (SVGDocument)document;
        SVGSVGElement root = svgDoc.getRootElement();
        // initialize the SVG document with the appropriate context
        String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME);
        DefaultSVGContext svgCtx = new DefaultSVGContext();
        svgCtx.setPixelToMM(userAgent.getPixelToMM());
        ((SVGOMDocument)document).setSVGContext(svgCtx);
View Full Code Here

Examples of org.w3c.dom.svg.SVGSVGElement

     */
    protected boolean updateRenderingTransform() {
        if ((svgDocument == null) || (gvtRoot == null))
            return false;
        try {
            SVGSVGElement elt = svgDocument.getRootElement();
            Dimension d = getSize();
            Dimension oldD = prevComponentSize;
            prevComponentSize = d;
            if (d.width  < 1) d.width  = 1;
            if (d.height < 1) d.height = 1;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.