Package org.openstreetmap.josm.gui.mappaint.mapcss

Examples of org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource$MapCSSRuleIndex


            return readMapCSS(new MapCSSParser(css));
        }

        static List<TagCheck> readMapCSS(MapCSSParser css) throws ParseException {
            CheckParameterUtil.ensureParameterNotNull(css, "css");
            final MapCSSStyleSource source = new MapCSSStyleSource("");
            css.sheet(source);
            assert source.getErrors().isEmpty();
            // Ignore "meta" rule(s) from external rules of JOSM wiki
            removeMetaRules(source);
            // group rules with common declaration block
            Map<Declaration, List<Selector>> g = new LinkedHashMap<>();
            for (MapCSSRule rule : source.rules) {
View Full Code Here


            cf = new CachedFile(entry.url).setHttpAccept(Utils.join(", ", mimes));
            String zipEntryPath = cf.findZipEntryPath("mapcss", "style");
            if (zipEntryPath != null) {
                entry.isZip = true;
                entry.zipEntryPath = zipEntryPath;
                return new MapCSSStyleSource(entry);
            }
            zipEntryPath = cf.findZipEntryPath("xml", "style");
            if (zipEntryPath != null)
                return new XmlStyleSource(entry);
            if (entry.url.toLowerCase().endsWith(".mapcss"))
                return new MapCSSStyleSource(entry);
            if (entry.url.toLowerCase().endsWith(".xml"))
                return new XmlStyleSource(entry);
            else {
                try (InputStreamReader reader = new InputStreamReader(cf.getInputStream(), StandardCharsets.UTF_8)) {
                    WHILE: while (true) {
                        int c = reader.read();
                        switch (c) {
                            case -1:
                                break WHILE;
                            case ' ':
                            case '\t':
                            case '\n':
                            case '\r':
                                continue;
                            case '<':
                                return new XmlStyleSource(entry);
                            default:
                                return new MapCSSStyleSource(entry);
                        }
                    }
                }
                Main.warn("Could not detect style type. Using default (xml).");
                return new XmlStyleSource(entry);
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource$MapCSSRuleIndex

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.