Ignore:
Timestamp:
2016-01-16T21:06:39+01:00 (9 years ago)
Author:
donvip
Message:

javadoc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java

    r31904 r31991  
    4444public class JMapViewer extends JPanel implements TileLoaderListener {
    4545
     46    /** whether debug mode is enabled or not */
    4647    public static boolean debug;
    4748
     
    5152    private static final Point[] move = {new Point(1, 0), new Point(0, 1), new Point(-1, 0), new Point(0, -1)};
    5253
     54    /** Maximum zoom level */
    5355    public static final int MAX_ZOOM = 22;
     56    /** Minimum zoom level */
    5457    public static final int MIN_ZOOM = 0;
    5558
     
    8285    protected JButton zoomOutButton;
    8386
     87    /**
     88     * Apparence of zoom controls.
     89     */
    8490    public enum ZOOM_BUTTON_STYLE {
     91        /** Zoom buttons are displayed horizontally (default) */
    8592        HORIZONTAL,
     93        /** Zoom buttons are displayed vertically */
    8694        VERTICAL
    8795    }
     
    229237    }
    230238
     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     */
    231245    public void setDisplayPosition(int x, int y, int zoom) {
    232246        setDisplayPosition(new Point(getWidth() / 2, getHeight() / 2), x, y, zoom);
    233247    }
    234248
     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     */
    235256    public void setDisplayPosition(Point mapPoint, int x, int y, int zoom) {
    236257        if (zoom > tileController.getTileSource().getMaxZoom() || zoom < MIN_ZOOM)
     
    865886     * level can be obtained via {@link #getZoom()}.
    866887     *
    867      * @param oldZoom
    868      *            the previous zoom level
     888     * @param oldZoom the previous zoom level
    869889     */
    870890    protected void zoomChanged(int oldZoom) {
     
    876896    }
    877897
     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     */
    878902    public boolean isTileGridVisible() {
    879903        return tileGridVisible;
    880904    }
    881905
     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     */
    882910    public void setTileGridVisible(boolean tileGridVisible) {
    883911        this.tileGridVisible = tileGridVisible;
     
    885913    }
    886914
     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     */
    887919    public boolean getMapMarkersVisible() {
    888920        return mapMarkersVisible;
     
    901933    }
    902934
     935    /**
     936     * Sets the list of {@link MapMarker}s.
     937     * @param mapMarkerList list of {@link MapMarker}s
     938     */
    903939    public void setMapMarkerList(List<MapMarker> mapMarkerList) {
    904940        this.mapMarkerList = mapMarkerList;
     
    906942    }
    907943
     944    /**
     945     * Returns the list of {@link MapMarker}s.
     946     * @return list of {@link MapMarker}s
     947     */
    908948    public List<MapMarker> getMapMarkerList() {
    909949        return mapMarkerList;
    910950    }
    911951
     952    /**
     953     * Sets the list of {@link MapRectangle}s.
     954     * @param mapRectangleList list of {@link MapRectangle}s
     955     */
    912956    public void setMapRectangleList(List<MapRectangle> mapRectangleList) {
    913957        this.mapRectangleList = mapRectangleList;
     
    915959    }
    916960
     961    /**
     962     * Returns the list of {@link MapRectangle}s.
     963     * @return list of {@link MapRectangle}s
     964     */
    917965    public List<MapRectangle> getMapRectangleList() {
    918966        return mapRectangleList;
    919967    }
    920968
     969    /**
     970     * Sets the list of {@link MapPolygon}s.
     971     * @param mapPolygonList list of {@link MapPolygon}s
     972     */
    921973    public void setMapPolygonList(List<MapPolygon> mapPolygonList) {
    922974        this.mapPolygonList = mapPolygonList;
     
    924976    }
    925977
     978    /**
     979     * Returns the list of {@link MapPolygon}s.
     980     * @return list of {@link MapPolygon}s
     981     */
    926982    public List<MapPolygon> getMapPolygonList() {
    927983        return mapPolygonList;
    928984    }
    929985
     986    /**
     987     * Add a {@link MapMarker}.
     988     * @param marker map marker to add
     989     */
    930990    public void addMapMarker(MapMarker marker) {
    931991        mapMarkerList.add(marker);
     
    933993    }
    934994
     995    /**
     996     * Remove a {@link MapMarker}.
     997     * @param marker map marker to remove
     998     */
    935999    public void removeMapMarker(MapMarker marker) {
    9361000        mapMarkerList.remove(marker);
     
    9381002    }
    9391003
     1004    /**
     1005     * Remove all {@link MapMarker}s.
     1006     */
    9401007    public void removeAllMapMarkers() {
    9411008        mapMarkerList.clear();
     
    9431010    }
    9441011
     1012    /**
     1013     * Add a {@link MapRectangle}.
     1014     * @param rectangle map rectangle to add
     1015     */
    9451016    public void addMapRectangle(MapRectangle rectangle) {
    9461017        mapRectangleList.add(rectangle);
     
    9481019    }
    9491020
     1021    /**
     1022     * Remove a {@link MapRectangle}.
     1023     * @param rectangle map rectangle to remove
     1024     */
    9501025    public void removeMapRectangle(MapRectangle rectangle) {
    9511026        mapRectangleList.remove(rectangle);
     
    9531028    }
    9541029
     1030    /**
     1031     * Remove all {@link MapRectangle}s.
     1032     */
    9551033    public void removeAllMapRectangles() {
    9561034        mapRectangleList.clear();
     
    9581036    }
    9591037
     1038    /**
     1039     * Add a {@link MapPolygon}.
     1040     * @param polygon map polygon to add
     1041     */
    9601042    public void addMapPolygon(MapPolygon polygon) {
    9611043        mapPolygonList.add(polygon);
     
    9631045    }
    9641046
     1047    /**
     1048     * Remove a {@link MapPolygon}.
     1049     * @param polygon map polygon to remove
     1050     */
    9651051    public void removeMapPolygon(MapPolygon polygon) {
    9661052        mapPolygonList.remove(polygon);
     
    9681054    }
    9691055
     1056    /**
     1057     * Remove all {@link MapPolygon}s.
     1058     */
    9701059    public void removeAllMapPolygons() {
    9711060        mapPolygonList.clear();
     
    9731062    }
    9741063
     1064    /**
     1065     * Sets whether zoom controls are displayed or not.
     1066     * @param visible {@code true} if zoom controls are displayed, {@code false} otherwise
     1067     */
    9751068    public void setZoomContolsVisible(boolean visible) {
    9761069        zoomSlider.setVisible(visible);
     
    9791072    }
    9801073
     1074    /**
     1075     * Determines whether zoom controls are displayed or not.
     1076     * @return {@code true} if zoom controls are displayed, {@code false} otherwise
     1077     */
    9811078    public boolean getZoomControlsVisible() {
    9821079        return zoomSlider.isVisible();
    9831080    }
    9841081
     1082    /**
     1083     * Sets the tile source.
     1084     * @param tileSource tile source
     1085     */
    9851086    public void setTileSource(TileSource tileSource) {
    9861087        if (tileSource.getMaxZoom() > MAX_ZOOM)
     
    10081109    }
    10091110
     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     */
    10101115    public boolean isMapRectanglesVisible() {
    10111116        return mapRectanglesVisible;
     
    10131118
    10141119    /**
    1015      * Enables or disables painting of the {@link MapRectangle}
     1120     * Enables or disables painting of the {@link MapRectangle}s.
    10161121     *
    10171122     * @param mapRectanglesVisible {@code true} to enable painting of rectangles
     
    10241129    }
    10251130
     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     */
    10261135    public boolean isMapPolygonsVisible() {
    10271136        return mapPolygonsVisible;
     
    10291138
    10301139    /**
    1031      * Enables or disables painting of the {@link MapPolygon}
     1140     * Enables or disables painting of the {@link MapPolygon}s.
    10321141     *
    10331142     * @param mapPolygonsVisible {@code true} to enable painting of polygons
     
    10401149    }
    10411150
     1151    /**
     1152     * Determines whether scroll wrap is enabled or not.
     1153     * @return {@code true} if scroll wrap is enabled, {@code false} otherwise
     1154     */
    10421155    public boolean isScrollWrapEnabled() {
    10431156        return scrollWrapEnabled;
    10441157    }
    10451158
     1159    /**
     1160     * Sets whether scroll wrap is enabled or not.
     1161     * @param scrollWrapEnabled {@code true} if scroll wrap is enabled, {@code false} otherwise
     1162     */
    10461163    public void setScrollWrapEnabled(boolean scrollWrapEnabled) {
    10471164        this.scrollWrapEnabled = scrollWrapEnabled;
     
    10491166    }
    10501167
     1168    /**
     1169     * Returns the zoom controls apparence style (horizontal/vertical).
     1170     * @return {@link ZOOM_BUTTON_STYLE#VERTICAL} or {@link ZOOM_BUTTON_STYLE#HORIZONTAL}
     1171     */
    10511172    public ZOOM_BUTTON_STYLE getZoomButtonStyle() {
    10521173        return zoomButtonStyle;
    10531174    }
    10541175
     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     */
    10551180    public void setZoomButtonStyle(ZOOM_BUTTON_STYLE style) {
    10561181        zoomButtonStyle = style;
     
    10591184        }
    10601185        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;
    10661186        case VERTICAL:
    10671187            zoomSlider.setBounds(10, 27, 30, 150);
     
    10691189            zoomOutButton.setBounds(14, 176, 20, 20);
    10701190            break;
     1191        case HORIZONTAL:
    10711192        default:
    10721193            zoomSlider.setBounds(10, 10, 30, 150);
     
    10781199    }
    10791200
     1201    /**
     1202     * Returns the tile controller.
     1203     * @return the tile controller
     1204     */
    10801205    public TileController getTileController() {
    10811206        return tileController;
     
    10911216    }
    10921217
     1218    /**
     1219     * Sets the tile loader.
     1220     * @param loader tile loader
     1221     */
    10931222    public void setTileLoader(TileLoader loader) {
    10941223        tileController.setTileLoader(loader);
    10951224    }
    10961225
     1226    /**
     1227     * Returns attribution.
     1228     * @return attribution
     1229     */
    10971230    public AttributionSupport getAttribution() {
    10981231        return attribution;
Note: See TracChangeset for help on using the changeset viewer.