Skip to content

Commit

Permalink
fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
don-vip committed Jun 22, 2018
1 parent 623be7c commit db4c6da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
4 changes: 2 additions & 2 deletions build.number
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Mon Jun 11 23:44:22 CEST 2018
build.number=2562
#Fri Jun 22 22:07:22 CEST 2018
build.number=2738
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.Notification;
import org.openstreetmap.josm.tools.Logging;
import org.openstreetmap.josm.tools.Shortcut;

/**
Expand Down Expand Up @@ -106,18 +107,18 @@ public void actionPerformed(ActionEvent e) {
node.getKeys().get("direction").equals("clockwise")
) {
lefthandtraffic = true;
System.out.println("REX: direction overridden by direction=clockwise");
Logging.debug("REX: direction overridden by direction=clockwise");
}

//See if user want another size
if (node.getKeys().containsKey("diameter")) {
System.out.println("diameter tag");
try {
int d = Integer.parseInt(node.getKeys().get("diameter"));
radi = d/2;
System.out.println("REX: diameter overridden by tag diameter="+d);
Logging.debug("REX: diameter overridden by tag diameter={0}", d);
} catch (NumberFormatException ex) {
System.out.println("REX: failed getting diameter from node tag diameter");
Logging.warn("REX: failed getting diameter from node tag diameter");
Logging.warn(ex);
}
}
makeRoundabout(node, radi, lefthandtraffic, max_gap);
Expand Down Expand Up @@ -239,17 +240,14 @@ public void makeRoundabout(Node node, double radi, boolean lefthandtraffic, doub
Node filler_node = null;
double heading1, heading2;
int s = ungrouped_nodes.size();
for (Node q : ungrouped_nodes) {
System.out.println(center.heading(q.getCoor())+" "+q);
}
DataSet ds = Main.main.getEditDataSet();
for (int i = 0, next_i = 0; i < s; i++) {
next_i = i+1;
//Reference back to start
if (next_i == s) next_i = 0;

heading1 = center.heading(ungrouped_nodes.get(i).getCoor());
heading2 = center.heading(ungrouped_nodes.get(next_i).getCoor());
heading1 = -center.bearing(ungrouped_nodes.get(i).getCoor());
heading2 = -center.bearing(ungrouped_nodes.get(next_i).getCoor());

//Add full circle (2PI) to heading2 to "come around" the circle.
if (heading1 > heading2 || i == next_i) {
Expand All @@ -258,14 +256,11 @@ public void makeRoundabout(Node node, double radi, boolean lefthandtraffic, doub

double gap = heading2 - heading1;
int fillers_to_make = ((int) (gap/max_gap))-1;
System.out.println("pair: "+i+" "+next_i+" "+heading1+ " "+ heading2 + " gap "+gap+ " fillers "+fillers_to_make);
if (fillers_to_make > 0) {
double to_next = gap / (fillers_to_make+1);
System.out.println("to next: " +to_next);
double next;
for (int j = 1; j <= fillers_to_make; j++) {
next = heading1 + to_next * j;
System.out.println("adding filler: "+j+ " heading: " +next);
filler_node = new Node(moveHeadingDistance(center, next, radi));
Main.main.undoRedo.add(new AddCommand(ds, filler_node));
ungrouped_nodes.add(filler_node);
Expand Down Expand Up @@ -431,10 +426,10 @@ static class AngComp implements Comparator<Node> {

@Override
public int compare(Node a, Node b) {
double ah = center.heading(a.getCoor());
double bh = center.heading(b.getCoor());
double ah = center.bearing(a.getCoor());
double bh = center.bearing(b.getCoor());
if (ah == bh) return 0;
return (ah < bh) ? 1 : -1;
return (ah > bh) ? 1 : -1;
}

} //END AngComp
Expand Down Expand Up @@ -508,7 +503,6 @@ public int compare(Way a, Way b) {
public boolean moveWayEndNodeTowardsNextNode(Node node, double distance) {
//some verification:
List<Way> referedWays = OsmPrimitive.getFilteredList(node.getReferrers(), Way.class);
for (Way w : referedWays) System.out.println(w);

//node must be member of exactly one way
if (referedWays.size() != 1) {
Expand Down Expand Up @@ -542,7 +536,7 @@ public boolean moveWayEndNodeTowardsNextNode(Node node, double distance, Way way

//Find heading to next node
Node ajacent_node = way.getNeighbours(node).iterator().next();
double heading = node.getCoor().heading(ajacent_node.getCoor());
double heading = -node.getCoor().bearing(ajacent_node.getCoor());

//Move the node towards the next node
LatLon newpos = moveHeadingDistance(node.getCoor(), heading, distance);
Expand Down Expand Up @@ -576,7 +570,7 @@ private LatLon moveHeadingDistance(LatLon start, double heading, double distance
}

/**
* Output a message
* Output a warning message
*
* @param str Message
*/
Expand All @@ -585,7 +579,7 @@ public void pri(String str) {
t.setIcon(JOptionPane.WARNING_MESSAGE);
t.setDuration(Notification.TIME_SHORT);
t.show();
System.out.println(str);
Logging.warn(str);
}

public boolean selectFlareCandidates() {
Expand Down

0 comments on commit db4c6da

Please sign in to comment.