Changeset 29244 in osm for applications/viewer/jmapviewer/src/org/openstreetmap/gui
- Timestamp:
- 2013-02-10T23:21:45+01:00 (12 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java
r26806 r29244 107 107 } 108 108 109 public boolean handleAttributionCursor(Point p) { 110 if (attrTextBounds != null && attrTextBounds.contains(p)) { 111 return true; 112 } else if (attrImageBounds != null && attrImageBounds.contains(p)) { 113 return true; 114 } else if (attrToUBounds != null && attrToUBounds.contains(p)) { 115 return true; 116 } 117 return false; 118 } 119 109 120 public boolean handleAttribution(Point p, boolean click) { 110 121 if (source == null || !source.requiresAttribution()) 111 122 return false; 112 113 /* TODO: Somehow indicate the link is clickable state to user */114 123 115 124 if (attrTextBounds != null && attrTextBounds.contains(p)) { -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Demo.java
r29170 r29244 4 4 5 5 import java.awt.BorderLayout; 6 import java.awt.Cursor; 6 7 import java.awt.event.ActionEvent; 7 8 import java.awt.event.ActionListener; 8 9 import java.awt.event.ItemEvent; 9 10 import java.awt.event.ItemListener; 11 import java.awt.event.MouseAdapter; 12 import java.awt.event.MouseEvent; 10 13 import java.io.IOException; 11 14 … … 162 165 // map.setDisplayPositionByLatLon(49.807, 8.6, 11); 163 166 // map.setTileGridVisible(true); 167 168 map.addMouseListener(new MouseAdapter() { 169 @Override 170 public void mouseClicked(MouseEvent e) { 171 if (e.getButton() == MouseEvent.BUTTON1) { 172 map.getAttribution().handleAttribution(e.getPoint(), true); 173 } 174 } 175 }); 176 177 map.addMouseMotionListener(new MouseAdapter() { 178 @Override 179 public void mouseMoved(MouseEvent e) { 180 boolean cursorHand = map.getAttribution().handleAttributionCursor(e.getPoint()); 181 if (cursorHand) { 182 map.setCursor(new Cursor(Cursor.HAND_CURSOR)); 183 } else { 184 map.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); 185 } 186 } 187 }); 164 188 } 165 189 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r29193 r29244 1022 1022 } 1023 1023 1024 public AttributionSupport getAttribution() { 1025 return attribution; 1026 } 1027 1024 1028 protected EventListenerList listenerList = new EventListenerList(); 1025 1029
Note:
See TracChangeset
for help on using the changeset viewer.