Package org.w3c.dom.svg

Examples of org.w3c.dom.svg.SVGDocument


    * Return the image as a SVG string
    * */
    public String generateSVGString() {
         try {
            StringWriter writer = new StringWriter();
            SVGDocument svgDoc = getRootActivity().getSVGDocument();
             this.svgDoc = svgDoc;
           
            DOMUtilities.writeDocument(svgDoc, writer);
            writer.close();
             svgStr = writer.toString();
View Full Code Here


     
      SVGDocumentFactory documentFactory =
        new SAXSVGDocumentFactory(userAgent.getXMLParserClassName(), true);
      documentFactory.setValidating(userAgent.isXMLParserValidating());

      SVGDocument document;
      if (svgText != null)
      {
        document = documentFactory.createSVGDocument(null,
            new StringReader(svgText));
      }
View Full Code Here

                if (svgUserAgent != null) {
                    String oldURI = svgDocument.getURL();
                    ParsedURL newURI = null;
                    // if the anchor element is in an external resource
                    if (elt.getOwnerDocument() != svgDocument) {
                        SVGDocument doc = (SVGDocument)elt.getOwnerDocument();
                        href = new ParsedURL(doc.getURL(), href).toString();
                    }
                    newURI = new ParsedURL(oldURI, href);
                    href = newURI.toString();
                    svgUserAgent.openLink(href, true);
                } else {
View Full Code Here

     * Runs this loader.
     */
    public void run() {
        try {
            fireStartedEvent();
            SVGDocument svgDocument = (SVGDocument)loader.loadDocument(url);
            fireCompletedEvent(svgDocument);
        } catch (InterruptedIOException e) {
            fireCancelledEvent();
        } catch (Exception e) {
            exception = e;
View Full Code Here

                                                        filterRegion,
                                                        ctx);

        Filter filter = null;
        // try to load the image as an svg document
        SVGDocument svgDoc = (SVGDocument)filterElement.getOwnerDocument();
        ParsedURL purl;
        URL baseURL = ((SVGOMDocument)svgDoc).getURLObject();
        if (baseURL != null)
            purl = new ParsedURL(baseURL.toString(), uriStr);
        else
View Full Code Here

        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

        if (n != -1) {
            uri = uri.substring(0, n);
        }
        DocumentState state = (DocumentState)cacheMap.get(uri);
        if (state == null) {
            SVGDocument document = documentFactory.createSVGDocument(uri);
            if (bridgeContext != null) {
                bridgeContext.initializeDocument(document);
            }

            DocumentDescriptor desc = documentFactory.getDocumentDescriptor();
View Full Code Here

        // In some cases we converted document fragments which didn't
        // have a parent SVG element, this check makes sure only the
        // real root of the SVG Document tries to do negotiation with
        // the UA.
        SVGDocument doc = (SVGDocument)((SVGElement)e).getOwnerDocument();
        boolean isOutermost = (doc.getRootElement() == e);
        float x = 0;
        float y = 0;
        // x and y have no meaning on the outermost 'svg' element
        if (!isOutermost) {
            // 'x' attribute - default is 0
View Full Code Here

        String uriStr = purl.toString();
        Dimension cursorSize = null;

        // Try to load as an SVG Document
        DocumentLoader loader = (DocumentLoader)ctx.getDocumentLoader();
        SVGDocument svgDoc = (SVGDocument)cursorElement.getOwnerDocument();
        URIResolver resolver = new URIResolver(svgDoc, loader);
        try {
            Element rootElement = null;
            Node n = resolver.getNode(uriStr, cursorElement);
            if (n.getNodeType() == n.DOCUMENT_NODE) {
View Full Code Here

        sw.flush();
        sw.close();

        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
        SVGDocument outDoc = null;

        try {
            outDoc = f.createSVGDocument
                (uri, new StringReader(sw.toString()));
        } catch (Exception e) {
            System.err.println("======================================");
            System.err.println(sw.toString());
            System.err.println("======================================");
           
            throw new IllegalArgumentException
                (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION));
        }

        // Patch the result tree to go under the root node
        // checkAndPatch(outDoc);
       
        svgViewerFrame.getJSVGCanvas().setSVGDocument((SVGDocument)outDoc);
        svgViewerFrame.setSVGDocument(outDoc,
                                      uri,
                                      outDoc.getTitle());
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.svg.SVGDocument

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.