Fix small issues. Introduce settings for smoothness of lines for MapCreator. Change default zoom levels

This commit is contained in:
Victor Shcherb 2011-06-21 01:12:07 +02:00
parent 5fab54f29e
commit 8535767bff
5 changed files with 44 additions and 4 deletions

View file

@ -83,7 +83,7 @@ public class MapZooms {
}
private static MapZooms DEFAULT = null;
public static String MAP_ZOOMS_DEFAULT = "5-8;9-11;12-14;15";
public static String MAP_ZOOMS_DEFAULT = "8-10;11-12;13-14;15";
public static MapZooms getDefault(){
if(DEFAULT == null){
DEFAULT = parseZooms(MAP_ZOOMS_DEFAULT);

View file

@ -102,6 +102,16 @@ public class DataExtractionSettings {
preferences.put("map_zooms", zooms);
}
public String getLineSmoothness(){
return preferences.get("line_smoothness", "0");
}
public void setLineSmoothness(String smooth){
// check string
Integer.parseInt(smooth);
preferences.put("line_smoothness", smooth);
}
public String getMapRenderingTypesFile(){
return preferences.get("rendering_types_file", "");

View file

@ -29,6 +29,7 @@ public class OsmExtractionPreferencesDialog extends JDialog {
private JTextField streetSuffixes;
private JTextField streetDefaultSuffixes;
private JTextField mapZooms;
private JTextField lineSmoothness;
private JTextField cityAdminLevel;
private JTextField renderingTypesFile;
private JTextField pathToObfRoutingFile;
@ -221,13 +222,33 @@ public class OsmExtractionPreferencesDialog extends JDialog {
constr.gridy = 2;
l.setConstraints(mapZooms, constr);
label = new JLabel("Line smoothness for low zooms (value 0-3) : ");
panel.add(label);
constr = new GridBagConstraints();
constr.ipadx = 5;
constr.gridx = 0;
constr.gridy = 3;
constr.anchor = GridBagConstraints.WEST;
l.setConstraints(label, constr);
lineSmoothness = new JTextField();
lineSmoothness.setText(DataExtractionSettings.getSettings().getLineSmoothness());
panel.add(lineSmoothness);
constr = new GridBagConstraints();
constr.weightx = 1;
constr.fill = GridBagConstraints.HORIZONTAL;
constr.ipadx = 5;
constr.gridx = 1;
constr.gridy = 3;
l.setConstraints(mapZooms, constr);
label = new JLabel("Rendering types (xml config to extract osm data) file path");
panel.add(label);
constr = new GridBagConstraints();
constr.ipadx = 5;
constr.gridx = 0;
constr.gridy = 3;
constr.gridy = 4;
constr.anchor = GridBagConstraints.WEST;
l.setConstraints(label, constr);
@ -239,7 +260,7 @@ public class OsmExtractionPreferencesDialog extends JDialog {
constr.fill = GridBagConstraints.HORIZONTAL;
constr.ipadx = 5;
constr.gridx = 1;
constr.gridy = 3;
constr.gridy = 4;
l.setConstraints(renderingTypesFile, constr);
panel.setMaximumSize(new Dimension(Short.MAX_VALUE, panel.getPreferredSize().height));
@ -276,6 +297,9 @@ public class OsmExtractionPreferencesDialog extends JDialog {
settings.setUseInterentToLoadImages(useInternet.isSelected());
}
if(!settings.getLineSmoothness().equals(lineSmoothness.getText())){
settings.setLineSmoothness(lineSmoothness.getText());
}
if(!settings.getMapZoomsValue().equals(mapZooms.getText())){
settings.setMapZooms(mapZooms.getText());
}

View file

@ -438,6 +438,12 @@ public class OsmExtractionUI implements IMapLocationListener {
types = new MapRenderingTypes(fn);
}
RTree.clearCache();
int smoothness = 0;
try {
Integer.parseInt(DataExtractionSettings.getSettings().getLineSmoothness());
} catch (NumberFormatException e) {
}
creator.setZoomWaySmothness(smoothness);
creator.generateIndexes(f, dlg, filter, DataExtractionSettings.getSettings().getMapZooms(), types);
} catch (IOException e) {
throw new IllegalArgumentException(e);

View file

@ -269,7 +269,7 @@ public class MapRenderRepositories {
}
for (String mapName : files.keySet()) {
if(basemapSearch && mapName.toLowerCase().contains(BASEMAP_NAME)){
if(basemapSearch && !mapName.toLowerCase().contains(BASEMAP_NAME)){
continue;
}
BinaryMapIndexReader c = files.get(mapName);