gvsig-raster / org.gvsig.raster.cache / trunk / org.gvsig.raster.cache / org.gvsig.raster.cache.lib.impl / src / main / java / org / gvsig / raster / cache / buffer / impl / PxTileImpl.java @ 999
History | View | Annotate | Download (2.45 KB)
1 |
package org.gvsig.raster.cache.buffer.impl; |
---|---|
2 |
|
3 |
import java.awt.geom.Rectangle2D; |
4 |
|
5 |
import org.gvsig.raster.cache.buffer.BufferDataSource; |
6 |
import org.gvsig.raster.cache.buffer.PxTile; |
7 |
|
8 |
/**
|
9 |
* Class with the information about a tile of data.
|
10 |
*
|
11 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
12 |
*/
|
13 |
public class PxTileImpl extends PxTile { |
14 |
private static final long serialVersionUID = 1L; |
15 |
private String reference = null; |
16 |
private Rectangle2D selection = null; |
17 |
private BufferDataSource[] dataSource = null; |
18 |
|
19 |
/**
|
20 |
* Set size and position values
|
21 |
* @param x
|
22 |
* Upper left X position
|
23 |
* @param y
|
24 |
* Upper left X position
|
25 |
* @param w
|
26 |
* Width
|
27 |
* @param h
|
28 |
* Height
|
29 |
*/
|
30 |
public PxTileImpl(int x, int y, int w, int h) { |
31 |
super(x, y, w, h);
|
32 |
} |
33 |
|
34 |
/**
|
35 |
* Set size, position values and a file reference
|
36 |
* @param x
|
37 |
* Upper left X position
|
38 |
* @param y
|
39 |
* Upper left X position
|
40 |
* @param w
|
41 |
* Width
|
42 |
* @param h
|
43 |
* Height
|
44 |
* @param ref
|
45 |
* file reference
|
46 |
*/
|
47 |
public PxTileImpl(int x, int y, int w, int h, String ref) { |
48 |
super(x, y, w, h);
|
49 |
this.reference = ref;
|
50 |
} |
51 |
|
52 |
/**
|
53 |
* Get a interest area
|
54 |
* @return Rectangle2D
|
55 |
*/
|
56 |
public Rectangle2D getAreaOfInterest() { |
57 |
return selection;
|
58 |
} |
59 |
|
60 |
/**
|
61 |
* Set a interest area
|
62 |
* @param selection
|
63 |
*/
|
64 |
public void setAreaOfInterest(Rectangle2D selection) { |
65 |
this.selection = selection;
|
66 |
} |
67 |
|
68 |
/**
|
69 |
* Get the file reference
|
70 |
* @return
|
71 |
*/
|
72 |
public String getReference() { |
73 |
return reference;
|
74 |
} |
75 |
|
76 |
/**
|
77 |
* Set the file reference
|
78 |
* @param ref
|
79 |
*/
|
80 |
public void setReference(String ref) { |
81 |
this.reference = ref;
|
82 |
} |
83 |
|
84 |
/**
|
85 |
* Set the data source
|
86 |
* @param dataSource
|
87 |
*/
|
88 |
public void setDataSource(BufferDataSource dataSource) { |
89 |
this.dataSource = new BufferDataSource[]{dataSource}; |
90 |
} |
91 |
|
92 |
/**
|
93 |
* Set the data source
|
94 |
* @param dataSource
|
95 |
*/
|
96 |
public void setDataSource(BufferDataSource[] dataSource) { |
97 |
this.dataSource = dataSource;
|
98 |
} |
99 |
|
100 |
/**
|
101 |
* Get the data source
|
102 |
* @return
|
103 |
*/
|
104 |
public BufferDataSource getDataSource() {
|
105 |
if(dataSource != null && dataSource.length >= 1) |
106 |
return dataSource[0]; |
107 |
return null; |
108 |
} |
109 |
|
110 |
/**
|
111 |
* Get the data source
|
112 |
* @return
|
113 |
*/
|
114 |
public BufferDataSource[] getDataSourceList() { |
115 |
return dataSource;
|
116 |
} |
117 |
|
118 |
/**
|
119 |
* Show information for debug
|
120 |
*/
|
121 |
public void show() { |
122 |
System.out.println("X:" + getX() + " Y:" + getY() + " W:" + getWidth() + " H:" + getHeight()); |
123 |
} |
124 |
} |