Commit b693599c authored by kai's avatar kai
Browse files

Removed obsolete code from RegionChooser, added it to deploy script and cleaned up build paths.

No related merge requests found
Showing with 12 additions and 224 deletions
+12 -224
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/GMapsFX-1.1.1.jar" sourcepath="C:/Users/Kai Brassel/Desktop/rterp-GMapsFX-71adc3c/GMapsFX/src/main/java">
<attributes>
<attribute name="javadoc_location" value="http://rterp.github.io/GMapsFX/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/Proj4J.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/SimStadtRepository"/>
<classpathentry kind="lib" path="lib/jts-1.13.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/SimStadtFrontend"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/SimStadtRepository"/>
<classpathentry kind="lib" path="lib/jts-1.13.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/SimStadtFrontend"/>
<classpathentry kind="output" path="bin"/>
</classpath>
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import com.lynden.gmapsfx.GoogleMapView?>
<BorderPane fx:controller="eu.simstadt.regionchooser.RegionChooserController" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<center>
<GoogleMapView onMouseClicked="#clicked" fx:id="mapView" prefHeight="750.0" prefWidth="750.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
</center>
<bottom>
<HBox BorderPane.alignment="CENTER">
<children>
<Button mnemonicParsing="false" onAction="#generateExportJob" text="Generate Export Job" />
<TextArea fx:id="outputTA" wrapText="true" />
</children>
</HBox>
</bottom>
</BorderPane>
package eu.simstadt.regionchooser;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import com.lynden.gmapsfx.GoogleMapView;
import com.lynden.gmapsfx.MapComponentInitializedListener;
import com.lynden.gmapsfx.javascript.JavascriptObject;
import com.lynden.gmapsfx.javascript.object.GoogleMap;
import com.lynden.gmapsfx.javascript.object.InfoWindow;
import com.lynden.gmapsfx.javascript.object.InfoWindowOptions;
import com.lynden.gmapsfx.javascript.object.LatLong;
import com.lynden.gmapsfx.javascript.object.MapOptions;
import com.lynden.gmapsfx.javascript.object.MapTypeIdEnum;
import com.lynden.gmapsfx.javascript.object.Marker;
import com.lynden.gmapsfx.javascript.object.MarkerOptions;
import eu.simstadt.nf4j.JobDescriptor;
import eu.simstadt.nf4j.async.Coord;
import eu.simstadt.nf4j.async.ExportJobDescription;
import eu.simstadt.nf4j.async.JobFileBuilderImpl;
import eu.simstadt.nf4j.async.Layer;
public class RegionChooserController implements MapComponentInitializedListener
{
ArrayList<Coord> regionPolygon = new ArrayList<>();
@FXML
private TextArea outputTA;
@FXML
private GoogleMapView mapView;
private GoogleMap map;
@FXML
public void initialize() {
mapView.addMapInializedListener(this);
}
@Override
public void mapInitialized() {
LatLong bochumLoc = new LatLong(48.879696, 9.215463);
LatLong hamburgLoc = new LatLong(48.878230, 9.215714);
LatLong stuttgartLoc = new LatLong(48.878323, 9.216613);
LatLong dresdenLoc = new LatLong(48.879402, 9.216532);
//Set the initial properties of the map.
MapOptions mapOptions = new MapOptions();
mapOptions.center(new LatLong(51.3, 11.0))
.mapType(MapTypeIdEnum.ROADMAP)
.overviewMapControl(true)
.panControl(false)
.rotateControl(false)
.scaleControl(false)
.streetViewControl(false)
.zoomControl(true)
.zoom(7);
map = mapView.createMap(mapOptions);
//Add markers to the map
MarkerOptions markerOptions1 = new MarkerOptions();
markerOptions1.position(bochumLoc);
MarkerOptions markerOptions2 = new MarkerOptions();
markerOptions2.position(hamburgLoc);
MarkerOptions markerOptions3 = new MarkerOptions();
markerOptions3.position(stuttgartLoc);
MarkerOptions markerOptions4 = new MarkerOptions();
markerOptions4.position(dresdenLoc);
Marker bochumMarker = new Marker(markerOptions1);
Marker hamburgMarker = new Marker(markerOptions2);
Marker stuttgartMarker = new Marker(markerOptions3);
Marker dresdenMarker = new Marker(markerOptions4);
map.addMarker(bochumMarker);
map.addMarker(hamburgMarker);
map.addMarker(stuttgartMarker);
map.addMarker(dresdenMarker);
InfoWindowOptions infoWindowOptions = new InfoWindowOptions();
infoWindowOptions.content("<h2>Bochum</h2>Tief im Westen");
InfoWindow bochumInfoWindow = new InfoWindow(infoWindowOptions);
bochumInfoWindow.open(map, bochumMarker);
regionPolygon.add(new Coord(bochumLoc.getLatitude(), bochumLoc.getLongitude()));
regionPolygon.add(new Coord(hamburgLoc.getLatitude(), hamburgLoc.getLongitude()));
regionPolygon.add(new Coord(stuttgartLoc.getLatitude(), stuttgartLoc.getLongitude()));
regionPolygon.add(new Coord(dresdenLoc.getLatitude(), dresdenLoc.getLongitude()));
}
// Build the nF export job description from a region polygon
@FXML
void generateExportJob(ActionEvent event) {
Service<String> exportRunner = new Service<String>() {
@Override
protected Task<String> createTask() {
return new Task<String>() {
@Override
protected String call() throws Exception {
Layer layer = new Layer();
layer.setName("GML");
layer.setProduct("LBTEST");
layer.setStyle("#000000");
ExportJobDescription jobDescriptor = ExportJobDescription.getDefaultDescriptor();
jobDescriptor.addLayer(layer);
jobDescriptor.setRegionPolygon(regionPolygon);
JobFileBuilderImpl jobBuilder = new JobFileBuilderImpl();
return jobBuilder.buildExportJobFile(jobDescriptor).getAbsolutePath();
}
};
}
};
exportRunner.setOnSucceeded(state -> {
outputTA.setText(exportRunner.getValue());
});
exportRunner.start();
}
@FXML
void clicked() {
// Test, if this LatLong will be returned by getCenter(). Seams to work.
System.out.println("Center: " + map.getCenter());
// Adding a fifth marker to the map seams to work without any problems.
LatLong loc = new LatLong(48.880003, 9.216849);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(loc);
Marker marker = new Marker(markerOptions);
map.addMarker(marker);
// Now I want to obtain the current coordinates from the map at the mouse position in order
// to instantiate and set a new marker.
//
// This statement fails. Why?
mapView.getMap().getLatLong();
}
}
\ No newline at end of file
......@@ -7,7 +7,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.prefs.Preferences;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -31,7 +30,6 @@
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;
import eu.simstadt.admin.RepositoryNode;
import eu.simstadt.desktop.SimStadtApp;
import eu.simstadt.nf4j.ExportJobFromJavaFXRegionChooser;
......
package eu.simstadt.regionchooser;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class RegionChooserMain extends Application
{
@Override
public void start(Stage primaryStage) {
try {
BorderPane root = (BorderPane) FXMLLoader.load(getClass().getResource("RegionChooser.fxml"));
Scene scene = new Scene(root, 750, 750);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment