Zasadniczy wsad inicjalizacyjny.

This commit is contained in:
2026-01-05 18:17:11 +01:00
parent e7956db333
commit 3e54ae8f23
65 changed files with 10709 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
package pl.wat.ms4ds.terenfunkcje.nmt;
import java.io.*;
public class NMTReader {
public static void main(String[] args) {
// File dir = new File(System.getProperty("user.home") + "/nmt/gugik_SkorowidzNMT2018.gml");
InputStream is = null;
try {
File file = new File("C:/Workspace/nmt/N-34-139-A-b-2-4.asc");
is = new FileInputStream(file);
readFromInputStream(is);
//...
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static void readFromInputStream(InputStream inputStream) throws IOException {
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
String line= br.readLine();
String[] split = line.split(" ");
int ncols = Integer.parseInt(split[1]);
line= br.readLine();
split = line.split(" ");
int nrows = Integer.parseInt(split[1]);
line= br.readLine();
split = line.split(" ");
double xll = Double.parseDouble(split[1]);
line= br.readLine();
split = line.split(" ");
double yll = Double.parseDouble(split[1]);
line= br.readLine();
split = line.split(" ");
double cellsize = Double.parseDouble(split[1]);
line= br.readLine();
split = line.split(" ");
double nodata = Double.parseDouble(split[1]);
while ((line = br.readLine()) != null) {
split = line.split(" ");
}
}
}
}