use of org.bimserver.plugins.renderengine.RenderEnginePlugin in project BIMserver by opensourceBIM.
the class TestGen method start.
private void start(String[] args) {
try {
PluginManagerInterface pluginManager = LocalDevSetup.setupPluginManager(args);
DeserializerPlugin deserializerPlugin = pluginManager.getFirstDeserializer("ifc", Schema.IFC2X3TC1, true);
Deserializer deserializer = deserializerPlugin.createDeserializer(null);
deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
RenderEnginePlugin renderEnginePlugin = pluginManager.getRenderEnginePlugin("org.bimserver.ifcengine.JvmRenderEnginePlugin", true);
RenderEngine renderEngine = renderEnginePlugin.createRenderEngine(null, "ifc2x3tc1");
renderEngine.init();
Path path = Paths.get("../TestData/data/AC11-Institute-Var-2-IFC.ifc");
RenderEngineModel renderEngineModel = renderEngine.openModel(new FileInputStream(path.toFile()), Files.size(path));
RenderEngineSettings settings = new RenderEngineSettings();
settings.setPrecision(Precision.SINGLE);
settings.setIndexFormat(IndexFormat.AUTO_DETECT);
settings.setGenerateNormals(true);
settings.setGenerateTriangles(true);
settings.setGenerateWireFrame(false);
renderEngineModel.setSettings(settings);
renderEngineModel.generateGeneralGeometry();
renderEngineModel.close();
renderEngine.close();
long start = System.nanoTime();
long end = System.nanoTime();
System.out.println(((end - start) / 1000000) + " ms");
} catch (PluginException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.bimserver.plugins.renderengine.RenderEnginePlugin in project BIMserver by opensourceBIM.
the class LongDownloadOrCheckoutAction method executeAction.
protected void executeAction(BimDatabaseAction<? extends IfcModelInterface> action, DownloadParameters downloadParameters, DatabaseSession session, boolean commit) throws BimserverDatabaseException, UserException, NoSerializerFoundException, ServerException {
try {
if (action == null) {
checkoutResult = new SCheckoutResult();
checkoutResult.setFile(new CachingDataHandler(getBimServer().getDiskCacheManager(), downloadParameters));
checkoutResult.setSerializerOid(downloadParameters.getSerializerOid());
} else {
Revision revision = session.get(StorePackage.eINSTANCE.getRevision(), downloadParameters.getRoid(), OldQuery.getDefault());
if (revision == null) {
throw new UserException("Revision with roid " + downloadParameters.getRoid() + " not found");
}
// Little hack to make
revision.getProject().getGeoTag().load();
// sure this is
// lazily loaded,
// because after the
// executeAndCommitAction
// the session won't
// be usable
IfcModelInterface ifcModel = session.executeAndCommitAction(action);
// Session is closed after this
DatabaseSession newSession = getBimServer().getDatabase().createSession();
RenderEnginePlugin renderEnginePlugin = null;
try {
PluginConfiguration serializerPluginConfiguration = newSession.get(StorePackage.eINSTANCE.getPluginConfiguration(), downloadParameters.getSerializerOid(), OldQuery.getDefault());
if (serializerPluginConfiguration != null) {
if (serializerPluginConfiguration instanceof MessagingSerializerPluginConfiguration) {
try {
messagingSerializer = getBimServer().getSerializerFactory().createMessagingSerializer(getUserName(), ifcModel, downloadParameters);
} catch (SerializerException e) {
e.printStackTrace();
}
} else if (serializerPluginConfiguration instanceof SerializerPluginConfiguration) {
RenderEnginePluginConfiguration renderEngine = ((SerializerPluginConfiguration) serializerPluginConfiguration).getRenderEngine();
if (renderEngine != null) {
renderEnginePlugin = getBimServer().getPluginManager().getRenderEnginePlugin(renderEngine.getPluginDescriptor().getPluginClassName(), true);
}
checkoutResult = convertModelToCheckoutResult(revision.getProject(), getUserName(), ifcModel, renderEnginePlugin, downloadParameters);
}
}
} catch (BimserverDatabaseException e) {
LOGGER.error("", e);
} finally {
newSession.close();
}
}
} finally {
done();
}
}
use of org.bimserver.plugins.renderengine.RenderEnginePlugin in project BIMserver by opensourceBIM.
the class RenderEnginePools method getRenderEnginePool.
public RenderEnginePool getRenderEnginePool(Schema schema, String className, PluginConfiguration pluginConfiguration) throws PluginException {
if (pools.containsKey(schema)) {
Map<String, RenderEnginePool> map = pools.get(schema);
if (map.containsKey(className)) {
return map.get(className);
} else {
// Maybe this plugin has been installed after startup, let's have a look in the PluginManager
RenderEnginePlugin renderEnginePlugin = bimServer.getPluginManager().getRenderEnginePlugin(className, true);
if (renderEnginePlugin == null) {
throw new PluginException("No render engine found for className " + className);
} else {
RenderEnginePool renderEnginePool = renderEnginePoolFactory.newRenderEnginePool(new RenderEngineFactory() {
@Override
public RenderEngine createRenderEngine() throws RenderEngineException {
return renderEnginePlugin.createRenderEngine(pluginConfiguration, schema.name());
}
});
map.put(className, renderEnginePool);
return renderEnginePool;
}
}
} else {
throw new PluginException("No render engine found for schema " + schema);
}
}
Aggregations