NPAL18352: Selection bug in GEOM GUI.

This commit is contained in:
jfa 2007-12-19 12:32:56 +00:00
parent 435a10574b
commit df391f9b95
2 changed files with 35 additions and 15 deletions

View File

@ -212,7 +212,7 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName )
// try to load library if it is not loaded yet // try to load library if it is not loaded yet
QCString libs; QCString libs;
#ifndef WNT #ifndef WNT
if( ( libs = getenv( "LD_LIBRARY_PATH" ) ) ) { if ( (libs = getenv( "LD_LIBRARY_PATH" )) ) {
QStringList dirList = QStringList::split( ":", libs, false ); // skip empty entries QStringList dirList = QStringList::split( ":", libs, false ); // skip empty entries
#else #else
if( ( libs = getenv( "PATH" ) ) ) { if( ( libs = getenv( "PATH" ) ) ) {
@ -1240,12 +1240,12 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast<SVTK_Viewer*>( vm->getViewModel() ), sm ) ); myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast<SVTK_Viewer*>( vm->getViewModel() ), sm ) );
// disable OCC selectors // disable OCC selectors
getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); //getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() );
for ( GEOMGUI_OCCSelector* sr = myOCCSelectors.first(); sr; sr = myOCCSelectors.next() ) for ( GEOMGUI_OCCSelector* sr = myOCCSelectors.first(); sr; sr = myOCCSelectors.next() )
sr->setEnabled(true); sr->setEnabled(true);
// disable VTK selectors // disable VTK selectors
getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); //getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() );
for ( LightApp_VTKSelector* sr = myVTKSelectors.first(); sr; sr = myVTKSelectors.next() ) for ( LightApp_VTKSelector* sr = myVTKSelectors.first(); sr; sr = myVTKSelectors.next() )
sr->setEnabled(true); sr->setEnabled(true);

View File

@ -41,6 +41,7 @@
#include "GEOMImpl_Block6Explorer.hxx" #include "GEOMImpl_Block6Explorer.hxx"
#include "GEOM_Function.hxx" #include "GEOM_Function.hxx"
#include "GEOM_ISubShape.hxx"
#include "GEOM_PythonDump.hxx" #include "GEOM_PythonDump.hxx"
#include "GEOMAlgo_FinderShapeOn1.hxx" #include "GEOMAlgo_FinderShapeOn1.hxx"
@ -753,9 +754,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
TopoDS_Shape aShape = theShape->GetValue(); TopoDS_Shape aShape = theShape->GetValue();
if (aShape.IsNull()) return NULL; if (aShape.IsNull()) return NULL;
Handle(GEOM_Function) aMainShape = theShape->GetLastFunction();
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
Handle(GEOM_Object) anObj; Handle(GEOM_Object) anObj;
Handle(GEOM_Function) aFunction;
TopTools_MapOfShape mapShape; TopTools_MapOfShape mapShape;
TopTools_ListOfShape listShape; TopTools_ListOfShape listShape;
@ -792,13 +794,33 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
TopExp::MapShapes(aShape, anIndices); TopExp::MapShapes(aShape, anIndices);
Handle(TColStd_HArray1OfInteger) anArray; Handle(TColStd_HArray1OfInteger) anArray;
Standard_Integer nbAllSubShape = anIndices.Extent();
TopTools_ListIteratorOfListOfShape itSub (listShape); TopTools_ListIteratorOfListOfShape itSub (listShape);
TCollection_AsciiString anAsciiList, anEntry; TCollection_AsciiString anAsciiList, anEntry;
for (int index = 1; itSub.More(); itSub.Next(), ++index) { for (int index = 1; itSub.More(); itSub.Next(), ++index)
{
TopoDS_Shape aValue = itSub.Value(); TopoDS_Shape aValue = itSub.Value();
anArray = new TColStd_HArray1OfInteger(1,1); anArray = new TColStd_HArray1OfInteger(1,1);
anArray->SetValue(1, anIndices.FindIndex(aValue)); anArray->SetValue(1, anIndices.FindIndex(aValue));
anObj = GetEngine()->AddSubShape(theShape, anArray);
//anObj = GetEngine()->AddSubShape(theShape, anArray);
{
anObj = GetEngine()->AddObject(GetDocID(), GEOM_SUBSHAPE);
Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOM_Object::GetSubShapeID(), 1);
if (aFunction.IsNull()) return aSeq;
GEOM_ISubShape aSSI (aFunction);
aSSI.SetMainShape(aMainShape);
aSSI.SetIndices(anArray);
// Set function value directly, as we know it.
// Usage of Solver here would lead to significant loss of time,
// because GEOM_SubShapeDriver will build TopTools_IndexedMapOfShape
// on the main shape for each being calculated sub-shape separately.
aFunction->SetValue(aValue);
}
if (!anObj.IsNull()) { if (!anObj.IsNull()) {
aSeq->Append(anObj); aSeq->Append(anObj);
@ -812,9 +834,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
//Make a Python command //Make a Python command
anAsciiList.Trunc(anAsciiList.Length() - 1); anAsciiList.Trunc(anAsciiList.Length() - 1);
aFunction = theShape->GetLastFunction(); GEOM::TPythonDump pd (aMainShape, /*append=*/true);
GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "[" << anAsciiList.ToCString(); pd << "[" << anAsciiList.ToCString();
pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "("); pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "(");
pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";