Statistics
| Revision:

root / trunk / libraries / libDataSource / src / org / gvsig / data / spatialprovisional / Extent.java @ 19440

History | View | Annotate | Download (1.41 KB)

1
package org.gvsig.data.spatialprovisional;
2

    
3
import java.awt.geom.Rectangle2D;
4

    
5
public class Extent implements IExtent{
6

    
7
        private double x1=0;
8
        private double y1=0;
9
        private double x2=0;
10
        private double y2=0;
11
        private double x3=0;
12
        private double y3=0;
13

    
14
        public Extent(double x1,double y1,double x2,double y2){
15
                this.x1=x1;
16
                this.y1=y1;
17
                this.x2=x2;
18
                this.y2=y2;
19
        }
20
        public Extent(double x1,double y1,double x2,double y2,double x3,double y3){
21
                this.x1=x1;
22
                this.y1=y1;
23
                this.x2=x2;
24
                this.y2=y2;
25
                this.x3=x3;
26
                this.y3=y3;
27
        }
28
        public Extent(Rectangle2D bounds2D) {
29
                this.x1=bounds2D.getX();
30
                this.y1=bounds2D.getY();
31
                this.x2=bounds2D.getMaxX();
32
                this.y2=bounds2D.getMaxY();
33
        }
34
        public void add(IExtent extent) {
35
                Extent auxExtent=(Extent)extent;
36
                this.x1 = Math.min(this.x1, auxExtent.x1);
37
                this.x2 = Math.max(this.x2, auxExtent.x2);
38
                this.x3 = Math.max(this.x3, auxExtent.x3);
39
                this.y1 = Math.min(this.y1, auxExtent.y1);
40
                this.y2 = Math.max(this.y2, auxExtent.y2);
41
                this.y3 = Math.max(this.y3, auxExtent.y3);
42
        }
43

    
44
        public boolean contains(Object geometry) {
45
//                Extent bounds=new Extent(geometry.getBounds2D());
46
//                if (bounds.x1 == bounds.x2 || bounds.y1 == bounds.y2) {
47
//                    return false;
48
//                }
49
//                double x0 = x1;
50
//                double y0 = y1;
51
//                return (bounds.x1 >= x0 &&
52
//                        bounds.y1 >= y0 &&
53
//                        (bounds.x2) <= x2 &&
54
//                        (bounds.y2) <= y2);
55
                return false;
56
        }
57

    
58
}