source: osm/applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/EastNorthBound.java@ 20390

Last change on this file since 20390 was 18544, checked in by pieren, 15 years ago

Add licence in headers for GPL compliance.

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. v2 and later. Copyright 2008-2009 by Pieren <pieren3@gmail.com> and others
2package cadastre_fr;
3
4import java.io.Serializable;
5
6import org.openstreetmap.josm.Main;
7import org.openstreetmap.josm.data.Bounds;
8import org.openstreetmap.josm.data.coor.EastNorth;
9
10public class EastNorthBound implements Serializable {
11
12 private static final long serialVersionUID = 8451650309216472069L;
13
14 public EastNorth min, max;
15 public EastNorthBound(EastNorth min, EastNorth max) {
16 this.min = min;
17 this.max = max;
18 }
19
20 public boolean contains(EastNorth eastNorth) {
21 if (eastNorth.east() < min.east() || eastNorth.north() < min.north())
22 return false;
23 if (eastNorth.east() > max.east() || eastNorth.north() > max.north())
24 return false;
25 return true;
26 }
27
28 public EastNorthBound interpolate(EastNorthBound en2, double proportion) {
29 EastNorthBound enb = new EastNorthBound(this.min.interpolate(en2.min, proportion),
30 this.max.interpolate(en2.max, proportion));
31 return enb;
32 }
33
34 public Bounds toBounds() {
35 return new Bounds(Main.proj.eastNorth2latlon(min), Main.proj.eastNorth2latlon(max));
36 }
37
38 @Override public String toString() {
39 return "EastNorthBound[" + min.east() + "," + min.north() + "," + max.east() + "," + max.north() + "]";
40 }
41}
42
Note: See TracBrowser for help on using the repository browser.