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

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

add subversion property svn:eol=native

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