diff --git a/Common/GmshConfig.h.in b/Common/GmshConfig.h.in index dc88f710c59d191d9f5ff77a7f50382ec7c76d53..0659077523f181eba21f808f2620593700476ae2 100644 --- a/Common/GmshConfig.h.in +++ b/Common/GmshConfig.h.in @@ -31,7 +31,6 @@ #cmakedefine HAVE_NO_SOCKLEN_T #cmakedefine HAVE_NO_VSNPRINTF #cmakedefine HAVE_OCC -#cmakedefine HAVE_OCC_MESH_CONSTRAINTS #cmakedefine HAVE_OPENGL #cmakedefine HAVE_OSMESA #cmakedefine HAVE_PARSER diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index 30102b2db387e2af46249e1bc3dea84cf05a52e2..90d40f66fd3c10acbe1aad27daf2c2b508c227fa 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -55,7 +55,7 @@ openglWindow::~openglWindow() delete _ctx; } -void openglWindow::drawScreenMessage() +void openglWindow::_drawScreenMessage() { if(screenMessage[0].empty() && screenMessage[1].empty()) return; @@ -81,7 +81,7 @@ void openglWindow::drawScreenMessage() } } -void openglWindow::drawBorder() +void openglWindow::_drawBorder() { // draw thin border if the parent group has several children if(parent()->children() > 1){ @@ -109,7 +109,7 @@ void openglWindow::draw() // some drawing routines can create data (STL triangulations, etc.): // make sure that we don't fire draw() while we are already drawing, // e.g. due to an impromptu Fl::check(). The same lock is also used in - // processSelectionBuffer to guarantee that we don't mix GL_RENDER and + // _processSelectionBuffer to guarantee that we don't mix GL_RENDER and // GL_SELECT rendering passes. if(_lock) return; _lock = true; @@ -179,8 +179,8 @@ void openglWindow::draw() glVertex3d(_point[0], _point[1], _point[2]); glEnd(); _ctx->draw2d(); - drawScreenMessage(); - drawBorder(); + _drawScreenMessage(); + _drawBorder(); CTX::instance()->mesh.draw = 1; CTX::instance()->post.draw = 1; } @@ -194,8 +194,8 @@ void openglWindow::draw() glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); _ctx->draw3d(); _ctx->draw2d(); - drawScreenMessage(); - drawBorder(); + _drawScreenMessage(); + _drawBorder(); } _lock = false; @@ -430,10 +430,10 @@ int openglWindow::handle(int event) std::vector<GFace*> faces; std::vector<GRegion*> regions; std::vector<MElement*> elements; - bool res = processSelectionBuffer(_selection, false, - CTX::instance()->mouseHoverMeshes, - (int)_curr.win[0], (int)_curr.win[1], 5, 5, - vertices, edges, faces, regions, elements); + bool res = _processSelectionBuffer(_selection, false, + CTX::instance()->mouseHoverMeshes, + (int)_curr.win[0], (int)_curr.win[1], 5, 5, + vertices, edges, faces, regions, elements); if((_selection == ENT_ALL && res) || (_selection == ENT_POINT && vertices.size()) || (_selection == ENT_LINE && edges.size()) || @@ -493,13 +493,13 @@ static MElement *getElement(GEntity *e, int va_type, int index) return 0; } -bool openglWindow::processSelectionBuffer(int type, bool multipleSelection, - bool meshSelection, int x, int y, int w, int h, - std::vector<GVertex*> &vertices, - std::vector<GEdge*> &edges, - std::vector<GFace*> &faces, - std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements) +bool openglWindow::_processSelectionBuffer(int type, bool multipleSelection, + bool meshSelection, int x, int y, int w, int h, + std::vector<GVertex*> &vertices, + std::vector<GEdge*> &edges, + std::vector<GFace*> &faces, + std::vector<GRegion*> ®ions, + std::vector<MElement*> &elements) { vertices.clear(); edges.clear(); @@ -730,10 +730,10 @@ char openglWindow::selectEntity(int type, selectionMode = false; return 'c'; } - else if(processSelectionBuffer(_selection, multi, true, _trySelectionXYWH[0], - _trySelectionXYWH[1], _trySelectionXYWH[2], - _trySelectionXYWH[3], vertices, edges, faces, - regions, elements)){ + else if(_processSelectionBuffer(_selection, multi, true, _trySelectionXYWH[0], + _trySelectionXYWH[1], _trySelectionXYWH[2], + _trySelectionXYWH[3], vertices, edges, faces, + regions, elements)){ _selection = ENT_NONE; selectionMode = false; if(add) diff --git a/Fltk/openglWindow.h b/Fltk/openglWindow.h index daf7b4483643d09672ddb1d149814637324d6511..85b3efdc760895327df90a06e141d1f56c44727b 100644 --- a/Fltk/openglWindow.h +++ b/Fltk/openglWindow.h @@ -28,16 +28,17 @@ class openglWindow : public Fl_Gl_Window { double _point[3]; int _selection, _trySelection, _trySelectionXYWH[4]; double _lassoXY[2]; - void drawScreenMessage(); - void drawBorder(); - bool processSelectionBuffer(int type, - bool multipleSelection, bool meshSelection, - int x, int y, int w, int h, - std::vector<GVertex*> &vertices, - std::vector<GEdge*> &edges, - std::vector<GFace*> &faces, - std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements); + void _drawScreenMessage(); + void _drawBorder(); + bool _processSelectionBuffer(int type, + bool multipleSelection, bool meshSelection, + int x, int y, int w, int h, + std::vector<GVertex*> &vertices, + std::vector<GEdge*> &edges, + std::vector<GFace*> &faces, + std::vector<GRegion*> ®ions, + std::vector<MElement*> &elements); + protected: void draw(); int handle(int); public: diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index 209b5f31e85ee943209b4eb36112fc9f2228dd4d..fba805f132d8ede1318e39982373a71ec9d9b6a6 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -873,8 +873,8 @@ int GModel::readSTL(const std::string &name, double tolerance) bool binary = strncmp(buffer, "solid", 5); + // ASCII STL if(!binary){ - // ASCII STL points.resize(1); while(!feof(fp)) { // "facet normal x y z" or "endsolid" @@ -907,6 +907,7 @@ int GModel::readSTL(const std::string &name, double tolerance) } } + // check if we could parse something bool empty = true; for(unsigned int i = 0; i < points.size(); i++){ if(points[i].size()){ @@ -916,10 +917,11 @@ int GModel::readSTL(const std::string &name, double tolerance) } if(empty) points.clear(); - // try binary read even with wrong header if file is empty + // binary STL (we also try to read in binary mode if the header told + // us the format was ASCII but we could not read any vertices) if(binary || empty){ if(binary) Msg::Info("Mesh is in binary format"); - else Msg::Info("Empty ASCII file or bad ASCII header: trying binary read"); + else Msg::Info("Wrong ASCII header or empty file: trying binary read"); rewind(fp); while(!feof(fp)) { char header[80];