Package org.openstreetmap.josm.gui.mappaint

Examples of org.openstreetmap.josm.gui.mappaint.Cascade


         }
     }

    @Override
    public void apply(MultiCascade mc, OsmPrimitive osm, double scale, OsmPrimitive multipolyOuterWay, boolean pretendWayIsClosed) {
        Cascade def = mc.getOrCreateCascade("default");
        boolean useMinMaxScale = Main.pref.getBoolean("mappaint.zoomLevelDisplay", false);

        if (osm instanceof Node || (osm instanceof Relation && "restriction".equals(osm.get("type")))) {
            IconPrototype icon = getNode(osm, (useMinMaxScale ? scale : null), mc);
            if (icon != null) {
                def.put(ICON_IMAGE, icon.icon);
                if (osm instanceof Node) {
                    if (icon.annotate != null) {
                        if (icon.annotate) {
                            def.put(TEXT, Keyword.AUTO);
                        } else {
                            def.remove(TEXT);
                        }
                    }
                }
            }
        } else if (osm instanceof Way || (osm instanceof Relation && ((Relation)osm).isMultipolygon())) {
            WayPrototypesRecord p = new WayPrototypesRecord();
            get(osm, pretendWayIsClosed || !(osm instanceof Way) || ((Way) osm).isClosed(), p, (useMinMaxScale ? scale : null), mc);
            if (p.line != null) {
                def.put(WIDTH, new Float(p.line.getWidth()));
                def.putOrClear(REAL_WIDTH, p.line.realWidth != null ? new Float(p.line.realWidth) : null);
                def.putOrClear(COLOR, p.line.color);
                if (p.line.color != null) {
                    int alpha = p.line.color.getAlpha();
                    if (alpha != 255) {
                        def.put(OPACITY, Utils.color_int2float(alpha));
                    }
                }
                def.putOrClear(DASHES, p.line.getDashed());
                def.putOrClear(DASHES_BACKGROUND_COLOR, p.line.dashedColor);
            }
            Float refWidth = def.get(WIDTH, null, Float.class);
            if (refWidth != null && p.linemods != null) {
                int numOver = 0, numUnder = 0;

                while (mc.hasLayer(String.format("over_%d", ++numOver)));
                while (mc.hasLayer(String.format("under_%d", ++numUnder)));

                for (LinemodPrototype mod : p.linemods) {
                    Cascade c;
                    if (mod.over) {
                        String layer = String.format("over_%d", numOver);
                        c = mc.getOrCreateCascade(layer);
                        c.put(OBJECT_Z_INDEX, new Float(numOver));
                        ++numOver;
                    } else {
                        String layer = String.format("under_%d", numUnder);
                        c = mc.getOrCreateCascade(layer);
                        c.put(OBJECT_Z_INDEX, new Float(-numUnder));
                        ++numUnder;
                    }
                    c.put(WIDTH, new Float(mod.getWidth(refWidth)));
                    c.putOrClear(COLOR, mod.color);
                    if (mod.color != null) {
                        int alpha = mod.color.getAlpha();
                        if (alpha != 255) {
                            c.put(OPACITY, Utils.color_int2float(alpha));
                        }
                    }
                    c.putOrClear(DASHES, mod.getDashed());
                    c.putOrClear(DASHES_BACKGROUND_COLOR, mod.dashedColor);
                }
            }
            if (multipolyOuterWay != null) {
                WayPrototypesRecord p2 = new WayPrototypesRecord();
                get(multipolyOuterWay, true, p2, (useMinMaxScale ? scale : null), mc);
View Full Code Here


    /**
     * load meta info from a selector "meta"
     */
    private void loadMeta() {
        Cascade c = constructSpecial("meta");
        String pTitle = c.get("title", null, String.class);
        if (title == null) {
            title = pTitle;
        }
        String pIcon = c.get("icon", null, String.class);
        if (icon == null) {
            icon = pIcon;
        }
    }
View Full Code Here

            icon = pIcon;
        }
    }

    private void loadCanvas() {
        Cascade c = constructSpecial("canvas");
        backgroundColorOverride = c.get("fill-color", null, Color.class);
        if (backgroundColorOverride == null) {
            backgroundColorOverride = c.get("background-color", null, Color.class);
            if (backgroundColorOverride != null) {
                Main.warn(tr("Detected deprecated ''{0}'' in ''{1}'' which will be removed shortly. Use ''{2}'' instead.", "canvas{background-color}", url, "fill-color"));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.mappaint.Cascade

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.