Changeset 3653 in josm for trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
- Timestamp:
- 2010-11-14T17:54:23+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r3471 r3653 1286 1286 } 1287 1287 1288 /** 1289 Return true, if this primitive is referred by at least n ways 1290 @param n Minimal number of ways to return true. Must be positive 1291 */ 1292 public final boolean isReferredByWays(int n) { 1293 // Count only referrers that are members of the same dataset (primitive can have some fake references, for example 1294 // when way is cloned 1295 Object referrers = this.referrers; 1296 if (referrers == null) return false; 1297 checkDataset(); 1298 if (referrers instanceof OsmPrimitive) { 1299 return n<=1 && referrers instanceof Way && ((OsmPrimitive)referrers).dataSet == dataSet; 1300 } else { 1301 int counter=0; 1302 for (OsmPrimitive o : (OsmPrimitive[])referrers) { 1303 if (dataSet == o.dataSet && o instanceof Way) { 1304 if (++counter >= n) 1305 return true; 1306 } 1307 } 1308 return false; 1309 } 1310 } 1311 1312 1288 1313 /*----------------- 1289 1314 * OTHER METHODS
Note:
See TracChangeset
for help on using the changeset viewer.