Changeset 13926 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java
- Timestamp:
- 2018-06-13T01:33:47+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java
r13761 r13926 15 15 import org.openstreetmap.josm.data.osm.BBox; 16 16 import org.openstreetmap.josm.data.osm.DataSet; 17 import org.openstreetmap.josm.data.osm.Node; 17 import org.openstreetmap.josm.data.osm.INode; 18 import org.openstreetmap.josm.data.osm.IPrimitive; 19 import org.openstreetmap.josm.data.osm.IRelation; 20 import org.openstreetmap.josm.data.osm.IRelationMember; 21 import org.openstreetmap.josm.data.osm.IWay; 22 import org.openstreetmap.josm.data.osm.OsmData; 18 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 import org.openstreetmap.josm.data.osm.Relation;20 import org.openstreetmap.josm.data.osm.RelationMember;21 24 import org.openstreetmap.josm.data.osm.Way; 22 25 import org.openstreetmap.josm.data.projection.proj.TransverseMercator; … … 36 39 37 40 private final StringBuilder s = new StringBuilder(); 38 private final DataSetds;39 40 InspectPrimitiveDataText( DataSetds) {41 private final OsmData<?, ?, ?, ?> ds; 42 43 InspectPrimitiveDataText(OsmData<?, ?, ?, ?> ds) { 41 44 this.ds = ds; 42 45 } … … 63 66 * @param o primitive to add 64 67 */ 65 public void addPrimitive( OsmPrimitive o) {68 public void addPrimitive(IPrimitive o) { 66 69 67 70 addHeadline(o); … … 82 85 addSpecial(o); 83 86 addReferrers(s, o); 84 addConflicts(o); 87 if (o instanceof OsmPrimitive) { 88 addConflicts((OsmPrimitive) o); 89 } 85 90 s.append(NL); 86 91 } 87 92 88 void addHeadline( OsmPrimitive o) {93 void addHeadline(IPrimitive o) { 89 94 addType(o); 90 95 addNameAndId(o); 91 96 } 92 97 93 void addType( OsmPrimitive o) {94 if (o instanceof Node) {98 void addType(IPrimitive o) { 99 if (o instanceof INode) { 95 100 s.append(tr("Node: ")); 96 } else if (o instanceof Way) {101 } else if (o instanceof IWay) { 97 102 s.append(tr("Way: ")); 98 } else if (o instanceof Relation) {103 } else if (o instanceof IRelation) { 99 104 s.append(tr("Relation: ")); 100 105 } 101 106 } 102 107 103 void addNameAndId( OsmPrimitive o) {108 void addNameAndId(IPrimitive o) { 104 109 String name = o.get("name"); 105 110 if (name == null) { … … 110 115 } 111 116 112 void addState( OsmPrimitive o) {117 void addState(IPrimitive o) { 113 118 StringBuilder sb = new StringBuilder(INDENT); 114 119 /* selected state is left out: not interesting as it is always selected */ … … 141 146 } 142 147 143 void addCommon( OsmPrimitive o) {148 void addCommon(IPrimitive o) { 144 149 add(tr("Data Set: "), Integer.toHexString(o.getDataSet().hashCode())); 145 150 add(tr("Edited at: "), o.isTimestampEmpty() ? tr("<new object>") … … 151 156 } 152 157 153 void addAttributes( OsmPrimitive o) {158 void addAttributes(IPrimitive o) { 154 159 if (o.hasKeys()) { 155 160 add(tr("Tags: ")); … … 161 166 } 162 167 163 void addSpecial( OsmPrimitive o) {164 if (o instanceof Node) {165 addCoordinates(( Node) o);166 } else if (o instanceof Way) {168 void addSpecial(IPrimitive o) { 169 if (o instanceof INode) { 170 addCoordinates((INode) o); 171 } else if (o instanceof IWay) { 167 172 addBbox(o); 168 173 add(tr("Centroid: "), 169 174 toStringCSV(", ", Main.getProjection().eastNorth2latlon( 170 175 Geometry.getCentroid(((Way) o).getNodes())))); 171 addWayNodes(( Way) o);172 } else if (o instanceof Relation) {176 addWayNodes((IWay<?>) o); 177 } else if (o instanceof IRelation) { 173 178 addBbox(o); 174 addRelationMembers(( Relation) o);175 } 176 } 177 178 void addRelationMembers( Relationr) {179 addRelationMembers((IRelation<?>) o); 180 } 181 } 182 183 void addRelationMembers(IRelation<?> r) { 179 184 add(trn("{0} Member: ", "{0} Members: ", r.getMembersCount(), r.getMembersCount())); 180 for ( RelationMemberm : r.getMembers()) {185 for (IRelationMember<?> m : r.getMembers()) { 181 186 s.append(INDENT).append(INDENT); 182 187 addHeadline(m.getMember()); … … 186 191 } 187 192 188 void addWayNodes( Wayw) {193 void addWayNodes(IWay<?> w) { 189 194 add(tr("{0} Nodes: ", w.getNodesCount())); 190 for ( Node n : w.getNodes()) {195 for (INode n : w.getNodes()) { 191 196 s.append(INDENT).append(INDENT); 192 197 addNameAndId(n); … … 195 200 } 196 201 197 void addBbox( OsmPrimitive o) {202 void addBbox(IPrimitive o) { 198 203 BBox bbox = o.getBBox(); 199 204 if (bbox != null) { … … 210 215 } 211 216 212 void addCoordinates( Node n) {217 void addCoordinates(INode n) { 213 218 if (n.isLatLonKnown()) { 214 219 add(tr("Coordinates:"), " ", … … 225 230 } 226 231 227 void addReferrers(StringBuilder s, OsmPrimitive o) {228 List< OsmPrimitive> refs = o.getReferrers();232 void addReferrers(StringBuilder s, IPrimitive o) { 233 List<? extends IPrimitive> refs = o.getReferrers(); 229 234 if (!refs.isEmpty()) { 230 235 add(tr("Part of: ")); 231 for ( OsmPrimitive p : refs) {236 for (IPrimitive p : refs) { 232 237 s.append(INDENT).append(INDENT); 233 238 addHeadline(p); … … 238 243 239 244 void addConflicts(OsmPrimitive o) { 240 Conflict<?> c = ds.getConflicts().getConflictForMy(o);245 Conflict<?> c = ((DataSet) ds).getConflicts().getConflictForMy(o); 241 246 if (c != null) { 242 247 add(tr("In conflict with: "));
Note:
See TracChangeset
for help on using the changeset viewer.