Changeset 31991 in osm for applications/viewer/jmapviewer/src/org
- Timestamp:
- 2016-01-16T21:06:39+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r31904 r31991 44 44 public class JMapViewer extends JPanel implements TileLoaderListener { 45 45 46 /** whether debug mode is enabled or not */ 46 47 public static boolean debug; 47 48 … … 51 52 private static final Point[] move = {new Point(1, 0), new Point(0, 1), new Point(-1, 0), new Point(0, -1)}; 52 53 54 /** Maximum zoom level */ 53 55 public static final int MAX_ZOOM = 22; 56 /** Minimum zoom level */ 54 57 public static final int MIN_ZOOM = 0; 55 58 … … 82 85 protected JButton zoomOutButton; 83 86 87 /** 88 * Apparence of zoom controls. 89 */ 84 90 public enum ZOOM_BUTTON_STYLE { 91 /** Zoom buttons are displayed horizontally (default) */ 85 92 HORIZONTAL, 93 /** Zoom buttons are displayed vertically */ 86 94 VERTICAL 87 95 } … … 229 237 } 230 238 239 /** 240 * Sets the display position. 241 * @param x X coordinate 242 * @param y Y coordinate 243 * @param zoom zoom level, between {@link #MIN_ZOOM} and {@link #MAX_ZOOM} 244 */ 231 245 public void setDisplayPosition(int x, int y, int zoom) { 232 246 setDisplayPosition(new Point(getWidth() / 2, getHeight() / 2), x, y, zoom); 233 247 } 234 248 249 /** 250 * Sets the display position. 251 * @param mapPoint map point 252 * @param x X coordinate 253 * @param y Y coordinate 254 * @param zoom zoom level, between {@link #MIN_ZOOM} and {@link #MAX_ZOOM} 255 */ 235 256 public void setDisplayPosition(Point mapPoint, int x, int y, int zoom) { 236 257 if (zoom > tileController.getTileSource().getMaxZoom() || zoom < MIN_ZOOM) … … 865 886 * level can be obtained via {@link #getZoom()}. 866 887 * 867 * @param oldZoom 868 * the previous zoom level 888 * @param oldZoom the previous zoom level 869 889 */ 870 890 protected void zoomChanged(int oldZoom) { … … 876 896 } 877 897 898 /** 899 * Determines whether the tile grid is visible or not. 900 * @return {@code true} if the tile grid is visible, {@code false} otherwise 901 */ 878 902 public boolean isTileGridVisible() { 879 903 return tileGridVisible; 880 904 } 881 905 906 /** 907 * Sets whether the tile grid is visible or not. 908 * @param tileGridVisible {@code true} if the tile grid is visible, {@code false} otherwise 909 */ 882 910 public void setTileGridVisible(boolean tileGridVisible) { 883 911 this.tileGridVisible = tileGridVisible; … … 885 913 } 886 914 915 /** 916 * Determines whether {@link MapMarker}s are painted or not. 917 * @return {@code true} if {@link MapMarker}s are painted, {@code false} otherwise 918 */ 887 919 public boolean getMapMarkersVisible() { 888 920 return mapMarkersVisible; … … 901 933 } 902 934 935 /** 936 * Sets the list of {@link MapMarker}s. 937 * @param mapMarkerList list of {@link MapMarker}s 938 */ 903 939 public void setMapMarkerList(List<MapMarker> mapMarkerList) { 904 940 this.mapMarkerList = mapMarkerList; … … 906 942 } 907 943 944 /** 945 * Returns the list of {@link MapMarker}s. 946 * @return list of {@link MapMarker}s 947 */ 908 948 public List<MapMarker> getMapMarkerList() { 909 949 return mapMarkerList; 910 950 } 911 951 952 /** 953 * Sets the list of {@link MapRectangle}s. 954 * @param mapRectangleList list of {@link MapRectangle}s 955 */ 912 956 public void setMapRectangleList(List<MapRectangle> mapRectangleList) { 913 957 this.mapRectangleList = mapRectangleList; … … 915 959 } 916 960 961 /** 962 * Returns the list of {@link MapRectangle}s. 963 * @return list of {@link MapRectangle}s 964 */ 917 965 public List<MapRectangle> getMapRectangleList() { 918 966 return mapRectangleList; 919 967 } 920 968 969 /** 970 * Sets the list of {@link MapPolygon}s. 971 * @param mapPolygonList list of {@link MapPolygon}s 972 */ 921 973 public void setMapPolygonList(List<MapPolygon> mapPolygonList) { 922 974 this.mapPolygonList = mapPolygonList; … … 924 976 } 925 977 978 /** 979 * Returns the list of {@link MapPolygon}s. 980 * @return list of {@link MapPolygon}s 981 */ 926 982 public List<MapPolygon> getMapPolygonList() { 927 983 return mapPolygonList; 928 984 } 929 985 986 /** 987 * Add a {@link MapMarker}. 988 * @param marker map marker to add 989 */ 930 990 public void addMapMarker(MapMarker marker) { 931 991 mapMarkerList.add(marker); … … 933 993 } 934 994 995 /** 996 * Remove a {@link MapMarker}. 997 * @param marker map marker to remove 998 */ 935 999 public void removeMapMarker(MapMarker marker) { 936 1000 mapMarkerList.remove(marker); … … 938 1002 } 939 1003 1004 /** 1005 * Remove all {@link MapMarker}s. 1006 */ 940 1007 public void removeAllMapMarkers() { 941 1008 mapMarkerList.clear(); … … 943 1010 } 944 1011 1012 /** 1013 * Add a {@link MapRectangle}. 1014 * @param rectangle map rectangle to add 1015 */ 945 1016 public void addMapRectangle(MapRectangle rectangle) { 946 1017 mapRectangleList.add(rectangle); … … 948 1019 } 949 1020 1021 /** 1022 * Remove a {@link MapRectangle}. 1023 * @param rectangle map rectangle to remove 1024 */ 950 1025 public void removeMapRectangle(MapRectangle rectangle) { 951 1026 mapRectangleList.remove(rectangle); … … 953 1028 } 954 1029 1030 /** 1031 * Remove all {@link MapRectangle}s. 1032 */ 955 1033 public void removeAllMapRectangles() { 956 1034 mapRectangleList.clear(); … … 958 1036 } 959 1037 1038 /** 1039 * Add a {@link MapPolygon}. 1040 * @param polygon map polygon to add 1041 */ 960 1042 public void addMapPolygon(MapPolygon polygon) { 961 1043 mapPolygonList.add(polygon); … … 963 1045 } 964 1046 1047 /** 1048 * Remove a {@link MapPolygon}. 1049 * @param polygon map polygon to remove 1050 */ 965 1051 public void removeMapPolygon(MapPolygon polygon) { 966 1052 mapPolygonList.remove(polygon); … … 968 1054 } 969 1055 1056 /** 1057 * Remove all {@link MapPolygon}s. 1058 */ 970 1059 public void removeAllMapPolygons() { 971 1060 mapPolygonList.clear(); … … 973 1062 } 974 1063 1064 /** 1065 * Sets whether zoom controls are displayed or not. 1066 * @param visible {@code true} if zoom controls are displayed, {@code false} otherwise 1067 */ 975 1068 public void setZoomContolsVisible(boolean visible) { 976 1069 zoomSlider.setVisible(visible); … … 979 1072 } 980 1073 1074 /** 1075 * Determines whether zoom controls are displayed or not. 1076 * @return {@code true} if zoom controls are displayed, {@code false} otherwise 1077 */ 981 1078 public boolean getZoomControlsVisible() { 982 1079 return zoomSlider.isVisible(); 983 1080 } 984 1081 1082 /** 1083 * Sets the tile source. 1084 * @param tileSource tile source 1085 */ 985 1086 public void setTileSource(TileSource tileSource) { 986 1087 if (tileSource.getMaxZoom() > MAX_ZOOM) … … 1008 1109 } 1009 1110 1111 /** 1112 * Determines whether the {@link MapRectangle}s are painted or not. 1113 * @return {@code true} if the {@link MapRectangle}s are painted, {@code false} otherwise 1114 */ 1010 1115 public boolean isMapRectanglesVisible() { 1011 1116 return mapRectanglesVisible; … … 1013 1118 1014 1119 /** 1015 * Enables or disables painting of the {@link MapRectangle} 1120 * Enables or disables painting of the {@link MapRectangle}s. 1016 1121 * 1017 1122 * @param mapRectanglesVisible {@code true} to enable painting of rectangles … … 1024 1129 } 1025 1130 1131 /** 1132 * Determines whether the {@link MapPolygon}s are painted or not. 1133 * @return {@code true} if the {@link MapPolygon}s are painted, {@code false} otherwise 1134 */ 1026 1135 public boolean isMapPolygonsVisible() { 1027 1136 return mapPolygonsVisible; … … 1029 1138 1030 1139 /** 1031 * Enables or disables painting of the {@link MapPolygon} 1140 * Enables or disables painting of the {@link MapPolygon}s. 1032 1141 * 1033 1142 * @param mapPolygonsVisible {@code true} to enable painting of polygons … … 1040 1149 } 1041 1150 1151 /** 1152 * Determines whether scroll wrap is enabled or not. 1153 * @return {@code true} if scroll wrap is enabled, {@code false} otherwise 1154 */ 1042 1155 public boolean isScrollWrapEnabled() { 1043 1156 return scrollWrapEnabled; 1044 1157 } 1045 1158 1159 /** 1160 * Sets whether scroll wrap is enabled or not. 1161 * @param scrollWrapEnabled {@code true} if scroll wrap is enabled, {@code false} otherwise 1162 */ 1046 1163 public void setScrollWrapEnabled(boolean scrollWrapEnabled) { 1047 1164 this.scrollWrapEnabled = scrollWrapEnabled; … … 1049 1166 } 1050 1167 1168 /** 1169 * Returns the zoom controls apparence style (horizontal/vertical). 1170 * @return {@link ZOOM_BUTTON_STYLE#VERTICAL} or {@link ZOOM_BUTTON_STYLE#HORIZONTAL} 1171 */ 1051 1172 public ZOOM_BUTTON_STYLE getZoomButtonStyle() { 1052 1173 return zoomButtonStyle; 1053 1174 } 1054 1175 1176 /** 1177 * Sets the zoom controls apparence style (horizontal/vertical). 1178 * @param style {@link ZOOM_BUTTON_STYLE#VERTICAL} or {@link ZOOM_BUTTON_STYLE#HORIZONTAL} 1179 */ 1055 1180 public void setZoomButtonStyle(ZOOM_BUTTON_STYLE style) { 1056 1181 zoomButtonStyle = style; … … 1059 1184 } 1060 1185 switch (style) { 1061 case HORIZONTAL:1062 zoomSlider.setBounds(10, 10, 30, 150);1063 zoomInButton.setBounds(4, 155, 18, 18);1064 zoomOutButton.setBounds(26, 155, 18, 18);1065 break;1066 1186 case VERTICAL: 1067 1187 zoomSlider.setBounds(10, 27, 30, 150); … … 1069 1189 zoomOutButton.setBounds(14, 176, 20, 20); 1070 1190 break; 1191 case HORIZONTAL: 1071 1192 default: 1072 1193 zoomSlider.setBounds(10, 10, 30, 150); … … 1078 1199 } 1079 1200 1201 /** 1202 * Returns the tile controller. 1203 * @return the tile controller 1204 */ 1080 1205 public TileController getTileController() { 1081 1206 return tileController; … … 1091 1216 } 1092 1217 1218 /** 1219 * Sets the tile loader. 1220 * @param loader tile loader 1221 */ 1093 1222 public void setTileLoader(TileLoader loader) { 1094 1223 tileController.setTileLoader(loader); 1095 1224 } 1096 1225 1226 /** 1227 * Returns attribution. 1228 * @return attribution 1229 */ 1097 1230 public AttributionSupport getAttribution() { 1098 1231 return attribution;
Note:
See TracChangeset
for help on using the changeset viewer.