Commit 652fa86d authored by Lionel Untereiner's avatar Lionel Untereiner

Merge branch 'develop' of icube-forge.unistra.fr:cgogn/cgogn into develop

parents e38ed6af 6471d0c6
......@@ -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)
......
......@@ -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 libtinyxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
Pour compiler CGoGN
......
......@@ -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
)
......
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
#########################
# 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)
This diff is collapsed.
......@@ -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);
template <typename PFP>
bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& polygons, CellMarker<FACE>& polygonsFaces);
bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttribute<typename PFP::VEC3,typename PFP::MAP>& position, CellMarker<typename PFP::MAP,EDGE>& polygons, CellMarker<typename PFP::MAP,FACE>& polygonsFaces);
/**
*
......
......@@ -26,9 +26,13 @@
#include "Geometry/bounding_box.h"
#include "Geometry/plane_3d.h"
#include "Algo/BooleanOperator/mergeVertices.h"
#include "Algo/Topo/basic.h"
#include "Container/fakeAttribute.h"
#include <limits>
#include "Utils/xml.h" // just for highlighting/completion in editor
namespace CGoGN
{
......@@ -41,9 +45,14 @@ namespace Surface
namespace Import
{
inline bool checkXmlNode(xmlNodePtr node, const std::string& name)
//inline bool checkXmlNode(xmlNodePtr node, const std::string& name)
//{
// return (strcmp((char*)(node->name),(char*)(name.c_str())) == 0);
//}
inline bool checkXmlNode(tinyxml2::XMLElement* node, const std::string& name)
{
return (strcmp((char*)(node->name),(char*)(name.c_str())) == 0);
return (strcmp(node->Name(),name.c_str()) == 0);
}
template<typename T>
......@@ -206,7 +215,7 @@ void getPolygonFromSVG(std::string allcoords, std::vector<VEC3>& curPoly, bool&
}
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)
......@@ -218,14 +227,16 @@ void readCoordAndStyle(xmlNode* cur_path,
POLYGON curPoly;
// CGoGNout << "--load a path--"<< CGoGNendl;
xmlChar* prop = xmlGetProp(cur_path, BAD_CAST "d");
std::string allcoords((reinterpret_cast<const char*>(prop)));
// xmlChar* prop = xmlGetProp(cur_path, BAD_CAST "d");
// std::string allcoords((reinterpret_cast<const char*>(prop)));
std::string allcoords = XMLAttribute(cur_path,"d");
getPolygonFromSVG(allcoords,curPoly,closedPoly);
//check orientation : set in CCW
if(curPoly.size()>2)
{
VEC3 v(0), v1, v2;
VEC3 v(0)/*, v1, v2*/;
typename std::vector<VEC3 >::iterator it0, it1, it2;
it0 = curPoly.begin();
it1 = it0+1;
......@@ -255,8 +266,11 @@ void readCoordAndStyle(xmlNode* cur_path,
{
//if not : read the linewidth for further dilatation
allBrokenLines.push_back(curPoly);
xmlChar* prop = xmlGetProp(cur_path, BAD_CAST "style");
std::string allstyle((reinterpret_cast<const char*>(prop)));
// xmlChar* prop = xmlGetProp(cur_path, BAD_CAST "style");
// std::string allstyle((reinterpret_cast<const char*>(prop)));
std::string allstyle = XMLAttribute(cur_path,"style");
std::stringstream is(allstyle);
std::string style;
while ( std::getline( is, style, ';' ) )
......@@ -274,7 +288,7 @@ void readCoordAndStyle(xmlNode* cur_path,
}
template <typename PFP>
bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark)
bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttribute<typename PFP::VEC3,typename PFP::MAP>& position, CellMarker<typename PFP::MAP,EDGE>& obstacleMark, CellMarker<typename PFP::MAP,FACE>& buildingMark)
{
//TODO : remove auto-intersecting faces
//TODO : handling polygons with holes
......@@ -282,8 +296,18 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
typedef typename PFP::VEC3 VEC3;
typedef std::vector<VEC3> POLYGON;
xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
xmlNodePtr map_node = xmlDocGetRootElement(doc);
tinyxml2::XMLDocument doc;
tinyxml2::XMLError eResult = doc.LoadFile(filename.c_str());
if (XMLisError(eResult,"unable loading file"+filename))
return false;
tinyxml2::XMLElement* map_node = doc.RootElement();
// xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
// xmlNodePtr map_node = xmlDocGetRootElement(doc);
if (!checkXmlNode(map_node,"svg"))
{
......@@ -295,11 +319,11 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
std::vector<POLYGON> allBrokenLines;
std::vector<float> allBrokenLinesWidth;
for (xmlNode* cur_node = map_node->children; cur_node; cur_node = cur_node->next)
for (tinyxml2::XMLElement* cur_node = map_node->FirstChildElement(); cur_node; cur_node = cur_node->NextSiblingElement())
{
// for each layer
if (checkXmlNode(cur_node, "g"))
for (xmlNode* cur_path = cur_node->children ; cur_path; cur_path = cur_path->next)
for (tinyxml2::XMLElement* cur_path = cur_node->FirstChildElement(); cur_path; cur_path = cur_path->NextSiblingElement())
{
if (checkXmlNode(cur_path, "path"))
readCoordAndStyle<PFP>(cur_path, allPoly, allBrokenLines, allBrokenLinesWidth);
......@@ -308,17 +332,30 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
readCoordAndStyle<PFP>(cur_node, allPoly, allBrokenLines, allBrokenLinesWidth);
}
xmlFreeDoc(doc);
// for (xmlNode* cur_node = map_node->children; cur_node; cur_node = cur_node->next)
// {
// // for each layer
// if (checkXmlNode(cur_node, "g"))
// for (xmlNode* cur_path = cur_node->children ; cur_path; cur_path = cur_path->next)
// {
// if (checkXmlNode(cur_path, "path"))
// readCoordAndStyle<PFP>(cur_path, allPoly, allBrokenLines, allBrokenLinesWidth);
// }
// else if (checkXmlNode(cur_node, "path"))
// readCoordAndStyle<PFP>(cur_node, allPoly, allBrokenLines, allBrokenLinesWidth);
// }
// xmlFreeDoc(doc);
std::cout << "importSVG : XML read." << std::endl;
CellMarker<EDGE> brokenMark(map);
EdgeAttribute<float> edgeWidth = map.template addAttribute<float, EDGE>("width");
CellMarker<typename PFP::MAP,EDGE> brokenMark(map);
EdgeAttribute<float,typename PFP::MAP> edgeWidth = map.template addAttribute<float, EDGE,typename PFP::MAP>("width");
// EdgeAttribute<NoMathAttribute<Geom::Plane3D<typename PFP::REAL> > > edgePlanes = map.template addAttribute<NoMathAttribute<Geom::Plane3D<typename PFP::REAL> >, EDGE>("planes");
EdgeAttribute<NoTypeNameAttribute<Geom::Plane3D<typename PFP::REAL> > > edgePlanes = map.template addAttribute<NoTypeNameAttribute<Geom::Plane3D<typename PFP::REAL> >, EDGE>("planes");
EdgeAttribute<NoTypeNameAttribute<Geom::Plane3D<typename PFP::REAL> >, typename PFP::MAP> edgePlanes = map.template addAttribute<NoTypeNameAttribute<Geom::Plane3D<typename PFP::REAL> >, EDGE,typename PFP::MAP>("planes");
/////////////////////////////////////////////////////////////////////////////////////////////
//create broken lines
DartMarker brokenL(map);
DartMarker<typename PFP::MAP> brokenL(map);
typename std::vector<POLYGON >::iterator it;
std::vector<float >::iterator itW = allBrokenLinesWidth.begin();
......@@ -459,7 +496,7 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
/////////////////////////////////////////////////////////////////////////////////////////////
//process broken lines
CellMarker<EDGE> eMTreated(map) ;
CellMarker<typename PFP::MAP,EDGE> eMTreated(map) ;
for (Dart d = map.begin() ; d != map.end() ; map.next(d))
{
if (brokenL.isMarked(d) && !eMTreated.isMarked(d))
......@@ -521,7 +558,7 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
{
for (Dart d = map.begin() ; d != map.end() ; map.next(d))
{
if(map.isBoundaryMarked2(d))
if(map.template isBoundaryMarked<2>(d))
{
map.fillHole(d);
}
......@@ -552,14 +589,14 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
}
}
map.template initAllOrbitsEmbedding<FACE>(true);
Algo::Topo::initAllOrbitsEmbedding<FACE>(map,true);
for (Dart d = map.begin() ; d != map.end() ; map.next(d))
{
if (!map.isBoundaryMarked2(d) && brokenL.isMarked(d))
if (!map.template isBoundaryMarked<2>(d) && brokenL.isMarked(d))
{
map.deleteFace(d,false);
// ??? map.deleteFace(d,false);
map.deleteCycle(d); // ???
}
}
......@@ -567,7 +604,7 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
for (Dart d = map.begin() ; d != map.end() ; map.next(d))
{
if (map.isBoundaryMarked2(d))
if (map.template isBoundaryMarked<2>(d))
buildingMark.mark(d);
}
......
......@@ -31,9 +31,6 @@
#include <vector>
#include <map>
#include <libxml/encoding.h>
#include <libxml/xmlwriter.h>
#include <libxml/parser.h>
namespace CGoGN
{
......@@ -41,7 +38,6 @@ namespace CGoGN
class RegisteredBaseAttribute;
class AttributeContainer;
class ContainerBrowser
{
public:
......@@ -76,6 +72,11 @@ protected:
*/
std::vector<AttributeMultiVectorGen*> m_tableAttribs;
/**
* vector of pointers to AttributeMultiVectors of MarkerBool
*/
std::vector<AttributeMultiVector<MarkerBool>*> m_tableMarkerAttribs;
/**
* vector of free indices in the vector of AttributeMultiVectors
*/
......@@ -161,6 +162,10 @@ public:
template <typename T>
AttributeMultiVector<T>* addAttribute(const std::string& attribName);
/// special version for marker
AttributeMultiVector<MarkerBool>* addMarkerAttribute(const std::string& attribName);
/**
* add a new attribute to the container
* @param typeName type of the new attribute in a string
......@@ -190,6 +195,8 @@ public:
template <typename T>
bool removeAttribute(const std::string& attribName);
bool removeMarkerAttribute(const std::string& attribName);
/**
* Remove an attribute (destroys data)
* @param index index of the attribute to remove
......@@ -325,6 +332,7 @@ public:
*/
unsigned int getAttributesNames(std::vector<std::string>& names) const;
/**
* fill a vector with attribute type names
* @param types vector of type names
......@@ -332,6 +340,8 @@ public:
*/
unsigned int getAttributesTypes(std::vector<std::string>& types);
std::vector<AttributeMultiVector<MarkerBool>*>& getMarkerAttributes();
/**************************************
* CONTAINER MANAGEMENT *
**************************************/
......@@ -381,6 +391,11 @@ public:
*/
void initLine(unsigned int index);
/**
* initialize all markers of a line of the container
*/
void initMarkersOfLine(unsigned int index);
/**
* copy the content of line src in line dst
*/
......@@ -442,6 +457,7 @@ public:
AttributeMultiVectorGen* getVirtualDataVector(unsigned int attrIndex);
/**
* get an AttributeMultiVector
* @param attribName name of the attribute
......
......@@ -43,6 +43,11 @@ inline void AttributeContainer::setOrbit(unsigned int orbit)
if (m_tableAttribs[i] != NULL)
m_tableAttribs[i]->setOrbit(orbit);
}
for(unsigned int i = 0; i < m_tableMarkerAttribs.size(); ++i)
{
m_tableMarkerAttribs[i]->setOrbit(orbit);
}
}
inline void AttributeContainer::setRegistry(std::map< std::string, RegisteredBaseAttribute* >* re)
......@@ -338,6 +343,15 @@ inline void AttributeContainer::initLine(unsigned int index)
}
}
inline void AttributeContainer::initMarkersOfLine(unsigned int index)
{
for(unsigned int i = 0; i < m_tableMarkerAttribs.size(); ++i)
{
m_tableMarkerAttribs[i]->initElt(index);
}
}
inline void AttributeContainer::copyLine(unsigned int dstIndex, unsigned int srcIndex)
{
for(unsigned int i = 0; i < m_tableAttribs.size(); ++i)
......@@ -345,6 +359,12 @@ inline void AttributeContainer::copyLine(unsigned int dstIndex, unsigned int src
if (m_tableAttribs[i] != NULL)
m_tableAttribs[i]->copyElt(dstIndex, srcIndex);
}
for(unsigned int i = 0; i < m_tableMarkerAttribs.size(); ++i)
{
m_tableMarkerAttribs[i]->copyElt(dstIndex, srcIndex);
}
}
inline void AttributeContainer::refLine(unsigned int index)
......@@ -480,4 +500,12 @@ inline void AttributeContainer::setData(unsigned int attrIndex, unsigned int elt
atm->operator[](eltIndex) = data;
}
inline std::vector<AttributeMultiVector<MarkerBool>*>& AttributeContainer::getMarkerAttributes()
{
return m_tableMarkerAttribs;
}
} // namespace CGoGN
......@@ -195,6 +195,8 @@ public:
* @param fs filestream
*/
virtual void dump(unsigned int i) const = 0;
virtual bool isMarkerBool() = 0;
};
......@@ -322,6 +324,8 @@ public:
*/
virtual void dump(unsigned int i) const;
inline bool isMarkerBool();
};
} // namespace CGoGN
......
......@@ -418,6 +418,11 @@ void AttributeMultiVector<T>::dump(unsigned int i) const
CGoGNout << this->operator[](i);
}
template <typename T>
inline bool AttributeMultiVector<T>::isMarkerBool()
{
return false;
}
template <typename T>
inline void AttributeMultiVector<T>::setTypeCode()
......
......@@ -400,6 +400,12 @@ public:
{
CGoGNout << this->operator[](i);
}
inline bool isMarkerBool()
{
return true;
}
};
......
......@@ -142,6 +142,7 @@ inline void GenericMap::releaseUIntBuffer(std::vector<unsigned int>* vui) const
inline Dart GenericMap::newDart()
{
unsigned int di = m_attribs[DART].insertLine(); // insert a new dart line
m_attribs[DART].initMarkersOfLine(di);
for(unsigned int i = 0; i < NB_ORBITS; ++i)
{
if (m_embeddings[i]) // set all its embeddings
......@@ -206,7 +207,10 @@ template <unsigned int ORBIT>
inline unsigned int GenericMap::newCell()
{
assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded");
return m_attribs[ORBIT].insertLine();
unsigned int c = m_attribs[ORBIT].insertLine();
m_attribs[ORBIT].initMarkersOfLine(c);
return c;
}
template <unsigned int ORBIT>
......@@ -286,7 +290,7 @@ AttributeMultiVector<MarkerBool>* GenericMap::askMarkVector()
x = x/10;
number[0]= '0'+x%10;
AttributeMultiVector<MarkerBool>* amv = m_attribs[ORBIT].addAttribute<MarkerBool>("marker_" + orbitName(ORBIT) + number);
AttributeMultiVector<MarkerBool>* amv = m_attribs[ORBIT].addMarkerAttribute("marker_" + orbitName(ORBIT) + number);
return amv;
}
}
......
......@@ -259,14 +259,14 @@ public:
* @param radius radius on pixel for clicking precision
* @return the distance in modelview world corresponding to radius pixel in screen
*/
// GLfloat getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f& rayB, int radius=4) { return m_glWidget->getOrthoScreenRay(x,y,rayA,rayB,radius);}
GLfloat getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f& rayB, int radius=4) { return m_qglWidget->getOrthoScreenRay(x,y,rayA,rayB,radius);}
/**
* transform a pixel distance on screen in distance in world
* @param pixel_width width on pixel on screen
* @param center reference point on world to use (defaut 0,0,0)
*/
// float getWidthInWorld(unsigned int pixel_width, const Geom::Vec3f& center) { return m_glWidget->getWidthInWorld(pixel_width,center);}
float getWidthInWorld(unsigned int pixel_width, const Geom::Vec3f& center) { return m_qglWidget->getWidthInWorld(pixel_width,center);}
const glm::mat4& transfoMatrix() const { return m_transfo_matrix; }
......
......@@ -60,6 +60,7 @@ protected:
int W;
int H;
int m_state_modifier;
int m_current_button;
public:
QGLView(SimpleQGLV* ptr, QGLFormat& format, QWidget *parent = 0);
......@@ -79,7 +80,7 @@ public:
void mouseReleaseEvent(QMouseEvent* event);
void mouseClickEvent(QMouseEvent* event);
// void mouseDoubleClickEvent(QMouseEvent* event);
// void mouseMoveEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void keyPressEvent(QKeyEvent* event);
void keyReleaseEvent(QKeyEvent* event);
// void wheelEvent(QWheelEvent* event);
......@@ -89,6 +90,9 @@ public:
int getHeight() const { return H; }
int getWidth() const { return W; }
GLfloat getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f& rayB, int radius);
float getWidthInWorld(unsigned int pixel_width, const Geom::Vec3f& center);
QSize minimumSizeHint() const;
QSize sizeHint() const;
......
/*******************************************************************************
* 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 __CGoGN_XML__
#define __CGoGN_XML__
#include <string>
#include "Utils/cgognStream.h"
#include <tinyxml2.h>
namespace CGoGN
{
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 attribute "<< attName << " not found"<< CGoGNendl;
return "";
}
return std::string(ptr);
}
}
#endif
This diff is collapsed.
......@@ -29,9 +29,6 @@
#include <cassert>
#include <stdio.h>
#include <string.h>
#include <libxml/encoding.h>
#include <libxml/xmlwriter.h>
#include <libxml/parser.h>
#include <iostream>
#include <sstream>
......
......@@ -235,8 +235,8 @@ void GenericMap::init(bool addBoundaryMarkers)
if (addBoundaryMarkers)
{
m_boundaryMarkers[0] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark0") ;
m_boundaryMarkers[1] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark1") ;
m_boundaryMarkers[0] = m_attribs[DART].addMarkerAttribute(