#define DEFAULT_SEPARATOR "***"
-//****************************************************************
+/*!
+ Converts rich text to plain text
+*/
static QString plainText( const QString& richText )
{
QString aText = richText;
return aText;
}
-//****************************************************************
-
+/*!
+ Default constructor
+*/
LogWindow::LogWindow( QWidget* parent )
: QFrame( parent ),
SUIT_PopupClient()
createActions();
}
+/*!
+ Destructor
+*/
LogWindow::~LogWindow()
{
}
+/*!
+ Custom event handler
+*/
bool LogWindow::eventFilter( QObject* o, QEvent* e )
{
if ( o == myView->viewport() && e->type() == QEvent::ContextMenu )
return QFrame::eventFilter( o, e );
}
+/*!
+ Sets banner (title of message log)
+ \param banner - new title
+*/
void LogWindow::setBanner( const QString& banner )
{
myBanner = banner;
clear( false );
}
+/*!
+ Set separator (line printing between messages)
+ \param separator - new separator
+*/
void LogWindow::setSeparator( const QString& separator )
{
mySeparator = separator;
clear( false );
}
+/*!
+ Puts message to log window
+ \param message - text of message
+ \addSeparator - if it is true, then separator is added to tail of message log
+*/
void LogWindow::putMessage( const QString& message, bool addSeparator )
{
myView->append( message );
myView->scrollToBottom();
}
+/*!
+ Clears message log
+ \param clearHistory - if it is true, then also history is cleared
+*/
void LogWindow::clear( bool clearHistory )
{
myView->clear();
myBannerSize = 0;
}
+/*!
+ Saves log to file
+ \param fileName - name of file
+*/
bool LogWindow::saveLog( const QString& fileName )
{
QFile file( fileName );
return true;
}
+/*!
+ Creates actions
+*/
void LogWindow::createActions()
{
QAction* a = new QAction( "", tr( "&Copy" ), 0, this );
myActions.insert( SaveToFileId, a );
}
+/*!
+ Redefined virtual method for popup filling
+*/
void LogWindow::contextMenuPopup( QPopupMenu* popup )
{
myActions[ CopyId ]->addTo( popup );
updateActions();
}
+/*!
+ Updates enable status of actions
+*/
void LogWindow::updateActions()
{
int paraFrom, paraTo, indexFrom, indexTo;
myActions[ SaveToFileId ]->setEnabled( myHistory.count() > 0 );
}
+/*!
+ SLOT: called if user click "Save" in popup
+*/
void LogWindow::onSaveToFile()
{
SUIT_Application* app = SUIT_Session::session()->activeApplication();
SUIT_MessageBox::error1( this, tr( "Error" ), tr( "Can't save file" ), tr( "OK" ) );
}
+/*!
+ SLOT: called if user click "Select all" in popup
+*/
void LogWindow::onSelectAll()
{
if ( myView )
myView->selectAll();
}
+/*!
+ SLOT: called if user click "Clear" in popup
+*/
void LogWindow::onClear()
{
clear( false );
}
+/*!
+ SLOT: called if user click "Copy" in popup
+*/
void LogWindow::onCopy()
{
if ( myView )
class QAction;
class QTextBrowser;
+/*!
+ \class LogWindow
+ Widget, showing logs message. Allows to show, to clear, to copy messages and to save then to file
+*/
class LOGWINDOW_EXPORT LogWindow : public QFrame, public SUIT_PopupClient
{
Q_OBJECT
}
/*!
- Unhilights all object in viewer
+ Unhilights all objects in viewer
\param updateviewer - update current viewer
*/
bool OCCViewer_Viewer::unHighlightAll( bool updateviewer )
PyInterp_Dispatcher* PyInterp_Dispatcher::myInstance = 0;
-//////////////////////////////////////////////////////////
-// class : PyInterp_Request
-//////////////////////////////////////////////////////////
-
void PyInterp_Request::process()
{
safeExecute();
}
}
-//////////////////////////////////////////////////////////
-// class : PyInterp_Event
-//////////////////////////////////////////////////////////
-
PyInterp_Event::~PyInterp_Event()
{
PyInterp_Request::Destroy( myRequest );
myRequest = 0;
}
-//////////////////////////////////////////////////////////
-// class : PyInterp_Dispatcher
-//////////////////////////////////////////////////////////
-
PyInterp_Dispatcher* PyInterp_Dispatcher::Get()
{
if ( !myInstance )
class PyInterp_Watcher;
class PyInterp_Dispatcher;
-//////////////////////////////////////////////////////////
-// class : PyInterp_Request
-//////////////////////////////////////////////////////////
class PYINTERP_EXPORT PyInterp_Request
{
friend class PyInterp_Dispatcher;
PyInterp_base* myInterp;
};
-//////////////////////////////////////////////////////////
-// class : PyInterp_Event
-//////////////////////////////////////////////////////////
class PYINTERP_EXPORT PyInterp_Event : public QCustomEvent
{
PyInterp_Event();
PyInterp_Request* myRequest;
};
-//////////////////////////////////////////////////////////
-// class : PyInterp_Dispatcher
-//////////////////////////////////////////////////////////
class PYINTERP_EXPORT PyInterp_Dispatcher : protected QThread
{
PyInterp_Dispatcher(); // private constructor
using namespace std;
-//////////////////////////////////////////////////////////////////////////////
-// VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
-// All methods are implemented using Event mechanism:
-// - getRenderer()
-// - getRenderWindow()
-// - getRenderWindowInteractor()
-// These methods open new VTK viewer if there is no one opened.
-// In case of error methods return None object in Python.
-//////////////////////////////////////////////////////////////////////////////
+/*!
+ VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
+ All methods are implemented using Event mechanism:
+ - getRenderer()
+ - getRenderWindow()
+ - getRenderWindowInteractor()
+ These methods open new VTK viewer if there is no one opened.
+ In case of error methods return None object in Python.
+*/
static PyObject* GetPyClass(const char* theClassName){
static PyObject *aVTKModule = NULL;
using namespace std;
-//////////////////////////////////////////////////////////////////////////////
-// asv : 3.12.04 : added checking for NULL GUI objects in almost all methods.
-// In the scope of fixing bug PAL6869.
-//////////////////////////////////////////////////////////////////////////////
-// (PR : modify comments)
-// Instance of this class is created every time "import salome" line is typed
-// - in IAPP embedded Python interpretor (SALOME_Session_Server executable),
-// - in inline Python nodes in Supervisor (in SALOME_Container executable),
-// - in stand-alone Python console outside any executable.
-// SALOME GUI(desktop and other objects) is only available in SALOME_Session_Server
-//////////////////////////////////////////////////////////////////////////////
-// VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
-// All methods are implemeted using Event mechanism.
-// Display/Erase methods use SALOME_Prs/SALOME_View mechanism. It is currently
-// implemented only for OCC and VTK viewers.
-//////////////////////////////////////////////////////////////////////////////
+/*!
+ asv : 3.12.04 : added checking for NULL GUI objects in almost all methods.
+ In the scope of fixing bug PAL6869.
+
+ (PR : modify comments)
+ Instance of this class is created every time "import salome" line is typed
+ - in IAPP embedded Python interpretor (SALOME_Session_Server executable),
+ - in inline Python nodes in Supervisor (in SALOME_Container executable),
+ - in stand-alone Python console outside any executable.
+ SALOME GUI(desktop and other objects) is only available in SALOME_Session_Server
+
+ VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based)
+ All methods are implemeted using Event mechanism.
+ Display/Erase methods use SALOME_Prs/SALOME_View mechanism. It is currently
+ implemented only for OCC and VTK viewers.
+*/
/*!
getApplication()
myResult = (bool)( getApplication() && getApplication()->desktop() );
}
};
+
+/*!
+ \return true if GUI is available.
+*/
bool SALOMEGUI_Swig::hasDesktop()
{
return ProcessEvent( new THasDesktopEvent() );
}
}
};
+
+/*!
+ \return active study's ID or 0 if there is no active study.
+*/
int SALOMEGUI_Swig::getActiveStudyId()
{
return ProcessEvent( new TGetActiveStudyIdEvent() );
}
}
};
+
+/*!
+ \return active study's name or NULL if there is no active study.
+*/
const char* SALOMEGUI_Swig::getActiveStudyName()
{
string result = ProcessEvent( new TGetActiveStudyNameEvent() );
myResult = anApp->namingService()->Resolve("/Kernel/ModulCatalog");
}
};
+
+/*!
+ \return the name of the component by its user name.
+*/
const char* SALOMEGUI_Swig::getComponentName( const char* componentUserName )
{
CORBA::Object_var anObject = ProcessEvent(new TGetModulCatalogEvent());
}
}
};
+
+/*!
+ \return the number of selected objects.
+*/
int SALOMEGUI_Swig::SelectedCount()
{
return ProcessEvent( new TSelectedCountEvent() );
}
}
};
+
+/*!
+ \return the selected object entry by the given index.
+*/
const char* SALOMEGUI_Swig::getSelected( int index )
{
QString result = ProcessEvent( new TGetSelectedEvent( index ) );
}
}
};
+
+/*!
+ \return TRUE if the object with given entry is in the current viewer.
+ VSR: For the current moment implemented for OCC and VTK viewers only.
+*/
bool SALOMEGUI_Swig::IsInCurrentView( const char* theEntry )
{
return ProcessEvent( new TIsInViewerEvent( theEntry ) );
#include <unistd.h>
#endif
+/*!
+ Constructor
+*/
SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* hand )
: QApplication( argc, argv ),
myExceptHandler( hand )
delete strTbl;
}
+/*!
+ Constructor
+*/
SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand )
: QApplication( argc, argv, type ),
myExceptHandler( hand )
installTranslator( strTbl );
}
+/*!
+ Sends event to receiver
+ \return the value that is returned from the receiver's event handler
+ \param e - event
+ \param receiver - receiver
+*/
bool SUITApp_Application::notify( QObject* receiver, QEvent* e )
{
return myExceptHandler ? myExceptHandler->handle( receiver, e ) :
QApplication::notify( receiver, e );
}
+/*!
+ Changes exception handler
+ \param hand - new handler
+*/
void SUITApp_Application::setHandler( SUIT_ExceptionHandler* hand )
{
myExceptHandler = hand;
}
+/*!
+ \return exception handler
+*/
SUIT_ExceptionHandler* SUITApp_Application::handler() const
{
return myExceptHandler;
}
-
+/*!
+ \return time of modification
+*/
unsigned long int
SVTK_DeviceActor
::GetMTime()
myTransformFilter->SetTransform(theTransform);
}
-
+/*!
+ \return true if actor is shrinkable
+*/
bool
SVTK_DeviceActor
::IsShrunkable()
{
return myIsShrinkable;
}
-
+
+/*!
+ Changes shrinkable state of actor
+ theIsShrinkable - new shrinkable state
+*/
void
SVTK_DeviceActor
::SetShrinkable(bool theIsShrinkable)
myIsShrinkable = theIsShrinkable;
}
+/*!
+ \return true if actor is shrunkable
+*/
bool
SVTK_DeviceActor
::IsShrunk()
return myIsShrunk;
}
+/*!
+ Insert shrink filter into pipeline
+*/
void
SVTK_DeviceActor
::SetShrink()
}
}
+/*!
+ Remove shrink filter from pipeline
+*/
void
SVTK_DeviceActor
::UnShrink()
}
}
+/*!
+ \return shrink factor
+*/
vtkFloatingPointType
SVTK_DeviceActor
::GetShrinkFactor()
return myShrinkFilter->GetShrinkFactor();
}
+/*!
+ Changes shrink factor
+ \param theValue - new shrink factor
+*/
void
SVTK_DeviceActor
::SetShrinkFactor(vtkFloatingPointType theValue)
}
-
+/*!
+ Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on)
+ param theMode - new mode
+*/
void
SVTK_DeviceActor
::SetRepresentation(SVTK::Representation::Type theMode)
myRepresentation = theMode;
}
+/*!
+ \return current representation mode
+*/
SVTK::Representation::Type
SVTK_DeviceActor
::GetRepresentation()
return myRepresentation;
}
+/*!
+ \return default point size
+*/
vtkFloatingPointType
SVTK_DeviceActor
::GetDefaultPointSize()
return 5;
}
+/*!
+ \return default line width
+*/
vtkFloatingPointType
SVTK_DeviceActor
::GetDefaultLineWidth()
return 3;
}
-
+/*!
+ \return true if actor is shaded
+*/
bool
SVTK_DeviceActor
::IsShaded()
return myIsShaded;
}
+/*!
+ Sets shaded state of actor
+ \param theShaded - new shaded state
+*/
void
SVTK_DeviceActor
::SetShaded(bool theShaded)
myIsShaded = theShaded;
}
-
+/*!
+ Maps VTK index of a node to corresponding object index
+*/
int
SVTK_DeviceActor
::GetNodeObjId(int theVtkID)
return theVtkID;
}
+/*!
+ Get coordinates of a node for given object index
+*/
vtkFloatingPointType*
SVTK_DeviceActor
::GetNodeCoord(int theObjID)
}
+/*!
+ Get corresponding #vtkCell for given object index
+*/
vtkCell*
SVTK_DeviceActor
::GetElemCell(int theObjID)
return GetInput()->GetCell(theObjID);
}
+/*!
+ Maps VTK index of a cell to corresponding object index
+*/
int
SVTK_DeviceActor
::GetElemObjId(int theVtkID)
return theVtkID;
}
-
+/*!
+ Renders actor
+*/
void
SVTK_DeviceActor
::Render(vtkRenderer *ren, vtkMapper* m)
}
}
-
+/*!
+ Set polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
void
SVTK_DeviceActor
::SetPolygonOffsetParameters(vtkFloatingPointType factor,
myPolygonOffsetUnits = units;
}
+/*!
+ Get polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
void
SVTK_DeviceActor
::GetPolygonOffsetParameters(vtkFloatingPointType& factor,
}
+/*!
+ \return corresponding render window interactor
+*/
vtkGenericRenderWindowInteractor*
QVTK_RenderWindowInteractor
::GetDevice()
return myDevice.GetPointer();
}
+/*!
+ \return corresponding render window
+*/
vtkRenderWindow*
QVTK_RenderWindowInteractor
::getRenderWindow()
GetDevice()->UpdateSize(w,h);
}
+/*!
+ Custom paint event handler
+*/
void
QVTK_RenderWindowInteractor
::paintEvent( QPaintEvent* theEvent )
}
+/*!
+ Custom resize event handler
+*/
void
QVTK_RenderWindowInteractor
::resizeEvent( QResizeEvent* theEvent )
}
+
+/*!
+ Custom context menu event handler
+*/
void
QVTK_RenderWindowInteractor
::contextMenuEvent( QContextMenuEvent* event )
{}
-
+/*!
+ Custom mouse move event handler
+*/
void
QVTK_RenderWindowInteractor
::mouseMoveEvent( QMouseEvent* event )
}
+/*!
+ Custom mouse press event handler
+*/
void
QVTK_RenderWindowInteractor
::mousePressEvent( QMouseEvent* event )
}
+/*!
+ Custom mouse release event handler
+*/
void
QVTK_RenderWindowInteractor
::mouseReleaseEvent( QMouseEvent *event )
}
+/*!
+ Custom mouse double click event handler
+*/
void
QVTK_RenderWindowInteractor
::mouseDoubleClickEvent( QMouseEvent* event )
{}
+/*!
+ Custom mouse wheel event handler
+*/
void
QVTK_RenderWindowInteractor
::wheelEvent( QWheelEvent* event )
}
+/*!
+ Custom key press event handler
+*/
void
QVTK_RenderWindowInteractor
::keyPressEvent( QKeyEvent* event )
GetDevice()->CharEvent();
}
+/*!
+ Custom key release event handler
+*/
void
QVTK_RenderWindowInteractor
::keyReleaseEvent( QKeyEvent * event )
}
+/*!
+ Custom enter event handler
+*/
void
QVTK_RenderWindowInteractor
::enterEvent( QEvent* event )
GetDevice()->EnterEvent();
}
+/*!
+ Custom leave event handler
+*/
void
QVTK_RenderWindowInteractor
::leaveEvent( QEvent * )
return GetRenderer()->GetDevice();
}
+/*!
+ Changes renderer
+ \param theRenderer - new renderer
+*/
void
SVTK_RenderWindowInteractor
::SetRenderer(SVTK_Renderer* theRenderer)
}
+/*!
+ Changes interactor style
+ \param theStyle - new interactor style
+*/
void
SVTK_RenderWindowInteractor
::InitInteractorStyle(vtkInteractorStyle* theStyle)
}
+/*!
+ Changes selector
+ \param theSelector - new selector
+*/
void
SVTK_RenderWindowInteractor
::SetSelector(SVTK_Selector* theSelector)
}
+/*!
+ Emits signal selectionChanged()
+*/
void
SVTK_RenderWindowInteractor
::onEmitSelectionChanged()
}
+/*!
+ Custom mouse move event handler
+*/
void
SVTK_RenderWindowInteractor
::mouseMoveEvent( QMouseEvent* event )
}
+/*!
+ Custom mouse press event handler
+*/
void
SVTK_RenderWindowInteractor
::mousePressEvent( QMouseEvent* event )
}
+/*!
+ Custom mouse release event handler
+*/
void
SVTK_RenderWindowInteractor
::mouseReleaseEvent( QMouseEvent *event )
}
+/*!
+ Custom mouse double click event handler
+*/
void
SVTK_RenderWindowInteractor
::mouseDoubleClickEvent( QMouseEvent* event )
}
+/*!
+ Custom mouse wheel event handler
+*/
void
SVTK_RenderWindowInteractor
::wheelEvent( QWheelEvent* event )
emit WheelMoved( event );
}
-
+/*!
+ Custom key press event handler
+*/
void
SVTK_RenderWindowInteractor
::keyPressEvent( QKeyEvent* event )
emit KeyPressed( event );
}
+/*!
+ Custom key release event handler
+*/
void
SVTK_RenderWindowInteractor
::keyReleaseEvent( QKeyEvent * event )
emit KeyReleased( event );
}
+/*!
+ Custom context menu event handler
+*/
void
SVTK_RenderWindowInteractor
::contextMenuEvent( QContextMenuEvent* event )
return false;
}
+/*!
+ Adjusts size of actors
+*/
bool
SVTK_Renderer
::OnAdjustActors()
return false;
}
+/*!
+ Adjusts size of actors
+*/
void
SVTK_Renderer
::AdjustActors()
::ResetCameraClippingRange(GetDevice());
}
+/*!
+ Set size of the trihedron
+ \param theSize - new size
+ \param theRelative - if it is true, then size is mesured in percents from bounding box of the scene,
+ otherwise - in viewer units
+*/
void
SVTK_Renderer
::SetTrihedronSize(int theSize, const bool theRelative)
}
}
+/*!
+ \return size of the trihedron in percents from bounding box of the scene
+*/
int
SVTK_Renderer
::GetTrihedronSize() const
return myTrihedronSize;
}
+/*!
+ \return true if the size of the trihedron is relative
+*/
bool
SVTK_Renderer
::IsTrihedronRelative() const
return myIsTrihedronRelative;
}
+/*!
+ \return trihedron control
+*/
VTKViewer_Trihedron*
SVTK_Renderer
::GetTrihedron()
return myTrihedron.GetPointer();
}
+/*!
+ \return true if trihedron is displayed
+*/
bool
SVTK_Renderer
::IsTrihedronDisplayed()
return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
}
+/*!
+ Toggle trihedron visibility
+*/
void
SVTK_Renderer
::OnViewTrihedron()
myTrihedron->VisibilityOn();
}
+/*!
+ Adjust size of the trihedron to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnAdjustTrihedron()
AdjustActors();
}
-
+/*!
+ \return graduated rules control
+*/
SVTK_CubeAxesActor2D*
SVTK_Renderer
::GetCubeAxes()
return myCubeAxes.GetPointer();
}
+/*!
+ \return true if graduated rules displayed
+*/
bool
SVTK_Renderer
::IsCubeAxesDisplayed()
return myCubeAxes->GetVisibility() == 1;
}
+/*!
+ Toggle graduated rules visibility
+*/
void
SVTK_Renderer
::OnViewCubeAxes()
myCubeAxes->VisibilityOn();
}
+/*!
+ Adjust size of the graduated rules to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnAdjustCubeAxes()
AdjustActors();
}
-
+/*!
+ Sets camera into predefined state
+*/
void
SVTK_Renderer
::OnResetView()
aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
}
-
+/*!
+ Fit all presentation in the scene into the window
+*/
void
SVTK_Renderer
::OnFitAll()
::ResetCameraClippingRange(GetDevice());
}
-
+/*!
+ Reset camera clipping range to adjust the range to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnResetClippingRange()
::ResetCameraClippingRange(GetDevice());
}
-
+/*!
+ To reset direction of the camera to front view
+*/
void
SVTK_Renderer
::OnFrontView()
this->OnFitAll();
}
+/*!
+ To reset direction of the camera to back view
+*/
void
SVTK_Renderer
::OnBackView()
this->OnFitAll();
}
+/*!
+ To reset direction of the camera to top view
+*/
void
SVTK_Renderer
::OnTopView()
this->OnFitAll();
}
+/*!
+ To reset direction of the camera to bottom view
+*/
void
SVTK_Renderer
::OnBottomView()
this->OnFitAll();
}
+/*!
+ To reset direction of the camera to left view
+*/
void
SVTK_Renderer
::OnLeftView()
this->OnFitAll();
}
+/*!
+ To reset direction of the camera to right view
+*/
void
SVTK_Renderer
::OnRightView()
#include <vtkCallbackCommand.h>
+/*!
+ \return new SVTK_Selector
+*/
SVTK_Selector*
SVTK_Selector
::New()
return new SVTK_SelectorDef();
}
+/*!
+ Default constructor
+*/
SVTK_SelectorDef
::SVTK_SelectorDef()
{
mySelectionMode = ActorSelection;
}
+/*!
+ Destructor
+*/
SVTK_SelectorDef
::~SVTK_SelectorDef()
{
}
+/*!
+ To invoke selectionChanged signals
+*/
void
SVTK_SelectorDef
::StartPickCallback()
this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
}
+/*!
+ To invoke selectionChanged signals
+*/
void
SVTK_SelectorDef
::EndPickCallback()
this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
}
+/*!
+ To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
+*/
void
SVTK_SelectorDef
::SetSelectionMode(Selection_Mode theMode)
}
}
+/*!
+ Clear selection
+*/
void
SVTK_SelectorDef
::ClearIObjects()
myMapIOSubIndex.clear();
}
+/*!
+ \return true if the SALOME_InteractiveObject presents into selection
+*/
bool
SVTK_SelectorDef
::IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const
return !theIO.IsNull() && (myIObjects.find(theIO) != myIObjects.end());
}
+/*!
+ \return true if the SALOME_Actor presents into selection
+*/
bool
SVTK_SelectorDef
::IsSelected(SALOME_Actor* theActor) const
return IsSelected(anIO) && myIO2Actors.find(anIO) != myIO2Actors.end();
}
+/*!
+ \return corresponding SALOME_Actor for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+*/
SALOME_Actor*
SVTK_SelectorDef
::GetActor(const Handle(SALOME_InteractiveObject)& theIO) const
return NULL;
}
+/*!
+ Adds SALOME_InteractiveObject into selection
+ \param theIO - SALOME_InteractiveObject
+*/
bool
SVTK_SelectorDef
::AddIObject(const Handle(SALOME_InteractiveObject)& theIO)
return false;
}
+/*!
+ Adds SALOME_Actor into selection
+ \param theActor - SALOME_Actor
+*/
bool
SVTK_SelectorDef
::AddIObject(SALOME_Actor* theActor)
return !anIsIOBound || !anIsActorBound;
}
+/*!
+ Removes SALOME_InteractiveObject from selection
+ \param theIO - SALOME_InteractiveObject
+*/
bool
SVTK_SelectorDef
::RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO)
return anIsIOBound;
}
+/*!
+ Removes SALOME_Actor from selection
+ \param theActor - SALOME_Actor
+*/
bool
SVTK_SelectorDef
::RemoveIObject(SALOME_Actor* theActor)
return RemoveIObject(anIO) || anIsActorBound;
}
+/*!
+ \return list of all SALOME_InteractiveObject presenting in selection
+*/
const SALOME_ListIO&
SVTK_SelectorDef
::StoredIObjects() const
return myIObjectList;
}
+/*!
+ \return number of selected objects
+*/
int
SVTK_SelectorDef
::IObjectCount() const
return myIObjects.size();
}
+/*!
+ \return true if the SALOME_InteractiveObject has a subselection
+ \param theIO - SALOME_InteractiveObject
+*/
bool
SVTK_SelectorDef
::HasIndex( const Handle(SALOME_InteractiveObject)& theIO) const
return myMapIOSubIndex.find(theIO) != myMapIOSubIndex.end();
}
+/*!
+ Gets indices of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+*/
void
SVTK_SelectorDef
::GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
theIndex.Clear();
}
+/*!
+ \return true if the index presents in subselection
+ \param theIO - SALOME_InteractiveObject
+ \param theIndex - index
+*/
bool
SVTK_SelectorDef
::IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
return anId;
}
-
+/*!
+ Changes indices of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+ \param theIndices - indices
+ \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
bool
SVTK_SelectorDef
::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
}
+/*!
+ Changes indices of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+ \param theIndices - indices
+ \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
bool
SVTK_SelectorDef
::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
}
+/*!
+ Changes indices of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+ \param theIndex - index
+ \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
bool
SVTK_SelectorDef
::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
}
+/*!
+ Removes index of subselection for SALOME_InteractiveObject
+ \param theIO - SALOME_InteractiveObject
+ \param theIndex - index
+*/
void
SVTK_SelectorDef
::RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
}
}
+/*!
+ Clears all indices of subselection
+*/
void
SVTK_SelectorDef
::ClearIndex()
myMapIOSubIndex.clear();
}
+/*!
+ To apply a filter on the selection
+ \param theFilter - new filter
+*/
void
SVTK_SelectorDef
::SetFilter(const Handle(VTKViewer_Filter)& theFilter)
myFilters.insert(TFilters::value_type(theFilter->GetId(),theFilter));
}
+/*!
+ \return true if filter with given number is applyed
+ \param theId - filter id
+*/
bool
SVTK_SelectorDef
::IsFilterPresent(const TFilterID theId) const
return myFilters.find(theId) != myFilters.end();
}
+/*!
+ To remove a filter from the selection
+ \param theId - filter id
+*/
void
SVTK_SelectorDef
::RemoveFilter(const TFilterID theId)
myFilters.erase(theId);
}
+/*!
+ \return true if the index satisfy installed filters
+ \param theActor - actor
+ \param theId - filter id
+ \param theIsNode - whether it is node
+*/
bool
SVTK_SelectorDef
::IsValid(SALOME_Actor* theActor,
return true;
}
+/*!
+ \return filter by it's id
+ \param theId - filter id
+*/
Handle(VTKViewer_Filter)
SVTK_SelectorDef
::GetFilter(const TFilterID theId) const
GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
TColStd_IndexedMapOfInteger& theIndex ) = 0;
- //! Change indexes of subslection for given #SALOME_InteractiveObject
+ //! Change indices of subselection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
int theIndex) = 0;
- //! Check, if the given index is present in subslection
+ //! Check, if the given index is present in subselection
virtual
bool
IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
Descr: Style for SALOME platform
*/
+/*!
+ Constructor
+*/
SalomeStyle::SalomeStyle()
: myTitleParent( 0 )
{
qApp->installEventFilter( this );
}
+/*!
+ Destructor
+*/
SalomeStyle::~SalomeStyle()
{
}
+/*!
+ Delayed initialization of style
+*/
void SalomeStyle::polish( QWidget* w )
{
if ( !w )
PARENT_STYLE::polish( w );
}
+/*!
+ Custom event filter
+*/
bool SalomeStyle::eventFilter( QObject* o, QEvent* e )
{
if ( e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut )
return x;
}
+/*!
+ Mixes two colors, part of first is 1-t, part of second is t
+ \param t - part parameter
+ \param c1, c2 - colors
+ \param res - result color
+*/
void SalomeStyle::mix( const double t, const QColor& c1, const QColor& c2, QColor& res )
{
if( t<0.0 || t>1.0 )
res.setRgb( r, g, b );
}
+/*!
+ Mixes two colors, part of first is 1-t, part of second is t
+ \param t - part parameter
+ \param rgb1, rgb2 - colors (result is stored in rgb1)
+*/
void SalomeStyle::mix( const double t, QRgb& rgb1, const QRgb& rgb2 )
{
if( t<0.0 || t>1.0 )
rgb1 = qRgba( c[0][0], c[0][1], c[0][2], qAlpha( rgb1 ) );
}
+/*!
+ Mixes colors of pixmap points with other color
+ \param t - part parameter
+ \param pix - pixmap to be processed
+ \param col - other color
+*/
void SalomeStyle::mix( const double t, QPixmap& pix, const QColor& col )
{
if( t<0.0 || t>1.0 )
pix = anImage;
}
+/*!
+ Converts pixmap to grayscale
+ \param pix - pixmap to be processed
+ \param k - factor (gray value after conversion will be multiplied on it and truncated by 255.0)
+*/
void SalomeStyle::toGrayscale( QPixmap& pix, double k )
{
QImage anImage = pix.convertToImage();
pix = anImage;
}
+/*!
+ Draws gradient filling
+ \param p - painter
+ \param r - rect
+ \param c1, c2 - two colors of gradient
+ \param d - direction of gradient
+ \param f - gradient function (maps co-ordinate to part parameter)
+*/
void SalomeStyle::drawGradient( QPainter* p, const QRect& r,
const QColor& c1, const QColor& c2,
const Direction d, gradient_func f ) const
p->restore();
}
+/*!
+ Draws primitive element
+ \param pe - type of primitive element
+ \param p - painter
+ \param r - rect
+ \param cg - group of colors
+ \param flags - is used to control how the PrimitiveElement is drawn
+ \param opt - can be used to control how various PrimitiveElements are drawn
+*/
void SalomeStyle::drawPrimitive( PrimitiveElement pe, QPainter* p, const QRect& r,
const QColorGroup& cg, SFlags flags, const QStyleOption& opt ) const
{
}
}
+/*!
+ Draws control element
+ \param element - type of control element
+ \param p - painter
+ \param widget - widget
+ \param r - rect
+ \param cg - group of colors
+ \param flags - is used to control how the element is drawn
+ \param opt - can be used to control how various elements are drawn
+*/
void SalomeStyle::drawControl( ControlElement element, QPainter* p, const QWidget* widget, const QRect& r,
const QColorGroup& cg, SFlags flags, const QStyleOption& opt ) const
{
}
}
+/*!
+ \return the sub-area for the widget in logical coordinates
+ \param subrect - type of sub area
+ \param w - widget
+*/
QRect SalomeStyle::subRect( SubRect subrect, const QWidget* w ) const
{
QRect r = PARENT_STYLE::subRect( subrect, w );
return r;
}
+/*!
+ Draws the ComplexControl
+ \param control - type of complex control element
+ \param p - painter
+ \param widget - widget
+ \param r - rect
+ \param cg - group of colors
+ \param flags, controls, active - is used to control how the element is drawn
+ \param opt - can be used to control how various elements are drawn
+*/
void SalomeStyle::drawComplexControl( ComplexControl control, QPainter* p, const QWidget* widget,
const QRect& r, const QColorGroup& cg, SFlags flags,
SCFlags controls, SCFlags active, const QStyleOption& opt ) const
}
}
+/*!
+ \return pixmap by type
+ \param st - type of pixmap
+ \param w - widget
+ \param opt - style option flags
+*/
QPixmap SalomeStyle::stylePixmap( StylePixmap st, const QWidget* w, const QStyleOption& opt ) const
{
switch ( st )
}
}
+/*!
+ \return the pixel size
+ \param pm - type of pixel metrics
+ \param widget - widget
+*/
int SalomeStyle::pixelMetric( PixelMetric pm, const QWidget* widget ) const
{
int ret = 0;
return ret;
}
+/*!
+ \return corrected title text
+ \param txt - title text
+ \param w - possible width
+ \param fm - font metrics
+*/
QString SalomeStyle::titleText( const QString& txt, const int W, const QFontMetrics& fm ) const
{
QString res = txt.stripWhiteSpace();
/*!
Class: SalomeStylePlugin [Internal]
- Descr: Plugin for Qt style mechanism
+ Constructor
*/
-
SalomeStylePlugin::SalomeStylePlugin()
{
}
+/*!
+ Destructor
+*/
SalomeStylePlugin::~SalomeStylePlugin()
{
}
+/*!
+ \return keys of styles of plugin
+*/
QStringList SalomeStylePlugin::keys() const
{
return QStringList() << "salome";
}
+/*!
+ \return just created style
+ \param str - style key
+*/
QStyle* SalomeStylePlugin::create( const QString& str )
{
if ( str == "salome" )