Activate only UI tree leaf as to display properly colors when browsing a STEP (there is currently a limitation within the reader which creates compound which are totally grey) and accelerate browsing by de-activating Compound rendering
This commit is contained in:
parent
bcea759287
commit
fc4a1c6081
|
@ -75,6 +75,9 @@
|
|||
#include <Mod/Part/App/ImportIges.h>
|
||||
#include <Mod/Part/App/ImportStep.h>
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
|
||||
#ifdef HAVE_TBB
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/blocked_range.h>
|
||||
|
@ -214,6 +217,7 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
|
|||
if (pcCompound) {
|
||||
pcCompound->Links.setValues(localValue);
|
||||
lValue.push_back(pcCompound);
|
||||
Node_Shapes.push_back(pcCompound->getNameInDocument());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -244,6 +248,7 @@ void ImportOCAF::createShape(const TDF_Label& label, const TopLoc_Location& loc,
|
|||
|
||||
pcCompound->Links.setValues(localValue);
|
||||
lValue.push_back(pcCompound);
|
||||
Node_Shapes.push_back(pcCompound->getNameInDocument());
|
||||
if (ctSolids > 0 || ctShells > 0)
|
||||
return;
|
||||
}
|
||||
|
@ -260,6 +265,7 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location&
|
|||
else
|
||||
part->Shape.setValue(aShape);
|
||||
part->Label.setValue(name);
|
||||
Leaf_Shapes.push_back(part->getNameInDocument());
|
||||
lvalue.push_back(part);
|
||||
|
||||
Quantity_Color aColor;
|
||||
|
|
|
@ -57,6 +57,12 @@ public:
|
|||
ImportOCAF(Handle_TDocStd_Document h, App::Document* d, const std::string& name);
|
||||
virtual ~ImportOCAF();
|
||||
void loadShapes();
|
||||
std::vector<const char *> return_leaf() const {
|
||||
return Leaf_Shapes;
|
||||
}
|
||||
std::vector<const char *> return_node() const {
|
||||
return Node_Shapes;
|
||||
}
|
||||
|
||||
private:
|
||||
void loadShapes(const TDF_Label& label, const TopLoc_Location&, const std::string& partname, const std::string& assembly, bool isRef, std::vector<App::DocumentObject*> &);
|
||||
|
@ -72,6 +78,10 @@ private:
|
|||
std::string default_name;
|
||||
std::set<int> myRefShapes;
|
||||
static const int HashUpper = INT_MAX;
|
||||
// These variables are used to transfer Shape names to the UI backend and decide
|
||||
// to activate / deactivate the right members for performance improvements
|
||||
std::vector<const char *> Leaf_Shapes;
|
||||
std::vector<const char *> Node_Shapes;
|
||||
};
|
||||
|
||||
class ImportExport ExportOCAF
|
||||
|
|
|
@ -112,6 +112,10 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
|
||||
class OCAFBrowser
|
||||
{
|
||||
public:
|
||||
|
@ -403,6 +407,16 @@ private:
|
|||
|
||||
ImportOCAFExt ocaf(hDoc, pcDoc, file.fileNamePure());
|
||||
ocaf.loadShapes();
|
||||
|
||||
// Shape are loaded we must now sort the one we want to display and the one we do want to hide
|
||||
Gui::Document *guiDoc = Gui::Application::Instance->activeDocument();
|
||||
std::vector<const char *>keep_leaf= ocaf.return_leaf();
|
||||
for (std::vector<const char *>::iterator it = keep_leaf.begin() ; it != keep_leaf.end(); ++it)
|
||||
guiDoc->setShow((*it));
|
||||
std::vector<const char *>hide_node= ocaf.return_node();
|
||||
for (std::vector<const char *>::iterator it = hide_node.begin() ; it != hide_node.end(); ++it)
|
||||
guiDoc->setHide((*it));
|
||||
|
||||
pcDoc->recompute();
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user