Commit e54d4957 authored by Sylvain Thery's avatar Sylvain Thery

Merge cgogn:CGoGN

parents 3e65eac4 192d8ed6
......@@ -965,7 +965,7 @@ void Clipping::cb_keyPress(int code)
}
}
void Clipping::cb_mousePress(int button, int x, int y)
void Clipping::cb_mousePress(int /*button*/, int x, int y)
{
// Check if no animation is active
if (m_lastAnimatedClippingPreset != NULL)
......
......@@ -145,7 +145,7 @@ void MyQT::cb_redraw()
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (!Shift())
return;
......@@ -249,7 +249,7 @@ void MyQT::cb_mouseMove(int buttons, int x, int y)
}
void MyQT::cb_wheelEvent(int delta, int x, int y)
void MyQT::cb_wheelEvent(int delta, int /*x*/, int /*y*/)
{
if (!Shift())
return;
......
......@@ -157,17 +157,17 @@ void TexView::cb_keyPress(int code)
updateGL();
}
void TexView::init(char *fnm, char* fnt)
void TexView::init(const std::string& fnm, const std::string& fnt)
{
if (fnm == NULL)
if (fnm.empty() )
{
computeTore();
m_fileNameTex = std::string(fnt);
m_fileNameTex = fnt;
}
else
{
m_fileNameMesh = std::string(fnm);
m_fileNameTex = std::string(fnt);
m_fileNameMesh = fnm;
m_fileNameTex = fnt;
std::vector<std::string> attrNames;
m_obj.import(m_fileNameMesh,attrNames);
......@@ -260,11 +260,11 @@ int main(int argc, char**argv)
}
else if (argc == 2)
{
tv.init(NULL, argv[1]);
tv.init("", argv[1]);
}
else
{
tv.init(NULL,"x");
tv.init("","x");
}
......
......@@ -89,7 +89,7 @@ public:
~TexView();
void init(char* fnm, char* fnt);
void init(const std::string& fnm, const std::string& fnt);
// callbacks of simpleQT to overdefine:
void cb_redraw();
......
......@@ -33,24 +33,26 @@
#include "Utils/chrono.h"
#include "Algo/Export/exportVol.h"
PFP::MAP myMap;
VertexAttribute<PFP::VEC3> position ;
VolumeAttribute<PFP::VEC3> color ;
void MyQT::volumes_onoff(bool x)
void MyQT::volumes_onoff(bool /*x*/)
{
render_volumes = !render_volumes;
updateGL();
}
void MyQT::edges_onoff(bool x)
void MyQT::edges_onoff(bool /*x*/)
{
render_edges = !render_edges;
updateGL();
}
void MyQT::topo_onoff(bool x)
void MyQT::topo_onoff(bool /*x*/)
{
render_topo = !render_topo;
if (render_topo)
......@@ -88,7 +90,7 @@ void MyQT::clipping_onoff(bool x)
updateGL();
}
void MyQT::hide_onoff(bool x)
void MyQT::hide_onoff(bool /*x*/)
{
hide_clipping = !hide_clipping;
updateGL();
......@@ -270,7 +272,7 @@ void MyQT::cb_redraw()
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (!Shift())
return;
......@@ -299,7 +301,7 @@ void MyQT::cb_mousePress(int button, int x, int y)
}
}
void MyQT::cb_mouseRelease(int button, int x, int y)
void MyQT::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
{
if (hide_clipping || !clip_volume)
......@@ -418,6 +420,12 @@ int main(int argc, char **argv)
color[i][0] /= maxV;
color[i][2] = 1.0f - color[i][0];
}
// Algo::Volume::Export::exportNAS<PFP>(myMap,position,"/tmp/test2.nas");
// Algo::Volume::Export::exportMSH<PFP>(myMap,position,"/tmp/test2.msh");
// Algo::Volume::Export::exportTet<PFP>(myMap,position,"/tmp/test2.tet");
// Algo::Volume::Export::exportNodeEle<PFP>(myMap,position,"/tmp/test2");
// Algo::Volume::Export::exportVTU<PFP>(myMap,position,"/tmp/test4.vtu");
}
else
{
......@@ -437,6 +445,9 @@ int main(int argc, char **argv)
TraversorW<PFP::MAP> tra(myMap);
for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
color[d] = position[d] + PFP::VEC3(0.5,0.5,0.5);
// Algo::Volume::Export::exportMSH<PFP>(myMap,position,"/tmp/test2.msh");
// Algo::Volume::Export::exportNAS<PFP>(myMap,position,"/tmp/test1.nas");
// Algo::Volume::Export::exportVTU<PFP>(myMap,position,"/tmp/test3.vtu");
}
// un peu d'interface
QApplication app(argc, argv);
......
......@@ -140,7 +140,7 @@ void MyQT::cb_redraw()
m_drawer.callList();
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (Shift())
{
......
......@@ -38,21 +38,21 @@ MAP myMap;
VertexAttribute<VEC3> position ;
Dart dglobal;
void MyQT::balls_onoff(bool x)
void MyQT::balls_onoff(bool /*x*/)
{
render_balls = !render_balls;
updateGL();
CGoGNerr << " balls_onoff "<< CGoGNendl;
}
void MyQT::vectors_onoff(bool x)
void MyQT::vectors_onoff(bool /*x*/)
{
render_vectors = !render_vectors;
updateGL();
CGoGNerr << " vectors_onoff "<< CGoGNflush;
}
void MyQT::text_onoff(bool x)
void MyQT::text_onoff(bool /*x*/)
{
render_text = !render_text;
updateGL();
......@@ -60,7 +60,7 @@ void MyQT::text_onoff(bool x)
}
void MyQT::topo_onoff(bool x)
void MyQT::topo_onoff(bool /*x*/)
{
render_topo = !render_topo;
updateGL();
......@@ -211,7 +211,7 @@ void MyQT::cb_redraw()
}
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (Shift())
{
......
......@@ -146,7 +146,7 @@ public:
FunctorAttribThreaded(),m_positions(pos),m_positions2(pos2)
{}
void run(unsigned int i, unsigned int threadID)
void run(unsigned int i, unsigned int /*threadID*/)
{
m_positions2[i] = 1.1f * m_positions[i];
}
......@@ -181,7 +181,7 @@ public:
m_positions(pos),m_positions2(pos2)
{}
void run(Dart d, unsigned int threadID)
void run(Dart d, unsigned int /*threadID*/)
{
typename XXX::VEC3 Q(0,0,0);
int nb=0;
......@@ -232,7 +232,7 @@ public:
unsigned int getNb() { return m_nb;}
void run(Dart d, unsigned int threadID)
void run(Dart d, unsigned int /*threadID*/)
{
Dart dd = this->m_map.phi2(d);
typename XXX::VEC3 V = m_positions[dd] - m_positions[d];
......
......@@ -88,7 +88,7 @@ void MyQT::clipping_onoff(bool x)
updateGL();
}
void MyQT::hide_onoff(bool x)
void MyQT::hide_onoff(bool /*x*/)
{
hide_clipping = !hide_clipping;
updateMap();
......@@ -253,7 +253,7 @@ void MyQT::operation(int x)
dock.listOper->setCurrentRow(-1);
}
void MyQT::createMap(int n)
void MyQT::createMap(int /*n*/)
{
myMap.clear(true);
position = myMap.getAttribute<VEC3, VERTEX>("position");
......@@ -440,7 +440,7 @@ void MyQT::cb_mousePress(int button, int x, int y)
}
}
void MyQT::cb_mouseRelease(int button, int x, int y)
void MyQT::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
{
if (hide_clipping || !clip_volume)
......
......@@ -42,7 +42,7 @@ VertexAttribute<VEC3> position ;
DartAttribute<VEC3> middleDarts;
void MyQT::text_onoff(bool x)
void MyQT::text_onoff(bool /*x*/)
{
render_text = !render_text;
updateGL();
......@@ -162,7 +162,7 @@ void MyQT::cb_redraw()
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (Shift())
{
......
......@@ -138,8 +138,9 @@ IF(WIN32)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
# set(CMAKE_CONFIGURATION_TYPES "Release Debug" CACHE STRING "Only Release or Debug" FORCE)
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -fPIC")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Woverride-init -fPIC")
add_subdirectory(Release)
add_subdirectory(Debug)
add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
......
......@@ -105,7 +105,7 @@ IF(WIN32)
set(CMAKE_CONFIGURATION_TYPES Release Debug)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra ")
ENDIF(WIN32)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
......
......@@ -26,6 +26,9 @@
#define __EXPORT_H__
#include "Topology/generic/attributeHandler.h"
#include "Algo/Import/importFileTypes.h"
#include <stdint.h>
namespace CGoGN
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __EXPORT_VOL_H__
#define __EXPORT_VOL_H__
#include "Topology/generic/attributeHandler.h"
#include <stdint.h>
namespace CGoGN
{
namespace Algo
{
namespace Volume
{
namespace Export
{
/**
* Export a mesh choosing the format according to filename extension
* @param the_map map to be exported
* @param position the position container
* @param filename filename of mesh file
* @return true
*/
template <typename PFP>
bool exportMesh(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const std::string& filename) ;
/**
* export the map into a .nas (nastran file)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of mesh file
* @return true
*/
template <typename PFP>
bool exportNAS(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export the map into a vtu file (vtk unstructured grid)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of mesh file
* @return true
*/
template <typename PFP>
bool exportVTU(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export the map into a .msh (gmesh file)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of mesh file
* @return true
*/
template <typename PFP>
bool exportMSH(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export the map into a .tet file
* @param the_map map to be exported
* @param position the position container
* @param filename filename of mesh file
* @return true
*/
template <typename PFP>
bool exportTet(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export the map into a .node/.ele file pair
* @param the_map map to be exported
* @param position the position container
* @param filename filename of mesh file
* @return true
*/
template <typename PFP>
bool exportNodeEle(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export in binary volume file (nb_vert,nb_tetra,nb_hexa, vertices, tetra, hexa)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of mesh file
*/
template <typename PFP>
bool exportVolBinGz(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename);
} // namespace Export
}
} // namespace Algo
} // namespace CGoGN
#include "Algo/Export/exportVol.hpp"
#endif
This diff is collapsed.
......@@ -174,7 +174,7 @@ inline void ImplicitHierarchicalMap::next(Dart& d) const
} while(d != Map2::end() && m_dartLevel[d] > m_curLevel) ;
}
inline bool ImplicitHierarchicalMap::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread)
inline bool ImplicitHierarchicalMap::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int /*thread*/)
{
Dart dNext = d;
do
......@@ -186,7 +186,7 @@ inline bool ImplicitHierarchicalMap::foreach_dart_of_vertex(Dart d, FunctorType&
return false;
}
inline bool ImplicitHierarchicalMap::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread)
inline bool ImplicitHierarchicalMap::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int /*thread*/)
{
if (f(d))
return true;
......@@ -198,7 +198,7 @@ inline bool ImplicitHierarchicalMap::foreach_dart_of_edge(Dart d, FunctorType& f
return false;
}
inline bool ImplicitHierarchicalMap::foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int thread)
inline bool ImplicitHierarchicalMap::foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int /*thread*/)
{
Dart dNext = d ;
do
......@@ -212,12 +212,12 @@ inline bool ImplicitHierarchicalMap::foreach_dart_of_oriented_face(Dart d, Funct
inline bool ImplicitHierarchicalMap::foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread)
{
return foreach_dart_of_oriented_face(d, f) ;
return foreach_dart_of_oriented_face(d, f,thread) ;
}
inline bool ImplicitHierarchicalMap::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int thread)
{
DartMarkerStore mark(*this); // Lock a marker
DartMarkerStore mark(*this,thread); // Lock a marker
bool found = false; // Last functor return value
std::list<Dart> visitedFaces; // Faces that are traversed
......@@ -253,12 +253,12 @@ inline bool ImplicitHierarchicalMap::foreach_dart_of_oriented_volume(Dart d, Fun
inline bool ImplicitHierarchicalMap::foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread)
{
return foreach_dart_of_oriented_volume(d, f) ;
return foreach_dart_of_oriented_volume(d, f, thread) ;
}
inline bool ImplicitHierarchicalMap::foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread)
{
return foreach_dart_of_oriented_volume(d, f) ;
return foreach_dart_of_oriented_volume(d, f, thread) ;
}
/***************************************************
......
......@@ -269,7 +269,7 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_edge(Dart d, FunctorType&
return false;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int thread)
inline bool ImplicitHierarchicalMap3::foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int /*thread*/)
{
Dart dNext = d ;
do
......@@ -401,7 +401,7 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_cc(Dart d, FunctorType& f,
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex2(Dart d, FunctorType& f, unsigned int thread)
inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex2(Dart d, FunctorType& f, unsigned int /*thread*/)
{
Dart dNext = d;
do
......@@ -413,7 +413,7 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex2(Dart d, FunctorTyp
return false;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_edge2(Dart d, FunctorType& f, unsigned int thread)
inline bool ImplicitHierarchicalMap3::foreach_dart_of_edge2(Dart d, FunctorType& f, unsigned int /*thread*/)
{
if (f(d))
return true;
......
......@@ -110,7 +110,7 @@ template <typename PFP>
bool importNodeWithELERegions(typename PFP::MAP& map, const std::string& filenameNode, const std::string& filenameELE, std::vector<std::string>& attrNames);
template <typename PFP>
bool importTet(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f, bool invertTetra=false);
bool importTet(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
template <typename PFP>
bool importMoka(typename PFP::MAP& the_gmap, const std::string& filename, std::vector<std::string>& attrNames);
......@@ -118,6 +118,20 @@ bool importMoka(typename PFP::MAP& the_gmap, const std::string& filename, std::v
template <typename PFP>
bool importTs(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
template <typename PFP>
bool importMSH(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
template <typename PFP>
bool importVTU(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
template <typename PFP>
bool importNAS(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
template <typename PFP>
bool importVBGZ(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
} // Import
} // Volume
......@@ -134,6 +148,11 @@ bool importTs(typename PFP::MAP& the_map, const std::string& filename, std::vect
#include "Algo/Import/importMoka.hpp"
#include "Algo/Import/importTs.hpp"
#include "Algo/Import/importNodeEle.hpp"
#include "Algo/Import/importMSH.hpp"
#include "Algo/Import/importVTU.hpp"
#include "Algo/Import/importNAS.hpp"
#include "Algo/Import/importVBGZ.hpp"
#include "Algo/Import/importChoupi.hpp"
......
......@@ -35,6 +35,8 @@
#include "Utils/gzstream.h"
#include "Algo/Import/importFileTypes.h"
#ifdef WITH_ASSIMP
#include "Assimp/assimp.h"
#include "Assimp/aiPostProcess.h"
......@@ -53,15 +55,6 @@ namespace Surface
namespace Import
{
enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, MESHBIN, PLY, /*PLYPTM, */PLYSLFgeneric, PLYSLFgenericBin, OFF, OBJ, VRML, AHEM };
// namespace ImportSurfacique
// {
//
// }
template <typename PFP>
class MeshTablesSurface
{
......@@ -127,6 +120,10 @@ public:
bool importAHEM(const std::string& filename, std::vector<std::string>& attrNames);
bool importSTLAscii(const std::string& filename, std::vector<std::string>& attrNames);
bool importSTLBin(const std::string& filename, std::vector<std::string>& attrNames);
/**
* @param container container of vertex orbite
* @param idPositions id of position attribute in the container
......@@ -147,8 +144,6 @@ namespace Volume
namespace Import
{
enum ImportType { UNKNOWNVOLUME , TET, OFF, TS, MOKA, NODE};
template <typename PFP>
class MeshTablesVolume
{
......
......@@ -73,6 +73,12 @@ ImportType MeshTablesSurface<PFP>::getFileType(const std::string& filename)
if ((filename.rfind(".ahem")!=std::string::npos) || (filename.rfind(".AHEM")!=std::string::npos))
return AHEM;
if ((filename.rfind(".stlb")!=std::string::npos) || (filename.rfind(".STLB")!=std::string::npos))
return STLB;
if ((filename.rfind(".stl")!=std::string::npos) || (filename.rfind(".STL")!=std::string::npos))
return STL;
return UNKNOWNSURFACE;
}
......@@ -125,6 +131,14 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector
CGoGNout << "TYPE: AHEM" << CGoGNendl;
return importAHEM(filename, attrNames);
break;
case STLB:
CGoGNout << "TYPE: STLB" << CGoGNendl;
return importSTLBin(filename, attrNames);
break;
case STL:
CGoGNout << "TYPE: STL" << CGoGNendl;
return importSTLAscii(filename, attrNames);
break;
default:
#ifdef WITH_ASSIMP
CGoGNout << "TYPE: ASSIMP" << CGoGNendl;
......@@ -1629,6 +1643,179 @@ bool MeshTablesSurface<PFP>::mergeCloseVertices()
return true;
}
template<typename PFP>
bool MeshTablesSurface<PFP>::importSTLAscii(const std::string& filename, std::vector<std::string>& attrNames)
{
VertexAttribute<typename PFP::VEC3> positions = m_map.template getAttribute<typename PFP::VEC3, VERTEX>("position") ;
if (!positions.isValid())
positions = m_map.template addAttribute<typename PFP::VEC3, VERTEX>("position") ;
attrNames.push_back(positions.name()) ;
AttributeContainer& container = m_map.template getAttributeContainer<VERTEX>() ;
// open file
std::ifstream fp(filename.c_str(), std::ios::in);
if (!fp.good())
{
CGoGNerr << "Unable to open file " << filename << CGoGNendl;
return false;
}