Changeset 30119 in osm for applications/editors/josm/plugins/smed2/src/seamap/SeaMap.java
- Timestamp:
- 2013-12-08T20:52:05+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/SeaMap.java
r29995 r30119 22 22 23 23 public enum Nflag { 24 ANON, ISOL, CONN 25 } 26 27 public class Snode { 28 public double lat; 29 public double lon; 30 public Nflag flg; 24 ANON, // Edge inner nodes 25 ISOL, // Node not part of Edge 26 CONN // Edge first and last nodes 27 } 28 29 public class Snode { // All coordinates in map 30 public double lat; // Latitude 31 public double lon; // Longitude 32 public Nflag flg; // Role of node 31 33 32 34 public Snode() { … … 35 37 lon = 0; 36 38 } 37 38 39 public Snode(double ilat, double ilon) { 39 40 flg = Nflag.ANON; … … 41 42 lon = ilon; 42 43 } 43 44 44 public Snode(double ilat, double ilon, Nflag iflg) { 45 45 lat = ilat; … … 49 49 } 50 50 51 public class Edge { 52 public boolean forward; 53 public long first; 54 public long last; 55 public ArrayList<Long> nodes; 51 public class Edge { // A polyline segment 52 public long first; // First CONN node 53 public long last; // Last CONN node 54 public ArrayList<Long> nodes; // Inner ANON nodes 56 55 57 56 public Edge() { 58 forward = true;59 57 first = 0; 60 58 last = 0; … … 63 61 } 64 62 65 public class Side { 66 Edge edge; 67 boolean forward; 63 public class Side { // An edge as used in a line or area feature 64 Edge edge; // Side is formed by this Edge... 65 boolean forward; // ... in this direction 68 66 69 67 public Side(Edge iedge, boolean ifwd) { … … 73 71 } 74 72 75 public class Bound { 76 public boolean outer; 77 ArrayList<Side> sides; 73 public class Bound { // A single closed area 74 public boolean outer; // Role 75 ArrayList<Side> sides; // Sides that make up this area 78 76 79 77 public Bound() { … … 81 79 sides = new ArrayList<Side>(); 82 80 } 83 84 81 public Bound(Side iside, boolean irole) { 85 82 outer = irole; … … 89 86 } 90 87 91 public class Area extends ArrayList<Bound> { 88 public class Area extends ArrayList<Bound> { // The collection of bounds for an area. 92 89 public Area() { 93 90 super(); … … 389 386 nodes.get(edge.first).flg = Nflag.CONN; 390 387 nodes.get(edge.last).flg = Nflag.CONN; 391 Bound ebound = (new Bound(new Side(edge, edge.forward), true));388 Bound ebound = (new Bound(new Side(edge, true), true)); 392 389 feature.length = calcLength(ebound); 393 390 if (edge.first == edge.last) { … … 410 407 long node1 = edge.first; 411 408 long node2 = edge.last; 412 bound = new Bound(new Side(edge, edge.forward), (role == outers));409 bound = new Bound(new Side(edge, true), (role == outers)); 413 410 if (node1 != node2) { 414 411 for (ListIterator<Long> it = role.listIterator(0); it.hasNext();) { … … 551 548 } else { 552 549 double arc = (Math.acos(Math.cos(lon - llon) * Math.cos(lat - llat))); 553 slat += ( lat* arc);554 slon += ( lon* arc);550 slat += ((lat + llat) / 2 * arc); 551 slon += ((lon + llon) / 2 * arc); 555 552 sarc += arc; 556 553 }
Note:
See TracChangeset
for help on using the changeset viewer.
