Package net.sf.latexdraw.parsers.svg

Examples of net.sf.latexdraw.parsers.svg.SVGDocument$SVGEntityResolver


  protected SVGElement node;


  @Before
  public void setUp() {
    SVGDocument doc = new SVGDocument();
        node = (SVGElement)doc.createElement("tag1"); //$NON-NLS-1$
  }
View Full Code Here


  @Before
  public void setUp() throws MalformedSVGDocument, URISyntaxException, IOException {
    FlyweightThumbnail.images().clear();
    FlyweightThumbnail.setThread(false);
    final SVGDocument doc = new SVGDocument(new URI(getPathSVGFile()));
    group = toLatexdraw(doc);
  }
View Full Code Here

  protected SVGNamedNodeMap map;
  protected SVGDocument doc;

  @Before
  public void setUp() {
    doc = new SVGDocument();
    map = new SVGNamedNodeMap();
  }
View Full Code Here

    @Override
    protected Boolean doInBackground() throws Exception {
      super.doInBackground();
      try{
        final SVGDocument svgDoc = new SVGDocument(new File(path).toURI());
        final IDrawing pres = ui.getPresentation(IDrawing.class, LCanvas.class).getAbstractPresentation();
        // Adding loaded shapes.
        pres.addShape(toLatexdraw(svgDoc, 0));
        // Updating the possible widgets of the instruments.
        for(final Instrument instrument : ui.getInstruments())
View Full Code Here

      // We export the updated template
      if(files!=null)
                for(final File file : files)
                    if(filter.accept(file))
                        try {
                            template = toLatexdraw(new SVGDocument(file.toURI()), 0);
                            thumbnail = new File(pathCache + File.separator + file.getName() + PNGFilter.PNG_EXTENSION);
                            createTemplateThumbnail(thumbnail, template);
                        }catch(final Exception ex) {BadaboomCollector.INSTANCE.add(ex);}
    }
View Full Code Here

     * @since 2.0
     */
    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();
View Full Code Here

      setProgress(0);
      final IDrawing drawing = ui.getPresentation(IDrawing.class, LCanvas.class).getAbstractPresentation();
      // 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);
          setProgress((int)Math.min(100., getProgress()+incr));
        }

        for(final Presentation<?,?> presentation : ui.getPresentations()) {
          presentation.getConcretePresentation().save(false, LNamespace.LATEXDRAW_NAMESPACE, doc, metaLTD);
          setProgress((int)Math.min(100., getProgress()+incr));
        }

        ui.save(false, LNamespace.LATEXDRAW_NAMESPACE, doc, metaLTD);
        ui.setTitle(getDocumentName());
      }

      return doc.saveSVGDocument(path);
    }
View Full Code Here

    @Override
    protected Boolean doInBackground() throws Exception {
      super.doInBackground();

      try{
        final SVGDocument svgDoc     = new SVGDocument(new File(path).toURI());
        final Element meta          = svgDoc.getDocumentElement().getMeta();
        final Instrument[] instruments   = ui.getInstruments();
        final IDrawing drawing = ui.getPresentation(IDrawing.class, LCanvas.class).getAbstractPresentation();
        final Element ldMeta;
        final double incrProgressBar;

        if(meta==null)
          ldMeta = null;
        else {
          final NodeList nl  = meta.getElementsByTagNameNS(LNamespace.LATEXDRAW_NAMESPACE_URI, SVGElements.SVG_METADATA);
          final Node node    = nl.getLength()==0 ? null : nl.item(0);
          ldMeta         = node instanceof Element ? (Element)node : null;
        }

              setProgress(0);

        // Adding loaded shapes.
        incrProgressBar       = Math.max(50./(svgDoc.getDocumentElement().getChildNodes().getLength()+ui.getPresentations().size()), 1.);
        final IShape shape     = toLatexdraw(svgDoc, incrProgressBar);

        if(shape instanceof IGroup) { // If several shapes have been loaded
          final IGroup group = (IGroup)shape;
          final double incr  = Math.max(50./group.size(), 1.);
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.parsers.svg.SVGDocument$SVGEntityResolver

Copyright © 2018 www.massapicom. 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.