Commit 5fc601bd authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' into 'master'

Christmas merge ..

See merge request !25
parents e7cd2254 ffaa09d7
......@@ -58,7 +58,8 @@ ENDIF(WIN32)
find_package(OpenGL REQUIRED)
find_package(Boost COMPONENTS regex REQUIRED)
find_package(ZLIB REQUIRED)
find_package(LibXml2 REQUIRED)
#find_package(LibXml2 REQUIRED)
find_package(TinyXml2 REQUIRED)
find_package(GLEW REQUIRED)
# MESSAGE HERE FOR MORE EASY USER READING
......@@ -98,7 +99,7 @@ SET (CGoGN_EXT_INCLUDES
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${LIBXML2_INCLUDE_DIR}
${TINYXML2_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
......@@ -108,7 +109,7 @@ SET (CGoGN_EXT_LIBS
${OPENGL_LIBRARY}
${GLEW_LIBRARIES}
${ZLIB_LIBRARIES}
${LIBXML2_LIBRARIES}
${TINYXML2_LIBRARY}
${Boost_REGEX_LIBRARY}
)
......
......@@ -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
......
#########################
# 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("BoundaryMark0") ;
m_boundaryMarkers[1] = m_attribs[DART].addMarkerAttribute("BoundaryMark1") ;
}
......@@ -405,17 +405,16 @@ void GenericMap::restore_shortcuts()
}
// MARKERS
m_attribs[DART].getAttributesNames(listeNames);
for (unsigned int i = 0; i < listeNames.size(); ++i)
std::vector<AttributeMultiVector<MarkerBool>*>& amvv = m_attribs[DART].getMarkerAttributes();
for (auto it=amvv.begin(); it != amvv.end(); ++it)
{
if (listeNames[i] == "BoundaryMark0")
m_boundaryMarkers[0] = cont.getDataVector<MarkerBool>(i);
if (listeNames[i] == "BoundaryMark1")
m_boundaryMarkers[1] = cont.getDataVector<MarkerBool>(i);
if ((*it)->getName() == "BoundaryMark0")
m_boundaryMarkers[0] = *it;
if ((*it)->getName() == "BoundaryMark1")
m_boundaryMarkers[1] = *it;
}
// QUICK TRAVERSAL
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
......@@ -603,17 +602,20 @@ void GenericMap::garbageMarkVectors()
for (unsigned int orbit=0; orbit<NB_ORBITS;++orbit)
{
std::vector<std::string> attNames;
m_attribs[orbit].getAttributesNames(attNames);
for (auto sit=attNames.begin(); sit!=attNames.end();++sit)
std::vector<AttributeMultiVector<MarkerBool>*>& amvv = m_attribs[orbit].getMarkerAttributes();
for (auto it = amvv.begin(); it != amvv.end(); ++it )
{
if (sit->substr(0,7) == "marker_")
AttributeMultiVector<MarkerBool>* amv = *it;
const std::string& name = amv->getName();
if (name.substr(0,7) == "marker_")
{
std::string num = sit->substr(sit->length()-3,3);
// store tne next free index for unique numbering
std::string num = name.substr(name.length()-3,3);
unsigned int id = 100*(num[0]-'0')+10*(num[1]-'0')+(num[2]-'0');
if (id > maxId)
maxId = id;
AttributeMultiVector<MarkerBool>* amv = m_attribs[orbit].getDataVector<MarkerBool>(*sit);
amv->allFalse();
m_markVectors_free[orbit][0].push_back(amv);
}
......
......@@ -162,7 +162,7 @@ void QGLView::mousePressEvent(QMouseEvent* event)
// beginx = event->x();
// beginy = event->y();
// clickPoint = event->pos();
// m_current_button = event->button();
m_current_button = event->button();
if (m_sqgl)
m_sqgl->cb_mousePress(event->button(), event->x(), getHeight() - event->y());
......@@ -173,7 +173,7 @@ void QGLView::mouseReleaseEvent(QMouseEvent* event)
{
if (m_sqgl)
m_sqgl->cb_mouseRelease(event->button(), event->x(), getHeight() - event->y());
m_current_button = 0;
QGLViewer::mouseReleaseEvent(event);
}
......@@ -183,6 +183,14 @@ void QGLView::mouseClickEvent(QMouseEvent* event)
m_sqgl->cb_mouseClick(event->button(), event->x(), getHeight() - event->y());
}
void QGLView::mouseMoveEvent(QMouseEvent* event)
{
if (m_sqgl)
m_sqgl->cb_mouseMove(m_current_button, event->x(), getHeight() - event->y());
QGLViewer::mouseMoveEvent(event);
}
void QGLView::glMousePosition(int& x, int& y)
{
QPoint xy = mapFromGlobal(QCursor::pos());
......@@ -190,6 +198,80 @@ void QGLView::glMousePosition(int& x, int& y)
y = getHeight() - xy.y();
}
GLfloat QGLView::getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f& rayB, int radius)