use of com.revolsys.elevation.tin.TriangulatedIrregularNetwork in project com.revolsys.open by revolsys.
the class TriangulationVisualization method tinVisualLas.
public static void tinVisualLas() {
final PathResource sourceFile = new PathResource("/data/dem/elevation/las/bc_093g057c_xl2m_2015_dem_ground.las");
final TriangulatedIrregularNetwork tin;
try (final LasPointCloud pointCloud = PointCloud.newPointCloud(sourceFile)) {
tin = pointCloud.newTriangulatedIrregularNetwork();
}
if (writeFile) {
tin.writeTriangulatedIrregularNetwork(new PathResource("/data/elevation/tin/093/g/093g057.tin"));
}
displayTin(tin);
}
use of com.revolsys.elevation.tin.TriangulatedIrregularNetwork in project com.revolsys.open by revolsys.
the class TriangulatedIrregularNetworkLayer method setTin.
public void setTin(final TriangulatedIrregularNetwork elevationModel) {
final TriangulatedIrregularNetwork old = this.tin;
Property.removeListener(this.tin, this);
this.tin = elevationModel;
if (elevationModel == null) {
setExists(false);
} else {
setExists(true);
Property.addListener(elevationModel, this);
}
firePropertyChange("elevationModel", old, this.tin);
}
use of com.revolsys.elevation.tin.TriangulatedIrregularNetwork in project com.revolsys.open by revolsys.
the class TriangulatedIrregularNetworkLayer method propertyChange.
@Override
public void propertyChange(final PropertyChangeEvent event) {
super.propertyChange(event);
final String propertyName = event.getPropertyName();
if ("hasChanges".equals(propertyName)) {
final TriangulatedIrregularNetwork image = getTin();
if (event.getSource() == image) {
image.writeTriangulatedIrregularNetwork();
}
}
}
use of com.revolsys.elevation.tin.TriangulatedIrregularNetwork in project com.revolsys.open by revolsys.
the class LasPointCloud method newTriangulatedIrregularNetwork.
@Override
public TriangulatedIrregularNetwork newTriangulatedIrregularNetwork(final Predicate<? super Point> filter) {
final GeometryFactory geometryFactory = getGeometryFactory();
final QuadEdgeDelaunayTinBuilder tinBuilder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
forEachPoint((lasPoint) -> {
if (filter.test(lasPoint)) {
tinBuilder.insertVertex(lasPoint);
}
});
final TriangulatedIrregularNetwork tin = tinBuilder.newTriangulatedIrregularNetwork();
return tin;
}
use of com.revolsys.elevation.tin.TriangulatedIrregularNetwork in project com.revolsys.open by revolsys.
the class TriangulatedIrregularNetworkLayer method revertDo.
protected void revertDo() {
if (this.resource != null) {
TriangulatedIrregularNetwork tin = null;
try {
this.tin = null;
final Resource resource = Resource.getResource(this.url);
if (resource.exists()) {
tin = TriangulatedIrregularNetwork.newTriangulatedIrregularNetwork(resource);
if (tin == null) {
Logs.error(TriangulatedIrregularNetworkLayer.class, "Cannot load TIN: " + this.url);
}
} else {
Logs.error(TriangulatedIrregularNetworkLayer.class, "TIN does not exist: " + this.url);
}
} catch (final Throwable e) {
Logs.error(TriangulatedIrregularNetworkLayer.class, "Unable to load TIN: " + this.url, e);
} finally {
setTin(tin);
}
firePropertyChange("hasChanges", true, false);
}
}
Aggregations