Examples of Doc


Examples of com.joshondesign.xml.Doc

        ngon.setSides(5);
        ngon.setTranslateX(100);
        ngon.setTranslateY(100);
        page.clear();
        page.add(ngon);
        Doc xdoc = saveAndReadback(doc);
        assertTrue("120.0,100.0 106.0,119.0 84.0,112.0 84.0,88.0 106.0,81.0 ".equals(xdoc.xpathString("/svg/polygon/@points")));       
    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

        path.addPoint(new SPath.PathPoint(10,10, 10,5, 10,15));
        path.addPoint(new SPath.PathPoint(0,205,20, 0,15));
        path.close();
        page.clear();
        page.add(path);
        Doc xdoc = saveAndReadback(doc);
        assertTrue(" M 0.0 0.0  C 5.0 0.0 10.0 5.0 10.0 10.0   C 10.0 15.0 5.0 20.0 0.0 20.0   z".equals(xdoc.xpathString("/svg/path/@d")));
    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

        text.setText("ABC");
        text.setFontSize(100);
        text.setFillPaint(FlatColor.GREEN);
        page.clear();
        page.add(text);
        Doc xdoc = saveAndReadback(doc);
        assertTrue("ABC".equals(xdoc.xpathString("/svg/text/text()")));
    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

       
        SRect rect2 = new SRect(0,0,150,150);
        rect2.setFillPaint(FlatColor.GREEN);
        page.add(rect2);
       
        Doc xdoc = saveAndReadback(doc);
        assertTrue("translate(50.0,50.0)".equals(xdoc.xpathString("/svg/g/@transform")));
        assertTrue("10.0".equals(xdoc.xpathString("/svg/g/rect/@width")));
        assertTrue("1.0".equals(xdoc.xpathString("/svg/g/ellipse/@stroke-width")));
        assertTrue("150.0".equals(xdoc.xpathString("/svg/rect/@width")));
    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

    private List<File> loadRecentDocs(File file) {
        List<File> files = new ArrayList<File>();
        if(file.exists()) {
            try {
                Doc doc = XMLParser.parse(file);
                for(Elem e : doc.xpath("//file")) {
                    File f = new File(e.attr("filepath"));
                    //files.add(new File(e.attr("filepath")));
                    if(f.exists()) {
                        files.add(f);
                    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

        sarea.setTranslateX(10);
        sarea.setTranslateY(10);
        sarea.setFillPaint(FlatColor.GREEN);
        page.clear();
        page.add(sarea);
        Doc xdoc = saveAndReadback(doc);
        assertTrue("translate(10.0,10.0)".equals(xdoc.xpathString("/svg/path/@transform")));
    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

        SRect rect = new SRect(0,0,100,100);
        rect.setFillPaint(grad);
        rect.setStrokeWidth(0);
        page.clear();
        page.add(rect);
        Doc xdoc = saveAndReadback(doc);
        Elem e = xdoc.xpath("/svg/linearGradient/stop").iterator().next();
        assertTrue("0.0".equals(e.attr("offset")));
    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

        SRect rect = new SRect(0,0,100,100);
        rect.setFillPaint(grad);
        rect.setStrokeWidth(0);
        page.clear();
        page.add(rect);
        Doc xdoc = saveAndReadback(doc);
        Iterator<? extends Elem> it = xdoc.xpath("/svg/linearGradient/stop").iterator();
        it.next();
        Elem e = it.next();
        assertTrue("0.5".equals(e.attr("offset")));
    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

    private Doc saveAndReadback(SketchDocument doc) throws Exception {
        File file = File.createTempFile("amino.test", ".svg");
        u.p("wrote to tempfile: " + file.getAbsolutePath());
        //SaveSVGAction.exportFragment(file,doc);
        Doc xdoc = XMLParser.parse(file);
        return xdoc;
    }
View Full Code Here

Examples of com.joshondesign.xml.Doc

            Log.error(e);
        }
    }

    public static SketchDocument load(InputStream in, File file, String fileName, ZipFile zipFile) throws Exception {
        Doc doc = XMLParser.parse(in);
        if(file != null) {
            doc.setBaseURI(file.toURI());
        }
        SketchDocument sdoc = new SketchDocument();
        sdoc.removePage(sdoc.getCurrentPage());
        int version = Integer.parseInt(doc.xpathString("/sketchy/@version"));

        Log.info("version = ",version);
        if(version < NativeExport.CURRENT_VERSION) {
            doc = upgradeDocument(doc);
        }
        loadNumberAttribute(doc.xpathElement("/sketchy/info"),sdoc,"width");
        loadNumberAttribute(doc.xpathElement("/sketchy/info"),sdoc,"height");
        for(Elem e : doc.xpath("/sketchy/page")) {
            loadPage(sdoc,e,zipFile);
        }
        String type = doc.xpathString("/sketchy/info/@type");
        if("presentation".equals(type)) {
            sdoc.setPresentation(true);
        }

        Elem info = doc.xpathElement("/sketchy/info");
        if(info != null) {
            loadBooleanAttribute(info,sdoc,"gridActive");
            loadBooleanAttribute(info,sdoc,"pagesVisible");
            if(info.hasAttr("backgroundFill")) {
                sdoc.setBackgroundFill(loadFillPaint(info, "backgroundFill", zipFile));
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.