Skip to content

Commit

Permalink
Merge branch 'otfvis'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/matsim/contrib/josm/actions/NetworkTest.java
  • Loading branch information
michaz committed Jul 23, 2016
2 parents 3188718 + 27dc1be commit 2c6f326
Show file tree
Hide file tree
Showing 36 changed files with 989 additions and 708 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/**
9 changes: 0 additions & 9 deletions .idea/libraries/Gradle__org_matsim_matsim_0_8_0.xml

This file was deleted.

124 changes: 0 additions & 124 deletions .idea/uiDesigner.xml

This file was deleted.

25 changes: 12 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,26 @@ repositories {

// Declare a configuration for our external dependency (MATSim) so we can later take its classes and zip them into our jar.
configurations {
zipIntoJar
provided
compile.extendsFrom(provided)
compile.exclude(group: 'org.geotools')
compile.exclude(group: 'kml')
compile.exclude(group: 'org.jfree')
compile.exclude(group: 'commons-logging')
}

dependencies {
zipIntoJar 'org.matsim:matsim:0.8.0'
// Compile is the distinguished configuration of the Java plug-in which actually needs to contain
// the dependency.
// We use zipIntoJar as a middleman, so that it has a name and we can later address its classes.
// We add it to compile, so that it becomes a dependency of our project.
compile (configurations.zipIntoJar.dependencies) {
exclude group: 'org.geotools'
exclude group: 'kml'
exclude group: 'org.jfree'
}
compile ('org.matsim:matsim:0.9.0-SNAPSHOT') {changing = true}
compile ('org.matsim.contrib:otfvis:0.9.0-SNAPSHOT') {changing = true}

// We also include the JOSM jar, which will be downloaded below. But it will not go into the jar.
// Should rather be 'provided', see https://issues.gradle.org/browse/GRADLE-784
compile files("libs/josm-latest.jar")
provided files("libs/josm-latest.jar")

testCompile group: 'junit', name: 'junit', version: '4.12'
}


// I (michaz) seem to need this when debugging from IntelliJ.
// With the default setting (build/resources/main),
// resources are not found on the classpath.
Expand Down Expand Up @@ -85,7 +84,7 @@ jar {
// Now take the dependencies of zipIntoJar (currently only MATSim), and put them into
// our target jar.
from {
configurations.zipIntoJar.collect { zipTree(it) }
(configurations.compile - configurations.provided).collect { zipTree(it) }
}
}

Expand Down
16 changes: 16 additions & 0 deletions src/main/java/org/matsim/contrib/gtfs/LineBrowser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.matsim.contrib.gtfs;

import javafx.application.Application;
import javafx.stage.Stage;

public class LineBrowser extends Application {

public static void main(String[] args) {
launch(args);
}

@Override
public void start(Stage primaryStage) throws Exception {

}
}
2 changes: 2 additions & 0 deletions src/main/java/org/matsim/contrib/josm/MATSimPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ public MATSimPlugin(PluginInformation info) {
jMenu2.add(new NewNetworkAction());
jMenu2.add(new ConvertAction());
jMenu2.add(new DownloadAction());
jMenu2.add(new DownloadVBBAction());
jMenu2.add(new JSeparator());
jMenu2.add(new RepairAction("Validate TransitSchedule", new TransitScheduleTest()));
TransitScheduleExportAction transitScheduleExportAction = new TransitScheduleExportAction();
Main.pref.addPreferenceChangeListener(transitScheduleExportAction);
jMenu2.add(transitScheduleExportAction);
jMenu2.add(new OTFVisAction());

// read tagging preset
Reader reader = new InputStreamReader(getClass().getResourceAsStream("matsimPreset.xml"));
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/matsim/contrib/josm/MapRenderer.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package org.matsim.contrib.josm;

import org.matsim.api.core.v01.TransportMode;
import org.matsim.api.core.v01.network.Link;
import org.matsim.contrib.josm.model.MLink;
import org.matsim.contrib.josm.model.OsmConvertDefaults;
import org.matsim.core.network.LinkImpl;
import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
Expand Down Expand Up @@ -43,9 +42,9 @@ public MapRenderer(Graphics2D arg0, NavigatableComponent arg1, boolean arg2) {
/**
* Maps links to their corresponding way.
*/
private static Map<Way, List<Link>> way2Links = new HashMap<>();
private static Map<Way, List<MLink>> way2Links = new HashMap<>();

