Changeset 31427 in osm for applications/viewer/jmapviewer/src/org
- Timestamp:
- 2015-08-01T18:19:40+02:00 (9 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Coordinate.java
r30900 r31427 6 6 import java.io.ObjectInputStream; 7 7 import java.io.ObjectOutputStream; 8 import java.io.Serializable;9 8 import java.util.Objects; 10 9 … … 18 17 * 19 18 */ 20 public class Coordinate implements Serializable,ICoordinate {19 public class Coordinate implements ICoordinate { 21 20 private transient Point2D.Double data; 22 21 … … 52 51 } 53 52 53 @Override 54 54 public String toString() { 55 55 return "Coordinate[" + data.y + ", " + data.x + "]"; -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r31310 r31427 89 89 protected ZOOM_BUTTON_STYLE zoomButtonStyle; 90 90 91 protected TileSource tileSource;91 protected transient TileSource tileSource; 92 92 93 93 protected AttributionSupport attribution = new AttributionSupport(); … … 263 263 int mapZoomMax = tileController.getTileSource().getMaxZoom(); 264 264 265 if (markers ) {265 if (markers && mapMarkerList != null) { 266 266 synchronized (mapMarkerList) { 267 267 for (MapMarker marker : mapMarkerList) { … … 277 277 } 278 278 279 if (rectangles ) {279 if (rectangles && mapRectangleList != null) { 280 280 synchronized (mapRectangleList) { 281 281 for (MapRectangle rectangle : mapRectangleList) { … … 292 292 } 293 293 294 if (polygons ) {294 if (polygons && mapPolygonList != null) { 295 295 synchronized (mapPolygonList) { 296 296 for (MapPolygon polygon : mapPolygonList) { -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewerTree.java
r30900 r31427 41 41 super(); 42 42 splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); 43 43 44 44 tree = new CheckBoxTree(name); 45 45 treePanel = new JPanel(); … … 51 51 splitPane.setOneTouchExpandable(true); 52 52 splitPane.setDividerLocation(150); 53 53 54 54 //Provide minimum sizes for the two components in the split pane 55 55 Dimension minimumSize = new Dimension(100, 50); … … 60 60 setTreeVisible(treeVisible); 61 61 tree.addNodeListener(new MouseAdapter() { 62 @Override 62 63 public void mousePressed(MouseEvent e) { 63 64 maybeShowPopup(e); 64 65 } 66 @Override 65 67 public void mouseReleased(MouseEvent e) { 66 68 maybeShowPopup(e); … … 68 70 private void maybeShowPopup(MouseEvent e) { 69 71 if (e.isPopupTrigger()) { 70 e.getSource();71 72 AbstractLayer layer = ((CheckBoxNodePanel)e.getComponent()).getData().getAbstractLayer(); 72 73 if(layer!=null) … … 79 80 JMenuItem menuItemShow = new JMenuItem("show texts"); 80 81 JMenuItem menuItemHide = new JMenuItem("hide texts"); 81 82 82 83 //Create the popup menu. 83 84 JPopupMenu popup = new JPopupMenu(); 84 85 85 86 // Create items 86 87 if(layer.isVisibleTexts()==null){ … … 89 90 }else if(layer.isVisibleTexts()) popup.add(menuItemHide); 90 91 else popup.add(menuItemShow); 91 92 92 93 menuItemShow.addActionListener(new ActionListener(){ 93 94 @Override … … 106 107 } 107 108 }); 108 109 109 110 return popup; 110 111 } … … 143 144 } 144 145 public void addMapObject(MapObject o){ 145 146 146 147 } 147 148 public void setTreeVisible(boolean visible){ -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
r30900 r31427 98 98 if(job.getTile() != null) { 99 99 for(TileJob oldJob : jobQueue) { 100 if (oldJob.getTile() == job.getTile()) {100 if (job.getTile().equals(oldJob.getTile())) { 101 101 return; 102 102 } … … 104 104 } 105 105 jobQueue.put(job); 106 if (workerThreadIdleCount == 0 && workerThreadCount < workerThreadMaxCount) 107 addWorkerThread(); 106 synchronized (this) { 107 if (workerThreadIdleCount == 0 && workerThreadCount < workerThreadMaxCount) 108 addWorkerThread(); 109 } 108 110 } catch (InterruptedException e) { 109 111 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/LayerGroup.java
r30900 r31427 6 6 public class LayerGroup extends AbstractLayer{ 7 7 private List<AbstractLayer> layers; 8 8 9 9 public LayerGroup(String name){ 10 10 super(name); … … 41 41 return this; 42 42 } 43 public void calculateVisibleTexts() {43 public void calculateVisibleTexts() { 44 44 Boolean calculate=null; 45 if (layers!=null&&layers.size()>0){45 if (layers!=null&&layers.size()>0){ 46 46 calculate=layers.get(0).isVisibleTexts(); 47 for (int i=1;i<layers.size(); i++){47 for (int i=1;i<layers.size(); i++){ 48 48 calculate = resultOf(calculate, layers.get(i).isVisibleTexts()); 49 49 } … … 52 52 if(getParent()!=null) getParent().calculateVisibleTexts(); 53 53 } 54 public Boolean resultOf(Boolean b1, Boolean b2){ 55 if(b1==null||b2==null) return null; 56 else if(b1.booleanValue() == b2.booleanValue()) return b1.booleanValue(); 57 else return null; 54 public Boolean resultOf(Boolean b1, Boolean b2) { 55 if (b1 != null && b1.equals(b2)) { 56 return b1; 57 } 58 return Boolean.FALSE; 58 59 } 59 60 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/MapObjectImpl.java
r30900 r31427 69 69 if(style!=null) style.setStroke(stroke); 70 70 } 71 71 72 72 public Font getFont() { 73 73 Style styleAssigned = getStyleAssigned(); … … 95 95 public static Font getDefaultFont(){ 96 96 Font f = UIManager.getDefaults().getFont("TextField.font"); 97 if (f == null) { 98 f = Font.decode(null); 99 } 97 100 return new Font(f.getName(), Font.BOLD, f.getSize()); 98 101 } 102 99 103 public void paintText(Graphics g, Point position) { 100 104 if(name!=null && g!=null && position!=null){ -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java
r30900 r31427 91 91 92 92 @Override 93 public int getTileCount() {93 public synchronized int getTileCount() { 94 94 return hash.size(); 95 95 } 96 96 97 public int getCacheSize() {97 public synchronized int getCacheSize() { 98 98 return cacheSize; 99 99 } … … 117 117 protected static class CacheEntry { 118 118 Tile tile; 119 120 119 CacheEntry next; 121 120 CacheEntry prev; … … 124 123 this.tile = tile; 125 124 } 126 127 public Tile getTile() {128 return tile;129 }130 131 public CacheEntry getNext() {132 return next;133 }134 135 public CacheEntry getPrev() {136 return prev;137 }138 139 125 } 140 126 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java
r31143 r31427 278 278 if (zoom != other.zoom) 279 279 return false; 280 if (!getTileSource().equals(other.getTileSource())) { 281 return false; 282 } 280 283 return true; 281 284 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java
r30900 r31427 21 21 /** 22 22 * JTree for checkBox Tree Layers 23 * 23 * 24 24 * @author galo 25 25 */ … … 27 27 /** Serial Version UID */ 28 28 private static final long serialVersionUID = 6943401106938034256L; 29 29 30 30 private final CheckBoxNodeEditor editor; 31 31 … … 48 48 setCellEditor(editor); 49 49 setEditable(true); 50 50 51 51 // listen for changes in the model (including check box toggles) 52 52 getModel().addTreeModelListener(new TreeModelListener() { … … 121 121 private static Boolean childStatus(DefaultMutableTreeNode node){ 122 122 Boolean status = data(node.getChildAt(0)).isSelected(); 123 for(int i=1; i<node.getChildCount()&&status!=null; i++){ 124 if(status != data(node.getChildAt(i)).isSelected()) return null; 123 for (int i=1; i<node.getChildCount() && status!=null; i++){ 124 if (!status.equals( 125 data(node.getChildAt(i)).isSelected() 126 )) 127 return null; 125 128 } 126 129 return status; … … 132 135 CheckBoxNodeData dataParent = data(parent); 133 136 Boolean childStatus = childStatus(parent); 134 if( dataParent.isSelected()!=childStatus){137 if(childStatus != null && !childStatus.equals(dataParent.isSelected())) { 135 138 dataParent.setSelected(childStatus); 136 139 changeParents(parent); … … 148 151 for(int i=0; i<node.getChildCount(); i++){ 149 152 DefaultMutableTreeNode childNode = node(node.getChildAt(i)); 150 if ( data(childNode).isSelected() !=data(node).isSelected()){153 if (!data(childNode).isSelected().equals(data(node).isSelected())){ 151 154 data(childNode).setSelected(data(node).isSelected()); 152 155 setChildrens(childNode, value); … … 216 219 public DefaultMutableTreeNode add(DefaultMutableTreeNode parent, final AbstractLayer layer){ 217 220 layer.setVisible(data(parent).isSelected()); 218 DefaultMutableTreeNode node = createNode(layer); 221 DefaultMutableTreeNode node = createNode(layer); 219 222 parent.add(node); 220 223 ((DefaultTreeModel)getModel()).reload(); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
r31301 r31427 61 61 } 62 62 63 protected class Attribution {63 protected static class Attribution { 64 64 String attribution; 65 65 int minZoom; -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TileSourceInfo.java
r31301 r31427 30 30 31 31 /** cookies that needs to be sent to tile source */ 32 protected String cookies ;32 protected String cookies = ""; 33 33 34 34 /** tile size of the displayed tiles */
Note:
See TracChangeset
for help on using the changeset viewer.