Commit 55036cd1 authored by CGoGN's avatar CGoGN
Browse files

Merge /home/kraemer/CGoGN

Conflicts:
	SCHNApps/Plugins/CMakeLists.txt
	include/Topology/generic/attributeHandler.h
	include/Topology/generic/attributeHandler.hpp
parents a5f73b59 3fa867c4
......@@ -129,16 +129,15 @@ SET(SCHNApps_QOBJECT_FILES
${SCHNApps_ROOT_DIR}/include/camera.h
${SCHNApps_ROOT_DIR}/include/mapHandler.h
${SCHNApps_ROOT_DIR}/include/plugin.h
${SCHNApps_ROOT_DIR}/include/plugin_interaction.h
${SCHNApps_ROOT_DIR}/include/plugin_processing.h
${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/schnapps.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/dialogs/camerasDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/pluginsDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/mapsDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraViewDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/pluginsViewDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/mapsViewDialog.h
${SCHNApps_ROOT_DIR}/include/colorComboBox.h
${SCHNApps_ROOT_DIR}/include/controlDock_cameraTab.h
${SCHNApps_ROOT_DIR}/include/controlDock_pluginTab.h
${SCHNApps_ROOT_DIR}/include/controlDock_mapTab.h
# ${SCHNApps_ROOT_DIR}/include/colorComboBox.h
)
......
cmake_minimum_required(VERSION 2.8)
ADD_SUBDIRECTORY(importSurface)
ADD_SUBDIRECTORY(importVolume)
ADD_SUBDIRECTORY(differentialProperties)
ADD_SUBDIRECTORY(render)
ADD_SUBDIRECTORY(renderVector)
ADD_SUBDIRECTORY(renderScalar)
ADD_SUBDIRECTORY(renderExplod)
ADD_SUBDIRECTORY(renderTopoSurface)
ADD_SUBDIRECTORY(subdivideSurface)
#ADD_SUBDIRECTORY(surfaceDeformation)
ADD_SUBDIRECTORY(subdivideMRVolume)
ADD_SUBDIRECTORY(surface_import)
ADD_SUBDIRECTORY(surface_render)
cmake_minimum_required(VERSION 2.8)
SET( PLUGIN_NAME Surface_Import )
SET( PLUGIN_ROOT_DIR ${SCHNApps_ROOT_DIR}/Plugins/surface_import )
INCLUDE_DIRECTORIES(
${PLUGIN_ROOT_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}
)
file(
GLOB_RECURSE
PLUGIN_FILES
${PLUGIN_ROOT_DIR}/src/*.cpp
${PLUGIN_ROOT_DIR}/include/*.h
${PLUGIN_ROOT_DIR}/include/*.hpp
)
file(
GLOB_RECURSE
PLUGIN_UI_FILES
${PLUGIN_ROOT_DIR}/forms/*.ui
)
SET(
PLUGIN_QOBJECT_FILES
${PLUGIN_ROOT_DIR}/include/surface_import.h
)
include( ${SCHNApps_ROOT_DIR}/Plugins/plugins_cmake.txt )
#ifndef _IMPORTSURFACE_PLUGIN_H_
#define _IMPORTSURFACE_PLUGIN_H_
#include "plugin_processing.h"
namespace CGoGN
{
namespace SCHNApps
{
class ImportSurfacePlugin : public PluginProcessing
{
Q_OBJECT
Q_INTERFACES(CGoGN::SCHNApps::Plugin)
public:
ImportSurfacePlugin()
{}
~ImportSurfacePlugin()
{}
private:
virtual bool enable();
virtual void disable() {}
public slots:
MapHandlerGen* importFromFile(const QString& fileName);
void importFromFileDialog();
private:
QAction* importAction;
};
} // namespace SCHNApps
} // namespace CGoGN
#endif
#include "surface_import.h"
#include "schnapps.h"
#include "mapHandler.h"
#include "Algo/Import/import.h"
#include <QFileDialog>
#include <QFileInfo>
namespace CGoGN
{
namespace SCHNApps
{
bool ImportSurfacePlugin::enable()
{
importAction = new QAction("import", this);
m_schnapps->addMenuAction(this, "Surface;Import", importAction);
connect(importAction, SIGNAL(triggered()), this, SLOT(importFromFileDialog()));
return true;
}
MapHandlerGen* ImportSurfacePlugin::importFromFile(const QString& fileName)
{
QFileInfo fi(fileName);
if(fi.exists())
{
MapHandlerGen* mhg = m_schnapps->addMap(fi.baseName(), 2);
if(mhg)
{
MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(mhg);
PFP2::MAP* map = mh->getMap();
std::vector<std::string> attrNames;
Algo::Surface::Import::importMesh<PFP2>(*map, fileName.toStdString(), attrNames);
// get vertex position attribute
VertexAttribute<PFP2::VEC3> position = map->getAttribute<PFP2::VEC3, VERTEX>(attrNames[0]);
mh->registerAttribute(position);
// update corresponding VBO & emit attribute update signal
mh->notifyAttributeModification(position);
// compute map bounding box
mh->updateBB(position);
}
return mhg;
}
else
return NULL;
}
void ImportSurfacePlugin::importFromFileDialog()
{
QStringList fileNames = QFileDialog::getOpenFileNames(m_schnapps, "Import surfaces", m_schnapps->getAppPath(), "Surface mesh Files (*.ply *.off *.trian)");
QStringList::Iterator it = fileNames.begin();
while(it != fileNames.end()) {
importFromFile(*it);
++it;
}
}
#ifndef DEBUG
Q_EXPORT_PLUGIN2(ImportSurfacePlugin, ImportSurfacePlugin)
#else
Q_EXPORT_PLUGIN2(ImportSurfacePluginD, ImportSurfacePlugin)
#endif
} // namespace SCHNApps
} // namespace CGoGN
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment