}
@Override
public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings settings, StyledMapRenderer painter, boolean selected, boolean member) {
if (primitive instanceof Node) {
Node n = (Node) primitive;
if (mapImage != null && painter.isShowIcons()) {
final Image nodeIcon;
if (painter.isInactiveMode() || n.isDisabled()) {
if (disabledNodeIcon == null || disabledNodeIconIsTemporary) {
disabledNodeIcon = mapImage.getDisplayedNodeIcon(true);
disabledNodeIconIsTemporary = mapImage.isTemporary();
}
nodeIcon = disabledNodeIcon;
} else {
if (enabledNodeIcon == null || enabledNodeIconIsTemporary) {
enabledNodeIcon = mapImage.getDisplayedNodeIcon(false);
enabledNodeIconIsTemporary = mapImage.isTemporary();
}
nodeIcon = enabledNodeIcon;
}
painter.drawNodeIcon(n, nodeIcon, Utils.color_int2float(mapImage.alpha), selected, member);
} else if (symbol != null) {
Color fillColor = symbol.fillColor;
if (fillColor != null) {
if (painter.isInactiveMode() || n.isDisabled()) {
fillColor = settings.getInactiveColor();
} else if (selected) {
fillColor = settings.getSelectedColor(fillColor.getAlpha());
} else if (member) {
fillColor = settings.getRelationSelectedColor(fillColor.getAlpha());
}
}
Color strokeColor = symbol.strokeColor;
if (strokeColor != null) {
if (painter.isInactiveMode() || n.isDisabled()) {
strokeColor = settings.getInactiveColor();
} else if (selected) {
strokeColor = settings.getSelectedColor(strokeColor.getAlpha());
} else if (member) {
strokeColor = settings.getRelationSelectedColor(strokeColor.getAlpha());
}
}
painter.drawNodeSymbol(n, symbol, fillColor, strokeColor);
} else {
Color color;
boolean isConnection = n.isConnectionNode();
if (painter.isInactiveMode() || n.isDisabled()) {
color = settings.getInactiveColor();
} else if (selected) {
color = settings.getSelectedColor();
} else if (member) {
color = settings.getRelationSelectedColor();
} else if (isConnection) {
if (n.isTagged()) {
color = settings.getTaggedConnectionColor();
} else {
color = settings.getConnectionColor();
}
} else {
if (n.isTagged()) {
color = settings.getTaggedColor();
} else {
color = settings.getNodeColor();
}
}
final int size = Utils.max((selected ? settings.getSelectedNodeSize() : 0),
(n.isTagged() ? settings.getTaggedNodeSize() : 0),
(isConnection ? settings.getConnectionNodeSize() : 0),
settings.getUnselectedNodeSize());
final boolean fill = (selected && settings.isFillSelectedNode()) ||
(n.isTagged() && settings.isFillTaggedNode()) ||
(isConnection && settings.isFillConnectionNode()) ||
settings.isFillUnselectedNode();
painter.drawNode(n, color, size, fill);