}
}
@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);