Changeset 32528 in osm for applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationObject.java
- Timestamp:
- 2016-07-02T03:55:03+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationObject.java
r29384 r32528 1 // License: WTFPL. For details, see LICENSE file. 1 2 package iodb; 2 3 3 4 import java.util.Map; 5 4 6 import org.openstreetmap.josm.data.coor.LatLon; 5 7 import org.openstreetmap.josm.data.osm.Node; … … 28 30 * Initialize a calibration object from OSM primitive. 29 31 */ 30 public CalibrationObject( OsmPrimitive p ) { 31 if( p instanceof Node ) 32 geometry = new LatLon[] { ((Node)p).getCoor() }; 33 else if( p instanceof Way ) { 34 geometry = new LatLon[((Way)p).getNodesCount()]; 35 for( int i = 0; i < geometry.length; i++ ) 36 geometry[i] = ((Way)p).getNode(i).getCoor(); 32 public CalibrationObject(OsmPrimitive p) { 33 if (p instanceof Node) 34 geometry = new LatLon[] {((Node) p).getCoor()}; 35 else if (p instanceof Way) { 36 geometry = new LatLon[((Way) p).getNodesCount()]; 37 for (int i = 0; i < geometry.length; i++) { 38 geometry[i] = ((Way) p).getNode(i).getCoor(); 39 } 37 40 } else 38 41 throw new IllegalArgumentException("Calibration Object can be created either from node or a way"); … … 47 50 48 51 @Override 49 public void putServerParams( Map<String, String> map) {52 public void putServerParams(Map<String, String> map) { 50 53 super.putServerParams(map); 51 54 StringBuilder sb = new StringBuilder(); 52 for (int i = 0; i < geometry.length; i++) {53 if ( i > 0)55 for (int i = 0; i < geometry.length; i++) { 56 if (i > 0) 54 57 sb.append(','); 55 58 sb.append(geometry[i].lon()).append(' ').append(geometry[i].lat()); … … 60 63 @Override 61 64 public String toString() { 62 return "CalibrationObject{" + geometry.length + "nodes; position=" + position + ", date=" + date + ", author=" + author + ", description=" + description + ", abandonDate=" + abandonDate + '}'; 65 return "CalibrationObject{" + geometry.length + "nodes; position=" + position + ", date=" + date + ", author=" + author + 66 ", description=" + description + ", abandonDate=" + abandonDate + '}'; 63 67 } 64 68 }
Note:
See TracChangeset
for help on using the changeset viewer.
