mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-17 03:57:58 +05:00
0022012: [CEA 737] A modified object by Translate or Rotate in the python interpretor is not updated in 3D view
This commit is contained in:
parent
117b9c5151
commit
87252edaac
@ -204,7 +204,7 @@ void DisplayGUI::EraseAll()
|
||||
SUIT_ViewManager* vman = vw->getViewManager();
|
||||
if ( vman->getType() == OCCViewer_Viewer::Type() ||
|
||||
vman->getType() == SVTK_Viewer::Type() ) {
|
||||
GEOM_Displayer( appStudy ).EraseAll();
|
||||
GEOM_Displayer( appStudy ).EraseAll(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -728,13 +728,7 @@ void GEOMBase::ShowErrorMessage( const QString& errorCode, const QString& commen
|
||||
//=======================================================================
|
||||
GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const QString& IOR )
|
||||
{
|
||||
GEOM::GEOM_Object_var geomObj;
|
||||
if ( !IOR.isEmpty() ) {
|
||||
CORBA::Object_var corbaObj = SalomeApp_Application::orb()->string_to_object( IOR.toLatin1().constData() );
|
||||
if ( !CORBA::is_nil( corbaObj ) )
|
||||
geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
|
||||
}
|
||||
return geomObj._retn();
|
||||
return GeometryGUI::GetObjectFromIOR (IOR);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -743,12 +737,7 @@ GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const QString& IOR )
|
||||
//=======================================================================
|
||||
QString GEOMBase::GetIORFromObject( GEOM::GEOM_Object_ptr object )
|
||||
{
|
||||
QString IOR;
|
||||
if ( !CORBA::is_nil( object ) ) {
|
||||
CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( object );
|
||||
IOR = anIOR.in();
|
||||
}
|
||||
return IOR;
|
||||
return GeometryGUI::GetIORFromObject (object);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -676,30 +676,7 @@ GEOM_Displayer* GEOMBase_Helper::getDisplayer()
|
||||
//================================================================
|
||||
void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
|
||||
{
|
||||
if ( CORBA::is_nil( theObj ) )
|
||||
return;
|
||||
|
||||
CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj );
|
||||
TCollection_AsciiString asciiIOR( (char *)IOR.in() );
|
||||
GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR );
|
||||
|
||||
if ( !getStudy() || !getStudy()->studyDS() )
|
||||
return;
|
||||
|
||||
_PTR(Study) aStudy = getStudy()->studyDS();
|
||||
_PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR ) ) );
|
||||
if ( !aSObj )
|
||||
return;
|
||||
|
||||
_PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
|
||||
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
|
||||
_PTR(AttributeIOR) anIOR ( anAttr );
|
||||
TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
|
||||
GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR );
|
||||
}
|
||||
}
|
||||
GeometryGUI::ClearShapeBuffer(theObj);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
|
@ -2326,6 +2326,118 @@ QAction* GeometryGUI::getAction(const int id) {
|
||||
return action(id);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief GEOM module message handler
|
||||
|
||||
This method can be re-implemented in the subclasses.
|
||||
This is a GEOM module message handler.
|
||||
|
||||
\param msg the message received.
|
||||
*/
|
||||
void GeometryGUI::message(const QString& msg)
|
||||
{
|
||||
// dispatch message
|
||||
QStringList data = msg.split("/");
|
||||
const int nbStrings = data.count();
|
||||
|
||||
if (nbStrings > 0) {
|
||||
if (data[0] == "modified") {
|
||||
// get mesh entry
|
||||
QString anIOR = nbStrings > 1 ? data[1] : QString();
|
||||
|
||||
if ( anIOR.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the geom object.
|
||||
GEOM::GEOM_Object_ptr anObj = GeometryGUI::GetObjectFromIOR (anIOR);
|
||||
|
||||
// Clear the shape buffer
|
||||
GeometryGUI::ClearShapeBuffer (anObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Clears the shape buffer.
|
||||
|
||||
This is a static method. It clears the shape buffer.
|
||||
|
||||
\param theObj the object
|
||||
*/
|
||||
void GeometryGUI::ClearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
|
||||
{
|
||||
if ( CORBA::is_nil( theObj ) )
|
||||
return;
|
||||
|
||||
CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj );
|
||||
TCollection_AsciiString asciiIOR( (char *)IOR.in() );
|
||||
GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR );
|
||||
|
||||
SALOMEDSClient_StudyManager *aManager = SalomeApp_Application::studyMgr();
|
||||
|
||||
if (!aManager)
|
||||
return;
|
||||
|
||||
_PTR(Study) aStudy = aManager->GetStudyByID(theObj->GetStudyID());
|
||||
|
||||
if ( !aStudy )
|
||||
return;
|
||||
|
||||
_PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR ) ) );
|
||||
if ( !aSObj )
|
||||
return;
|
||||
|
||||
_PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
|
||||
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
|
||||
_PTR(AttributeIOR) anIOR ( anAttr );
|
||||
TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
|
||||
GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the object from IOR.
|
||||
|
||||
This is a static method. It returns the object from its IOR.
|
||||
|
||||
\param IOR object IOR
|
||||
\return GEOM object.
|
||||
*/
|
||||
GEOM::GEOM_Object_ptr GeometryGUI::GetObjectFromIOR( const QString& IOR )
|
||||
{
|
||||
GEOM::GEOM_Object_var geomObj;
|
||||
if ( !IOR.isEmpty() ) {
|
||||
CORBA::Object_var corbaObj = SalomeApp_Application::orb()->string_to_object
|
||||
( IOR.toLatin1().constData() );
|
||||
if ( !CORBA::is_nil( corbaObj ) )
|
||||
geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
|
||||
}
|
||||
return geomObj._retn();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns IOR of the object.
|
||||
|
||||
This is a static method. It returns the object's IOR.
|
||||
|
||||
\param object the GEOM object.
|
||||
\return object's IOR.
|
||||
*/
|
||||
QString GeometryGUI::GetIORFromObject( GEOM::GEOM_Object_ptr object )
|
||||
{
|
||||
QString IOR;
|
||||
if ( !CORBA::is_nil( object ) ) {
|
||||
CORBA::String_var anIOR =
|
||||
SalomeApp_Application::orb()->object_to_string( object );
|
||||
IOR = anIOR.in();
|
||||
}
|
||||
return IOR;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Check if this object is can't be renamed in place
|
||||
|
||||
|
@ -135,6 +135,14 @@ public:
|
||||
|
||||
QAction* getAction(const int id);
|
||||
|
||||
virtual void message( const QString& msg);
|
||||
static void ClearShapeBuffer( GEOM::GEOM_Object_ptr );
|
||||
static GEOM::GEOM_Object_ptr
|
||||
GetObjectFromIOR( const QString& IOR );
|
||||
|
||||
static QString GetIORFromObject( GEOM::GEOM_Object_ptr object );
|
||||
|
||||
|
||||
public slots:
|
||||
virtual bool deactivateModule( SUIT_Study* );
|
||||
virtual bool activateModule( SUIT_Study* );
|
||||
|
@ -85,6 +85,11 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
||||
// generic method to be put in a super class
|
||||
void register_name(char * name);
|
||||
|
||||
// Get ORB object
|
||||
CORBA::ORB_ptr GetORB() { return CORBA::ORB::_duplicate(_orb); }
|
||||
|
||||
// Get Naming Service object
|
||||
SALOME_NamingService* GetNS() { return name_service; }
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
// Inherited methods from SALOMEDS::Driver //
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "GEOM_IOperations_i.hh"
|
||||
|
||||
#include "GEOM_Engine.hxx"
|
||||
#include "GEOM_Gen_i.hh"
|
||||
#include <SALOME_NamingService.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
#include "OpUtil.hxx"
|
||||
@ -32,6 +34,8 @@
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
|
||||
#include CORBA_SERVER_HEADER(SALOME_Session)
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* default constructor:
|
||||
@ -155,3 +159,32 @@ Handle(GEOM_Object) GEOM_IOperations_i::GetObjectImpl(GEOM::GEOM_Object_ptr theO
|
||||
}
|
||||
return anImpl;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* UpdateGUIForObject
|
||||
*/
|
||||
//=============================================================================
|
||||
void GEOM_IOperations_i::UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj)
|
||||
{
|
||||
if (!CORBA::is_nil (theObj)) {
|
||||
// Cast _engine to GEOM_Gen_i type.
|
||||
PortableServer::Servant aServant = myPOA->reference_to_servant(_engine.in());
|
||||
GEOM_Gen_i *anEngine = dynamic_cast<GEOM_Gen_i *>(aServant);
|
||||
|
||||
if (anEngine) {
|
||||
SALOME_NamingService *aNameService = anEngine->GetNS();
|
||||
CORBA::Object_var aSessionObj = aNameService->Resolve("/Kernel/Session");
|
||||
SALOME::Session_var aSession = SALOME::Session::_narrow(aSessionObj);
|
||||
|
||||
if (!aSession->_is_nil())
|
||||
{
|
||||
std::string aMsg("GEOM/modified/");
|
||||
CORBA::String_var anIOR = anEngine->GetORB()->object_to_string(theObj);
|
||||
|
||||
aMsg += anIOR.in();
|
||||
aSession->emitMessageOneWay(aMsg.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio
|
||||
|
||||
::GEOM_IOperations* GetImpl() { return _impl; }
|
||||
|
||||
virtual void UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj);
|
||||
|
||||
private:
|
||||
|
||||
::GEOM_IOperations* _impl;
|
||||
|
@ -100,6 +100,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints
|
||||
//Perform the translation
|
||||
GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -169,6 +172,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ
|
||||
//Perform the translation
|
||||
GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -233,6 +239,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector
|
||||
//Perform the translation
|
||||
GetOperations()->TranslateVector(anObject, aVector);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -310,6 +319,10 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance
|
||||
}
|
||||
|
||||
GetOperations()->TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -347,6 +360,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr
|
||||
//Perform the rotation
|
||||
GetOperations()->Rotate(anObject, anAxis, theAngle);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -413,6 +429,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane
|
||||
//Perform the mirror
|
||||
GetOperations()->MirrorPlane(anObject, aPlane);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -479,6 +498,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis
|
||||
//Perform the mirror
|
||||
GetOperations()->MirrorAxis(anObject, aAxis);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -545,6 +567,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint
|
||||
//Perform the mirror
|
||||
GetOperations()->MirrorPoint(anObject, aPoint);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -607,6 +632,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape
|
||||
//Create the offset shape
|
||||
GetOperations()->OffsetShape(aBasicObject, theOffset);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -700,6 +728,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
|
||||
//Perform the scale
|
||||
GetOperations()->ScaleShape(anObject, aPoint, theFactor);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -778,6 +809,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes
|
||||
GetOperations()->ScaleShapeAlongAxes
|
||||
(anObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/false);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -860,6 +894,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape
|
||||
//Perform the Position
|
||||
GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
@ -933,6 +970,11 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
if (!theCopy) {
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
}
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
@ -1209,6 +1251,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints
|
||||
//Perform the translation
|
||||
GetOperations()->RotateThreePoints(anObject, aCentPoint, aPoint1, aPoint2);
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user