Changeset 17520 in osm
- Timestamp:
- 2009-09-08T17:08:26+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/openstreetbugs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/openstreetbugs/build.xml
r17354 r17520 26 26 <attribute name="Plugin-Description" value="Imports issues from OpenStreetBugs"/> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/OpenStreetBugs"/> 28 <attribute name="Plugin-Mainversion" value="20 10"/>28 <attribute name="Plugin-Mainversion" value="2067"/> 29 29 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 30 30 </manifest> -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbLayer.java
r17410 r17520 68 68 69 69 private JToolTip tooltip = new JToolTip(); 70 70 71 71 private static ImageIcon iconError = OsbPlugin.loadIcon("icon_error16.png"); 72 72 private static ImageIcon iconValid = OsbPlugin.loadIcon("icon_valid16.png"); … … 83 83 // if the map layer has been closed, while we are requesting the osb db, 84 84 // the mapframe is null, so we check that, before installing the mouse listener 85 if(Main.map != null && Main.map.mapView != null) { 85 if(Main.map != null && Main.map.mapView != null) { 86 86 Main.map.mapView.addMouseListener(this); 87 87 } … … 125 125 126 126 // don't paint deleted nodes 127 if( node.deleted)127 if(!node.isUsable()) 128 128 continue; 129 129 … … 140 140 }); 141 141 } 142 142 143 143 if(selection == null) 144 144 return; 145 145 146 146 // This loop renders the selection border and tooltips so they get drawn 147 147 // on top of the bug icons 148 148 for (int i = 0; i < nodes.length; i++) { 149 149 Node node = (Node) nodes[i]; 150 151 if( node.deleted|| !selection.contains(node))152 continue; 153 150 151 if(!node.isUsable() || !selection.contains(node)) 152 continue; 153 154 154 // draw selection border 155 155 Point p = mv.getPoint(node); 156 156 157 157 ImageIcon icon = ("1".equals(node.get("state"))) ? iconValid : iconError; 158 158 int width = icon.getIconWidth(); 159 159 int height = icon.getIconHeight(); 160 160 161 161 g.setColor(ColorHelper.html2color(Main.pref.get("color.selected"))); 162 g.drawRect(p.x - (width / 2), p.y - (height / 2), 16, 16);163 162 g.drawRect(p.x-(width/2), p.y-(height/2), width-1, height-1); 163 164 164 // draw description 165 165 String desc = node.get("note"); … … 175 175 // draw description as a tooltip 176 176 tooltip.setTipText(desc); 177 177 178 178 int tx = p.x + (width / 2) + 5; 179 179 int ty = (int)(p.y - height / 2) -1; 180 180 g.translate(tx, ty); 181 181 182 182 // This limits the width of the tooltip to 2/3 of the drawing 183 183 // area, which makes longer tooltips actually readable (they 184 184 // would disappear if scrolled too much to the right) 185 185 186 186 // Need to do this twice as otherwise getPreferredSize doesn't take 187 187 // the reduced width into account 188 188 for(int x = 0; x < 2; x++) { 189 Dimension d = tooltip.getUI().getPreferredSize(tooltip); 189 Dimension d = tooltip.getUI().getPreferredSize(tooltip); 190 190 d.width = Math.min(d.width, (int)(mv.getWidth()*2/3)); 191 191 tooltip.setSize(d); 192 192 tooltip.paint(g); 193 193 } 194 194 195 195 g.translate(-tx, -ty); 196 196 } … … 210 210 Node minPrimitive = null; 211 211 for (Node n : data.nodes) { 212 if ( n.deleted || n.incomplete)212 if (!n.isUsable()) 213 213 continue; 214 214 Point sp = Main.map.mapView.getPoint(n); -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/DownloadAction.java
r16290 r17520 85 85 double lon = Double.parseDouble(m.group(2)); 86 86 LatLon latlon = new LatLon(lat, lon); 87 Node osmNode = new Node(latlon); 88 osmNode.id = Long.parseLong(m.group(1)); 87 Node osmNode = new Node(Long.parseLong(m.group(1))); 88 osmNode.setCoor(latlon); 89 osmNode.incomplete = false; 89 90 osmNode.put("id", m.group(1)); 90 91 osmNode.put("note", m.group(4)); -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java
r17354 r17520 79 79 80 80 public class OsbDialog extends ToggleDialog implements OsbObserver, ListSelectionListener, LayerChangeListener, 81 81 DataChangeListener, MouseListener, OsbActionObserver { 82 82 83 83 private static final long serialVersionUID = 1L; … … 188 188 189 189 for (Node node : sortedList) { 190 if ( !node.deleted) {190 if (node.isUsable()) { 191 191 model.addElement(new OsbListItem(node)); 192 192 } … … 218 218 219 219 OsbAction.setSelectedNode(node); 220 221 220 scrollToSelected(node); 222 223 if (fireSelectionChanged) { 224 Main.main.getCurrentDataSet().setSelected(selected); 225 } 221 } 222 223 // CurrentDataSet may be null if there is no normal, edible map 224 // If so, a temporary DataSet is created because it's the simplest way 225 // to fire all necessary events so OSB updates its popups. 226 DataSet ds = Main.main.getCurrentDataSet(); 227 if (fireSelectionChanged) { 228 if(ds == null) 229 ds = new DataSet(); 230 ds.setSelected(selected); 226 231 } 227 232 } … … 230 235 for (int i = 0; i < model.getSize(); i++) { 231 236 Node current = ((OsbListItem) model.get(i)).getNode(); 232 if (current. id == node.id) {237 if (current.getId()== node.getId()) { 233 238 list.scrollRectToVisible(list.getCellBounds(i, i)); 234 239 list.setSelectedIndex(i); … … 320 325 }); 321 326 } 322 323 324 325 326 327 328 329 330 327 328 @Override 329 public void showDialog() { 330 if (!downloaded) { 331 initialDownload(); 332 downloaded = true; 333 } 334 super.showDialog(); 335 } 331 336 } -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbListItem.java
r13497 r17520 63 63 OsbListItem other = (OsbListItem)obj; 64 64 if(getNode() != null && other.getNode() != null) { 65 return getNode(). id == other.getNode().id;65 return getNode().getId() == other.getNode().getId(); 66 66 } 67 67 }
Note:
See TracChangeset
for help on using the changeset viewer.