- Timestamp:
- 2011-02-02T16:56:07+01:00 (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r3717 r3844 1216 1216 1217 1217 for (Relation r : CombineWayAction.getParentRelations(selectedWays)) { 1218 if (r.isDeleted() || 1219 r.get("type") == null || 1220 !r.get("type").equalsIgnoreCase("multipolygon")) { 1218 if (r.isDeleted() || !r.isMultipolygon()) { 1221 1219 continue; 1222 1220 } … … 1390 1388 1391 1389 for (RelationRole r : rels) { 1392 if (r.rel.get("type") != null && 1393 r.rel.get("type").equalsIgnoreCase("multipolygon") && 1394 r.role.equalsIgnoreCase("outer") 1395 ) { 1390 if (r.rel.isMultipolygon() && r.role.equalsIgnoreCase("outer")) { 1396 1391 multiouters.add(r); 1397 1392 continue; -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r3843 r3844 560 560 public PrimitiveId getPrimitiveId() { 561 561 return new SimplePrimitiveId(getUniqueId(), getType()); 562 } 563 564 public OsmPrimitiveType getDisplayType() { 565 return getType(); 562 566 } 563 567 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java
r3440 r3844 10 10 NODE (marktr("node"), Node.class, NodeData.class), 11 11 WAY (marktr("way"), Way.class, WayData.class), 12 RELATION (marktr("relation"), Relation.class, RelationData.class); 12 RELATION (marktr("relation"), Relation.class, RelationData.class), 13 14 /* only for display, no real type */ 15 CLOSEDWAY (marktr("closedway"), Way.class, WayData.class), 16 MULTIPOLYGON (marktr("multipolygon"), Relation.class, RelationData.class); 13 17 14 18 private final String apiTypeName; -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r3719 r3844 371 371 } 372 372 373 public OsmPrimitiveType getDisplayType() { 374 return isMultipolygon() ? OsmPrimitiveType.MULTIPOLYGON 375 : OsmPrimitiveType.RELATION; 376 } 377 378 public boolean isMultipolygon() { 379 return "multipolygon".equals(get("type")); 380 } 381 373 382 @Override 374 383 public BBox getBBox() { -
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r3719 r3844 54 54 public boolean isWay() { 55 55 return member instanceof Way; 56 } 57 58 /** 59 * 60 * @return type of member for icon display 61 * @since 3844 62 */ 63 public OsmPrimitiveType getDisplayType() { 64 return member.getDisplayType(); 56 65 } 57 66 -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r3836 r3844 429 429 } 430 430 431 @Override 432 public OsmPrimitiveType getDisplayType() { 433 return isClosed() ? OsmPrimitiveType.CLOSEDWAY : OsmPrimitiveType.WAY; 434 } 435 431 436 private void checkNodes() { 432 437 DataSet dataSet = getDataSet(); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r3836 r3844 128 128 public void visit(Relation r) { 129 129 nonClosedWays.clear(); 130 if ( "multipolygon".equals(r.get("type"))) {130 if (r.isMultipolygon()) { 131 131 checkMembersAndRoles(r); 132 132 -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java
r3674 r3844 111 111 if (type != null && !w.isClosed()) { 112 112 for (OsmPrimitive parent: w.getReferrers()) { 113 if (parent instanceof Relation && "multipolygon".equals(parent.get("type")))113 if (parent instanceof Relation && ((Relation)parent).isMultipolygon()) 114 114 return; 115 115 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r3671 r3844 114 114 multipolygonways = new LinkedList<Way>(); 115 115 for (Relation r : Main.main.getCurrentDataSet().getRelations()) { 116 if (r.isUsable() && "multipolygon".equals(r.get("type"))) {116 if (r.isUsable() && r.isMultipolygon()) { 117 117 for (RelationMember m : r.getMembers()) { 118 118 if (m.getMember() != null && m.getMember() instanceof Way && -
trunk/src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java
r2885 r3844 68 68 if (def != null && value != null && def instanceof JLabel) { 69 69 ((JLabel)def).setText(getComponentText(value)); 70 ((JLabel)def).setIcon(ImageProvider.get(value.getType())); 70 ((JLabel)def).setIcon(ImageProvider.get(value.getDisplayType())); 71 71 ((JLabel)def).setToolTipText(getComponentToolTipText(value)); 72 72 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRenderer.java
r3083 r3844 38 38 public final static Color BGCOLOR_FROZEN = new Color(234,234,234); 39 39 40 private ImageIcon nodeIcon;41 private ImageIcon wayIcon;42 private ImageIcon relationIcon;43 40 private Border rowNumberBorder = null; 44 45 /**46 * Load the image icon for an OSM primitive of type node47 *48 * @return the icon; null, if not found49 */50 protected void loadIcons() {51 nodeIcon = ImageProvider.get("data", "node");52 wayIcon = ImageProvider.get("data", "way");53 relationIcon = ImageProvider.get("data", "relation");54 }55 41 56 42 /** … … 60 46 setIcon(null); 61 47 setOpaque(true); 62 loadIcons();63 48 rowNumberBorder = BorderFactory.createEmptyBorder(0,4,0,0); 64 49 } … … 156 141 setText(displayName); 157 142 setToolTipText(buildToolTipText(member.getMember())); 158 if (member.isNode()) { 159 setIcon(nodeIcon); 160 } else if (member.isWay()) { 161 setIcon(wayIcon); 162 } else if (member.isRelation()) { 163 setIcon(relationIcon); 164 } else { 165 // should not happen 166 setIcon(null); 167 } 143 setIcon(ImageProvider.get(member.getDisplayType())); 168 144 } 169 145 -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r3843 r3844 103 103 for (OsmPrimitive referrer : osm.getReferrers()) { 104 104 Relation r = (Relation) referrer; 105 if (!drawMultipolygon || ! "multipolygon".equals(r.get("type")) || !r.isUsable()) {105 if (!drawMultipolygon || !r.isMultipolygon() || !r.isUsable()) { 106 106 continue; 107 107 } … … 150 150 for (OsmPrimitive referrer : osm.getReferrers()) { 151 151 Relation ref = (Relation) referrer; 152 if (!drawMultipolygon || ! "multipolygon".equals(ref.get("type"))|| !ref.isUsable()) {152 if (!drawMultipolygon || !ref.isMultipolygon() || !ref.isUsable()) { 153 153 continue; 154 154 } … … 184 184 { 185 185 Pair<StyleList, Range> p = generateStyles(osm, scale, null, true); 186 if (drawMultipolygon && "multipolygon".equals(osm.get("type"))) {186 if (drawMultipolygon && ((Relation)osm).isMultipolygon()) { 187 187 if (!Utils.exists(p.a, AreaElemStyle.class)) { 188 188 // look at outer ways to find area style … … 235 235 addIfNotNull(sl, NodeElemStyle.create(c)); 236 236 } else if (osm instanceof Relation) { 237 if ( "multipolygon".equals(osm.get("type"))) {237 if (((Relation)osm).isMultipolygon()) { 238 238 addIfNotNull(sl, AreaElemStyle.create(c)); 239 239 addIfNotNull(sl, LineElemStyle.createLine(c)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r3843 r3844 67 67 while(parser.hasNext()) { 68 68 } 69 69 70 70 } catch(IOException e) { 71 71 System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString())); … … 278 278 } 279 279 } 280 } else if (osm instanceof Way || (osm instanceof Relation && "multipolygon".equals(osm.get("type")))) {280 } else if (osm instanceof Way || (osm instanceof Relation && ((Relation)osm).isMultipolygon())) { 281 281 WayPrototypesRecord p = new WayPrototypesRecord(); 282 282 get(osm, pretendWayIsClosed || !(osm instanceof Way) || ((Way) osm).isClosed(), p, (useMinMaxScale ? scale : null), mc);
Note:
See TracChangeset
for help on using the changeset viewer.