public static void setWay2Links(Map<Way, List<Link>> way2LinksTmp) {
public static void setWay2Links(Map<Way, List<MLink>> way2LinksTmp) {
way2Links = way2LinksTmp;
Main.map.repaint();
}
Expand Down Expand Up @@ -172,8 +171,8 @@ public static Properties getInstance() {
public String compose(OsmPrimitive prim) {
StringBuilder sB = new StringBuilder();
if (way2Links.containsKey(prim)) {
for (Link link : way2Links.get(prim)) {
sB.append(" [").append(((LinkImpl) link).getOrigId()).append("] ");
for (MLink link : way2Links.get(prim)) {
sB.append(" [").append(link.getOrigId()).append("] ");
}
}
return sB.toString();
Expand Down
25 changes: 9 additions & 16 deletions src/main/java/org/matsim/contrib/josm/actions/DownloadAction.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package org.matsim.contrib.josm.actions;

import static org.openstreetmap.josm.tools.I18n.tr;

import java.awt.event.ActionEvent;
import java.io.InputStream;
import java.util.concurrent.Future;

import org.matsim.contrib.josm.model.OsmConvertDefaults;
import org.matsim.contrib.josm.gui.DownloadDialog;
import org.matsim.contrib.josm.model.OsmConvertDefaults;
import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
Expand All @@ -21,6 +15,11 @@
import org.openstreetmap.josm.tools.CheckParameterUtil;
import org.openstreetmap.josm.tools.HttpClient;

import java.awt.event.ActionEvent;
import java.io.InputStream;

import static org.openstreetmap.josm.tools.I18n.tr;

/**
* Action that opens a connection to the osm server and downloads MATSim-related
* map data.
Expand All @@ -34,7 +33,7 @@ public class DownloadAction extends JosmAction {
* Constructs a new {@code DownloadAction}.
*/
public DownloadAction() {
super(tr("Download from Overpass API ..."), null, tr("Download data from Overpass API, filtered by relevance for MATSim."), null, true);
super(tr("Download from Overpass API..."), null, tr("Download data from Overpass API, filtered by relevance for MATSim."), null, true);
}

@Override
Expand All @@ -45,14 +44,8 @@ public void actionPerformed(ActionEvent e) {
if (!dialog.isCanceled()) {
dialog.rememberSettings();
Bounds area = dialog.getSelectedDownloadArea();
DownloadOsmTask task = new DownloadOsmTask() {
@Override
public Future<?> download(boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor) {
return download(new FilteredDownloader(downloadArea), newLayer, downloadArea, progressMonitor);
}
};
Future<?> future = task.download(dialog.isNewLayerRequired(), area, null);
Main.worker.submit(new PostDownloadHandler(task, future));
DownloadOsmTask task = new DownloadOsmTask();
Main.worker.submit(new PostDownloadHandler(task, task.download(new FilteredDownloader(area), dialog.isNewLayerRequired(), area, null)));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.matsim.contrib.josm.actions;

import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
import org.openstreetmap.josm.actions.downloadtasks.PostDownloadHandler;
import org.openstreetmap.josm.data.Bounds;

import java.awt.event.ActionEvent;

import static org.openstreetmap.josm.tools.I18n.tr;

/**
* Action that opens a connection to the osm server and downloads MATSim-related
* map data.
*
* An dialog is displayed asking the user to specify a rectangle to grab. The
* url and account settings from the preferences are used.
*/
public class DownloadVBBAction extends JosmAction {

/**
* Constructs a new {@code DownloadAction}.
*/
public DownloadVBBAction() {
super(tr("Download VBB..."), null, tr("Download VBB."), null, true);
}

@Override
public void actionPerformed(ActionEvent e) {
DownloadOsmTask task = new DownloadOsmTask();
String query =
String.format("[timeout:%d];", MyOverpassDownloader.TIMEOUT_S) +
"rel[\"type\"=\"route_master\"][\"network\"=\"Verkehrsverbund Berlin-Brandenburg\"];" +
"out meta;";
Main.worker.submit(new PostDownloadHandler(task, task.download(new MyOverpassDownloader(query) ,true, new Bounds(0,0,true), null)));
}

}
Loading

0 comments on commit 2c6f326

Please sign in to comment.