use of org.twak.tweed.gen.MeshGen in project chordatlas by twak.
the class TweedFrame method addLayer.
private void addLayer(MouseEvent evt) {
SimplePopup2 sp = new SimplePopup2(evt);
if (hasGIS()) {
sp.add("+ mesh (obj)", new Runnable() {
@Override
public void run() {
new SimpleFileChooser(frame, false, "Select .obj mesh file", new File(Tweed.JME), "obj") {
public void heresTheFile(File obj) throws Throwable {
// removeMeshSources();
String f = tweed.makeWorkspaceRelative(obj).toString();
addGen(new MeshGen(f, tweed), true);
}
};
}
});
sp.add("+ mesh (minimesh)", new Runnable() {
@Override
public void run() {
new SimpleFileChooser(frame, false, "Select minimesh index file (index.xml), or obj to convert", new File(Tweed.JME), null) {
@Override
public void heresTheFile(File f) throws Throwable {
if (!f.getName().equals(MiniTransform.INDEX)) {
MiniTransform.convertToMini(f, new File(Tweed.DATA + "/minimesh"), () -> addGen(new MiniGen(new File("minimesh"), tweed), true));
return;
}
// removeMeshSources();
addGen(new MiniGen(tweed.makeWorkspaceRelative(f.getParentFile()), tweed), true);
}
};
}
});
sp.add("+ panos (jpg)", new Runnable() {
@Override
public void run() {
new SimpleFileChooser(frame, false, "Select one of many panoramas images in a directory, or todo.list", new File(Tweed.JME), null) {
public void heresTheFile(File oneOfMany) throws Throwable {
// removeGens( PanoGen.class );
addGen(new PanoGen(tweed.makeWorkspaceRelative(oneOfMany.getParentFile()), tweed, Tweed.LAT_LONG), true);
}
};
}
});
} else {
sp.add("+ gis (2d obj)", new Runnable() {
@Override
public void run() {
new SimpleFileChooser(frame, false, "Select .obj gis footprints", new File(Tweed.JME), "obj") {
public void heresTheFile(File obj) throws Throwable {
removeGISSources();
addGen(new GISGen(tweed.makeWorkspaceRelative(obj), tweed), true);
}
};
}
});
// sp.add( "+ gis (3d obj)", new Runnable() {
// @Override
// public void run() {
// new SimpleFileChooser( frame, false, "Select .obj gis footprints", new File( Tweed.JME ), "obj" ) {
// public void heresTheFile( File obj ) throws Throwable {
//
// };
// };
// }
// } );
sp.add("+ gis (gml)", new Runnable() {
@Override
public void run() {
new SimpleFileChooser(frame, false, "Select .gml gis footprints", new File(Tweed.JME), "gml") {
public void heresTheFile(File gml) throws Throwable {
removeGISSources();
tweed.addGML(gml, null);
}
};
}
});
}
sp.show();
}
Aggregations