本文整理汇总了C++中Exporter类的典型用法代码示例。如果您正苦于以下问题:C++ Exporter类的具体用法?C++ Exporter怎么用?C++ Exporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Exporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void ExportDialog::on_buttonBox_accepted() {
QString filter;
switch(outputFormatComboBox->currentIndex()) {
case ExportDialog::pdf: filter = "PDF-Files (*.pdf)"; break;
case ExportDialog::png: filter = "PNG-Files (*.png)"; break;
}
QString filename = QFileDialog::getSaveFileName(this, "Export to filename...", QDir::currentPath(), filter);
if(filename.isEmpty())
return;
// extract values from export_dialog
double width = widthSpinBox->value(),
height = heightSpinBox->value();
if(measureComboBox->currentIndex()==ExportDialog::cm) {
width /= 2.54;
height /= 2.54;
};
int res_dpi = resSpinBox->value();
if(resRatioComboBox->currentIndex()==ExportDialog::cm_px)
res_dpi /= 2.54;
// export to file
Exporter* exporter;
if(outputFormatComboBox->currentIndex() == ExportDialog::pdf)
exporter = ExportPDF::getExportPDF();
else
exporter = ExportPNG::getExportPNG();
exporter->save(filename, mExp, width, height, res_dpi);
}
示例2: saveAndLoadMap
Map* FileFormatTest::saveAndLoadMap(Map* input, const FileFormat* format)
{
try {
QBuffer buffer;
buffer.open(QIODevice::ReadWrite);
Exporter* exporter = format->createExporter(&buffer, input, NULL);
if (!exporter)
return NULL;
exporter->doExport();
delete exporter;
buffer.seek(0);
Map* out = new Map;
Importer* importer = format->createImporter(&buffer, out, NULL);
if (!importer)
return NULL;
importer->doImport(false);
importer->finishImport();
delete importer;
buffer.close();
return out;
}
catch (std::exception& e)
{
return NULL;
}
}
示例3: exporterTest
virtual bool exporterTest() {
Importer importer;
Exporter exporter;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", 0);
EXPECT_NE(nullptr, scene);
EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "ply", ASSIMP_TEST_MODELS_DIR "/PLY/cube_test.ply"));
return true;
}
示例4: aiExportSceneEx
// ------------------------------------------------------------------------------------------------
ASSIMP_API aiReturn aiExportSceneEx( const aiScene* pScene, const char* pFormatId, const char* pFileName, aiFileIO* pIO, unsigned int pPreprocessing )
{
Exporter exp;
if (pIO) {
exp.SetIOHandler(new CIOSystemWrapper(pIO));
}
return exp.Export(pScene,pFormatId,pFileName,pPreprocessing);
}
示例5: QString
void MainWindow::on_butExport_clicked()
{
using namespace Assimp;
#ifndef ASSIMP_BUILD_NO_EXPORT
QString filename, filter, format_id;
Exporter exporter;
QTime time_begin;
aiReturn rv;
QStringList exportersList;
QMap<QString, const aiExportFormatDesc*> exportersMap;
if(mScene == nullptr)
{
QMessageBox::critical(this, "Export error", "Scene is empty");
return;
}
for (size_t i = 0; i < exporter.GetExportFormatCount(); ++i)
{
const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i);
exportersList.push_back(desc->id + QString(": ") + desc->description);
exportersMap.insert(desc->id, desc);
}
// get an exporter
bool dialogSelectExporterOk;
QString selectedExporter = QInputDialog::getItem(this, "Export format", "Select the exporter : ", exportersList, 0, false, &dialogSelectExporterOk);
if (!dialogSelectExporterOk)
return;
// build the filter
QString selectedId = selectedExporter.left(selectedExporter.indexOf(':'));
filter = QString("*.") + exportersMap[selectedId]->fileExtension;
// get file path
filename = QFileDialog::getSaveFileName(this, "Set file name", "", filter);
// if it's canceled
if (filename == "")
return;
// begin export
time_begin = QTime::currentTime();
rv = exporter.Export(mScene, selectedId.toLocal8Bit(), filename.toLocal8Bit(), aiProcess_FlipUVs);
ui->lblExportTime->setText(QString::number(time_begin.secsTo(QTime::currentTime())));
if(rv == aiReturn_SUCCESS)
LogInfo("Export done: " + filename);
else
{
QString errorMessage = QString("Export failed: ") + filename;
LogError(errorMessage);
QMessageBox::critical(this, "Export error", errorMessage);
}
#endif
}
示例6: MAKEINTRESOURCE
int Ss3exp::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options) // Export file
{
//TODO: Implement the actual file import here and
// return TRUE If the file is imported properly
if(!suppressPrompts)
{
if(!DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_PANEL),
GetActiveWindow(),
Ss3expOptionsDlgProc, (LPARAM)this))
return true;
}
DWORD start,end;
start=timeGetTime();
BEInitLog(NULL,hInstance);
log("Export Started ( %d )\n",start);
Exporter exporter;
RSMObject rsm;
exporter.DoExport(name,i,&rsm);
log("Model exported.\n");
rsm.Optimize(bVertex);
log("Model Optimized.\n");
if(bAnimation)
{
log("Constructing Animation.\n");
AnimConstructor *ac=new AnimConstructor;
ac->BuildAnimation(i,"default",1.0f,bVertex);
rsm.AddAnimation(ac);
log("Animation built.\n");
}
FILE *file=fopen(name,"wb+");
if(!file) return false;
rsm.SaveRML(file);
rsm.SaveRSM(file);
rsm.SaveCameraInfo(file);
fputc(bSky ? 1 : 0,file);
fclose(file);
/*
rsm.SaveRML("ss3test.rml");
rsm.SaveRSM("ss3test.rsm");
*/
end=timeGetTime();
log("Export Ended ( %d ) %d seconds elapsed \n",end, (end-start)/1000);
BECloseLog();
return true;
}
示例7: aiExportSceneToBlob
// ------------------------------------------------------------------------------------------------
ASSIMP_API const C_STRUCT aiExportDataBlob* aiExportSceneToBlob( const aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing )
{
Exporter exp;
if (!exp.ExportToBlob(pScene,pFormatId,pPreprocessing)) {
return NULL;
}
const aiExportDataBlob* blob = exp.GetOrphanedBlob();
ai_assert(blob);
return blob;
}
示例8: exportData
void EditorState::exportData(const ExportOptions &options) const
{
Exporter exporter;
HeightmapData &heightmapData = data->terrainMode.loadHeightmap();
exporter.getScene().setHeightmap(heightmapData.heightMap, heightmapData.mapSize, heightmapData.realSize);
for(unsigned int i = 0; i < data->modes.size(); ++i)
data->modes[i]->doExport(exporter);
exporter.save(options);
}
示例9: QString
void AsyncLoader::saveTask(FileEvent *event, DataSetPackage *package)
{
_currentEvent = event;
QString path = event->path();
if (event->IsOnlineNode())
path = _odm->getLocalPath(path);
QString tempPath = path + QString(".tmp");
try
{
int maxSleepTime = 2000;
int sleepTime = 100;
int delay = 0;
while (package->isReady() == false)
{
if (delay > maxSleepTime)
break;
Utils::sleep(sleepTime);
delay += sleepTime;
}
Exporter *exporter = event->getExporter();
if (exporter)
{
exporter->saveDataSet(fq(tempPath), package, boost::bind(&AsyncLoader::progressHandler, this, _1, _2));
} else {
throw runtime_error("No Exporter found!");
}
if ( ! Utils::renameOverwrite(fq(tempPath), fq(path)))
throw runtime_error("File '" + fq(path) + "' is being used by another application.");
if (event->IsOnlineNode())
QMetaObject::invokeMethod(_odm, "beginUploadFile", Qt::AutoConnection, Q_ARG(QString, event->path()), Q_ARG(QString, "asyncloader"), Q_ARG(QString, tq(package->id)), Q_ARG(QString, tq(package->initalMD5)));
else
event->setComplete();
}
catch (runtime_error e)
{
Utils::removeFile(fq(tempPath));
event->setComplete(false, e.what());
}
catch (exception e)
{
Utils::removeFile(fq(tempPath));
event->setComplete(false, e.what());
}
}
示例10: GetString
bool ExportCommand::Apply(CommandExecutionContext context)
{
wxString mode = GetString(wxT("Mode"));
wxString filename = GetString(wxT("Filename"));
long numChannels = GetLong(wxT("Channels"));
bool selection = mode.IsSameAs(wxT("Selection"));
double t0, t1;
if (selection)
{
t0 = context.GetProject()->mViewInfo.selectedRegion.t0();
t1 = context.GetProject()->mViewInfo.selectedRegion.t1();
}
else
{
t0 = 0.0;
t1 = context.GetProject()->GetTracks()->GetEndTime();
}
// Find the extension and check it's valid
int splitAt = filename.Find(wxUniChar('.'), true);
if (splitAt < 0)
{
Error(wxT("Export filename must have an extension!"));
return false;
}
wxString extension = filename.Mid(splitAt+1).MakeUpper();
Exporter exporter;
bool exportSuccess = exporter.Process(context.GetProject(),
std::max(0L, numChannels),
extension, filename,
selection, t0, t1);
if (exportSuccess)
{
Status(wxString::Format(wxT("Exported to %s format: %s"),
extension, filename));
return true;
}
Error(wxString::Format(wxT("Could not export to %s format!"), extension));
return false;
}
示例11: wxFileDialog
void GUICutRenderWindow::OnExportCSV(wxCommandEvent &event) {
wxFileDialog *SaveDialog = new wxFileDialog(this, wxT("Speichern unter..."),
_(""), _(""), _("Character-separated values (*.csv)|*.csv"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
//Speichern bestätigt?
if (SaveDialog->ShowModal() == wxID_OK) {
Exporter exporter;
CutRender_info* info = getCutRenderProperties();
exporter.ExportCutCSV(string(SaveDialog->GetPath().ToUTF8().data()),
value_img, info);
delete info;
}
SaveDialog->Close();
SaveDialog->Destroy();
}
示例12: actualRef
// Save
status_t
BitmapSetSaver::Save(Document* document)
{
entry_ref actualRef(fRef);
char name[B_OS_NAME_LENGTH];
// 64x64
snprintf(name, sizeof(name), "%s_64.png", fRef.name);
actualRef.set_name(name);
Exporter* exporter = new BitmapExporter(64);
exporter->SetSelfDestroy(true);
exporter->Export(document, actualRef);
// 16x16
snprintf(name, sizeof(name), "%s_16.png", fRef.name);
actualRef.set_name(name);
exporter = new BitmapExporter(16);
exporter->SetSelfDestroy(true);
exporter->Export(document, actualRef);
// 32x32
snprintf(name, sizeof(name), "%s_32.png", fRef.name);
actualRef.set_name(name);
exporter = new BitmapExporter(32);
exporter->SetSelfDestroy(true);
exporter->Export(document, actualRef);
return B_OK;
}
示例13: setup
void cApp::setup(){
int w = win_w*master_scale;
int h = win_h*master_scale;
setFrameRate( fps );
setWindowSize( w*0.5, h*0.5 );
setWindowPos( 0, 0 );
mExp.setup( w, h, 0, 3000, GL_RGB, mt::getRenderPath(), 0);
CameraPersp cam( w, h, 54.4f, 1, 10000 );
cam.lookAt( Vec3f(0,0, 1300), Vec3f(0,0,0) );
cam.setCenterOfInterestPoint( Vec3f(0,0,0) );
camUi.setCurrentCam( cam );
assetDir = mt::getAssetPath();
simDir.push_back( assetDir/"sim"/"red_particle3"/"rpc2");
int nSim = simDir.size();
vbo.assign( nSim, VboSet() );
#ifdef RENDER
mExp.startRender();
#endif
}
示例14: keyDown
void cApp::keyDown( KeyEvent event ){
switch( event.getChar() ){
case 'S': mExp.startRender(); break;
case 's': mExp.snapShot(); break;
case ' ': bStart = !bStart; break;
}
}
示例15: draw
void cApp::draw(){
bOrtho ? mExp.beginOrtho( true ) : mExp.begin( camUi.getCamera() ); {
gl::clear();
gl::enableDepthRead();
gl::enableDepthWrite();
gl::enableAlphaBlending();
glPointSize(1);
glLineWidth(1);
if( !mExp.bRender && !mExp.bSnap ){ mt::drawCoordinate(10); }
for( int i=0; i<rms.size(); i++){
rms[rms.size()-i-1].draw();
}
norms.draw();
}mExp.end();
mExp.draw();
if(gui) gui->draw();
if( bStart && !bFall )frame++;
}