mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
better organization io_base
This commit is contained in:
parent
28234c05c9
commit
7d05349409
@ -4,12 +4,14 @@
|
||||
|
||||
set(SOURCES
|
||||
baseio.cpp
|
||||
load_project.cpp
|
||||
${VCGDIR}/wrap/openfbx/src/miniz.c
|
||||
${VCGDIR}/wrap/openfbx/src/ofbx.cpp
|
||||
${VCGDIR}/wrap/ply/plylib.cpp)
|
||||
|
||||
set(HEADERS
|
||||
baseio.h
|
||||
load_project.h
|
||||
${VCGDIR}/wrap/io_trimesh/export_obj.h
|
||||
${VCGDIR}/wrap/io_trimesh/export_off.h
|
||||
${VCGDIR}/wrap/io_trimesh/export_ply.h
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "baseio.h"
|
||||
#include "load_project.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QDir>
|
||||
|
||||
#include <wrap/io_trimesh/import_ply.h>
|
||||
#include <wrap/io_trimesh/import_stl.h>
|
||||
@ -44,12 +44,6 @@
|
||||
#include <wrap/io_trimesh/export_gts.h>
|
||||
#include <wrap/io_trimesh/export.h>
|
||||
|
||||
#include <wrap/io_trimesh/alnParser.h>
|
||||
|
||||
#include <common/utilities/load_save.h>
|
||||
#include <common/ml_document/mesh_document.h>
|
||||
#include <common/meshlabdocumentbundler.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace vcg;
|
||||
|
||||
@ -668,70 +662,4 @@ void BaseMeshIOPlugin::initSaveParameter(const QString &format, const MeshModel
|
||||
}
|
||||
}
|
||||
|
||||
std::list<MeshModel*> BaseMeshIOPlugin::loadALN(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
CallBackPos* cb)
|
||||
{
|
||||
std::list<MeshModel*> meshList;
|
||||
std::vector<RangeMap> rmv;
|
||||
int retVal = ALNParser::ParseALN(rmv, qUtf8Printable(filename));
|
||||
if(retVal != ALNParser::NoError) {
|
||||
throw MLException("Unable to open ALN file");
|
||||
}
|
||||
QFileInfo fi(filename);
|
||||
|
||||
for(const RangeMap& rm : rmv) {
|
||||
QString relativeToProj = fi.absoluteDir().absolutePath() + "/" + rm.filename.c_str();
|
||||
try {
|
||||
std::list<MeshModel*> tmp =
|
||||
meshlab::loadMeshWithStandardParameters(relativeToProj, md, cb);
|
||||
md.mm()->cm.Tr.Import(rm.transformation);
|
||||
meshList.insert(meshList.end(), tmp.begin(), tmp.end());
|
||||
}
|
||||
catch (const MLException& e){
|
||||
for (MeshModel* m : meshList)
|
||||
md.delMesh(m);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return meshList;
|
||||
}
|
||||
|
||||
std::list<MeshModel*> BaseMeshIOPlugin::loadOUT(
|
||||
const QString& filename,
|
||||
const QString& imageListFile,
|
||||
MeshDocument& md,
|
||||
CallBackPos*)
|
||||
{
|
||||
std::list<MeshModel*> meshList;
|
||||
|
||||
QString model_filename;
|
||||
QFileInfo fi(filename);
|
||||
|
||||
//todo: move here this function...
|
||||
if(!MeshDocumentFromBundler(md, filename, imageListFile, fi.baseName())){
|
||||
throw MLException("Unable to open OUTs file");
|
||||
}
|
||||
|
||||
return meshList;
|
||||
}
|
||||
|
||||
std::list<MeshModel*> BaseMeshIOPlugin::loadNVM(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
CallBackPos*)
|
||||
{
|
||||
std::list<MeshModel*> meshList;
|
||||
|
||||
QString model_filename;
|
||||
QFileInfo fi(filename);
|
||||
|
||||
if(!MeshDocumentFromNvm(md, filename, model_filename)){
|
||||
throw MLException("Unable to open NVMs file");
|
||||
}
|
||||
|
||||
return meshList;
|
||||
}
|
||||
|
||||
MESHLAB_PLUGIN_NAME_EXPORTER(BaseMeshIOPlugin)
|
||||
|
||||
@ -90,23 +90,6 @@ public:
|
||||
|
||||
void initPreOpenParameter(const QString &formatName, RichParameterList &parlst);
|
||||
void initSaveParameter(const QString &format, const MeshModel &/*m*/, RichParameterList & par);
|
||||
|
||||
private:
|
||||
std::list<MeshModel*> loadALN(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos* cb);
|
||||
|
||||
std::list<MeshModel*> loadOUT(
|
||||
const QString& filename,
|
||||
const QString& imageListFile,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos* cb);
|
||||
|
||||
std::list<MeshModel*> loadNVM(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos* cb);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -2,6 +2,7 @@ include (../../shared.pri)
|
||||
|
||||
HEADERS += \
|
||||
baseio.h \
|
||||
load_project.h \
|
||||
$$VCGDIR/wrap/io_trimesh/import_ply.h \
|
||||
$$VCGDIR/wrap/io_trimesh/import_obj.h \
|
||||
$$VCGDIR/wrap/io_trimesh/import_off.h \
|
||||
@ -16,6 +17,7 @@ HEADERS += \
|
||||
|
||||
SOURCES += \
|
||||
baseio.cpp \
|
||||
load_project.cpp \
|
||||
$$VCGDIR/wrap/ply/plylib.cpp \
|
||||
$$VCGDIR/wrap/openfbx/src/ofbx.cpp \
|
||||
$$VCGDIR/wrap/openfbx/src/miniz.c \
|
||||
|
||||
73
src/meshlabplugins/io_base/load_project.cpp
Normal file
73
src/meshlabplugins/io_base/load_project.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
#include "load_project.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include <wrap/io_trimesh/alnParser.h>
|
||||
#include <common/ml_document/mesh_document.h>
|
||||
#include <common/utilities/load_save.h>
|
||||
#include <common/meshlabdocumentbundler.h>
|
||||
|
||||
std::list<MeshModel*> loadALN(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos* cb)
|
||||
{
|
||||
std::list<MeshModel*> meshList;
|
||||
std::vector<RangeMap> rmv;
|
||||
int retVal = ALNParser::ParseALN(rmv, qUtf8Printable(filename));
|
||||
if(retVal != ALNParser::NoError) {
|
||||
throw MLException("Unable to open ALN file");
|
||||
}
|
||||
QFileInfo fi(filename);
|
||||
|
||||
for(const RangeMap& rm : rmv) {
|
||||
QString relativeToProj = fi.absoluteDir().absolutePath() + "/" + rm.filename.c_str();
|
||||
try {
|
||||
std::list<MeshModel*> tmp =
|
||||
meshlab::loadMeshWithStandardParameters(relativeToProj, md, cb);
|
||||
md.mm()->cm.Tr.Import(rm.transformation);
|
||||
meshList.insert(meshList.end(), tmp.begin(), tmp.end());
|
||||
}
|
||||
catch (const MLException& e){
|
||||
for (MeshModel* m : meshList)
|
||||
md.delMesh(m);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return meshList;
|
||||
}
|
||||
|
||||
std::list<MeshModel*> loadOUT(
|
||||
const QString& filename,
|
||||
const QString& imageListFile,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos*)
|
||||
{
|
||||
std::list<MeshModel*> meshList;
|
||||
|
||||
QFileInfo fi(filename);
|
||||
|
||||
//todo: move here this function...
|
||||
if(!MeshDocumentFromBundler(md, filename, imageListFile, fi.baseName())){
|
||||
throw MLException("Unable to open OUTs file");
|
||||
}
|
||||
|
||||
return meshList;
|
||||
}
|
||||
|
||||
std::list<MeshModel*> loadNVM(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos*)
|
||||
{
|
||||
std::list<MeshModel*> meshList;
|
||||
|
||||
QFileInfo fi(filename);
|
||||
|
||||
//todo: move here this function...
|
||||
if(!MeshDocumentFromNvm(md, filename, fi.baseName())){
|
||||
throw MLException("Unable to open NVMs file");
|
||||
}
|
||||
|
||||
return meshList;
|
||||
}
|
||||
22
src/meshlabplugins/io_base/load_project.h
Normal file
22
src/meshlabplugins/io_base/load_project.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef LOAD_PROJECT_H
|
||||
#define LOAD_PROJECT_H
|
||||
|
||||
#include <common/ml_document/mesh_model.h>
|
||||
|
||||
std::list<MeshModel*> loadALN(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos* cb);
|
||||
|
||||
std::list<MeshModel*> loadOUT(
|
||||
const QString& filename,
|
||||
const QString& imageListFile,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos* cb);
|
||||
|
||||
std::list<MeshModel*> loadNVM(
|
||||
const QString& filename,
|
||||
MeshDocument& md,
|
||||
vcg::CallBackPos* cb);
|
||||
|
||||
#endif // LOAD_PROJECT_H
|
||||
Loading…
x
Reference in New Issue
Block a user