} else if ("LPEleConstraintEnforcer".equals(enforcerType)) {
cf.setEleConstraintEnforcerFactory(
new DefaultFactory<EleConstraintEnforcer>(LPEleConstraintEnforcer.class));
}
Results results = cf.createRepresentations(
argumentsGroup.getRepresentative().getInput(), null, config, null);
ImageExporter exporter = null;
for (CLIArguments args : argumentsGroup.getCLIArgumentsList()) {
Camera camera = null;
Projection projection = null;
if (args.isOviewTiles()) {
camera = OrthoTilesUtil.cameraForTiles(
results.getMapProjection(),
args.getOviewTiles(),
args.getOviewAngle(),
args.getOviewFrom());
projection = OrthoTilesUtil.projectionForTiles(
results.getMapProjection(),
args.getOviewTiles(),
args.getOviewAngle(),
args.getOviewFrom());
} else if (args.isOviewBoundingBox()) {
double angle = args.getOviewAngle();
CardinalDirection from = args.getOviewFrom();
Collection<VectorXZ> pointsXZ = new ArrayList<VectorXZ>();
for (LatLonEle l : args.getOviewBoundingBox()) {
pointsXZ.add(results.getMapProjection().calcPos(l.lat, l.lon));
}
AxisAlignedBoundingBoxXZ bounds =
new AxisAlignedBoundingBoxXZ(pointsXZ);
camera = OrthoTilesUtil.cameraForBounds(bounds, angle, from);
projection = OrthoTilesUtil.projectionForBounds(bounds, angle, from);
} else if (args.isPviewPos()) {
MapProjection proj = results.getMapProjection();
LatLonEle pos = args.getPviewPos();
LatLonEle lookAt = args.getPviewLookat();
camera = new Camera();
VectorXYZ posV = proj.calcPos(pos.lat, pos.lon).xyz(pos.ele);
VectorXYZ laV = proj.calcPos(lookAt.lat, lookAt.lon).xyz(lookAt.ele);
camera.setCamera(posV.x, posV.y, posV.z, laV.x, laV.y, laV.z);
projection = new Projection(false,
args.isPviewAspect() ? args.getPviewAspect() :
(double)args.getResolution().x / args.getResolution().y,
args.getPviewFovy(),
0,
1, 50000);
}
for (File outputFile : args.getOutput()) {
OutputMode outputMode =
CLIArgumentsUtil.getOutputMode(outputFile);
switch (outputMode) {
case OBJ:
Integer primitiveThresholdOBJ =
config.getInteger("primitiveThresholdOBJ", null);
if (primitiveThresholdOBJ == null) {
ObjWriter.writeObjFile(outputFile,
results.getMapData(), results.getMapProjection(),
camera, projection);
} else {
ObjWriter.writeObjFiles(outputFile,
results.getMapData(), results.getMapProjection(),
camera, projection, primitiveThresholdOBJ);
}
break;
case POV:
POVRayWriter.writePOVInstructionFile(outputFile,
results.getMapData(), camera, projection);
break;
case PNG:
case PPM:
if (camera == null || projection == null) {