Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
beca7656
Commit
beca7656
authored
Jan 12, 2015
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'cgogn/develop' into develop
parents
7a3e52d4
6471d0c6
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
853 additions
and
499 deletions
+853
-499
CMakeLists.txt
CMakeLists.txt
+24
-3
README.TXT
README.TXT
+1
-1
SCHNApps/CMakeLists.txt
SCHNApps/CMakeLists.txt
+2
-4
ThirdParty/CMakeLists.txt
ThirdParty/CMakeLists.txt
+19
-2
cmake_modules/FindTinyXml2.cmake
cmake_modules/FindTinyXml2.cmake
+27
-0
include/Algo/Import/import2tablesVolume.hpp
include/Algo/Import/import2tablesVolume.hpp
+306
-77
include/Algo/Import/importSvg.h
include/Algo/Import/importSvg.h
+5
-3
include/Algo/Import/importSvg.hpp
include/Algo/Import/importSvg.hpp
+62
-25
include/Container/attributeContainer.h
include/Container/attributeContainer.h
+20
-4
include/Container/attributeContainer.hpp
include/Container/attributeContainer.hpp
+28
-0
include/Container/attributeMultiVector.h
include/Container/attributeMultiVector.h
+4
-0
include/Container/attributeMultiVector.hpp
include/Container/attributeMultiVector.hpp
+5
-0
include/Container/attributeMultiVectorBool.hpp
include/Container/attributeMultiVectorBool.hpp
+6
-0
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+6
-2
include/Utils/Qt/qtQGLV.h
include/Utils/Qt/qtQGLV.h
+2
-2
include/Utils/Qt/qtQGLV_glw.h
include/Utils/Qt/qtQGLV_glw.h
+5
-1
include/Utils/xml.h
include/Utils/xml.h
+59
-0
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+170
-279
src/Container/holeblockref.cpp
src/Container/holeblockref.cpp
+0
-3
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+18
-16
src/Utils/Qt/qtQGLV_glw.cpp
src/Utils/Qt/qtQGLV_glw.cpp
+84
-2
src/Utils/Qt/qtSimple.cpp
src/Utils/Qt/qtSimple.cpp
+0
-75
No files found.
CMakeLists.txt
View file @
beca7656
...
...
@@ -9,6 +9,29 @@ SET ( CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR} )
SET
(
CMAKE_MODULE_PATH
${
CGoGN_ROOT_DIR
}
/cmake_modules/
)
# ====== Check GCC VERSION FOR C++11 ======
if
(
CMAKE_COMPILER_IS_GNUCXX
)
execute_process
(
COMMAND
${
CMAKE_CXX_COMPILER
}
-dumpversion OUTPUT_VARIABLE GCC_VERSION
)
if
(
GCC_VERSION VERSION_LESS 4.8
)
message
(
FATAL_ERROR
"Full support of C++11 needed. Therefore a gcc/g++ compiler with a version at least 4.8 is needed."
)
endif
()
endif
()
# ====== Check CLANG VERSION FOR C++11 ======
if
(
APPLE
)
execute_process
(
COMMAND
${
CMAKE_CXX_COMPILER
}
-dumpversion OUTPUT_VARIABLE CLANG_VERSION
)
if
(
CLANG_VERSION VERSION_LESS 3.1
)
message
(
FATAL_ERROR
"Full support of C++11 needed. Therefore a clang compiler with a version at least 3.1 is needed !!"
)
endif
()
endif
()
# ====== Check MSVC VERSION FOR C++11 ======
if
(
WIN32
)
if
(
MSVC_VERSION LESS 1800
)
message
(
FATAL_ERROR
"Full support of C++11 needed. Therefore a microsoft compiler with a version at least 12 is needed."
)
endif
()
endif
()
IF
(
NOT
(
${
CMAKE_BUILD_TYPE
}
MATCHES
"Debug|Release"
))
IF
(
${
CMAKE_CURRENT_BINARY_DIR
}
MATCHES
"(.*)Debug|(.*)debug|(.*)DEBUG"
)
...
...
@@ -58,7 +81,6 @@ ENDIF(WIN32)
find_package
(
OpenGL REQUIRED
)
find_package
(
Boost COMPONENTS regex REQUIRED
)
find_package
(
ZLIB REQUIRED
)
find_package
(
LibXml2 REQUIRED
)
find_package
(
GLEW REQUIRED
)
# MESSAGE HERE FOR MORE EASY USER READING
...
...
@@ -98,7 +120,6 @@ SET (CGoGN_EXT_INCLUDES
${
OPENGL_INCLUDE_DIR
}
${
GLEW_INCLUDE_DIRS
}
${
ZLIB_INCLUDE_DIRS
}
${
LIBXML2_INCLUDE_DIR
}
${
Boost_INCLUDE_DIRS
}
)
...
...
@@ -108,8 +129,8 @@ SET (CGoGN_EXT_LIBS
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARIES
}
${
ZLIB_LIBRARIES
}
${
LIBXML2_LIBRARIES
}
${
Boost_REGEX_LIBRARY
}
tinyxml2
)
IF
(
WIN32
)
...
...
README.TXT
View file @
beca7656
...
...
@@ -3,7 +3,7 @@ English version bellow
Dépendences Linux
=================
installer les paquets suivants:
cmake cmake-curses-gui cmake-qt-gui libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
cmake cmake-curses-gui cmake-qt-gui libXi-dev libXmu-dev libglew-dev lib
tiny
xml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
Pour compiler CGoGN
...
...
SCHNApps/CMakeLists.txt
View file @
beca7656
...
...
@@ -23,7 +23,6 @@ SET( USE_OGL_CORE_PROFILE OFF CACHE BOOL "use OpenGL 3.3 core profile (do not wo
find_package
(
OpenGL REQUIRED
)
find_package
(
Boost COMPONENTS regex system REQUIRED
)
find_package
(
ZLIB REQUIRED
)
find_package
(
LibXml2 REQUIRED
)
find_package
(
GLEW REQUIRED
)
find_package
(
Qt4 REQUIRED
)
find_package
(
QGLViewer REQUIRED
)
...
...
@@ -73,7 +72,6 @@ SET (EXT_INCLUDES
${
OPENGL_INCLUDE_DIR
}
${
GLEW_INCLUDE_DIRS
}
${
ZLIB_INCLUDE_DIRS
}
${
LIBXML2_INCLUDE_DIR
}
${
Boost_INCLUDE_DIRS
}
${
QT_INCLUDE_DIR
}
${
QGLVIEWER_INCLUDE_DIR
}
...
...
@@ -86,17 +84,17 @@ SET (EXT_INCLUDES
SET
(
EXT_LIBS
PythonQt
nl
${
QGLVIEWER_LIBRARIES
}
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARIES
}
${
ZLIB_LIBRARIES
}
${
LIBXML2_LIBRARIES
}
${
Boost_SYSTEM_LIBRARY
}
${
Boost_REGEX_LIBRARY
}
${
QT_LIBRARIES
}
${
QGLVIEWER_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
SUITESPARSE_LIBRARIES
}
# ${SUPERLU_LIBRARIES}
tinyxml2
)
...
...
ThirdParty/CMakeLists.txt
View file @
beca7656
cmake_minimum_required
(
VERSION 2.8
)
include
(
ExternalProject
)
project
(
CGoGN_ThirdParty
)
SET
(
CGoGN_ROOT_DIR
${
CMAKE_SOURCE_DIR
}
/..
)
IF
(
WIN32
)
...
...
@@ -36,6 +39,7 @@ ENDIF(WIN32)
SET
(
BUILD_SHARED_LIBS OFF CACHE BOOL
"if used all library are build as shared type (.so/.dylib/.dll)"
)
SET
(
WITH_TINYXML2 ON CACHE BOOL
"get & build tinyxml2"
)
SET
(
WITH_ASSIMP OFF CACHE BOOL
"build with Assimp"
)
SET
(
WITH_ZINRI ON CACHE BOOL
"build with Zinri libs"
)
SET
(
WITH_PYTHONQT ON CACHE BOOL
"build PythonQt (for Schnapps)"
)
...
...
@@ -67,5 +71,18 @@ IF (WITH_ASSIMP)
INSTALL
(
DIRECTORY Assimp/include/ DESTINATION
${
CGoGN_ROOT_DIR
}
/ThirdParty/include/Assimp
)
ENDIF
(
WITH_ASSIMP
)
IF
(
WITH_TINYXML2
)
ExternalProject_Add
(
Tinyxml2
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
/tinyxml2
GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
CMAKE_CACHE_ARGS
"-DCMAKE_BUILD_TYPE:string=
${
CMAKE_BUILD_TYPE
}
"
CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=
${
CGoGN_ROOT_DIR
}
/ThirdParty/TinyXml2"
BUILD_COMMAND make
INSTALL_COMMAND make install
)
INSTALL
(
DIRECTORY TinyXml2/include/ DESTINATION
${
CGoGN_ROOT_DIR
}
/ThirdParty/include
)
FILE
(
GLOB_RECURSE tinyLib_files
${
CGoGN_ROOT_DIR
}
/ThirdParty/TinyXml2/lib/*.so.*
${
CGoGN_ROOT_DIR
}
/ThirdParty/TinyXml2/lib/*.a
)
INSTALL
(
FILES
${
tinyLib_files
}
DESTINATION
${
CGoGN_ROOT_DIR
}
/lib/
${
CMAKE_BUILD_TYPE
}
)
ENDIF
(
WITH_TINYXML2
)
\ No newline at end of file
cmake_modules/FindTinyXml2.cmake
0 → 100644
View file @
beca7656
#########################
# UPDATE VARIABLES:
# - TINYXML2_FOUND
# - TINYXML2_INCLUDE_DIR
# - TINYXML2_LIBRARY
#########################
find_path
(
TINYXML2_INCLUDE_DIR tinyxml2.h
HINTS $ENV{TINYXML2DIR}
PATH_SUFFIXES include
PATHS ~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
)
find_library
(
TINYXML2_LIBRARY tinyxml2
HINTS $ENV{TINYXML2DIR}
PATH_SUFFIXES lib64 lib
PATH_SUFFIXESS ~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
)
include
(
FindPackageHandleStandardArgs
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
TINYXML2 DEFAULT_MSG TINYXML2_LIBRARY
)
mark_as_advanced
(
TINYXML2_LIBRARY TINYXML2_INCLUDE_DIR
)
include/Algo/Import/import2tablesVolume.hpp
View file @
beca7656
...
...
@@ -24,9 +24,12 @@
#include "Geometry/orientation.h"
#include <libxml/encoding.h>
#include <libxml/xmlwriter.h>
#include <libxml/parser.h>
//#include <libxml/encoding.h>
//#include <libxml/xmlwriter.h>
//#include <libxml/parser.h>
//#include <tinyxml2.h>
#include "Utils/xml.h"
namespace CGoGN
{
...
...
@@ -1436,9 +1439,249 @@ bool MeshTablesVolume<PFP>::importVBGZ(const std::string& filename, std::vector<
return true;
}
//template <typename PFP>
//bool MeshTablesVolume<PFP>::importVTU(const std::string& filename, std::vector<std::string>& attrNames)
//{
// VertexAttribute<VEC3, MAP> position = m_map.template getAttribute<VEC3, VERTEX, MAP>("position") ;
// if (!position.isValid())
// position = m_map.template addAttribute<VEC3, VERTEX, MAP>("position") ;
// attrNames.push_back(position.name()) ;
// //
// AttributeContainer& container = m_map.template getAttributeContainer<VERTEX>() ;
// xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
// xmlNodePtr vtu_node = xmlDocGetRootElement(doc);
// // std::cout << " NAME "<<vtu_node->name << std::endl;
// xmlChar *prop = xmlGetProp(vtu_node, BAD_CAST "type");
// // std::cout << "type = "<< prop << std::endl;
// xmlNode* grid_node = vtu_node->children;
// while (strcmp((char*)(grid_node->name),(char*)"UnstructuredGrid")!=0)
// grid_node = grid_node->next;
// xmlNode* piece_node = grid_node->children;
// while (strcmp((char*)(piece_node->name),(char*)"Piece")!=0)
// piece_node = piece_node->next;
// prop = xmlGetProp(piece_node, BAD_CAST "NumberOfPoints");
// m_nbVertices = atoi((char*)(prop));
// prop = xmlGetProp(piece_node, BAD_CAST "NumberOfCells");
// m_nbVolumes = atoi((char*)(prop));
// std::cout << "Number of points = "<< m_nbVertices<< std::endl;
// std::cout << "Number of cells = "<< m_nbVolumes << std::endl;
// xmlNode* points_node = piece_node->children;
// while (strcmp((char*)(points_node->name),(char*)"Points")!=0)
// points_node = points_node->next;
// points_node = points_node->children;
// while (strcmp((char*)(points_node->name),(char*)"DataArray")!=0)
// points_node = points_node->next;
// std::vector<unsigned int> verticesID;
// verticesID.reserve(m_nbVertices);
// std::stringstream ss((char*)(xmlNodeGetContent(points_node->children)));
// for (unsigned int i=0; i< m_nbVertices; ++i)
// {
// typename PFP::VEC3 P;
// ss >> P[0]; ss >> P[1]; ss >> P[2];
// unsigned int id = container.insertLine();
// position[id] = P;
// verticesID.push_back(id);
// }
// xmlNode* cell_node = piece_node->children;
// while (strcmp((char*)(cell_node->name),(char*)"Cells")!=0)
// cell_node = cell_node->next;
// std::cout <<"CELL NODE = "<< cell_node->name << std::endl;
// std::vector<unsigned char> typeVols;
// typeVols.reserve(m_nbVolumes);
// std::vector<unsigned int> offsets;
// offsets.reserve(m_nbVolumes);
// std::vector<unsigned int> indices;
// indices.reserve(m_nbVolumes*4);
// for (xmlNode* x_node = cell_node->children; x_node!=NULL; x_node = x_node->next)
// {
// while ((x_node!=NULL) && (strcmp((char*)(x_node->name),(char*)"DataArray")!=0))
// x_node = x_node->next;
// if (x_node == NULL)
// break;
// else
// {
// xmlChar* type = xmlGetProp(x_node, BAD_CAST "Name");
// if (strcmp((char*)(type),(char*)"connectivity")==0)
// {
// std::stringstream ss((char*)(xmlNodeGetContent(x_node->children)));
// while (!ss.eof())
// {
// unsigned int ind;
// ss >> ind;
// indices.push_back(ind);
// }
// }
// if (strcmp((char*)(type),(char*)"offsets")==0)
// {
// std::stringstream ss((char*)(xmlNodeGetContent(x_node->children)));
// for (unsigned int i=0; i< m_nbVolumes; ++i)
// {
// unsigned int o;
// ss >> o;
// offsets.push_back(o);
// }
// }
// if (strcmp((char*)(type),(char*)"types")==0)
// {
// bool unsupported = false;
// std::stringstream ss((char*)(xmlNodeGetContent(x_node->children)));
// for (unsigned int i=0; i< m_nbVolumes; ++i)
// {
// unsigned int t;
// ss >> t;
// if ((t != 12) && (t!= 10))
// {
// unsupported = true;
// typeVols.push_back(0);
// }
// else
// {
// typeVols.push_back((unsigned char)t);
// }
// }
// if (unsupported)
// CGoGNerr << "warning, some unsupported volume cell types"<< CGoGNendl;
// }
// }
// }
// xmlFreeDoc(doc);
// unsigned int currentOffset = 0;
// for (unsigned int i=0; i< m_nbVolumes; ++i)
// {
// if (typeVols[i]==12)
// {
// m_nbFaces.push_back(8);
// unsigned int pt[8];
// pt[0] = indices[currentOffset];
// pt[1] = indices[currentOffset+1];
// pt[2] = indices[currentOffset+2];
// pt[3] = indices[currentOffset+3];
// pt[4] = indices[currentOffset+4];
// typename PFP::VEC3 P = position[verticesID[indices[currentOffset+4]]];
// typename PFP::VEC3 A = position[verticesID[indices[currentOffset ]]];
// typename PFP::VEC3 B = position[verticesID[indices[currentOffset+1]]];
// typename PFP::VEC3 C = position[verticesID[indices[currentOffset+2]]];
// if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER)
// {
// pt[0] = indices[currentOffset+3];
// pt[1] = indices[currentOffset+2];
// pt[2] = indices[currentOffset+1];
// pt[3] = indices[currentOffset+0];
// pt[4] = indices[currentOffset+7];
// pt[5] = indices[currentOffset+6];
// pt[6] = indices[currentOffset+5];
// pt[7] = indices[currentOffset+4];
// }
// else
// {
// pt[0] = indices[currentOffset+0];
// pt[1] = indices[currentOffset+1];
// pt[2] = indices[currentOffset+2];
// pt[3] = indices[currentOffset+3];
// pt[4] = indices[currentOffset+4];
// pt[5] = indices[currentOffset+5];
// pt[6] = indices[currentOffset+6];
// pt[7] = indices[currentOffset+7];
// }
// m_emb.push_back(verticesID[pt[0]]);
// m_emb.push_back(verticesID[pt[1]]);
// m_emb.push_back(verticesID[pt[2]]);
// m_emb.push_back(verticesID[pt[3]]);
// m_emb.push_back(verticesID[pt[4]]);
// m_emb.push_back(verticesID[pt[5]]);
// m_emb.push_back(verticesID[pt[6]]);
// m_emb.push_back(verticesID[pt[7]]);
// }
// else if (typeVols[i]==10)
// {
// m_nbFaces.push_back(4);
// Geom::Vec4ui pt;
// pt[0] = indices[currentOffset];
// pt[1] = indices[currentOffset+1];
// pt[2] = indices[currentOffset+2];
// pt[3] = indices[currentOffset+3];
// typename PFP::VEC3 P = position[verticesID[pt[0]]];
// typename PFP::VEC3 A = position[verticesID[pt[1]]];
// typename PFP::VEC3 B = position[verticesID[pt[2]]];
// typename PFP::VEC3 C = position[verticesID[pt[3]]];
// if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER)
// {
// unsigned int ui=pt[1];
// pt[1] = pt[2];
// pt[2] = ui;
// }
// m_emb.push_back(verticesID[pt[0]]);
// m_emb.push_back(verticesID[pt[1]]);
// m_emb.push_back(verticesID[pt[2]]);
// m_emb.push_back(verticesID[pt[3]]);
// }
// currentOffset = offsets[i];
// }
// return true;
//}
//inline bool XMLisError(tinyxml2::XMLError err, const std::string& msg)
//{
// if (err != tinyxml2::XML_NO_ERROR)
// {
// CGoGNerr << msg << CGoGNendl;
// return true;
// }
// return false;
//}
//inline std::string XMLAttribute(tinyxml2::XMLElement* node, const char* attName)
//{
// const char *ptr = node->Attribute(attName);
// if (ptr == NULL)
// {
// CGoGNerr << "Warning attrbute "<< attName << " not found"<< CGoGNendl;
// return "";
// }
// return std::string(ptr);
//}
template <typename PFP>
bool MeshTablesVolume<PFP>::importVTU(const std::string& filename, std::vector<std::string>& attrNames)
{
VertexAttribute<VEC3, MAP> position = m_map.template getAttribute<VEC3, VERTEX, MAP>("position") ;
if (!position.isValid())
...
...
@@ -1449,43 +1692,36 @@ bool MeshTablesVolume<PFP>::importVTU(const std::string& filename, std::vector<s
//
AttributeContainer& container = m_map.template getAttributeContainer<VERTEX>() ;
xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
xmlNodePtr vtu_node = xmlDocGetRootElement(doc);
// std::cout << " NAME "<<vtu_node->name << std::endl;
xmlChar *prop = xmlGetProp(vtu_node, BAD_CAST "type");
// std::cout << "type = "<< prop << std::endl;
xmlNode* grid_node = vtu_node->children;
while (strcmp((char*)(grid_node->name),(char*)"UnstructuredGrid")!=0)
grid_node = grid_node->next;
tinyxml2::XMLDocument doc;
tinyxml2::XMLError eResult = doc.LoadFile(filename.c_str());
xmlNode* piece_node = grid_node->children;
while (strcmp((char*)(piece_node->name),(char*)"Piece")!=0)
piece_node = piece_node->next;
if (XMLisError(eResult,"unable loading file"+filename))
return false;
prop = xmlGetProp(piece_node, BAD_CAST "NumberOfPoints");
m_nbVertices = atoi((char*)(prop));
tinyxml2::XMLElement* vtu_node = doc.RootElement();
prop = xmlGetProp(piece_node, BAD_CAST "NumberOfCells
");
m_nbVolumes = atoi((char*)(prop)
);
tinyxml2::XMLElement* grid_node = vtu_node->FirstChildElement("UnstructuredGrid
");
tinyxml2::XMLElement* piece_node = grid_node->FirstChildElement("Piece"
);
std::cout << "Number of points = "<< m_nbVertices<< std::endl;
std::cout << "Number of cells = "<< m_nbVolumes << std::endl;
eResult = piece_node->QueryUnsignedAttribute("NumberOfPoints",&m_nbVertices);
if (XMLisError(eResult,"unreadable VTU file: "+filename))
return false;
eResult = piece_node->QueryUnsignedAttribute("NumberOfCells",&m_nbVolumes);
if (XMLisError(eResult,"unreadable VTU file: "+filename))
return false;
xmlNode* points_node = piece_node->children;
while (strcmp((char*)(points_node->name),(char*)"Points")!=0)
points_node = points_node->next;
CGoGNout << "Number of points = "<< m_nbVertices<< CGoGNendl;
CGoGNout << "Number of cells = "<< m_nbVolumes << CGoGNendl;
points_node = points_node->children;
while (strcmp((char*)(points_node->name),(char*)"DataArray")!=0)
points_node = points_node->next;
tinyxml2::XMLElement* points_node = piece_node->FirstChildElement("Points");
tinyxml2::XMLElement* array_node = points_node->FirstChildElement("DataArray");
std::vector<unsigned int> verticesID;
verticesID.reserve(m_nbVertices);
std::stringstream ss((char*)(xmlNodeGetContent(points_node->children)));
std::stringstream ss(array_node->GetText());
for (unsigned int i=0; i< m_nbVertices; ++i)
{
typename PFP::VEC3 P;
...
...
@@ -1495,12 +1731,8 @@ bool MeshTablesVolume<PFP>::importVTU(const std::string& filename, std::vector<s
verticesID.push_back(id);
}
xmlNode* cell_node = piece_node->children;
while (strcmp((char*)(cell_node->name),(char*)"Cells")!=0)
cell_node = cell_node->next;
std::cout <<"CELL NODE = "<< cell_node->name << std::endl;
tinyxml2::XMLElement* cell_node = piece_node->FirstChildElement("Cells");
array_node = cell_node->FirstChildElement("DataArray");
std::vector<unsigned char> typeVols;
typeVols.reserve(m_nbVolumes);
...
...
@@ -1509,63 +1741,60 @@ bool MeshTablesVolume<PFP>::importVTU(const std::string& filename, std::vector<s
std::vector<unsigned int> indices;
indices.reserve(m_nbVolumes*4);
for (xmlNode* x_node = cell_node->children; x_node!=NULL; x_node = x_node->next
)
while (array_node
)
{
while ((x_node!=NULL) && (strcmp((char*)(x_node->name),(char*)"DataArray")!=0))
x_node = x_node->next;
std::string propName = XMLAttribute(array_node,"Name");
if (x_node == NULL)
break;
else
if (propName == "")
{
xmlChar* type = xmlGetProp(x_node, BAD_CAST "Name");
CGoGNerr << "Error reading VTU unreadable file: "<<filename<< CGoGNendl;
return false;
}
if (strcmp((char*)(type),(char*)"connectivity")==0)
if (propName == "connectivity")
{
std::stringstream ss(array_node->GetText());
while (!ss.eof())
{
std::stringstream ss((char*)(xmlNodeGetContent(x_node->children)));
while (!ss.eof())
{
unsigned int ind;
ss >> ind;
indices.push_back(ind);
}
unsigned int ind;
ss >> ind;
indices.push_back(ind);
}
if (strcmp((char*)(type),(char*)"offsets")==0)
}
if (propName == "offsets")
{
std::stringstream ss(array_node->GetText());
for (unsigned int i=0; i< m_nbVolumes; ++i)
{
std::stringstream ss((char*)(xmlNodeGetContent(x_node->children)));
for (unsigned int i=0; i< m_nbVolumes; ++i)
{
unsigned int o;
ss >> o;
offsets.push_back(o);
}
unsigned int o;
ss >> o;
offsets.push_back(o);
}
if (strcmp((char*)(type),(char*)"types")==0)
}
if (propName == "types")
{
bool unsupported = false;
std::stringstream ss(array_node->GetText());
for (unsigned int i=0; i< m_nbVolumes; ++i)
{
bool unsupported = false
;
s
td::stringstream ss((char*)(xmlNodeGetContent(x_node->children)))
;
for (unsigned int i=0; i< m_nbVolumes; ++i
)
unsigned int t
;
s
s >> t
;
if ((t != 12) && (t!= 10)
)
{
unsigned int t;
ss >> t;
if ((t != 12) && (t!= 10))
{
unsupported = true;
typeVols.push_back(0);
}
else
{
typeVols.push_back((unsigned char)t);
}
unsupported = true;
typeVols.push_back(0);
}
else
{
typeVols.push_back((unsigned char)t);
}
if (unsupported)
CGoGNerr << "warning, some unsupported volume cell types"<< CGoGNendl;
}
if (unsupported)
CGoGNerr << "warning, some unsupported volume cell types"<< CGoGNendl;
}
array_node = array_node->NextSiblingElement("DataArray");
}
xmlFreeDoc(doc);
unsigned int currentOffset = 0;
for (unsigned int i=0; i< m_nbVolumes; ++i)
{
...
...
include/Algo/Import/importSvg.h
View file @
beca7656
...
...
@@ -25,6 +25,8 @@
#ifndef __IMPORTSVG_H__
#define __IMPORTSVG_H__
#include "Utils/xml.h"
namespace
CGoGN
{
...
...
@@ -43,16 +45,16 @@ namespace Import
* @param name the name
* @ return true if node has the good name
*/
bool
checkXmlNode
(
xmlNodePtr
node
,
const
std
::
string
&
name
);
bool
checkXmlNode
(
tinyxml2
::
XMLElement
*
node
,
const
std
::
string
&
name
);
template
<
typename
PFP
>
void
readCoordAndStyle
(
xmlNode
*
cur_path
,
void
readCoordAndStyle
(
tinyxml2
::
XMLElement
*
cur_path
,
std
::
vector
<
std
::
vector
<
VEC3
>
>&
allPoly
,
std
::
vector
<
std
::
vector
<
VEC3
>
>&
allBrokenLines
,
std
::
vector
<
float
>&
allBrokenLinesWidth
);