54
54
protected IExtension createExtension(final NodeModel node, final XMLElement element) {
55
final MapStyleModel model = new MapStyleModel();
55
57
final String colorString = element.getAttribute("background", null);
56
58
final Color bgColor;
57
59
if (colorString != null) {
63
final MapStyleModel model = new MapStyleModel();
64
65
model.setBackgroundColor(bgColor);
66
final String zoomString = element.getAttribute("zoom", null);
67
if (zoomString != null) {
68
final float zoom = Float.valueOf(zoomString);
72
final String layoutString = element.getAttribute("layout", null);
74
if (layoutString != null) {
75
final MapViewLayout layout = MapViewLayout.valueOf(layoutString);
76
model.setMapViewLayout(layout);
97
113
protected void saveExtension(final IExtension extension, final XMLElement element) {
98
114
super.saveExtension(extension, element);
99
final Color backgroundColor = ((MapStyleModel) extension).getBackgroundColor();
115
MapStyleModel mapStyleModel = (MapStyleModel) extension;
116
final Color backgroundColor = mapStyleModel.getBackgroundColor();
100
117
if (backgroundColor != null) {
101
118
element.setAttribute("background", ColorUtils.colorToString(backgroundColor));
120
float zoom = mapStyleModel.getZoom();
122
element.setAttribute("zoom", Float.toString(zoom));
124
MapViewLayout layout = mapStyleModel.getMapViewLayout();
125
if(! layout.equals(MapViewLayout.MAP)){
126
element.setAttribute("layout", layout.toString());
130
public void setZoom(MapModel map, final float zoom ) {
131
final MapStyleModel mapStyleModel = MapStyleModel.getExtension(map);
132
if(zoom == mapStyleModel.getZoom()){
135
mapStyleModel.setZoom(zoom);
136
getModeController().getMapController().setSaved(map, false);
139
public void setMapViewLayout(MapModel map, final MapViewLayout layout ) {
140
final MapStyleModel mapStyleModel = MapStyleModel.getExtension(map);
141
if(layout.equals(mapStyleModel.getMapViewLayout())){
144
mapStyleModel.setMapViewLayout(layout);
145
getModeController().getMapController().setSaved(map, false);
105
148
public void setBackgroundColor(final MapStyleModel model, final Color actionColor) {
106
149
final Color oldColor = model.getBackgroundColor();
107
150
if (actionColor == oldColor || actionColor != null && actionColor.equals(oldColor)) {