epfl-archive/Alpano/tests/ch/epfl/alpano/gui/LabelizerTest.java

51 lines
1.4 KiB
Java
Raw Permalink Normal View History

2022-04-07 18:43:21 +02:00
package ch.epfl.alpano.gui;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.junit.Test;
import ch.epfl.alpano.dem.ContinuousElevationModel;
import ch.epfl.alpano.dem.HgtDiscreteElevationModel;
import ch.epfl.alpano.summit.GazetteerParser;
import ch.epfl.alpano.summit.Summit;
import javafx.scene.Node;
import javafx.scene.text.Text;
public class LabelizerTest {
@Test
public void testLabels() {
try {
List<Summit> listOfSummit = GazetteerParser.readSummitsFrom(new File("HGT/alps.txt"));
HgtDiscreteElevationModel dDem = new HgtDiscreteElevationModel(new File ("HGT/N46E007.hgt"));
ContinuousElevationModel cDem = new ContinuousElevationModel(dDem);
Labelizer l = new Labelizer(cDem, listOfSummit);
List<Node> n= l.labels(PredefinedPanoramas.NIESEN.get().panoramaComputeParameters());
int count =0;
for (Node node : n){
System.out.println(node);
if (node instanceof Text){
++count;
//System.out.println("node");
System.out.println(node.toString());
}
}
System.out.println(count);
} catch (IOException e) {
e.printStackTrace();
}
}
}