read osm format longitude and latitude bounds, separate ways and buildings
- read longitude and lattude boundaries - separate ways ( open ways ) from buildings ( closed ) - save as .imc and .drawing ( raw format ) [ since .imc seems buggy ) - read uncompressed drawing format
This commit is contained in:
@@ -397,6 +397,26 @@ implements StatusListener
|
||||
|
||||
loadMenu.add(loadImcButton);
|
||||
|
||||
Action loadDrawingAction = new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
//
|
||||
addStatus("load Drawing");
|
||||
|
||||
String filename = loadName.getText();
|
||||
|
||||
if ((filename.length() > 0)) {
|
||||
setMazeName(filename);
|
||||
loadDrawing(false);
|
||||
refresh();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
JButton loadDrawingButton = new JButton(labels.getString("load" ) + " Drawing");
|
||||
loadDrawingButton.addActionListener(loadDrawingAction);
|
||||
|
||||
loadMenu.add(loadDrawingButton);
|
||||
|
||||
Action loadOsmAction = new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
//
|
||||
@@ -701,9 +721,9 @@ implements StatusListener
|
||||
FileInputStream inputStream = null;
|
||||
try {
|
||||
// TODO really use InputStream and not pathname
|
||||
OsmToDrawing converter = new OsmToDrawing(43.6399000, 7.0058300, 10000,10000);
|
||||
OsmReader reader = new OsmReader(infile.getCanonicalPath());
|
||||
reader.read();
|
||||
OsmToDrawing converter = new OsmToDrawing(reader, 25000,25000);
|
||||
Drawing drawing = converter.getDrawing(reader.getWays());
|
||||
statusEnable = false;
|
||||
maze.addDrawing(drawing,add);
|
||||
@@ -760,6 +780,40 @@ implements StatusListener
|
||||
}
|
||||
}
|
||||
|
||||
private void loadDrawing(boolean add) {
|
||||
if ( maze != null ) {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
File infile = new File(params.getSaveDir(), params.getName() + ".drawing");
|
||||
FileInputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(infile);
|
||||
// TODO
|
||||
// model = new MazePersistRaw().parseInputStream("raw",inputStream);
|
||||
Drawing drawing = new Drawing();
|
||||
drawing.loadLines(new DataInputStream(inputStream));
|
||||
statusEnable = false;
|
||||
maze.addDrawing(drawing,add);
|
||||
statusEnable = true;
|
||||
} catch (IOException io) {
|
||||
io.printStackTrace(System.err);
|
||||
statusField.setText("[ERROR] Can't load " + infile.getAbsolutePath());
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
// cleanup
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Exception any) {
|
||||
// don't care really
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
private JButton addDirection(final JPanel panel, final String direction, String key, Action goAction) {
|
||||
String actionName = "go" + direction;
|
||||
JButton button = new JButton(direction);
|
||||
|
||||
Reference in New Issue
Block a user