Package org.openstreetmap.josm.gui.mappaint.xml

Examples of org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource


                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);
            }
        } catch (IOException e) {
            Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", entry.url, e.toString()));
            Main.error(e);
        }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource

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.