-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEO1Sensor.java
executable file
·236 lines (203 loc) · 8.63 KB
/
EO1Sensor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// EO1Sensor.java defines the EO-1 sensor details common to both the ALI and
// Hyperion instruments.
//--------------------------------------------------------------------------
import java.awt.Color;
import java.awt.Dimension;
import java.text.DecimalFormat;
public abstract class EO1Sensor extends Sensor
{
private DecimalFormat fourDigitFormat; // four digit number formatter
private static final int[] borderX = {-4,4,4,-4};
// 4 corner highlight X border offsets
private static final int[] borderY = {-4,-4,4,4};
// 4 corner highlight Y border offsets
// Constructor with basic parameters (plain EO-1 ALI & Hyperion)
EO1Sensor
(
imgViewer applet, // I: applet reference
String sensorName, // I: name to use for the sensor
String inventoryDir, // I: name of directory for the data
String datasetName, // I: EE data set name for ordering
int[] resolutions // I: resolutions for this sensor
)
{
super(applet,sensorName,inventoryDir,datasetName, "showEO1Browse.cgi",
"showEO1Metadata.cgi", "USGS_logo.gif", "http://www.usgs.gov",
"https://lta.cr.usgs.gov/ALI", // covers ALI & Hyperion
"http://eo1.usgs.gov/acquisition",
"Enter at least the first 22 characters of a scene ID",
resolutions, borderX,borderY,Color.YELLOW);
// enable the feature to do a full mosaic
isFullMosaic = true;
// Set up formatter for creating file names
fourDigitFormat = new DecimalFormat ("0000");
// set the flags for the optional sensor features available
hasJulianDateMetadata = true;
isOrderable = false;
isDownloadable = true;
hasColRowInSceneID = true;
hasCustomSceneInfoLine = true;
allowAddAll = false;
hasLookAngle = true;
hasNdviLineGraph = true;
// set the data acquisition request URL
dataAcqRequestURL = new String("http://eo1.usgs.gov/dar");
// don't use the transparent pixel fix so that the SCA misalignment is
// completely highlighted
useHighlightTransparentPixelFix = false;
// set the navigation model to the WRS-2 descending model
navModel = new WRS2Model();
// enable user defined area
hasUserDefinedArea = true;
}
// Constructor with extended parameters (GLS2005 Islands - EO-1)
EO1Sensor
(
imgViewer applet, // I: applet reference
String sensorName, // I: name to use for the sensor
String inventoryDir, // I: name of directory for the data
String datasetName, // I: EE data set name for ordering
String showBrowseCGI, // I: CGI script to use to show browse
String showMetadataCGI, // I: CGI script to use to show metadata
String productInfoURL, // I: URL that describes this product
String acquisitionScheduleURL, // I: acquisition schedule link
String dataAcqRequestURL, // I: acquisition request link
int[] resolutions // I: resolutions for this sensor
)
{
super(applet,sensorName,inventoryDir,datasetName, showBrowseCGI,
showMetadataCGI, "USGS_logo.gif", "http://www.usgs.gov",
productInfoURL, acquisitionScheduleURL,
"Enter at least the first 22 characters of a scene ID",
resolutions, borderX,borderY,Color.YELLOW);
// enable the feature to do a full mosaic
isFullMosaic = true;
// Set up formatter for creating file names
fourDigitFormat = new DecimalFormat ("0000");
// set the flags for the optional sensor features available
hasJulianDateMetadata = true;
isOrderable = false;
isDownloadable = true;
hasColRowInSceneID = true;
hasCustomSceneInfoLine = true;
allowAddAll = false;
hasLookAngle = true;
hasNdviLineGraph = true;
// set the data acquisition request URL
dataAcqRequestURL = dataAcqRequestURL;
// don't use the transparent pixel fix so that the SCA misalignment is
// completely highlighted
useHighlightTransparentPixelFix = false;
// set the navigation model to the WRS-2 descending model
navModel = new WRS2Model();
// enable user defined area
hasUserDefinedArea = true;
}
// method to return an image file name for a given metadata reference and
// resolution
// Returns: full file name, including directory
//-----------------------------------------------------------------------
public String makeImageName
(
Metadata scene, // I: metadata for scene
int resolution // I: resolution requested in meters
)
{
StringBuffer imgName;
// build the image name, starting with the TOC directory and adding
// the items that make up the file name
imgName = new StringBuffer(getCellDirectory(scene.gridCol,
scene.gridRow));
imgName.append("/y");
imgName.append(scene.year);
imgName.append("/");
imgName.append(scene.entityID);
imgName.append("_");
imgName.append(fourDigitFormat.format(resolution));
// load correct image based on full res or mosaic view
if (resolution != 1000)
{
// full resolution uses jpeg files
imgName.append(".jpg");
}
else
{
// mosaic area uses gif files
imgName.append(".gif");
}
return imgName.toString();
}
// method to return the number of cells to display for a given resolution.
// Sensor.SINGLE_SCENE is returned if only one scene should be displayed.
//------------------------------------------------------------------------
public int getNumCellsAtResolution
(
int resolution // I: resolution in meters
)
{
if (resolution == resolutions[0])
return applet.md.getMosaicSize();
else
return SINGLE_SCENE;
}
// method to return a scene filter that is compatible with this sensor.
// Returns a SceneFilter object.
//---------------------------------------------------------------------
public SceneFilter getSceneFilter
(
MosaicData md, // I: the mosaic data object
TOC[] tocs // I: array of TOC's to build the scene filter for
)
{
return new SwathSceneFilter(md, tocs, this, applet, true);
}
// method to return the starting year for the sensor
//--------------------------------------------------
public int getStartingYear()
{
return 1999;
}
// method to return the ending year for the sensor (or -1 if collections
// continue)
//----------------------------------------------------------------------
public int getEndingYear()
{
return -1;
}
// method to convert an entity ID from a scene's metadata to the value
// short enough to display. The first 22 characters are displayed.
//--------------------------------------------------------------------
String buildShortEntityID(Metadata scene)
{
return (scene.entityID.substring(0,22));
}
// method to return the custom scene info line
//--------------------------------------------
public String getCustomSceneInfo(Metadata scene)
{
if (scene == null)
return "Look Angle: ";
return "Look Angle: " + scene.lookAngle;
}
// method to return the files to download for a given scene when the
// user downloads metadata and browse. Returns an array of filenames where
// the source and destination file names are paired up. If the source
// browse name is not known, null is returned in that array entry.
//-------------------------------------------------------------------------
public String[] getFilesForScene(Metadata scene)
{
String[] files = new String[4];
// set the metadata source and destination names
files[0] = makeImageName(scene, resolutions[resolutions.length - 1]);
int index = files[0].lastIndexOf('.');
files[0] = files[0].substring(0, index);
files[0] += ".meta";
files[1] = scene.entityID + ".meta";
// set the browse image source and destination names
files[2] = getCellDirectory(scene.gridCol, scene.gridRow)
+ "/y" + scene.year + "/" + scene.entityID.substring(0,3)
+ scene.entityID.substring(4) + ".jpeg";
files[3] = scene.entityID + ".jpeg";
return files;
}
}