source: josm/trunk/src/org/openstreetmap/josm/data/ViewportData.java@ 7816

Last change on this file since 7816 was 7816, checked in by bastiK, 9 years ago

fixed #10860 - set initial viewport correctly when mapview is opened

File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data;
3
4import org.openstreetmap.josm.data.coor.EastNorth;
5
6/**
7 * Data class to keep viewport information.
8 *
9 * This can be either a combination of map center and map scale or
10 * a rectangle in east-north coordinate space.
11 *
12 * Either of those will be null, so the consumer of the ViewportData
13 * object has to check, which one is set.
14 *
15 * @since 5670 (creation)
16 * @since 6992 (extraction in this package)
17 */
18public class ViewportData {
19 private final EastNorth center;
20 private final Double scale;
21
22 private final ProjectionBounds bounds;
23
24 /**
25 * Constructs a new {@code ViewportData}.
26 * @param center Projected coordinates of the map center
27 * @param scale Scale factor in east-/north-units per pixel
28 */
29 public ViewportData(EastNorth center, Double scale) {
30 this.center = center;
31 this.scale = scale;
32 this.bounds = null;
33 }
34
35 public ViewportData(ProjectionBounds bounds) {
36 this.center = null;
37 this.scale = null;
38 this.bounds = bounds;
39 }
40
41 /**
42 * Return the projected coordinates of the map center
43 * @return the center
44 */
45 public EastNorth getCenter() {
46 return center;
47 }
48
49 /**
50 * Return the scale factor in east-/north-units per pixel.
51 * @return the scale
52 */
53 public Double getScale() {
54 return scale;
55 }
56
57 /**
58 * Return the bounds in east-north coordinate space.
59 * @return the bounds
60 */
61 public ProjectionBounds getBounds() {
62 return bounds;
63 }
64}
Note: See TracBrowser for help on using the repository browser.