aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
int anIndex = aMap(1);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
-
aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
{
displayPreview();
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_ArcDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
+ objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
+ objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+ break;
+ case 1:
+ objMap[Group3Pnts2->LineEdit1->text()] = myPoint1;
+ objMap[Group3Pnts2->LineEdit2->text()] = myPoint2;
+ objMap[Group3Pnts2->LineEdit3->text()] = myPoint3;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();
aSelMgr->GetIndexes(anIO, aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
int anIndex = aMap(1);
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes(aShape, aShapes);
- aShape = aShapes.FindKey(anIndex);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
-
if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
{
GEOMBase_Skeleton::closeEvent(e);
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_CircleDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
+ objMap[GroupPntVecR->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
+ objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
+ objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+ break;
+ case 2:
+ objMap[GroupCenter2Pnts->LineEdit1->text()] = myPoint4;
+ objMap[GroupCenter2Pnts->LineEdit2->text()] = myPoint5;
+ objMap[GroupCenter2Pnts->LineEdit3->text()] = myPoint6;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
virtual void closeEvent( QCloseEvent* e );
+ virtual void addSubshapesToStudy();
private:
void Init();
aSelMgr->GetIndexes(anIO, aMap);
if (aMap.Extent() == 1)
{
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
int anIndex = aMap(1);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
-
if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ } else {
+ aSelectedObject = aFindedObject; // get Object from study
+ }
}
else // Global Selection
{
GEOMBase_Skeleton::closeEvent( e );
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_EllipseDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ objMap[GroupPoints->LineEdit2->text()] = myDir;
+
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
virtual void closeEvent( QCloseEvent* e );
+ virtual void addSubshapesToStudy();
private :
void Init();
//=================================================================================
bool BasicGUI_LineDlg::ClickOnApply()
{
+
if ( !onAccept() )
return false;
if (!CORBA::is_nil(aSelectedObject) && aRes)
{
QString aName = GEOMBase::GetName(aSelectedObject);
-
+
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
{
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
- int anIndex = aMap( 1 );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
-
+ int anIndex = aMap( 1 );
if (aNeedType == TopAbs_FACE)
aName += QString(":face_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
{
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_LineDlg::addSubshapesToStudy()
+{
+ if (getConstructorId() != 0)
+ return;
+
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit1->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+
+ addSubshapesToFather( objMap );
+}
virtual bool execute( ObjectList& objects );
virtual void closeEvent( QCloseEvent* e );
+ virtual void addSubshapesToStudy();
private :
void Init();
if (!aMap.IsEmpty()) {
int anIndex = aMap(1);
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes(aShape, aShapes);
- aShape = aShapes.FindKey(anIndex);
-
if (aNeedType == TopAbs_EDGE)
aName += QString("_edge_%1").arg(anIndex);
else
aName += QString("_vertex_%1").arg(anIndex);
+
+ TopTools_IndexedMapOfShape aShapes;
+ TopExp::MapShapes(aShape, aShapes);
+ aShape = aShapes.FindKey(anIndex);
}
if (myEditCurrentArgument == Group2->LineEdit1) {
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
- int anIndex = aMap(1);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
+ int anIndex = aMap(1);
if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else if (aNeedType == TopAbs_FACE)
aName += QString(":face_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
GEOMBase_Skeleton::closeEvent( e );
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_PlaneDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPntDir->LineEdit1->text()] = myPoint;
+ objMap[GroupPntDir->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
+ objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
+ objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+ break;
+ case 2:
+ objMap[GroupFace->LineEdit1->text()] = myFace;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
int anIndex = aMap(1);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
-
if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
{
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_PointDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ break;
+ case 1:
+ objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
+ break;
+ case 2:
+ objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
+ break;
+ case 3:
+ objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
+ objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
- int anIndex = aMap(1);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
+ int anIndex = aMap(1);
aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
return res;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_VectorDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private :
void Init();
myEditCurrentArgument = Group2->LineEdit1;
Group2->LineEdit1->setText("");
- Group2->LineEdit2->setText("");
+ Group2->LineEdit2->setText("");
myVectX = GEOM::GEOM_Object::_nil();
myVectZ = GEOM::GEOM_Object::_nil();
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
aName = aName + ":edge_" + QString::number( anIndex );
- if(myEditCurrentArgument == Group2->LineEdit1)
- myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- else
- myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ if(myEditCurrentArgument == Group2->LineEdit1)
+ myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ else
+ myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex);
}
else {
if (myEditCurrentArgument == Group2->LineEdit1)
return true;
}
+
showError();
}
else {
+ addSubshapesToStudy(); // add Subshapes if local selection
const int nbObjs = objects.size();
int aNumber = 1;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
return true;
}
-
-
+//================================================================
+// Function : findObjectInFather
+// Purpose : It should return an object if its founded in study or
+// return Null object if the object is not founded
+//================================================================
+GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_ptr theFather, const char* theName)
+{
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ _PTR(Study) aDStudy = appStudy->studyDS();
+ string IOR = GEOMBase::GetIORFromObject( theFather );
+ _PTR(SObject) SObj ( aDStudy->FindObjectIOR( IOR ) );
+
+ bool inStudy = false;
+ GEOM::GEOM_Object_var aReturnObject;
+ for (_PTR(ChildIterator) iit (aDStudy->NewChildIterator( SObj )); iit->More(); iit->Next()) {
+ _PTR(SObject) child (iit->Value());
+ QString aChildName = child->GetName();
+ if (aChildName == theName) {
+ inStudy = true;
+ CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(iit->Value());
+ aReturnObject = GEOM::GEOM_Object::_narrow( corbaObj );
+ }
+ }
+ if (!inStudy)
+ return GEOM::GEOM_Object::_nil();
+ else
+ return aReturnObject._retn();
+}
+//================================================================
+// Function : addSubshapesToStudy
+// Purpose : Virtual method to add subshapes if needs
+//================================================================
+void GEOMBase_Helper::addSubshapesToStudy()
+{
+ //Impemented in Dialogs, called from Accept method
+}
+
+//================================================================
+// Function : addSubshapesToFather
+// Purpose : Method to add Father Subshapes to Study if it`s not exist
+//================================================================
+void GEOMBase_Helper::addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap )
+{
+ //GetStudyDS
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ _PTR(Study) aDStudy = appStudy->studyDS();
+
+ GEOM::GEOM_IGroupOperations_var anOp = getGeomEngine()->GetIGroupOperations( getStudyId() );
+
+ for( QMap<QString, GEOM::GEOM_Object_var>::Iterator it = theMap.begin(); it != theMap.end(); it++ )
+ {
+ if ( !anOp->_is_nil() ) {
+ GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.data() );
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key() );
+
+ //Add Object to study if its not exist
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() )
+ GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
+ it.data(), it.key(), aFatherObj );
+ }
+ else {
+ //cout << " anOperations is NULL! " << endl;
+ }
+ }
+}
-
\ No newline at end of file
#include CORBA_CLIENT_HEADER(GEOM_Gen)
#include <qstring.h>
+#include <qmap.h>
#include <list>
//#if defined WNT
// as a top-level object.
virtual const char* getNewObjectName() const;
+ virtual void addSubshapesToStudy();
+
+ GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_ptr theFather, const char* theName );
+ //This Metod to find SubObject in theFather Object by Name (theName)
+
+ void addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap );
void SetIsPreview(const bool thePreview) {isPreview = thePreview;}
bool IsPreview() {return isPreview;}
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aName.append( ":edge_" + QString::number( anIndex ) );
- myOkPath = true;
- aSelMgr->clearSelected();
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ myOkPath = true;
+ }
+ else { // get Object from study
+ myPath = aFindedObject;
+ myOkPath = true;
+ }
}
else {
myOkPath = true;
return true;
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_PipeDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit2->text()] = myPath;
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aName.append( ":edge_" + QString::number( anIndex ) );
- aSelMgr->clearSelected();
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else {
if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) {
aSelMgr->GetIndexes( firstIObject(), aMap );
if (aMap.Extent() == 1)
{
- GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
int anIndex = aMap(1);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aName.append(":vertex_" + QString::number(anIndex));
- aSelMgr->clearSelected();
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject;
}
else
{
myBothway2 = !anOldValue;
displayPreview();
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_PrismDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit2->text()] = myVec;
+ break;
+ case 1:
+ objMap[GroupPoints2->LineEdit2->text()] = myPoint1;
+ objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
+
int anIndex = aMap( 1 );
aName.append( ":edge_" + QString::number( anIndex ) );
- myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- myOkAxis = true;
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ myOkAxis = true;
+ }
+ else {
+ myAxis = aFindedObject;
+ myOkAxis = true;
+ }
}
else {
myOkAxis = true;
GroupPoints->CheckButton2->setEnabled(!myBothway);
displayPreview();
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_RevolDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit2->text()] = myAxis;
+
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private :
void Init();
myEditCurrentArgument == mySelName[ Faces ] ) )
localSelection( myShape, TopAbs_FACE );
else if (!myShape->_is_nil() && myEditCurrentArgument == mySelName[ Edges ] )
- localSelection( myShape, TopAbs_EDGE );
+ localSelection( myShape, TopAbs_EDGE );
else
{
TColStd_MapOfInteger aMap;
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
aName.append( ":vertex_" + QString::number( anIndex ) );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
{
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_BoxDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+ if ( getConstructorId() == 0 )
+ {
+ objMap[GroupPoints->LineEdit1->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
aSelMgr->GetIndexes( firstIObject(), aMap );
if (aMap.Extent() == 1)
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations(getStudyId());
int anIndex = aMap(1);
-
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
-
if (aNeedType == TopAbs_EDGE)
aName.append(":edge_" + QString::number(anIndex));
else
aName.append(":vertex_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else
{
return GroupDimensions->SpinBox_DZ->GetValue();
return 0;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_ConeDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ objMap[GroupPoints->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations(getStudyId());
int anIndex = aMap(1);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected(); // ???
-
if (aNeedType == TopAbs_EDGE)
aName.append(":edge_" + QString::number(anIndex));
else
aName.append(":vertex_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
return GroupDimensions->SpinBox_DY->GetValue();
return 0;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_CylinderDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ objMap[GroupPoints->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
-
aName.append( ":vertex_" + QString::number( anIndex ) );
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
return GroupDimensions->SpinBox_DX->GetValue();
return 0;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_SphereDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap(1);
-
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
-
if (aNeedType == TopAbs_EDGE)
aName.append(":edge_" + QString::number(anIndex));
else
aName.append(":vertex_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else // Global Selection
{
return GroupDimensions->SpinBox_DY->GetValue();
return 0;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_TorusDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ objMap[GroupPoints->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- int id = getConstructorId();
if (aNeedType == TopAbs_VERTEX)
aName += QString(":vertex_%1").arg(anIndex);
else
aName += QString(":edge_%1").arg(anIndex);
-
- myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ myArgument = aFindedObject; // get Object from study
}
else {
if (aShape.ShapeType() != aNeedType) {
{
this->GroupBoxName->setEnabled(isCreateCopy);
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_MirrorDlg::addSubshapesToStudy()
+{
+ bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
+ if (toCreateCopy) {
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit2->text()] = myArgument;
+ break;
+ case 1:
+ objMap[GroupPoints->LineEdit2->text()] = myArgument;
+ break;
+ case 2:
+ return;
+ }
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes( firstIObject(), aMap );
- if ( aMap.Extent() == 1 )
- {
+ if ( aMap.Extent() == 1 )
+ {
+ int anIndex = aMap( 1 );
+ aName += QString(":edge_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
- int anIndex = aMap( 1 );
- aName += QString(":edge_%1").arg(anIndex);
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
}
- else {
- if (aShape.ShapeType() != TopAbs_EDGE) {
- aSelectedObject = GEOM::GEOM_Object::_nil();
- aName = "";
- }
- myVector = aSelectedObject;
+ else
+ myVector = aFindedObject; // get existing object
+ }
+ else {
+ if (aShape.ShapeType() != TopAbs_EDGE) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
}
-
+ myVector = aSelectedObject;
+ }
+
}
}
}
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_MultiRotationDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit2->text()] = myVector;
+ break;
+ case 1:
+ objMap[GroupDimensions->LineEdit2->text()] = myVector;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
aName += QString(":edge_%1").arg(anIndex);
- if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
- myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- else
- myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
+ myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ else
+ myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else {
+ if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
+ myVectorV = aFindedObject;
+ else
+ myVectorU = aFindedObject;
+ }
}
else {
if (aShape.ShapeType() != TopAbs_EDGE) {
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit2->text()] = myVectorU;
+ break;
+ case 1:
+ objMap[GroupDimensions->LineEdit2->text()] = myVectorU;
+ objMap[GroupDimensions->LineEdit3->text()] = myVectorV;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else {
if (aShape.ShapeType() != aNeedType) {
double anOldValue = GroupPoints->SpinBox_DX->GetValue();
GroupPoints->SpinBox_DX->SetValue( -anOldValue );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_RotationDlg::addSubshapesToStudy()
+{
+ bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
+ if (toCreateCopy) {
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+ switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit2->text()] = myAxis;
+ break;
+ case 1:
+ objMap[GroupPoints->LineEdit2->text()] = myCentPoint;
+ objMap[GroupPoints->LineEdit4->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit5->text()] = myPoint2;
+ break;
+ }
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
aName += QString(":vertex_%1").arg(anIndex);
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aSelMgr->clearSelected();
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
}
else {
if (aShape.ShapeType() != TopAbs_VERTEX) {
{
this->GroupBoxName->setEnabled(isCreateCopy);
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_ScaleDlg::addSubshapesToStudy()
+{
+ bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
+ if (toCreateCopy) {
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit2->text()] = myPoint;
+
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject;
} else // Global Selection
{
if (aShape.ShapeType() != aNeedType) {
{
GroupBoxName->setEnabled(isCreateCopy);
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_TranslationDlg::addSubshapesToStudy()
+{
+ bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked();
+ if (toCreateCopy) {
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ switch (getConstructorId())
+ {
+ case 0:
+ return;
+ case 1:
+ objMap[GroupPoints->LineEdit2->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit3->text()] = myPoint2;
+ break;
+ case 2:
+ objMap[GroupPoints->LineEdit2->text()] = myVector;
+ break;
+ }
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();