diff --git a/Fltk/visibilityWindow.cpp b/Fltk/visibilityWindow.cpp index f2033d87493cede2e4e0168cc501cb8735956005..77e35cd4514f8f8ae0f058a306aeda4363c6fdd1 100644 --- a/Fltk/visibilityWindow.cpp +++ b/Fltk/visibilityWindow.cpp @@ -314,7 +314,9 @@ static void visibility_browser_apply_cb(Fl_Widget *w, void *data) // then refresh the browser to account for recursive selections for(int i = 0; i < VisibilityList::instance()->getNumEntities(); i++) if(VisibilityList::instance()->getVisibility(i)) - FlGui::instance()->visibility->browser->select(i + 1); + FlGui::instance()->visibility->browser->select(i + 1,true); + else + FlGui::instance()->visibility->browser->select(i + 1,false); drawContext::global()->draw(); } } diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index ee12f225168fd84379a8a0c9d922786728ca6dc3..6e7b80af3f075dad0fd47affcb63d4ceb8c91590 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -168,8 +168,9 @@ void GEdge::setVisibility(char val, bool recursive) GEntity::setVisibility(0); if(v0) v0->setVisibility(0); if(v1) v1->setVisibility(0); - if(getCompound()->v0) getCompound()->v0->setVisibility(1); - if(getCompound()->v1) getCompound()->v1->setVisibility(1); + bool val2 = getCompound()->getVisibility(); + if(getCompound()->v0) getCompound()->v0->setVisibility(val2); + if(getCompound()->v1) getCompound()->v1->setVisibility(val2); } else { GEntity::setVisibility(val); if(recursive){ diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index 881338882c85bd98265648df8d197d8a15ed6d52..0f761f4addbe9153686a931ac8615aedda2db33e 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -247,9 +247,14 @@ void GFace::setVisibility(char val, bool recursive) for (std::list<GEdge*>::iterator it = l_edges.begin(); it != l_edges.end(); ++it) (*it)->setVisibility(0, true); std::list<GEdge*> edgesComp = getCompound()->edges(); + bool val2 = getCompound()->getVisibility(); //show edges of the compound surface - for (std::list<GEdge*>::iterator it = edgesComp.begin(); it != edgesComp.end(); ++it) - (*it)->setVisibility(1, true); + for (std::list<GEdge*>::iterator it = edgesComp.begin(); it != edgesComp.end(); ++it) { + if((*it)->getCompound()) + (*it)->getCompound()->setVisibility(val2, true); + else + (*it)->setVisibility(val2, true); + } } else { GEntity::setVisibility(val); if(recursive){ diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index c189f2e47d16079bb4e43615381df1606504713d..8053e7da9a3b7058207425a2c50ee5b280735ff4 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -482,23 +482,6 @@ void GModel::setSelection(int val) } } -void GModel::updateUpperTopology() -{ - for(eiter it = firstEdge(); it != lastEdge(); ++it) { - if(!(*it)->getCompound() && !edgesUpper.count((*it))) - edgesUpper.insert((*it)); - } - for(fiter it = firstFace(); it != lastFace(); ++it) { - if(!(*it)->getCompound() && !facesUpper.count((*it))) - facesUpper.insert((*it)); - } - for(riter it = firstRegion(); it != lastRegion(); ++it) { - if(!(*it)->getCompound() && !regionsUpper.count((*it))) - regionsUpper.insert((*it)); - } -} - - SBoundingBox3d GModel::bounds(bool aroundVisible) { std::vector<GEntity*> entities; diff --git a/Geo/GModel.h b/Geo/GModel.h index 3a4171cae82e96dc17c38e5283e0e2d49d1169ae..fc8802cd7c9412524758d4cf5223ae455a5b6946 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -117,12 +117,6 @@ class GModel std::set<GEdge*, GEntityLessThan> edges; std::set<GVertex*, GEntityLessThan> vertices; - // represents uppermost topology level, when using compounds - // same as normal regions, edges, vertices but without entities contained in compounds - std::set<GRegion*, GEntityLessThan> regionsUpper; - std::set<GFace*, GEntityLessThan> facesUpper; - std::set<GEdge*, GEntityLessThan> edgesUpper; - // map between the pair <dimension, elementary or physical number> // and an optional associated name std::map<std::pair<int, int>, std::string> physicalNames, elementaryNames; @@ -164,9 +158,6 @@ class GModel FM_Internals *getFMInternals() { return _fm_internals; } ACIS_Internals *getACISInternals(){ return _acis_internals; } - // if model has been loaded or changed fill facesUpper, edgesUpper - void updateUpperTopology(); - // access characteristic length (mesh size) fields FieldManager *getFields(){ return _fields; } @@ -199,13 +190,13 @@ class GModel typedef std::set<GVertex*, GEntityLessThan>::iterator viter; // get an iterator initialized to the first/last entity in this model - riter firstRegion(const bool upper = false) { return upper ? regionsUpper.begin() : regions.begin(); } - fiter firstFace(const bool upper = false) { return upper ? facesUpper.begin() : faces.begin(); } - eiter firstEdge(const bool upper = false) { return upper ? edgesUpper.begin() : edges.begin(); } + riter firstRegion() { return regions.begin(); } + fiter firstFace() { return faces.begin(); } + eiter firstEdge() { return edges.begin(); } viter firstVertex() { return vertices.begin(); } - riter lastRegion(const bool upper = false) { return upper ? regionsUpper.end() : regions.end(); } - fiter lastFace(const bool upper = false) { return upper ? facesUpper.end() : faces.end(); } - eiter lastEdge(const bool upper = false) { return upper ? edgesUpper.end() : edges.end(); } + riter lastRegion() { return regions.end(); } + fiter lastFace() { return faces.end(); } + eiter lastEdge() { return edges.end(); } viter lastVertex() { return vertices.end(); } // find the entity with the given tag diff --git a/Geo/GModelIO_ACIS.cpp b/Geo/GModelIO_ACIS.cpp index 29d162bda16e5709b55a4d85263845728f553fe3..cd39c20e4372f73c54e5a437b0e01cf95e666cec 100644 --- a/Geo/GModelIO_ACIS.cpp +++ b/Geo/GModelIO_ACIS.cpp @@ -247,7 +247,6 @@ void ACIS_Internals::loadSAT(std::string fileName, GModel *gm) } } } - gm->updateUpperTopology(); } int GModel::readACISSAT(const std::string &fn) diff --git a/Geo/GModelIO_Fourier.cpp b/Geo/GModelIO_Fourier.cpp index 7c44dc3b3b093bda0da1dff6211fbbc03250c7e7..2f63b4e1c762ac386a0db9ef2d3e95ee601f198b 100644 --- a/Geo/GModelIO_Fourier.cpp +++ b/Geo/GModelIO_Fourier.cpp @@ -97,7 +97,6 @@ void FM_Internals::buildGModel(FM::Reader* reader, GModel* model) { for (int i = 0; i < reader->GetNumPatches(); i++) makeGFace(reader->GetPatch(i), model); - model->updateUpperTopology(); } void GModel::_createFMInternals() diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp index dad32884e4fe354bbfda4454717a814c63cf81cd..47ebcd09b58a2d012b8f669e9e659434ce8a2643 100644 --- a/Geo/GModelIO_Geo.cpp +++ b/Geo/GModelIO_Geo.cpp @@ -145,6 +145,9 @@ int GModel::importGEOInternals() } e = new GEdgeCompound(this, c->Num, comp); add(e); + if (!CTX::instance()->showCompounds) + for (std::vector<GEdge*>::iterator it = comp.begin(); it != comp.end(); ++it) + (*it)->setVisibility(0,true); } else if(!e && c->beg && c->end){ e = new gmshEdge(this, c, @@ -192,7 +195,7 @@ int GModel::importGEOInternals() if (param == 1) typ = GFaceCompound::CONFORMAL; if (param == 2) typ = GFaceCompound::RBF; int algo = CTX::instance()->mesh.remeshAlgo; - f = new GFaceCompound(this, s->Num, comp, U0, typ, algo); + f = new GFaceCompound(this, s->Num, comp, U0, typ, algo); f->meshAttributes.recombine = s->Recombine; f->meshAttributes.recombineAngle = s->RecombineAngle; @@ -282,8 +285,6 @@ int GModel::importGEOInternals() } } - updateUpperTopology(); - Msg::Debug("Gmsh model (GModel) imported:"); Msg::Debug("%d Vertices", vertices.size()); Msg::Debug("%d Edges", edges.size()); diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp index b7ae3887d2eb64e68ba634f6814b446a2522824b..4d80c00183f796e8062a6229f80778ed688d729b 100644 --- a/Geo/GModelIO_OCC.cpp +++ b/Geo/GModelIO_OCC.cpp @@ -707,8 +707,6 @@ void OCC_Internals::buildGModel(GModel *model) if (!getOCCRegionByNativePtr(model, TopoDS::Solid(somap(i)))) model->add(new OCCRegion(model, TopoDS::Solid(somap(i)), num)); } - - model->updateUpperTopology(); } void addSimpleShapes(TopoDS_Shape theShape, TopTools_ListOfShape &theList) diff --git a/Geo/GModelVertexArrays.cpp b/Geo/GModelVertexArrays.cpp index 4d0b58c98d40d0b99273a92f9b32fb0dc931f4c2..e4bc930ee45492e22641436984a2b77147860b65 100644 --- a/Geo/GModelVertexArrays.cpp +++ b/Geo/GModelVertexArrays.cpp @@ -251,8 +251,13 @@ class initMeshGEdge { public: void operator () (GEdge *e) { - if(!e->getVisibility()) return; - + if(!e->getVisibility()) { + if(e->getCompound()) { + if(!e->getCompound()->getVisibility()) return; + } else + return; + } + e->deleteVertexArrays(); e->setAllElementsVisible(CTX::instance()->mesh.lines && areAllElementsVisible(e->lines)); @@ -302,7 +307,12 @@ class initMeshGFace { public: void operator () (GFace *f) { - if(!f->getVisibility()) return; + if(!f->getVisibility()) { + if(f->getCompound()) { + if(!f->getCompound()->getVisibility()) return; + } else + return; + } f->deleteVertexArrays(); f->setAllElementsVisible diff --git a/Graphics/drawGeom.cpp b/Graphics/drawGeom.cpp index 8587b4d6f2edd0479a609a46acb6c12d0d98d442..c6e449d65f2ac3a3031be1105eb31f6a29079243 100644 --- a/Graphics/drawGeom.cpp +++ b/Graphics/drawGeom.cpp @@ -509,14 +509,13 @@ void drawContext::drawGeom() std::for_each(m->firstVertex(), m->lastVertex(), drawGVertex(this)); if(CTX::instance()->geom.lines || CTX::instance()->geom.linesNum || CTX::instance()->geom.tangents) - std::for_each(m->firstEdge(true), m->lastEdge(true), drawGEdge(this)); + std::for_each(m->firstEdge(), m->lastEdge(), drawGEdge(this)); if(CTX::instance()->geom.surfaces || CTX::instance()->geom.surfacesNum || CTX::instance()->geom.normals) { - GModel::fiter test = m->firstFace(true); - std::for_each(m->firstFace(true), m->lastFace(true), drawGFace(this)); + std::for_each(m->firstFace(), m->lastFace(), drawGFace(this)); } if(CTX::instance()->geom.volumes || CTX::instance()->geom.volumesNum) - std::for_each(m->firstRegion(true), m->lastRegion(true), drawGRegion(this)); + std::for_each(m->firstRegion(), m->lastRegion(), drawGRegion(this)); } } diff --git a/Graphics/drawMesh.cpp b/Graphics/drawMesh.cpp index 4d2cad424ef002c73ea1c54d972432ff3681d270..f0983d2dcf2b9ef9cee2f9d7c40cc7961280b5b7 100644 --- a/Graphics/drawMesh.cpp +++ b/Graphics/drawMesh.cpp @@ -141,6 +141,12 @@ static void drawVertexLabel(drawContext *ctx, GEntity *e, MVertex *v, static void drawVerticesPerEntity(drawContext *ctx, GEntity *e) { + //if(e->dim() == 2) { + // if(e->cast2Edge()->getCompound()) { + // if(e->cast2Edge()->getCompound() + // + // } + //} if(CTX::instance()->mesh.points) { if(CTX::instance()->mesh.pointType) { for(unsigned int i = 0; i < e->mesh_vertices.size(); i++){ @@ -398,7 +404,7 @@ class drawMeshGVertex { public: drawMeshGVertex(drawContext *ctx) : _ctx(ctx){} void operator () (GVertex *v) - { + { if(!v->getVisibility()) return; bool select = (_ctx->render_mode == drawContext::GMSH_SELECT && @@ -427,7 +433,12 @@ class drawMeshGEdge { drawMeshGEdge(drawContext *ctx) : _ctx(ctx){} void operator () (GEdge *e) { - if(!e->getVisibility()) return; + if(!e->getVisibility()) { + if(e->getCompound()) { + if(!e->getCompound()->getVisibility()) return; + } else + return; + } bool select = (_ctx->render_mode == drawContext::GMSH_SELECT && e->model() == GModel::current()); @@ -468,7 +479,12 @@ class drawMeshGFace { drawMeshGFace(drawContext *ctx) : _ctx(ctx){} void operator () (GFace *f) { - if(!f->getVisibility()) return; + if(!f->getVisibility()) { + if(f->getCompound()) { + if(!f->getCompound()->getVisibility()) return; + } else + return; + } bool select = (_ctx->render_mode == drawContext::GMSH_SELECT && f->model() == GModel::current());