qt_ok=yes
+QTDIR=$(echo $QTDIR | sed 's%[/]\+$%%')
+
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
#include <dlfcn.h>
#endif
+#include <cstdio>
+
/*!
\brief Create new instance of CAM_Application.
\return new instance of CAM_Application class
*/
CAM_Application::~CAM_Application()
{
+ for ( QList<CAM_Module*>::const_iterator it = myModules.begin(); it != myModules.end(); ++it )
+ delete *it;
+ myModules.clear();
}
/*!
void CAM_Application::afterCloseDoc()
{
- for ( QList<CAM_Module*>::const_iterator it = myModules.begin(); it != myModules.end(); ++it )
- delete *it;
- myModules.clear();
}
/*!
*/
void GLViewer_ViewFrame::createToolBar()
{
- int tid = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL") );
+ int tid = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), false );
toolMgr()->append( DumpId, tid );
QtxMultiAction* aScaleAction = new QtxMultiAction( this );
#include <WNT_Window.hxx>
#include <Graphic3d_WNTGraphicDevice.hxx>
#include <WNT_GraphicDevice.hxx>
-#include <WNT_GraphicDevice.hxx>
#include <WNT_WDriver.hxx>
#include <InterfaceGraphic_WNT.hxx>
#else
#endif // WNT
/*!
- Maps CasCade view to the window [ static ]
+ Create native view window for CasCade view [ static ]
*/
-void OCCViewer_VService::SetWindow( const Handle(V3d_View)& view,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality quality )
+Handle(Aspect_Window) OCCViewer_VService::CreateWindow( const Handle(V3d_View)& view,
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Xw_WindowQuality quality )
{
#ifdef WNT
- Handle(WNT_Window) w =
- new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin );
- // Prevent flicker
- w->SetFlags( WDF_NOERASEBKGRND );
+ Handle(WNT_Window) viewWindow = new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin );
+ // Prevent flickering
+ viewWindow->SetFlags( WDF_NOERASEBKGRND );
#else
- Handle(Xw_Window) w =
- new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, quality );
+ Handle(Xw_Window) viewWindow = new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, quality );
#endif
- view->SetWindow( w );
+ return viewWindow;
+}
+
+/*!
+ Maps CasCade view to the window [ static ]
+*/
+void OCCViewer_VService::SetWindow( const Handle(V3d_View)& view,
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Xw_WindowQuality quality )
+{
+ view->SetWindow( OCCViewer_VService::CreateWindow( view, hiwin, lowin, quality ) );
}
/*!
#ifndef _Handle_Aspect_WindowDriver_HeaderFile
#include <Handle_Aspect_WindowDriver.hxx>
#endif
+#ifndef _Handle_Aspect_Window_HeaderFile
+#include <Handle_Aspect_Window.hxx>
+#endif
class V3d_View;
class V2d_View;
}
// STATIC METHODS
+ static Handle(Aspect_Window)
+ CreateWindow( const Handle(V3d_View)& view,
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Xw_WindowQuality quality );
+
static void SetWindow( const Handle( V3d_View )& view,
const Standard_Integer hiwin,
const Standard_Integer lowin,
static Standard_Boolean zRotation = Standard_False;
/*!
- Constructor
+ Constructor
*/
OCCViewer_ViewPort3d::OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_Viewer)& viewer, V3d_TypeOfView type )
-: OCCViewer_ViewPort( parent ),
-myScale( 1.0 ),
-myDegenerated( true ),
-myAnimate( false ),
-myBusy( true )
+ : OCCViewer_ViewPort( parent ),
+ myScale( 1.0 ),
+ myDegenerated( true ),
+ myAnimate( false ),
+ myBusy( true )
{
selectVisualId();
}
/*!
- Destructor
+ Destructor
*/
OCCViewer_ViewPort3d::~OCCViewer_ViewPort3d()
{
}
/*!
- Activates the desired 'type' of view in the viewer
- ( view of 'type' is created if it doesn't exist ). [ public ]
+ Activates the desired 'type' of view in the viewer
+ ( view of 'type' is created if it doesn't exist ). [ public ]
*/
/*void OCCViewer_ViewPort3d::setActive( V3d_TypeOfView type )
{
- if ( activeView().IsNull() )
- return;
-
- if ( activeView()->Type() != type )
- {
- if ( type == V3d_ORTHOGRAPHIC )
- setView( myOrthoView );
- if ( type == V3d_PERSPECTIVE )
- setView( myPerspView );
- }
+ if ( activeView().IsNull() )
+ return;
+
+ if ( activeView()->Type() != type )
+ {
+ if ( type == V3d_ORTHOGRAPHIC )
+ setView( myOrthoView );
+ if ( type == V3d_PERSPECTIVE )
+ setView( myPerspView );
+ }
}*/
/*!
- Maps CasCade 'view' to this viewport. [ private ]
+ Maps CasCade 'view' to this viewport. [ private ]
*/
bool OCCViewer_ViewPort3d::mapView( const Handle(V3d_View)& view )
{
if ( !setWindow( view ) )
return false;
- if ( !mapped( view ) )
- {
- view->SetWindow( myWindow );
- if ( view != activeView() )
- view->View()->Deactivate();
- }
+ if ( !mapped( view ) ) {
+ view->SetWindow( myWindow );
+ if ( view != activeView() )
+ view->View()->Deactivate();
+ }
/* create static trihedron (16551: EDF PAL 501) */
OCCViewer_ViewWindow* aVW = dynamic_cast<OCCViewer_ViewWindow*>( parentWidget() );
- if ( aVW ){
+ if ( aVW ) {
OCCViewer_Viewer* aViewModel = dynamic_cast<OCCViewer_Viewer*>( aVW->getViewManager()->getViewModel() );
if ( aViewModel && aViewModel->isStaticTrihedronDisplayed() ){
view->ZBufferTriedronSetup();
}
/*!
- Sets new CASCADE view on viewport. Returns the previous active view. [ public ]
+ Sets new CASCADE view on viewport. Returns the previous active view. [ public ]
*/
Handle( V3d_View ) OCCViewer_ViewPort3d::setView( const Handle( V3d_View )& view )
{
if ( view == activeView() || !mapView( view ) )
return activeView();
- /* activate the new view*/
+ /* activate the new view*/
Handle( V3d_View ) oldView = activeView();
- if ( !oldView.IsNull() )
- {
- oldView->View()->Deactivate();
- view->SetBackgroundColor( oldView->BackgroundColor() );
- }
+ if ( !oldView.IsNull() ) {
+ if (oldView->View()->IsDefined())
+ oldView->View()->Deactivate();
+ view->SetBackgroundColor( oldView->BackgroundColor() );
+ }
+
if ( myDegenerated )
view->SetDegenerateModeOn();
else
view->View()->Activate();
activeView() = view;
- return oldView;
+ return oldView;
}
/*!
- Returns CasCade 3D view. [ public ]
+ Returns CasCade 3D view. [ public ]
*/
Handle(V3d_View) OCCViewer_ViewPort3d::getView() const
{
- return activeView();
+ return activeView();
}
/*!
- Returns CasCade 3D viewer [ public ]
+ Returns CasCade 3D viewer [ public ]
*/
Handle(V3d_Viewer) OCCViewer_ViewPort3d::getViewer() const
{
- Handle(V3d_Viewer) viewer;
- if ( !activeView().IsNull() )
+ Handle(V3d_Viewer) viewer;
+ if ( !activeView().IsNull() )
viewer = activeView()->Viewer();
- return viewer;
+ return viewer;
}
/*!
- Syncronizes visual state of this viewport with 'ref'
- ( scale, projection, eye etc ) Returns 'true' if copied OK,
- 'false' otherwise. [ virtual public ]
+ Syncronizes visual state of this viewport with 'ref'
+ ( scale, projection, eye etc ) Returns 'true' if copied OK,
+ 'false' otherwise. [ virtual public ]
*/
bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref )
{
Handle(V3d_View) tgtView = getView();
/* Syncronize view types */
-/* if ( tgtView->Type() != refView->Type() )
- {
- setActive( refView->Type() );
- tgtView = getView();
- }*/
+ /* if ( tgtView->Type() != refView->Type() )
+ {
+ setActive( refView->Type() );
+ tgtView = getView();
+ }*/
/* The following params are copied:
- view type( ortho/persp )
/* perspective */
if ( refView->Type() == V3d_PERSPECTIVE )
- tgtView->SetFocale( refView->Focale() );
+ tgtView->SetFocale( refView->Focale() );
/* copy params */
Standard_Real x, y, z;
}
/*!
- Returns Z-size of this view. [ public ]
+ Returns Z-size of this view. [ public ]
*/
double OCCViewer_ViewPort3d::getZSize() const
{
}
/*!
- Sets Z-size of this view ( for both orthographic and perspective ). [ public ]
+ Sets Z-size of this view ( for both orthographic and perspective ). [ public ]
*/
void OCCViewer_ViewPort3d::setZSize( double zsize )
{
myActiveView->SetZSize( zsize );
-/* if ( !myOrthoView.IsNull() )
+ /* if ( !myOrthoView.IsNull() )
myOrthoView->SetZSize( zsize );
- if ( !myPerspView.IsNull() )
+ if ( !myPerspView.IsNull() )
myPerspView->SetZSize( zsize );*/
}
/*!
- Returns the background color [ virtual public ]
+ Returns the background color [ virtual public ]
*/
QColor OCCViewer_ViewPort3d::backgroundColor() const
{
- if ( !activeView().IsNull() )
- {
- Standard_Real aRed, aGreen, aBlue;
- activeView()->BackgroundColor( Quantity_TOC_RGB, aRed, aGreen, aBlue );
- int red = (int) (aRed * 255);
- int green = (int) (aGreen * 255);
- int blue = (int) (aBlue * 255);
- return QColor( red, green, blue );
- }
- return OCCViewer_ViewPort::backgroundColor();
+ if ( !activeView().IsNull() ) {
+ Standard_Real aRed, aGreen, aBlue;
+ activeView()->BackgroundColor( Quantity_TOC_RGB, aRed, aGreen, aBlue );
+ int red = (int) (aRed * 255);
+ int green = (int) (aGreen * 255);
+ int blue = (int) (aBlue * 255);
+ return QColor( red, green, blue );
+ }
+ return OCCViewer_ViewPort::backgroundColor();
}
/*!
- Sets the background color [ virtual public ]
+ Sets the background color [ virtual public ]
*/
void OCCViewer_ViewPort3d::setBackgroundColor( const QColor& color )
{
- if ( !activeView().IsNull() )
- {
- activeView()->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255.,
- color.green()/255., color.blue()/255.);
- activeView()->Update();
- emit vpChangeBGColor( color );
- }
+ if ( !activeView().IsNull() ) {
+ activeView()->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255.,
+ color.green()/255., color.blue()/255.);
+ activeView()->Update();
+ emit vpChangeBGColor( color );
+ }
}
/*!
*/
void OCCViewer_ViewPort3d::setAnimationMode(bool theDegenerated)
{
- if ( !activeView().IsNull() )
- {
+ if ( !activeView().IsNull() ) {
myAnimate = theDegenerated;
activeView()->SetAnimationMode(true, theDegenerated);
}
}
/*!
- Updates the active viewport. [ virtual public ]
+ Updates the active viewport. [ virtual public ]
*/
void OCCViewer_ViewPort3d::onUpdate()
{
}
/*!
- Called at 'window fit' transformation. [ virtual protected ]
+ Called at 'window fit' transformation. [ virtual protected ]
*/
void OCCViewer_ViewPort3d::fitRect( const QRect& rect )
{
- if ( !activeView().IsNull() )
- activeView()->WindowFit( rect.left(), rect.top(), rect.right(), rect.bottom() );
+ if ( !activeView().IsNull() )
+ activeView()->WindowFit( rect.left(), rect.top(), rect.right(), rect.bottom() );
}
/*!
- Called at 'zoom' transformation. [ virtual protected ]
+ Called at 'zoom' transformation. [ virtual protected ]
*/
void OCCViewer_ViewPort3d::zoom( int x0, int y0, int x, int y )
{
}
/*!
- Centers the viewport. [ virtual protected ]
+ Centers the viewport. [ virtual protected ]
*/
void OCCViewer_ViewPort3d::setCenter( int x, int y )
{
- if ( !activeView().IsNull() )
- activeView()->Place( x, y, myScale );
+ if ( !activeView().IsNull() )
+ activeView()->Place( x, y, myScale );
}
/*!
- Called at 'pan' transformation. [ virtual protected ]
+ Called at 'pan' transformation. [ virtual protected ]
*/
void OCCViewer_ViewPort3d::pan( int dx, int dy )
{
- if ( !activeView().IsNull() )
- activeView()->Pan( dx, dy, 1.0 );
+ if ( !activeView().IsNull() )
+ activeView()->Pan( dx, dy, 1.0 );
}
/*!
- Inits 'rotation' transformation. [ protected ]
+ Inits 'rotation' transformation. [ protected ]
*/
void OCCViewer_ViewPort3d::startRotation( int x, int y,
int theRotationPointType,
const gp_Pnt& theSelectedPoint )
{
- if ( !activeView().IsNull() )
- {
- myDegenerated = activeView()->DegenerateModeIsOn();
- activeView()->SetDegenerateModeOn();
- if (myAnimate) activeView()->SetAnimationModeOn();
-
- //double gx, gy, gz;
- //double gx = activeView()->gx;
- //activeView()->Gravity(gx,gy,gz);
-
- switch ( theRotationPointType ) {
- case OCCViewer_ViewWindow::GRAVITY:
- activeView()->StartRotation( x, y, 0.45 );
- break;
- case OCCViewer_ViewWindow::SELECTED:
- sx = x; sy = y;
-
- double X,Y;
- activeView()->Size(X,Y);
- rx = Standard_Real(activeView()->Convert(X));
- ry = Standard_Real(activeView()->Convert(Y));
-
- activeView()->Rotate( 0., 0., 0.,
- theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(),
- Standard_True );
-
- Quantity_Ratio zRotationThreshold;
- zRotation = Standard_False;
- zRotationThreshold = 0.45;
- if( zRotationThreshold > 0. ) {
- Standard_Real dx = Abs(sx - rx/2.);
- Standard_Real dy = Abs(sy - ry/2.);
- Standard_Real dd = zRotationThreshold * (rx + ry)/2.;
- if( dx > dd || dy > dd ) zRotation = Standard_True;
- }
- break;
- default:
- break;
+ if ( !activeView().IsNull() ) {
+ myDegenerated = activeView()->DegenerateModeIsOn();
+ activeView()->SetDegenerateModeOn();
+ if (myAnimate) activeView()->SetAnimationModeOn();
+
+ //double gx, gy, gz;
+ //double gx = activeView()->gx;
+ //activeView()->Gravity(gx,gy,gz);
+
+ switch ( theRotationPointType ) {
+ case OCCViewer_ViewWindow::GRAVITY:
+ activeView()->StartRotation( x, y, 0.45 );
+ break;
+ case OCCViewer_ViewWindow::SELECTED:
+ sx = x; sy = y;
+
+ double X,Y;
+ activeView()->Size(X,Y);
+ rx = Standard_Real(activeView()->Convert(X));
+ ry = Standard_Real(activeView()->Convert(Y));
+
+ activeView()->Rotate( 0., 0., 0.,
+ theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(),
+ Standard_True );
+
+ Quantity_Ratio zRotationThreshold;
+ zRotation = Standard_False;
+ zRotationThreshold = 0.45;
+ if( zRotationThreshold > 0. ) {
+ Standard_Real dx = Abs(sx - rx/2.);
+ Standard_Real dy = Abs(sy - ry/2.);
+ Standard_Real dd = zRotationThreshold * (rx + ry)/2.;
+ if( dx > dd || dy > dd ) zRotation = Standard_True;
}
+ break;
+ default:
+ break;
}
+ }
}
/*!
- Rotates the viewport. [ protected ]
+ Rotates the viewport. [ protected ]
*/
void OCCViewer_ViewPort3d::rotate( int x, int y,
int theRotationPointType,
}
/*!
- Resets the viewport after 'rotation'. [ protected ]
+ Resets the viewport after 'rotation'. [ protected ]
*/
void OCCViewer_ViewPort3d::endRotation()
{
- if ( !activeView().IsNull() )
- {
- if (myAnimate) activeView()->SetAnimationModeOff();
- if ( !myDegenerated )
- activeView()->SetDegenerateModeOff();
- activeView()->ZFitAll(1.);
- activeView()->SetZSize(0.);
- activeView()->Update();
- }
+ if ( !activeView().IsNull() ) {
+ if (myAnimate) activeView()->SetAnimationModeOff();
+ if ( !myDegenerated )
+ activeView()->SetDegenerateModeOff();
+ activeView()->ZFitAll(1.);
+ activeView()->SetZSize(0.);
+ activeView()->Update();
+ }
}
/*!
- Repaints the viewport. [ virtual protected ]
+ Repaints the viewport. [ virtual protected ]
*/
void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e )
{
#ifndef WNT
- /* X11 : map before show doesn't work */
- if ( !mapped( activeView() ) )
- mapView( activeView() );
+ /* X11 : map before show doesn't work */
+ if ( !mapped( activeView() ) )
+ mapView( activeView() );
#endif
- if ( !myWindow.IsNull() )
- {
- QApplication::syncX();
- QRect rc = e->rect();
- if ( !myPaintersRedrawing )
- activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() );
- }
- OCCViewer_ViewPort::paintEvent( e );
- myBusy = false;
+ if ( !myWindow.IsNull() ) {
+ QApplication::syncX();
+ QRect rc = e->rect();
+ if ( !myPaintersRedrawing )
+ activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() );
+ }
+ OCCViewer_ViewPort::paintEvent( e );
+ myBusy = false;
}
/*!
- Resizes the viewport. [ virtual protected ]
+ Resizes the viewport. [ virtual protected ]
*/
void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e )
{
#ifdef WNT
- /* Win32 : map before first show to avoid flicker */
- if ( !mapped( activeView() ) )
- mapView( activeView() );
+ /* Win32 : map before first show to avoid flicker */
+ if ( !mapped( activeView() ) )
+ mapView( activeView() );
#endif
- QApplication::syncX();
- if ( !activeView().IsNull() )
- activeView()->MustBeResized();
+ QApplication::syncX();
+ if ( !activeView().IsNull() )
+ activeView()->MustBeResized();
}
/*!
- Fits all objects in view. [ virtual protected ]
+ Fits all objects in view. [ virtual protected ]
*/
void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd )
{
if ( activeView().IsNull() )
return;
-
if ( keepScale )
myScale = activeView()->Scale();
}
/*!
- Resets the view. [ virtual protected ]
+ Resets the view. [ virtual protected ]
*/
void OCCViewer_ViewPort3d::reset()
{
-// double zsize = getZSize();
- if ( !activeView().IsNull() )
- activeView()->Reset();
-// setZSize( zsize );
+ // double zsize = getZSize();
+ if ( !activeView().IsNull() )
+ activeView()->Reset();
+ // setZSize( zsize );
}
/*!
- Passed the handle of native window of the component to CASCADE view. [ private ]
+ Passed the handle of native window of the component to CASCADE view. [ private ]
*/
bool OCCViewer_ViewPort3d::setWindow( const Handle(V3d_View)& view )
{
- if ( !myWindow.IsNull() )
- return true;
-
- if ( view.IsNull() )
- return false;
-
- int hwnd = (int)winId();
- if ( !hwnd )
- return false;
-
- /* set this widget as the drawing window */
- short lo = (short)hwnd;
- short hi = (short)( hwnd >> 16 );
- OCCViewer_VService::SetWindow( view, (int)hi, (int)lo, Xw_WQ_SAMEQUALITY );
- myWindow = view->Window();
- return !myWindow.IsNull();
+ if ( !myWindow.IsNull() )
+ return true;
+
+ if ( view.IsNull() )
+ return false;
+
+ int hwnd = (int)winId();
+ if ( !hwnd )
+ return false;
+
+ /* set this widget as the drawing window */
+ short lo = (short)hwnd;
+ short hi = (short)( hwnd >> 16 );
+
+ attachWindow( view, OCCViewer_VService::CreateWindow( view, (int)hi, (int)lo, Xw_WQ_SAMEQUALITY ) );
+
+ myWindow = view->Window();
+ return !myWindow.IsNull();
+}
+
+void OCCViewer_ViewPort3d::attachWindow( const Handle(V3d_View)& view,
+ const Handle(Aspect_Window)& window)
+{
+ if (!view.IsNull())
+ view->SetWindow( window );
}
/*!
- Returns the current active view. [ private ]
+ Returns the current active view. [ private ]
*/
Handle(V3d_View) OCCViewer_ViewPort3d::activeView() const
{
- return myActiveView;
+ return myActiveView;
}
/*!
- Returns the current inactive view [ private ]
+ Returns the current inactive view [ private ]
*/
/*Handle(V3d_View) OCCViewer_ViewPort3d::inactiveView() const
-{
- return ( activeView() == myOrthoView ? myPerspView : myOrthoView );
-}*/
+ {
+ return ( activeView() == myOrthoView ? myPerspView : myOrthoView );
+ }*/
/*!
- Returns 'true' if the given view is mapped to window. [ private ]
+ Returns 'true' if the given view is mapped to window. [ private ]
*/
bool OCCViewer_ViewPort3d::mapped( const Handle(V3d_View)& view ) const
{
- return ( !view.IsNull() && view->View()->IsDefined() );
+ return ( !view.IsNull() && view->View()->IsDefined() );
}
virtual void paintEvent( QPaintEvent* );
virtual void resizeEvent( QResizeEvent* );
+ // initialization
+ virtual void attachWindow( const Handle(V3d_View)&, const Handle(Aspect_Window)& );
+
private:
Handle(V3d_View) activeView() const;
Handle(V3d_View) inactiveView() const;
# include <QWindowsStyle>
#endif
+#include <GL/gl.h>
+
const char* imageZoomCursor[] = {
"32 32 3 1",
". c None",
*/
void OCCViewer_ViewWindow::createToolBar()
{
- int tid = toolMgr()->createToolBar( tr( "LBL_TOOLBAR_LABEL" ) );
+ int tid = toolMgr()->createToolBar( tr( "LBL_TOOLBAR_LABEL" ), false );
toolMgr()->append( DumpId, tid );
if( myModel->trihedronActivated() )
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Xpos);
onViewFitAll();
+ emit vpTransformationFinished ( FRONTVIEW );
}
/*!
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Xneg);
onViewFitAll();
+ emit vpTransformationFinished ( BACKVIEW );
}
/*!
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Zpos);
onViewFitAll();
+ emit vpTransformationFinished ( TOPVIEW );
}
/*!
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Zneg);
onViewFitAll();
+ emit vpTransformationFinished ( BOTTOMVIEW );
}
/*!
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Yneg);
onViewFitAll();
+ emit vpTransformationFinished ( LEFTVIEW );
}
/*!
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Ypos);
onViewFitAll();
+ emit vpTransformationFinished ( RIGHTVIEW );
}
/*!
myViewPort->fitAll( false, true, false );
myViewPort->getView()->SetImmediateUpdate( upd );
myViewPort->getView()->Update();
+ emit vpTransformationFinished( RESETVIEW );
}
/*!
{
emit vpTransformationStarted( FITALLVIEW );
myViewPort->fitAll();
+ emit vpTransformationFinished( FITALLVIEW );
}
/*!
*/
QImage OCCViewer_ViewWindow::dumpView()
{
- QPixmap px = QPixmap::grabWindow( myViewPort->winId() );
- return px.toImage();
+ Handle(V3d_View) view = myViewPort->getView();
+ if ( view.IsNull() )
+ return QImage();
+ QApplication::syncX();
+ view->Update();
+ view->Redraw();
+
+ unsigned char* data = new unsigned char[ (myViewPort->width()*myViewPort->height())*4 ];
+
+ QPoint p = myViewPort->mapFromParent(myViewPort->geometry().topLeft());
+
+ glReadPixels( p.x(), p.y(), myViewPort->width(), myViewPort->height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ data);
+
+ QImage anImage( data, myViewPort->width(), myViewPort->height(), QImage::Format_ARGB32 );
+ anImage = anImage.mirrored();
+ anImage = anImage.rgbSwapped();
+ return anImage;
+
}
bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img,
Handle(Visual3d_View) a3dView = myViewPort->getView()->View();
if (format == "PS")
- a3dView->Export(qPrintable(fileName), Graphic3d_EF_PostScript);
+ a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_PostScript);
else if (format == "EPS")
- a3dView->Export(qPrintable(fileName), Graphic3d_EF_EnhPostScript);
+ a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_EnhPostScript);
return true;
}
void Plot2d_ViewWindow::createToolBar()
{
QtxActionToolMgr* mgr = toolMgr();
- myToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_LABEL" ) );
+ myToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_LABEL" ), false );
mgr->append( DumpId, myToolBar );
mgr->append( ScaleOpId, myToolBar );
mgr->append( MoveOpId, myToolBar );
return Py_None;
}
+static PyObject*
+PyStdOut_flush(PyStdOut *self)
+{
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyMethodDef PyStdOut_methods[] = {
- {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
- PyDoc_STR("write(string) -> None")},
+ {"write", (PyCFunction)PyStdOut_write, METH_VARARGS, PyDoc_STR("write(string) -> None")},
+ {"flush", (PyCFunction)PyStdOut_flush, METH_NOARGS, PyDoc_STR("flush() -> None")},
{NULL, NULL} /* sentinel */
};
/*!
\brief Scale the pixmap to the required size.
- If \h is 0 (default) the value of \a w is used instead (to create
+ If \a h is 0 (default) the value of \a w is used instead (to create
square pixmap).
\param icon pixmap to be resized
- "RR,GG,BB[,AA]" or "RR GG BB[ AA]" (\c RR, \c GG, \c BB
and optional \c AA values represent red, green, blue and alpha
components of the color in decimal form)
- - #RRGGBB" - (\c RR, \c GG and \c BB values represent red, green and blue
+ - "#RRGGBB" - (\c RR, \c GG and \c BB values represent red, green and blue
components of the color in hexadecimal form)
- an integer value representing packed color components (see rgbSet())
- a name from the list of colors defined in the list of SVG color keyword names
\return id of created/found toolbar
*/
int QtxActionToolMgr::createToolBar( const QString& title, const int tid, QMainWindow* mw )
+{
+ return createToolBar( title, true, Qt::AllToolBarAreas, tid, mw );
+}
+
+int QtxActionToolMgr::createToolBar( const QString& title, bool floatable, Qt::ToolBarAreas dockAreas,
+ int tid, QMainWindow* mw )
{
static int _toolBarId = -1;
if ( !tb )
{
tb = new QtxToolBar( true, tbw );
+ tb->setFloatable( floatable );
+ tb->setAllowedAreas( dockAreas );
+ tb->setMovable( dockAreas & Qt::AllToolBarAreas );
//mainWindow()->addToolBar( tb );
tb->setWindowTitle( title );
tb->setObjectName( title );
QMainWindow* mainWindow() const;
int createToolBar( const QString&, int = -1, QMainWindow* = 0 );
+ int createToolBar( const QString&, bool, Qt::ToolBarAreas = Qt::AllToolBarAreas,
+ int = -1, QMainWindow* = 0 );
void removeToolBar( const QString& );
void removeToolBar( const int );
{
QSize sz = QDockWidget::sizeHint();
- printf( "----------------> QtxDockWidget::sizeHint()\n" );
+ // printf( "----------------> QtxDockWidget::sizeHint()\n" );
return QSize( 500, 100 );
#include <QDateTimeEdit>
#include <QStackedWidget>
+#include <stdio.h>
+
/*!
\class QtxPagePrefMgr
\brief GUI implementation of the QtxPreferenceMgr class: preferences manager.
/*!
\brief Get the list of the values from the selection widget.
\return list of values
- \sa numbers(), setStrings()
+ \sa numbers(), icons(), setStrings()
*/
QStringList QtxPagePrefSelectItem::strings() const
{
/*!
\brief Get the list of the values identifiers from the selection widget.
\return list of values IDs
- \sa strings(), setNumbers()
+ \sa strings(), icons(), setNumbers()
*/
QList<int> QtxPagePrefSelectItem::numbers() const
{
return res;
}
+/*!
+ \brief Get the list of the icons associated with the selection widget.items
+ \return list of icons
+ \sa strings(), numbers(), setIcons()
+*/
+QList<QIcon> QtxPagePrefSelectItem::icons() const
+{
+ QList<QIcon> res;
+ for ( uint i = 0; i < mySelector->count(); i++ )
+ res.append( mySelector->itemIcon( i ) );
+ return res;
+}
+
/*!
\brief Set the list of the values to the selection widget.
\param lst new list of values
- \sa strings(), setNumbers()
+ \sa strings(), setNumbers(), setIcons()
*/
void QtxPagePrefSelectItem::setStrings( const QStringList& lst )
{
}
/*!
- \brief Set the list of the values identifiers to the selection widget.
+ \brief Set the list of the values identifiers to the selection widget
\param ids new list of values IDs
- \sa numbers(), setStrings()
+ \sa numbers(), setStrings(), setIcons()
*/
void QtxPagePrefSelectItem::setNumbers( const QList<int>& ids )
{
uint i = 0;
- for ( QList<int>::const_iterator it = ids.begin(); it != ids.end() && i < mySelector->count(); ++it, i++ )
+ for ( QList<int>::const_iterator it = ids.begin(); it != ids.end(); ++it, i++ ) {
+ if ( i >= mySelector->count() )
+ mySelector->addItem(QString("") );
+
mySelector->setId( i, *it );
+ }
+}
+
+/*!
+ \brief Set the list of the icons to the selection widget items
+
+ Important: call this method after setStrings() or setNumbers()
+
+ \param icns new list of icons
+ \sa icons(), setStrings(), setNumbers()
+*/
+void QtxPagePrefSelectItem::setIcons( const QList<QIcon>& icns )
+{
+ uint i = 0;
+ for ( QList<QIcon>::const_iterator it = icns.begin(); it != icns.end() && i < mySelector->count(); ++it, i++ )
+ mySelector->setItemIcon( i, *it );
}
/*!
lst.append( *it );
return lst;
}
+ else if ( name == "icons" || name == "pixmaps" )
+ {
+ QList<QVariant> lst;
+ QList<QIcon> ics = icons();
+ for ( QList<QIcon>::const_iterator it = ics.begin(); it != ics.end(); ++it )
+ lst.append( *it );
+ return lst;
+ }
else
return QtxPageNamedPrefItem::optionValue( name );
}
setStrings( val );
else if ( name == "numbers" || name == "ids" || name == "indexes" )
setNumbers( val );
+ else if ( name == "icons" || name == "pixmaps" )
+ setIcons( val );
else
QtxPageNamedPrefItem::setOptionValue( name, val );
}
setNumbers( lst );
}
+/*!
+ \brief Set the list of the icons from the resource manager.
+ \param var new icons list
+ \internal
+*/
+void QtxPagePrefSelectItem::setIcons( const QVariant& var )
+{
+ if ( var.type() != QVariant::List )
+ return;
+
+ QList<QIcon> lst;
+ QList<QVariant> varList = var.toList();
+ for ( QList<QVariant>::const_iterator it = varList.begin(); it != varList.end(); ++it )
+ {
+ if ( (*it).canConvert<QIcon>() )
+ lst.append( (*it).value<QIcon>() );
+ else if ( (*it).canConvert<QPixmap>() )
+ lst.append( (*it).value<QPixmap>() );
+ else
+ lst.append( QIcon() );
+ }
+ setIcons( lst );
+}
+
/*!
\brief Update selector widget.
*/
#include <QFrame>
#include <QLabel>
#include <QPointer>
+#include <QIcon>
class QtxGridBox;
class QtxFontEdit;
QStringList strings() const;
QList<int> numbers() const;
+ QList<QIcon> icons() const;
void setStrings( const QStringList& );
void setNumbers( const QList<int>& );
+ void setIcons( const QList<QIcon>& );
virtual void store();
virtual void retrieve();
void updateSelector();
void setStrings( const QVariant& );
void setNumbers( const QVariant& );
+ void setIcons( const QVariant& );
private:
int myType;
//
#include "QtxSplash.h"
#include "QtxResourceMgr.h"
+#include <cstdio>
#include <QApplication>
#include <QPainter>
{
DEBTRACE("QxScene_ViewWindow::createToolBar");
QtxActionToolMgr* mgr = toolMgr();
- myToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_LABEL" ) );
+ myToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_LABEL" ), false );
mgr->append( ScaleOpId, myToolBar );
mgr->append( MoveOpId, myToolBar );
mgr->append( ResetId, myToolBar );
if ( !myInterp || !myModule )
return;
- if ( PyObject_HasAttrString( myModule->get() , "engineIOR" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"engineIOR", (char*)"" ) );
+ if ( PyObject_HasAttrString( myModule , "engineIOR" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"engineIOR", (char*)"" ) );
if ( !res ) {
PyErr_Print();
}
#include <QMenu>
#include <QAction>
-
#include "sipAPISalomePyQtGUILight.h"
#include <sip.h>
{
if ( myXmlHandler )
delete myXmlHandler;
- if ( myInterp ) {
+ if ( myInterp && myModule ) {
PyLockWrapper aLock = myInterp->GetLockWrapper();
- delete myModule;
+ Py_XDECREF(myModule);
}
}
PyLockWrapper aLock = myInterp->GetLockWrapper();
// ... (the Python module is already imported)
// ... finally call Python module's initialize() method
- if ( PyObject_HasAttrString( myModule->get(), "initialize" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"initialize", (char*)"" ) );
+ if ( PyObject_HasAttrString( myModule, "initialize" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"initialize", (char*)"" ) );
if ( !res ) {
PyErr_Print();
}
myWindowsMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
myWindowsMap.insert( LightApp_Application::WT_LogWindow, Qt::BottomDockWidgetArea );
- if ( PyObject_HasAttrString( myModule->get() , "windows" ) ) {
- PyObjWrapper res1( PyObject_CallMethod( myModule->get(), (char*)"windows", (char*)"" ) );
+ if ( PyObject_HasAttrString( myModule , "windows" ) ) {
+ PyObjWrapper res1( PyObject_CallMethod( myModule, (char*)"windows", (char*)"" ) );
if ( !res1 ) {
PyErr_Print();
}
// get compatible view windows types from the Python module
// by calling views() method
- if ( PyObject_HasAttrString( myModule->get() , "views" ) ) {
- PyObjWrapper res2( PyObject_CallMethod( myModule->get(), (char*)"views", (char*)"" ) );
+ if ( PyObject_HasAttrString( myModule , "views" ) ) {
+ PyObjWrapper res2( PyObject_CallMethod( myModule, (char*)"views", (char*)"" ) );
if ( !res2 ) {
PyErr_Print();
}
// initialize Python subinterpreter (on per study) and put it in <myInterp> variable
initInterp( aStudyId );
- if ( !myInterp )
+ if ( !myInterp ) {
+ myLastActivateStatus = false;
return; // Error
+ }
// import Python GUI module
importModule();
- if ( !myModule )
+ if ( !myModule ) {
+ myLastActivateStatus = false;
return; // Error
+ }
// get python lock
PyLockWrapper aLock = myInterp->GetLockWrapper();
// call Python module's activate() method (for the new modules)
- if ( PyObject_HasAttrString( myModule->get() , "activate" ) ) {
- PyObject* res1 = PyObject_CallMethod( myModule->get(), (char*)"activate", (char*)"" );
+ if ( PyObject_HasAttrString( myModule , "activate" ) ) {
+ PyObject* res1 = PyObject_CallMethod( myModule, (char*)"activate", (char*)"" );
if ( !res1 || !PyBool_Check( res1 ) ) {
PyErr_Print();
// always true for old modules (no return value)
if ( IsCallOldMethods ) {
// call Python module's setSettings() method (obsolete)
- if ( PyObject_HasAttrString( myModule->get() , "setSettings" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"setSettings", (char*)"" ) );
+ if ( PyObject_HasAttrString( myModule , "setSettings" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"setSettings", (char*)"" ) );
if( !res ) {
PyErr_Print();
}
return;
}
// then call Python module's deactivate() method
- if ( PyObject_HasAttrString( myModule->get() , "deactivate" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"deactivate", (char*)"" ) );
+ if ( PyObject_HasAttrString( myModule , "deactivate" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"deactivate", (char*)"" ) );
if( !res ) {
PyErr_Print();
}
PyLockWrapper aLock = myInterp->GetLockWrapper();
// call Python module's activeStudyChanged() method
- if ( PyObject_HasAttrString( myModule->get(), "activeStudyChanged" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"activeStudyChanged", (char*)"i", aStudyId ) );
+ if ( PyObject_HasAttrString( myModule, "activeStudyChanged" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"activeStudyChanged", (char*)"i", aStudyId ) );
if( !res ) {
PyErr_Print();
}
QString aContext( "" ), aObject( "" ), aParent( theContext );
- if ( IsCallOldMethods && PyObject_HasAttrString( myModule->get(), "definePopup" ) ) {
+ if ( IsCallOldMethods && PyObject_HasAttrString( myModule, "definePopup" ) ) {
// call definePopup() Python module's function
// this is obsolete function, used only for compatibility reasons
- PyObjWrapper res( PyObject_CallMethod( myModule->get(),
+ PyObjWrapper res( PyObject_CallMethod( myModule,
(char*)"definePopup",
(char*)"sss",
theContext.toLatin1().constData(),
if ( myXmlHandler )
myXmlHandler->createPopup( thePopupMenu, aContext, aParent, aObject );
- PyObjWrapper sipPopup( sipBuildResult( 0, "M", thePopupMenu, sipClass_QMenu ) );
+#if SIP_VERSION < 0x040800
+ PyObjWrapper sipPopup( sipBuildResult( 0, "M", thePopupMenu, sipClass_QMenu) );
+#else
+ PyObjWrapper sipPopup( sipBuildResult( 0, "D", thePopupMenu, sipType_QMenu, NULL) );
+#endif
// then call Python module's createPopupMenu() method (for new modules)
- if ( PyObject_HasAttrString( myModule->get(), "createPopupMenu" ) ) {
- PyObjWrapper res1( PyObject_CallMethod( myModule->get(),
+ if ( PyObject_HasAttrString( myModule, "createPopupMenu" ) ) {
+ PyObjWrapper res1( PyObject_CallMethod( myModule,
(char*)"createPopupMenu",
(char*)"Os",
sipPopup.get(),
}
}
- if ( IsCallOldMethods && PyObject_HasAttrString( myModule->get(), "customPopup" ) ) {
+ if ( IsCallOldMethods && PyObject_HasAttrString( myModule, "customPopup" ) ) {
// call customPopup() Python module's function
// this is obsolete function, used only for compatibility reasons
- PyObjWrapper res2( PyObject_CallMethod( myModule->get(),
+ PyObjWrapper res2( PyObject_CallMethod( myModule,
(char*)"customPopup",
(char*)"Osss",
sipPopup.get(),
if ( !myInterp || !myModule )
return;
- if ( PyObject_HasAttrString( myModule->get(), "OnGUIEvent" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"OnGUIEvent", (char*)"i", theId ) );
+ if ( PyObject_HasAttrString( myModule, "OnGUIEvent" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"OnGUIEvent", (char*)"i", theId ) );
if( !res ) {
PyErr_Print();
}
// might be called during the module intialization process
myInitModule = this;
- if ( PyObject_HasAttrString( myModule->get(), "createPreferences" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"createPreferences", (char*)"" ) );
+ if ( PyObject_HasAttrString( myModule, "createPreferences" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"createPreferences", (char*)"" ) );
if( !res ) {
PyErr_Print();
}
PyLockWrapper aLock = myInterp->GetLockWrapper();
// ... then import a module
QString aMod = name() + "GUI";
- myModule = new PyObjWrapper( PyImport_ImportModule( aMod.toLatin1().data() ) );
+ try {
+ myModule = PyImport_ImportModule( aMod.toLatin1().data() );
+ }
+ catch (...) {
+ }
if( !myModule ) {
// Error!
PyErr_Print();
if ( aDesktop )
aWorkspace = aDesktop->workstack();
}
- PyObjWrapper pyws( sipBuildResult( 0, "M", aWorkspace, sipClass_QWidget ) );
+#if SIP_VERSION < 0x040800
+ PyObjWrapper pyws( sipBuildResult( 0, "M", aWorkspace, sipClass_QWidget) );
+#else
+ PyObjWrapper pyws( sipBuildResult( 0, "D", aWorkspace, sipType_QWidget , NULL) );
+#endif
// ... and finally call Python module's setWorkspace() method (obsolete)
- if ( PyObject_HasAttrString( myModule->get(), "setWorkSpace" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"setWorkSpace", (char*)"O", pyws.get() ) );
+ if ( PyObject_HasAttrString( myModule, "setWorkSpace" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"setWorkSpace", (char*)"O", pyws.get() ) );
if( !res ) {
PyErr_Print();
}
if ( !myInterp || !myModule )
return;
- if ( PyObject_HasAttrString( myModule->get(), "preferenceChanged" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(),
+ if ( PyObject_HasAttrString( myModule, "preferenceChanged" ) ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule,
(char*)"preferenceChanged",
(char*)"ss",
section.toLatin1().constData(),
connectView( pview );
- if ( PyObject_HasAttrString( myModule->get(), "activeViewChanged" ) )
+ if ( PyObject_HasAttrString( myModule, "activeViewChanged" ) )
{
if ( !pview )
return;
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"activeViewChanged", (char*)"i" , pview->getId() ) );
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"activeViewChanged", (char*)"i" , pview->getId() ) );
if( !res )
PyErr_Print();
}
if ( !myInterp || !myModule || !pview )
return;
- if ( PyObject_HasAttrString( myModule->get(), "viewCloned" ) )
+ if ( PyObject_HasAttrString( myModule, "viewCloned" ) )
{
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"viewCloned", (char*)"i", pview->getId() ) );
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"viewCloned", (char*)"i", pview->getId() ) );
if( !res )
PyErr_Print();
}
if ( !myInterp || !myModule )
return;
- if ( PyObject_HasAttrString( myModule->get(), "viewClosed" ) )
+ if ( PyObject_HasAttrString( myModule, "viewClosed" ) )
{
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"viewClosed", (char*)"i", pview->getId() ) );
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"viewClosed", (char*)"i", pview->getId() ) );
if ( !res )
{
PyErr_Print();
if ( !myInterp || !myModule || (it == theListOfFiles.end()))
return;
- if ( PyObject_HasAttrString(myModule->get(), "saveFiles") ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"saveFiles",
+ if ( PyObject_HasAttrString(myModule, "saveFiles") ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"saveFiles",
(char*)"s", (*it).toLatin1().constData()));
if( !res ) {
PyErr_Print();
return;
QStringList* theList = new QStringList(theListOfFiles);
- PyObjWrapper sipList( sipBuildResult( 0, "M", theList, sipClass_QStringList ) );
-
- if ( PyObject_HasAttrString(myModule->get() , "openFiles") ) {
- PyObjWrapper res( PyObject_CallMethod( myModule->get(), (char*)"openFiles",
+#if SIP_VERSION < 0x040800
+ PyObjWrapper sipList( sipBuildResult( 0, "M", theList, sipClass_QStringList) );
+#else
+ PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList , NULL) );
+#endif
+ if ( PyObject_HasAttrString(myModule , "openFiles") ) {
+ PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"openFiles",
(char*)"O", sipList.get()));
if( !res || !PyBool_Check( res )) {
PyErr_Print();
bool myLastActivateStatus; //!< latest module activation status
protected:
- PyObjWrapper* myModule; //!< Python GUI module
- PyInterp_Interp* myInterp; //!< current Python subinterpreter
- static InterpMap myInterpMap; //!< study to Python subinterpreter map
+ PyObject* myModule; //!< Python GUI module
+ PyInterp_Interp* myInterp; //!< current Python subinterpreter
+ static InterpMap myInterpMap; //!< study to Python subinterpreter map
public:
SALOME_PYQT_ModuleLight();
# Module : SALOME
#
import libSalomePy
-ren=libSalomePy.renderer
-#iren=libSalomePy.interactor
+import vtk
-from libVTKCommonPython import *
-from libVTKGraphicsPython import *
-cone = vtkConeSource()
+# get the "vtkRenderer": an OpenGL rendering context
+ren=libSalomePy.getRenderer()
+
+# create an actor and give it cone geometry
+cone = vtk.vtkConeSource()
cone.SetResolution(8)
-coneMapper = vtkPolyDataMapper()
+coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
-coneActor = vtkActor()
+coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
+# assign our actor to the renderer
ren.AddActor(coneActor)
-iren = vtkRenderWindowInteractor()
+libSalomePy.fitAll()
+
+iren = libSalomePy.getRenderWindowInteractor()
libSPlot2d_la_CPPFLAGS = $(QT_INCLUDES) $(CAS_CPPFLAGS) $(QWT_INCLUDES) $(BOOST_CPPFLAGS) \
-I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -I$(srcdir)/../Plot2d \
-I$(srcdir)/../Prs -I$(srcdir)/../OBJECT
-libSPlot2d_la_LDFLAGS = $(QT_MT_LIBS) $(CAS_KERNEL) $(QWT_LIBS) ../SUIT/libsuit.la ../Plot2d/libPlot2d.la ../Prs/libSalomePrs.la ../OBJECT/libSalomeObject.la
+libSPlot2d_la_LDFLAGS = ../SUIT/libsuit.la ../Plot2d/libPlot2d.la ../Prs/libSalomePrs.la ../OBJECT/libSalomeObject.la
+
+### VSR: 24/11/2009: remove these libs to avoid double linking to the native libraries
+###$(QT_MT_LIBS) $(CAS_KERNEL) $(QWT_LIBS)
//
#include "SUIT_DataObject.h"
#include "SUIT_DataObjectKey.h"
+#include <cstdio>
SUIT_DataObject::Signal* SUIT_DataObject::mySignal = 0;
setBackgroundColor(QColor(R,G,B));*/
myToolBar = new QToolBar(this);
+ myToolBar->setFloatable(false);
//myToolBar->setCloseMode(QDockWindow::Undocked);
myToolBar->setWindowTitle(tr("LBL_TOOLBAR_LABEL"));
createActions();
SVTK_SetRotationPointDlg.h \
SVTK_ViewParameterDlg.h \
SVTK_ComboAction.h \
- SVTK_Extension.h \
SVTK_Recorder.h \
SVTK_RecorderDlg.h \
SVTK_ImageWriter.h \
SVTK_SetRotationPointDlg.cxx \
SVTK_ViewParameterDlg.cxx \
SVTK_ComboAction.cxx \
- SVTK_Extension.cxx \
SVTK_Recorder.cxx \
SVTK_RecorderDlg.cxx \
SVTK_ImageWriter.cxx \
myPreHighlightActor->SetVisibility( theVisibility && myIsPreselected );
- vtkProperty* aProp = vtkProperty::New();
- aProp->SetColor( 255, 255, 255);
- aProp->SetLineWidth ( 3 );
- myPreHighlightActor->SetProperty(aProp);
- aProp->Delete();
-
- int vis = myPreHighlightActor->GetVisibility();
- //printf ("\n Visibility = %d", vis);
-
if(mySelector.GetPointer() && hasIO()){
- if(mySelector->SelectionMode() != ActorSelection) {
+ if(mySelector->SelectionMode() != ActorSelection){
int aHasIndex = mySelector->HasIndex( getIO() );
myHighlightActor->SetVisibility( theVisibility && isHighlighted() && aHasIndex);
}
aRenderer->Delete();
aSelector->Delete();
- myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), -1, this );
- myRecordingToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_RECORD_LABEL"), -1, this );
+ myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), false, Qt::AllToolBarAreas, -1, this );
+ myRecordingToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_RECORD_LABEL"), false, Qt::AllToolBarAreas, -1, this );
createActions( SUIT_Session::session()->activeApplication()->resourceMgr() );
createToolBar();
if( myDumpImage.isNull() )
return dumpViewContent();
+ RefreshDumpImage();
return myDumpImage;
}
#include <vector>//?
#include <string>//?
+#include <cstdio>
/*!
Constructor.
libSalomeSession_la_CPPFLAGS+= -DENABLE_TESTRECORDER $(TESTRECORDER_INCLUDES)
endif
-libSalomeSession_la_LDFLAGS = $(QT_MT_LIBS) $(KERNEL_LDFLAGS) -lSalomeNS \
+libSalomeSession_la_LDFLAGS = $(KERNEL_LDFLAGS) -lSalomeNS \
-lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lSalomeCatalog \
-lSalomeDSClient $(CAS_KERNEL) -lwith_loggerTraceCollector \
-lSalomeIDLKernel -lSalomeContainer -lTOOLSDS -lSalomeLauncher \
-lRegistry -lSALOMEBasics \
../SUIT/libsuit.la ../Event/libEvent.la ../../idl/libSalomeIDLGUI.la \
- ../Style/libSalomeStyle.la
+ ../Style/libSalomeStyle.la $(QT_MT_LIBS)
if ENABLE_TESTRECORDER
libSalomeSession_la_LDFLAGS+= $(TESTRECORDER_LIBS)
SALOME_Session_Server_CPPFLAGS = $(libSalomeSession_la_CPPFLAGS)
SALOME_Session_Server_LDADD = $(libSalomeSession_la_LDFLAGS) \
- $(PYTHON_LIBS) $(OMNIORB_LIBS) \
- $(HDF5_LIBS) -lSalomeContainer -lSalomeResourcesManager -lTOOLSDS \
+ -lSalomeContainer -lSalomeResourcesManager -lTOOLSDS \
-lSalomeHDFPersist -lSalomeDSImpl -lSalomeGenericObj -lRegistry \
-lSalomeNotification -lSALOMEBasics -lSalomeLauncher ../Qtx/libqtx.la \
- $(top_builddir)/idl/libSalomeIDLGUI.la \
- libSalomeSession.la
+ $(top_builddir)/idl/libSalomeIDLGUI.la libSalomeSession.la \
+ $(HDF5_LIBS) $(PYTHON_LIBS) $(OMNIORB_LIBS)
if ENABLE_TESTRECORDER
SALOME_Session_Server_LDADD+= $(TESTRECORDER_LIBS)
myTransformFilter(VTKViewer_TransformFilter::New())
{
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ myPolygonOffsetUnits);
for(int i = 0; i < 6; i++)
myPassFilter.push_back(vtkPassThroughFilter::New());
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ myPolygonOffsetUnits);
Superclass::Render(ren,m);
vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
void
VTKViewer_Actor
::SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units)
+ vtkFloatingPointType units)
{
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;
void
VTKViewer_Actor
::GetPolygonOffsetParameters(vtkFloatingPointType& factor,
- vtkFloatingPointType& units)
+ vtkFloatingPointType& units)
{
factor = myPolygonOffsetFactor;
units = myPolygonOffsetUnits;
void
VTKViewer_Actor
::SetColor(vtkFloatingPointType r,
- vtkFloatingPointType g,
- vtkFloatingPointType b)
+ vtkFloatingPointType g,
+ vtkFloatingPointType b)
{
GetProperty()->SetColor(r,g,b);
}
void
VTKViewer_Actor
::GetColor(vtkFloatingPointType& r,
- vtkFloatingPointType& g,
- vtkFloatingPointType& b)
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b)
{
vtkFloatingPointType aColor[3];
GetProperty()->GetColor(aColor);
virtual
void
SetColor(vtkFloatingPointType r,
- vtkFloatingPointType g,
- vtkFloatingPointType b);
+ vtkFloatingPointType g,
+ vtkFloatingPointType b);
//! Get current color
virtual
void
GetColor(vtkFloatingPointType& r,
- vtkFloatingPointType& g,
- vtkFloatingPointType& b);
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b);
//! Change color
virtual
//! Set ResolveCoincidentTopology parameters
void
SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units);
+ vtkFloatingPointType units);
//! Get current ResolveCoincidentTopology parameters
void
GetPolygonOffsetParameters(vtkFloatingPointType& factor,
- vtkFloatingPointType& units);
+ vtkFloatingPointType& units);
virtual
void
int
VTKViewer_AppendFilter
::RequestData(
- vtkInformation *request,
- vtkInformationVector **inputVector,
- vtkInformationVector *outputVector)
+ vtkInformation *request,
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
{
int aRet = 0;
if(GetSharedPointsDataSet())
inline
vtkIdType
GetOutputID(vtkIdType theInputID,
- vtkIdType theInputDataSetID,
- const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ vtkIdType theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
{
theInputID = theInputDataSetID = -1;
vtkIdType
VTKViewer_AppendFilter
::GetPointOutputID(vtkIdType theInputID,
- vtkIdType theInputDataSetID)
+ vtkIdType theInputDataSetID)
{
if(GetSharedPointsDataSet())
return theInputID;
vtkIdType
VTKViewer_AppendFilter
::GetCellOutputID(vtkIdType theInputID,
- vtkIdType theInputDataSetID)
+ vtkIdType theInputDataSetID)
{
if(GetSharedPointsDataSet())
return theInputID;
{
void
GetInputID(vtkIdType theOutputID,
- vtkIdType& theInputID,
- vtkIdType& theStartID,
- vtkIdType& theInputDataSetID,
- const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
{
theInputID = theStartID = theInputDataSetID = -1;
for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){
vtkIdType aRange = theRanges[aDataSetId];
if(aRange > theOutputID){
- theInputID = theOutputID - aStartId;
- theInputDataSetID = aDataSetId;
- theStartID = aStartId;
- break;
+ theInputID = theOutputID - aStartId;
+ theInputDataSetID = aDataSetId;
+ theStartID = aStartId;
+ break;
}
aStartId = aRange;
}
void
VTKViewer_AppendFilter
::GetPointInputID(vtkIdType theOutputID,
- vtkIdType& theInputID,
- vtkIdType& theStartID,
- vtkIdType& theInputDataSetID)
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID)
{
if(GetSharedPointsDataSet()) {
theStartID = theInputDataSetID = 0;
}
::GetInputID(theOutputID,
- theInputID,
- theStartID,
- theInputDataSetID,
- myNodeRanges);
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myNodeRanges);
}
void
VTKViewer_AppendFilter
::GetCellInputID(vtkIdType theOutputID,
- vtkIdType& theInputID,
- vtkIdType& theStartID,
- vtkIdType& theInputDataSetID)
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID)
{
::GetInputID(theOutputID,
- theInputID,
- theStartID,
- theInputDataSetID,
- myCellRanges);
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myCellRanges);
}
vtkIdType
GetPointOutputID(vtkIdType theInputID,
- vtkIdType theInputDataSetID);
+ vtkIdType theInputDataSetID);
vtkIdType
GetCellOutputID(vtkIdType theInputID,
- vtkIdType theInputDataSetID);
+ vtkIdType theInputDataSetID);
void
GetPointInputID(vtkIdType theOutputID,
- vtkIdType& theInputID,
- vtkIdType& theStartID,
- vtkIdType& theInputDataSetID);
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
void
GetCellInputID(vtkIdType theOutputID,
- vtkIdType& theInputID,
- vtkIdType& theStartID,
- vtkIdType& theInputDataSetID);
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
typedef std::vector<vtkIdType> TVectorIds;
Pnt::Pnt(double X,
double Y,
double Z,
- double ScalarValue):
+ double ScalarValue):
coord(X,Y,Z),
scalarValue(ScalarValue)
{
for(vtkIdType idx = 1; idx < aNbPts-1;idx++) {
curID = output->GetPoints()->InsertNextPoint(aPoints->GetPoint(idx));
if( outputScalars )
- outputScalars->InsertNextTuple1(aScalarValues[idx]);
+ outputScalars->InsertNextTuple1(aScalarValues[idx]);
aNewPoints[idx] = curID;
}
aNewPoints[aNbPts-1] = pts[1];
* Array theIds - it is array with ids of added points.
*/
vtkIdType MergevtkPoints(const std::vector<vtkPoints*>& theCollection,
- const std::vector< std::vector<double> >& theScalarCollection,
- vtkPoints* thePoints,
- std::map<int, double>& thePntId2ScalarValue,
- vtkIdType* &theIds){
+ const std::vector< std::vector<double> >& theScalarCollection,
+ vtkPoints* thePoints,
+ std::map<int, double>& thePntId2ScalarValue,
+ vtkIdType* &theIds){
vtkIdType aNbPoints = 0;
vtkIdType anIdCounter = 0;
vtkIdType aNewPntId = 0;
for(vtkIdType idx = 0;idx < aPoints->GetNumberOfPoints()-1;idx++){
aNewPntId = thePoints->InsertNextPoint(aPoints->GetPoint(idx));
theIds[anIdCounter] = aNewPntId;
- thePntId2ScalarValue[ aNewPntId ] = aScalarValues[idx];
+ thePntId2ScalarValue[ aNewPntId ] = aScalarValues[idx];
anIdCounter++;
}
}
typedef std::list<Pnt> PntList;
vtkIdType MergevtkPoints(const std::vector<vtkPoints*>& theCollection,
- const std::vector< std::vector<double> >& theScalarCollection,
+ const std::vector< std::vector<double> >& theScalarCollection,
vtkPoints* thePoints,
- std::map<int, double>& thePntId2ScalarValue,
+ std::map<int, double>& thePntId2ScalarValue,
vtkIdType* &theIds);
vtkIdType Build1DArc(vtkIdType cellId,
vtkFloatingPointType myMaxArcAngle);
Pnt CreatePnt(vtkCell* cell,
- vtkDataArray* scalars,
- vtkIdType index);
+ vtkDataArray* scalars,
+ vtkIdType index);
/*!
* Class for represenation coordinates X,Y,Z
void CalculatePlane(const Pnt& thePnt1, const Pnt& thePnt2, const Pnt& thePnt3);
private:
- double myA;
- double myB;
- double myC;
+ double myA;
+ double myB;
+ double myC;
};
public:
enum ArcStatus {Arc_Done=0, Arc_Error};
VTKViewer_ArcBuilder(const Pnt& thePnt1,
- const Pnt& thePnt2,
- const Pnt& thePnt3,
- double theAngle);
+ const Pnt& thePnt2,
+ const Pnt& thePnt3,
+ double theAngle);
~VTKViewer_ArcBuilder();
void GetAngle(const double theAngle);
static double GetPointAngleOnCircle(const double theXCenter, const double theYCenter,
- const double theXPoint, const double theYPoint);
+ const double theXPoint, const double theYPoint);
vtkPoints* GetPoints();
const std::vector<double>& GetScalarValues();
vtkFloatingPointType myOrigin[3];
vtkFloatingPointType myNormal[3];
TPolygon(const TConnectivities& theConnectivities,
- vtkFloatingPointType theOrigin[3],
- vtkFloatingPointType theNormal[3]):
+ vtkFloatingPointType theOrigin[3],
+ vtkFloatingPointType theNormal[3]):
myConnectivities(theConnectivities)
{
myOrigin[0] = theOrigin[0];
vtkPoints*
VTKViewer_Triangulator
::InitPoints(vtkUnstructuredGrid *theInput,
- vtkIdType theCellId)
+ vtkIdType theCellId)
{
myPoints->Reset();
myPoints->Modified(); // the VTK bug
aCoordDiff[2] = (aBounds[5] - aBounds[4]);
return sqrt(aCoordDiff[0]*aCoordDiff[0] +
- aCoordDiff[1]*aCoordDiff[1] +
- aCoordDiff[2]*aCoordDiff[2]);
+ aCoordDiff[1]*aCoordDiff[1] +
+ aCoordDiff[2]*aCoordDiff[2]);
}
void
VTKViewer_Triangulator
::GetCellNeighbors(vtkUnstructuredGrid *theInput,
- vtkIdType theCellId,
- vtkCell* theFace,
- vtkIdList* theCellIds)
+ vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds)
{
myFaceIds->Reset();
vtkIdList *anIdList = theFace->PointIds;
bool
VTKViewer_Triangulator
::Execute(vtkUnstructuredGrid *theInput,
- vtkCellData* thInputCD,
- vtkIdType theCellId,
- int theShowInside,
- int theAllVisible,
- const char* theCellsVisibility,
- vtkPolyData *theOutput,
- vtkCellData* theOutputCD,
- int theStoreMapping,
- std::vector<vtkIdType>& theVTK2ObjIds,
- bool theIsCheckConvex)
+ vtkCellData* thInputCD,
+ vtkIdType theCellId,
+ int theShowInside,
+ int theAllVisible,
+ const char* theCellsVisibility,
+ vtkPolyData *theOutput,
+ vtkCellData* theOutputCD,
+ int theStoreMapping,
+ std::vector<vtkIdType>& theVTK2ObjIds,
+ bool theIsCheckConvex)
{
vtkPoints *aPoints = InitPoints(theInput, theCellId);
vtkIdType aNumPts = GetNbOfPoints();
vtkIdList *anIdList = aFace->PointIds;
vtkIdType aNewPts[3] = {anIdList->GetId(0), anIdList->GetId(1), anIdList->GetId(2)};
-
+
// To initialize set of points for the plane where the trinangle face belong to
TPointIds aPointIds;
aPointIds.insert(aNewPts[0]);
/* To calculate plane normal for face (aFace)
- ^ aNormal
- |
- | ^ aVector01
- | /
- /_________> aVector02
+ ^ aNormal
+ |
+ | ^ aVector01
+ | /
+ /_________> aVector02
*/
vtkFloatingPointType aVector01[3] = { aCoord[1][0] - aCoord[0][0],
- aCoord[1][1] - aCoord[0][1],
- aCoord[1][2] - aCoord[0][2] };
+ aCoord[1][1] - aCoord[0][1],
+ aCoord[1][2] - aCoord[0][2] };
vtkFloatingPointType aVector02[3] = { aCoord[2][0] - aCoord[0][0],
- aCoord[2][1] - aCoord[0][1],
- aCoord[2][2] - aCoord[0][2] };
+ aCoord[2][1] - aCoord[0][1],
+ aCoord[2][2] - aCoord[0][2] };
vtkMath::Normalize(aVector01);
vtkMath::Normalize(aVector02);
// To calculate bounds of the point set
vtkFloatingPointType aCenter[3] = {0.0, 0.0, 0.0};
{
- TPointIds::const_iterator anIter = anInitialPointIds.begin();
- TPointIds::const_iterator anEndIter = anInitialPointIds.end();
- for(; anIter != anEndIter; anIter++){
- vtkFloatingPointType aPntCoord[3];
- vtkIdType aPntId = *anIter;
- aPoints->GetPoint(aPntId,aPntCoord);
-
- vtkFloatingPointType aVector0Pnt[3] = { aPntCoord[0] - aCoord[0][0],
- aPntCoord[1] - aCoord[0][1],
- aPntCoord[2] - aCoord[0][2] };
-
-
- vtkMath::Normalize(aVector0Pnt);
-
- vtkFloatingPointType aNormalPnt[3];
- // calculate aNormalPnt
- {
- vtkFloatingPointType aCosPnt01 = vtkMath::Dot(aVector0Pnt,aVector01);
- vtkFloatingPointType aCosPnt02 = vtkMath::Dot(aVector0Pnt,aVector02);
- if(aCosPnt01<-1)
- aCosPnt01 = -1;
- if(aCosPnt01>1)
- aCosPnt01 = 1;
- if(aCosPnt02<-1)
- aCosPnt02 = -1;
- if(aCosPnt02>1)
- aCosPnt02 = 1;
-
- vtkFloatingPointType aDist01,aDist02;// deflection from Pi/3 angle (equilateral triangle)
- vtkFloatingPointType aAngPnt01 = fabs(acos(aCosPnt01));
- vtkFloatingPointType aAngPnt02 = fabs(acos(aCosPnt02));
-
- /* check that triangle similar to equilateral triangle
- AOC or COB ?
- aVector0Pnt = (OC)
- aVector01 = (OB)
- aVector02 = (OA)
-
- B
- ^ aVector01 C
- | ^ aVector0Pnt
- | _____/
- | ___/
- |/________> aVector02
- O A
- */
- aDist01 = fabs(aAngPnt01-(vtkMath::Pi())/3.0);
- aDist02 = fabs(aAngPnt02-(vtkMath::Pi())/3.0);
-
- // caculate a normal for best triangle
- if(aDist01 <= aDist02)
- vtkMath::Cross(aVector0Pnt,aVector01,aNormalPnt);
- else
- vtkMath::Cross(aVector0Pnt,aVector02,aNormalPnt);
-
- }
-
- vtkMath::Normalize(aNormalPnt);
-
- if(DEBUG_TRIA_EXECUTE)
- cout<<"\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"};";
-
- vtkFloatingPointType aDist = vtkPlane::DistanceToPlane(aPntCoord,aNormal,aCoord[0]);
- if(DEBUG_TRIA_EXECUTE) cout<<": aDist = "<<aDist;
- if(fabs(aDist) < aDistEps){
- aPointIds.insert(aPntId);
- aCenter[0] += aPntCoord[0];
- aCenter[1] += aPntCoord[1];
- aCenter[2] += aPntCoord[2];
- if(DEBUG_TRIA_EXECUTE) cout << "; Added = TRUE" << endl;
- } else {
- if(DEBUG_TRIA_EXECUTE) cout << "; Added = FALSE" << endl;
- }
- }
- int aNbPoints = aPointIds.size();
- aCenter[0] /= aNbPoints;
- aCenter[1] /= aNbPoints;
- aCenter[2] /= aNbPoints;
+ TPointIds::const_iterator anIter = anInitialPointIds.begin();
+ TPointIds::const_iterator anEndIter = anInitialPointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType aPntId = *anIter;
+ aPoints->GetPoint(aPntId,aPntCoord);
+
+ vtkFloatingPointType aVector0Pnt[3] = { aPntCoord[0] - aCoord[0][0],
+ aPntCoord[1] - aCoord[0][1],
+ aPntCoord[2] - aCoord[0][2] };
+
+
+ vtkMath::Normalize(aVector0Pnt);
+
+ vtkFloatingPointType aNormalPnt[3];
+ // calculate aNormalPnt
+ {
+ vtkFloatingPointType aCosPnt01 = vtkMath::Dot(aVector0Pnt,aVector01);
+ vtkFloatingPointType aCosPnt02 = vtkMath::Dot(aVector0Pnt,aVector02);
+ if(aCosPnt01<-1)
+ aCosPnt01 = -1;
+ if(aCosPnt01>1)
+ aCosPnt01 = 1;
+ if(aCosPnt02<-1)
+ aCosPnt02 = -1;
+ if(aCosPnt02>1)
+ aCosPnt02 = 1;
+
+ vtkFloatingPointType aDist01,aDist02;// deflection from Pi/3 angle (equilateral triangle)
+ vtkFloatingPointType aAngPnt01 = fabs(acos(aCosPnt01));
+ vtkFloatingPointType aAngPnt02 = fabs(acos(aCosPnt02));
+
+ /* check that triangle similar to equilateral triangle
+ AOC or COB ?
+ aVector0Pnt = (OC)
+ aVector01 = (OB)
+ aVector02 = (OA)
+
+ B
+ ^ aVector01 C
+ | ^ aVector0Pnt
+ | _____/
+ | ___/
+ |/________> aVector02
+ O A
+ */
+ aDist01 = fabs(aAngPnt01-(vtkMath::Pi())/3.0);
+ aDist02 = fabs(aAngPnt02-(vtkMath::Pi())/3.0);
+
+ // caculate a normal for best triangle
+ if(aDist01 <= aDist02)
+ vtkMath::Cross(aVector0Pnt,aVector01,aNormalPnt);
+ else
+ vtkMath::Cross(aVector0Pnt,aVector02,aNormalPnt);
+
+ }
+
+ vtkMath::Normalize(aNormalPnt);
+
+ if(DEBUG_TRIA_EXECUTE)
+ cout<<"\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"};";
+
+ vtkFloatingPointType aDist = vtkPlane::DistanceToPlane(aPntCoord,aNormal,aCoord[0]);
+ if(DEBUG_TRIA_EXECUTE) cout<<": aDist = "<<aDist;
+ if(fabs(aDist) < aDistEps){
+ aPointIds.insert(aPntId);
+ aCenter[0] += aPntCoord[0];
+ aCenter[1] += aPntCoord[1];
+ aCenter[2] += aPntCoord[2];
+ if(DEBUG_TRIA_EXECUTE) cout << "; Added = TRUE" << endl;
+ } else {
+ if(DEBUG_TRIA_EXECUTE) cout << "; Added = FALSE" << endl;
+ }
+ }
+ int aNbPoints = aPointIds.size();
+ aCenter[0] /= aNbPoints;
+ aCenter[1] /= aNbPoints;
+ aCenter[2] /= aNbPoints;
}
//To sinchronize orientation of the cell and its face
vtkFloatingPointType aVectorC[3] = { aCenter[0] - aCellCenter[0],
- aCenter[1] - aCellCenter[1],
- aCenter[2] - aCellCenter[2] };
+ aCenter[1] - aCellCenter[1],
+ aCenter[2] - aCellCenter[2] };
vtkMath::Normalize(aVectorC);
vtkFloatingPointType aDot = vtkMath::Dot(aNormal,aVectorC);
if(DEBUG_TRIA_EXECUTE) {
- cout<<"\t\taNormal = {"<<aNormal[0]<<", "<<aNormal[1]<<", "<<aNormal[2]<<"}";
- cout<<"; aVectorC = {"<<aVectorC[0]<<", "<<aVectorC[1]<<", "<<aVectorC[2]<<"}\n";
- cout<<"\t\taDot = "<<aDot<<"\n";
+ cout<<"\t\taNormal = {"<<aNormal[0]<<", "<<aNormal[1]<<", "<<aNormal[2]<<"}";
+ cout<<"; aVectorC = {"<<aVectorC[0]<<", "<<aVectorC[1]<<", "<<aVectorC[2]<<"}\n";
+ cout<<"\t\taDot = "<<aDot<<"\n";
}
if(aDot > 0){
- aNormal[0] = -aNormal[0];
- aNormal[1] = -aNormal[1];
- aNormal[2] = -aNormal[2];
+ aNormal[0] = -aNormal[0];
+ aNormal[1] = -aNormal[1];
+ aNormal[2] = -aNormal[2];
}
// To calculate the primary direction for point set
vtkFloatingPointType aVector0[3] = { aCoord[0][0] - aCenter[0],
- aCoord[0][1] - aCenter[1],
- aCoord[0][2] - aCenter[2] };
+ aCoord[0][1] - aCenter[1],
+ aCoord[0][2] - aCenter[2] };
vtkMath::Normalize(aVector0);
if(DEBUG_TRIA_EXECUTE) {
- cout<<"\t\taCenter = {"<<aCenter[0]<<", "<<aCenter[1]<<", "<<aCenter[2]<<"}";
- cout<<"; aVector0 = {"<<aVector0[0]<<", "<<aVector0[1]<<", "<<aVector0[2]<<"}\n";
+ cout<<"\t\taCenter = {"<<aCenter[0]<<", "<<aCenter[1]<<", "<<aCenter[2]<<"}";
+ cout<<"; aVector0 = {"<<aVector0[0]<<", "<<aVector0[1]<<", "<<aVector0[2]<<"}\n";
}
// To calculate the set of points by face those that belong to the plane
TFace2PointIds aRemoveFace2PointIds;
{
- TFace2PointIds::const_iterator anIter = aFace2PointIds.begin();
- TFace2PointIds::const_iterator anEndIter = aFace2PointIds.end();
- for(; anIter != anEndIter; anIter++){
- const TPointIds& anIds = *anIter;
- TPointIds anIntersection;
- std::set_intersection(aPointIds.begin(),aPointIds.end(),
- anIds.begin(),anIds.end(),
- std::inserter(anIntersection,anIntersection.begin()));
-
-
- if(DEBUG_TRIA_EXECUTE) {
- cout << "anIntersection:";
- TPointIds::iterator aII = anIntersection.begin();
- for(;aII!=anIntersection.end();aII++)
- cout << *aII << ",";
- cout << endl;
- cout << "anIds :";
- TPointIds::const_iterator aIIds = anIds.begin();
- for(;aIIds!=anIds.end();aIIds++)
- cout << *aIIds << ",";
- cout << endl;
- }
- if(anIntersection == anIds){
- aRemoveFace2PointIds.insert(anIds);
- }
- }
+ TFace2PointIds::const_iterator anIter = aFace2PointIds.begin();
+ TFace2PointIds::const_iterator anEndIter = aFace2PointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ const TPointIds& anIds = *anIter;
+ TPointIds anIntersection;
+ std::set_intersection(aPointIds.begin(),aPointIds.end(),
+ anIds.begin(),anIds.end(),
+ std::inserter(anIntersection,anIntersection.begin()));
+
+
+ if(DEBUG_TRIA_EXECUTE) {
+ cout << "anIntersection:";
+ TPointIds::iterator aII = anIntersection.begin();
+ for(;aII!=anIntersection.end();aII++)
+ cout << *aII << ",";
+ cout << endl;
+ cout << "anIds :";
+ TPointIds::const_iterator aIIds = anIds.begin();
+ for(;aIIds!=anIds.end();aIIds++)
+ cout << *aIIds << ",";
+ cout << endl;
+ }
+ if(anIntersection == anIds){
+ aRemoveFace2PointIds.insert(anIds);
+ }
+ }
}
// To remove from the set of points by face those that belong to the plane
{
- TFace2PointIds::const_iterator anIter = aRemoveFace2PointIds.begin();
- TFace2PointIds::const_iterator anEndIter = aRemoveFace2PointIds.end();
- for(; anIter != anEndIter; anIter++){
- const TPointIds& anIds = *anIter;
- aFace2PointIds.erase(anIds);
- }
+ TFace2PointIds::const_iterator anIter = aRemoveFace2PointIds.begin();
+ TFace2PointIds::const_iterator anEndIter = aRemoveFace2PointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ const TPointIds& anIds = *anIter;
+ aFace2PointIds.erase(anIds);
+ }
}
// To sort the planar set of the points accrding to the angle
{
- typedef std::map<vtkFloatingPointType,vtkIdType> TSortedPointIds;
- TSortedPointIds aSortedPointIds;
-
- TPointIds::const_iterator anIter = aPointIds.begin();
- TPointIds::const_iterator anEndIter = aPointIds.end();
- for(; anIter != anEndIter; anIter++){
- vtkFloatingPointType aPntCoord[3];
- vtkIdType aPntId = *anIter;
- aPoints->GetPoint(aPntId,aPntCoord);
- vtkFloatingPointType aVector[3] = { aPntCoord[0] - aCenter[0],
- aPntCoord[1] - aCenter[1],
- aPntCoord[2] - aCenter[2] };
- vtkMath::Normalize(aVector);
-
- vtkFloatingPointType aCross[3];
- vtkMath::Cross(aVector,aVector0,aCross);
- vtkFloatingPointType aCr = vtkMath::Dot(aCross,aNormal);
- bool aGreaterThanPi = aCr < 0;
- vtkFloatingPointType aCosinus = vtkMath::Dot(aVector,aVector0);
- vtkFloatingPointType anAngle = 0.0;
- if(aCosinus >= 1.0){
- aCosinus = 1.0;
- } else if (aCosinus <= -1.0){
- aCosinus = -1.0;
- anAngle = vtkMath::Pi();
- } else {
- anAngle = acos(aCosinus);
- if(aGreaterThanPi)
- anAngle = 2*vtkMath::Pi() - anAngle;
- }
-
- if(DEBUG_TRIA_EXECUTE) {
- cout << "\t\t\t vtkMath::Dot(aCross,aNormal)="<<aCr<<endl;
- cout<<"\t\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}";
- cout<<"; aGreaterThanPi = "<<aGreaterThanPi<<"; aCosinus = "<<aCosinus<<"; anAngle = "<<anAngle<<"\n";
- }
- aSortedPointIds[anAngle] = aPntId;
- }
-
- if(!aSortedPointIds.empty()){
- int aNumFacePts = aSortedPointIds.size();
- ::TConnectivities aConnectivities(aNumFacePts);
- TSortedPointIds::const_iterator anIter = aSortedPointIds.begin();
- TSortedPointIds::const_iterator anEndIter = aSortedPointIds.end();
- if(DEBUG_TRIA_EXECUTE) cout << "Polygon:";
- for(vtkIdType anId = 0; anIter != anEndIter; anIter++, anId++){
- vtkIdType aPntId = anIter->second;
- aConnectivities[anId] = GetConnectivity(aPntId);
- if(DEBUG_TRIA_EXECUTE) cout << aPntId << ",";
- }
- if(DEBUG_TRIA_EXECUTE) cout << endl;
- aPolygons.push_back(::TPolygon(aConnectivities,aCenter,aNormal));
- }
+ typedef std::map<vtkFloatingPointType,vtkIdType> TSortedPointIds;
+ TSortedPointIds aSortedPointIds;
+
+ TPointIds::const_iterator anIter = aPointIds.begin();
+ TPointIds::const_iterator anEndIter = aPointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType aPntId = *anIter;
+ aPoints->GetPoint(aPntId,aPntCoord);
+ vtkFloatingPointType aVector[3] = { aPntCoord[0] - aCenter[0],
+ aPntCoord[1] - aCenter[1],
+ aPntCoord[2] - aCenter[2] };
+ vtkMath::Normalize(aVector);
+
+ vtkFloatingPointType aCross[3];
+ vtkMath::Cross(aVector,aVector0,aCross);
+ vtkFloatingPointType aCr = vtkMath::Dot(aCross,aNormal);
+ bool aGreaterThanPi = aCr < 0;
+ vtkFloatingPointType aCosinus = vtkMath::Dot(aVector,aVector0);
+ vtkFloatingPointType anAngle = 0.0;
+ if(aCosinus >= 1.0){
+ aCosinus = 1.0;
+ } else if (aCosinus <= -1.0){
+ aCosinus = -1.0;
+ anAngle = vtkMath::Pi();
+ } else {
+ anAngle = acos(aCosinus);
+ if(aGreaterThanPi)
+ anAngle = 2*vtkMath::Pi() - anAngle;
+ }
+
+ if(DEBUG_TRIA_EXECUTE) {
+ cout << "\t\t\t vtkMath::Dot(aCross,aNormal)="<<aCr<<endl;
+ cout<<"\t\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}";
+ cout<<"; aGreaterThanPi = "<<aGreaterThanPi<<"; aCosinus = "<<aCosinus<<"; anAngle = "<<anAngle<<"\n";
+ }
+ aSortedPointIds[anAngle] = aPntId;
+ }
+
+ if(!aSortedPointIds.empty()){
+ int aNumFacePts = aSortedPointIds.size();
+ ::TConnectivities aConnectivities(aNumFacePts);
+ TSortedPointIds::const_iterator anIter = aSortedPointIds.begin();
+ TSortedPointIds::const_iterator anEndIter = aSortedPointIds.end();
+ if(DEBUG_TRIA_EXECUTE) cout << "Polygon:";
+ for(vtkIdType anId = 0; anIter != anEndIter; anIter++, anId++){
+ vtkIdType aPntId = anIter->second;
+ aConnectivities[anId] = GetConnectivity(aPntId);
+ if(DEBUG_TRIA_EXECUTE) cout << aPntId << ",";
+ }
+ if(DEBUG_TRIA_EXECUTE) cout << endl;
+ aPolygons.push_back(::TPolygon(aConnectivities,aCenter,aNormal));
+ }
}
}
}
vtkFloatingPointType* aNormal = aPolygon.myNormal;
vtkFloatingPointType* anOrigin = aPolygon.myOrigin;
if(DEBUG_TRIA_EXECUTE) {
- cout<<"\taPolygonId = "<<aPolygonId<<"\n";
- cout<<"\t\taNormal = {"<<aNormal[0]<<", "<<aNormal[1]<<", "<<aNormal[2]<<"}";
- cout<<"; anOrigin = {"<<anOrigin[0]<<", "<<anOrigin[1]<<", "<<anOrigin[2]<<"}\n";
+ cout<<"\taPolygonId = "<<aPolygonId<<"\n";
+ cout<<"\t\taNormal = {"<<aNormal[0]<<", "<<aNormal[1]<<", "<<aNormal[2]<<"}";
+ cout<<"; anOrigin = {"<<anOrigin[0]<<", "<<anOrigin[1]<<", "<<anOrigin[2]<<"}\n";
}
for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++){
- vtkFloatingPointType aPntCoord[3];
- vtkIdType anId = GetPointId(aPntId);
- aPoints->GetPoint(anId,aPntCoord);
- vtkFloatingPointType aDist = vtkPlane::Evaluate(aNormal,anOrigin,aPntCoord);
- if(DEBUG_TRIA_EXECUTE) cout<<"\t\taPntId = "<<anId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}; aDist = "<<aDist<<"\n";
- if(aDist < -aDistEps)
- return false;
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType anId = GetPointId(aPntId);
+ aPoints->GetPoint(anId,aPntCoord);
+ vtkFloatingPointType aDist = vtkPlane::Evaluate(aNormal,anOrigin,aPntCoord);
+ if(DEBUG_TRIA_EXECUTE) cout<<"\t\taPntId = "<<anId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}; aDist = "<<aDist<<"\n";
+ if(aDist < -aDistEps)
+ return false;
}
}
}
if(DEBUG_TRIA_EXECUTE) cout << "PoilygonId="<<aPolygonId<<" | ";
TConnectivities& aConnectivities = aPolygon.myConnectivities;
if(DEBUG_TRIA_EXECUTE) {
- for(int i=0;i<aConnectivities.size();i++)
- cout << aConnectivities[i] << ",";
- cout << endl;
+ for(int i=0;i<aConnectivities.size();i++)
+ cout << aConnectivities[i] << ",";
+ cout << endl;
}
int aNbPoints = aConnectivities.size();
vtkIdType aNewCellId = theOutput->InsertNextCell(VTK_POLYGON,aNbPoints,&aConnectivities[0]);
if(theStoreMapping)
- theVTK2ObjIds.push_back(theCellId);
+ theVTK2ObjIds.push_back(theCellId);
theOutputCD->CopyData(thInputCD,theCellId,aNewCellId);
}
}
vtkPoints*
VTKViewer_OrderedTriangulator
::InitPoints(vtkUnstructuredGrid *theInput,
- vtkIdType theCellId)
+ vtkIdType theCellId)
{
myBoundaryTris->Reset();
vtkPoints*
VTKViewer_DelaunayTriangulator
::InitPoints(vtkUnstructuredGrid *theInput,
- vtkIdType theCellId)
+ vtkIdType theCellId)
{
vtkPoints* aPoints = VTKViewer_Triangulator::InitPoints(theInput, theCellId);
inline void InsertCell(vtkUnstructuredGrid *theInput,
- vtkCellArray *theConnectivity,
- vtkUnsignedCharArray* theCellTypesArray,
- vtkIdType theCellId,
- vtkIdList *theIdList,
- bool theStoreMapping,
- vtkIdType theOutId,
- VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId,
- VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId)
+ vtkCellArray *theConnectivity,
+ vtkUnsignedCharArray* theCellTypesArray,
+ vtkIdType theCellId,
+ vtkIdList *theIdList,
+ bool theStoreMapping,
+ vtkIdType theOutId,
+ VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId,
+ VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId)
{
vtkCell *aCell = theInput->GetCell(theCellId);
vtkIdList *aPntIds = aCell->GetPointIds();
}
inline void InsertPointCell(vtkCellArray *theConnectivity,
- vtkUnsignedCharArray* theCellTypesArray,
- vtkIdType theCellId,
- vtkIdList *theIdList,
- bool theStoreMapping,
- vtkIdType theOutId,
- VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId,
- VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId)
+ vtkUnsignedCharArray* theCellTypesArray,
+ vtkIdType theCellId,
+ vtkIdList *theIdList,
+ bool theStoreMapping,
+ vtkIdType theOutId,
+ VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId,
+ VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId)
{
theIdList->SetId(0,theCellId);
theConnectivity->InsertNextCell(theIdList);
// purpose :
//==================================================================
void VTKViewer_FramedTextActor::SetForegroundColor(const vtkFloatingPointType r,
- const vtkFloatingPointType g,
- const vtkFloatingPointType b)
+ const vtkFloatingPointType g,
+ const vtkFloatingPointType b)
{
myTextProperty->SetColor(r, g, b);
myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
// purpose :
//==================================================================
void VTKViewer_FramedTextActor::GetForegroundColor(vtkFloatingPointType& r,
- vtkFloatingPointType& g,
- vtkFloatingPointType& b)
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b)
{
vtkFloatingPointType aColor[3];
myTextProperty->GetColor(aColor);
// purpose :
//==================================================================
void VTKViewer_FramedTextActor::SetBackgroundColor(const vtkFloatingPointType r,
- const vtkFloatingPointType g,
- const vtkFloatingPointType b)
+ const vtkFloatingPointType g,
+ const vtkFloatingPointType b)
{
myBarActor->GetProperty()->SetColor(r, g, b);
Modified();
// purpose :
//==================================================================
void VTKViewer_FramedTextActor::GetBackgroundColor(vtkFloatingPointType& r,
- vtkFloatingPointType& g,
- vtkFloatingPointType& b)
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b)
{
vtkFloatingPointType aColor[3];
myBarActor->GetProperty()->GetColor(aColor);
}
PositionCoordinate->SetValue(x / (vtkFloatingPointType)aViewPortWidth,
- y / (vtkFloatingPointType)aViewPortHeight);
+ y / (vtkFloatingPointType)aViewPortHeight);
}
aPoints->SetPoint(0, xMin, yMax, 0.0);
vtkFloatingPointType GetDistance() const;
void SetForegroundColor(const vtkFloatingPointType r,
- const vtkFloatingPointType g,
- const vtkFloatingPointType b);
+ const vtkFloatingPointType g,
+ const vtkFloatingPointType b);
void GetForegroundColor(vtkFloatingPointType& r,
- vtkFloatingPointType& g,
- vtkFloatingPointType& b);
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b);
void SetBackgroundColor(const vtkFloatingPointType r,
- const vtkFloatingPointType g,
- const vtkFloatingPointType b);
+ const vtkFloatingPointType g,
+ const vtkFloatingPointType b);
void GetBackgroundColor(vtkFloatingPointType& r,
- vtkFloatingPointType& g,
- vtkFloatingPointType& b);
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b);
void SetTransparency(const vtkFloatingPointType theTransparency);
vtkFloatingPointType GetTransparency() const;
{}
void operator()(TActor* theActor)
{
- (theActor->*myAction)(myArg);
+ (theActor->*myAction)(myArg);
}
};
template<class TActor, class TArg = int> struct TSetVisibility: TSetFunction<TActor,TArg>
{
TSetVisibility(TArg theArg):
- TSetFunction<TActor,TArg>(&TActor::SetVisibility,theArg)
+ TSetFunction<TActor,TArg>(&TActor::SetVisibility,theArg)
{}
};
}
int
VTKViewer_GeometryFilter
::UnstructuredGridExecute(
- vtkDataSet *dataSetInput,
- vtkPolyData *output,
- vtkInformation *outInfo)
+ vtkDataSet *dataSetInput,
+ vtkPolyData *output,
+ vtkInformation *outInfo)
{
vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)dataSetInput;
case VTK_VERTEX:
case VTK_POLY_VERTEX:
newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
- }
+ if(myStoreMapping){
+ myVTK2ObjIds.push_back(cellId); //apo
+ }
outputCD->CopyData(cd,cellId,newCellId);
break;
case VTK_LINE:
case VTK_POLY_LINE:
newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
break;
case VTK_QUAD:
case VTK_POLYGON:
newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
break;
case VTK_TRIANGLE_STRIP:
newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
break;
case VTK_PIXEL:
newCellId = output->InsertNextCell(aCellType,npts,pts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
- outputCD->CopyData(cd,cellId,newCellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+
+ case VTK_CONVEX_POINT_SET: {
+ bool anIsOk = anOrderedTriangulator.Execute(input,
+ cd,
+ cellId,
+ myShowInside,
+ allVisible,
+ cellVis,
+ output,
+ outputCD,
+ myStoreMapping,
+ myVTK2ObjIds,
+ true);
+ if(!anIsOk)
+ aDelaunayTriangulator.Execute(input,
+ cd,
+ cellId,
+ myShowInside,
+ allVisible,
+ cellVis,
+ output,
+ outputCD,
+ myStoreMapping,
+ myVTK2ObjIds,
+ false);
+
break;
-
- case VTK_CONVEX_POINT_SET: {
- bool anIsOk = anOrderedTriangulator.Execute(input,
- cd,
- cellId,
- myShowInside,
- allVisible,
- cellVis,
- output,
- outputCD,
- myStoreMapping,
- myVTK2ObjIds,
- true);
- if(!anIsOk)
- aDelaunayTriangulator.Execute(input,
- cd,
- cellId,
- myShowInside,
- allVisible,
- cellVis,
- output,
- outputCD,
- myStoreMapping,
- myVTK2ObjIds,
- false);
-
- break;
- }
+ }
case VTK_TETRA: {
for (faceId = 0; faceId < 4; faceId++)
{
faceIds->InsertNextId(pts[faceVerts[0]]);
faceIds->InsertNextId(pts[faceVerts[1]]);
faceIds->InsertNextId(pts[faceVerts[2]]);
- aCellType = VTK_TRIANGLE;
+ aCellType = VTK_TRIANGLE;
numFacePts = 3;
input->GetCellNeighbors(cellId, faceIds, cellIds);
if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ||
for ( i=0; i < numFacePts; i++)
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
break;
- }
+ }
case VTK_VOXEL: {
for (faceId = 0; faceId < 6; faceId++)
{
faceIds->InsertNextId(pts[faceVerts[1]]);
faceIds->InsertNextId(pts[faceVerts[2]]);
faceIds->InsertNextId(pts[faceVerts[3]]);
- aCellType = VTK_QUAD;
+ aCellType = VTK_QUAD;
numFacePts = 4;
input->GetCellNeighbors(cellId, faceIds, cellIds);
if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ||
for ( i=0; i < numFacePts; i++)
aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
break;
- }
+ }
case VTK_HEXAHEDRON: {
for (faceId = 0; faceId < 6; faceId++)
{
faceIds->InsertNextId(pts[faceVerts[1]]);
faceIds->InsertNextId(pts[faceVerts[2]]);
faceIds->InsertNextId(pts[faceVerts[3]]);
- aCellType = VTK_QUAD;
+ aCellType = VTK_QUAD;
numFacePts = 4;
input->GetCellNeighbors(cellId, faceIds, cellIds);
if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ||
for ( i=0; i < numFacePts; i++)
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
break;
- }
+ }
case VTK_WEDGE: {
for (faceId = 0; faceId < 5; faceId++)
{
faceIds->InsertNextId(pts[faceVerts[0]]);
faceIds->InsertNextId(pts[faceVerts[1]]);
faceIds->InsertNextId(pts[faceVerts[2]]);
- aCellType = VTK_TRIANGLE;
+ aCellType = VTK_TRIANGLE;
numFacePts = 3;
if (faceVerts[3] >= 0)
{
faceIds->InsertNextId(pts[faceVerts[3]]);
- aCellType = VTK_QUAD;
+ aCellType = VTK_QUAD;
numFacePts = 4;
}
input->GetCellNeighbors(cellId, faceIds, cellIds);
for ( i=0; i < numFacePts; i++)
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
break;
- }
+ }
case VTK_PYRAMID: {
for (faceId = 0; faceId < 5; faceId++)
{
faceIds->InsertNextId(pts[faceVerts[0]]);
faceIds->InsertNextId(pts[faceVerts[1]]);
faceIds->InsertNextId(pts[faceVerts[2]]);
- aCellType = VTK_TRIANGLE;
+ aCellType = VTK_TRIANGLE;
numFacePts = 3;
if (faceVerts[3] >= 0)
{
faceIds->InsertNextId(pts[faceVerts[3]]);
- aCellType = VTK_QUAD;
+ aCellType = VTK_QUAD;
numFacePts = 4;
}
input->GetCellNeighbors(cellId, faceIds, cellIds);
for ( i=0; i < numFacePts; i++)
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
break;
- }
+ }
//Quadratic cells
case VTK_QUADRATIC_EDGE:
case VTK_QUADRATIC_TRIANGLE:
case VTK_QUADRATIC_HEXAHEDRON:
case VTK_QUADRATIC_WEDGE:
case VTK_QUADRATIC_PYRAMID:
- if(!myIsWireframeMode){
- input->GetCell(cellId,cell);
- vtkIdList *lpts = vtkIdList::New();
- vtkPoints *coords = vtkPoints::New();
- vtkIdList *cellIds = vtkIdList::New();
- vtkIdType newCellId;
-
- if ( cell->GetCellDimension() == 1 ) {
+ if(!myIsWireframeMode){
+ input->GetCell(cellId,cell);
+ vtkIdList *lpts = vtkIdList::New();
+ vtkPoints *coords = vtkPoints::New();
+ vtkIdList *cellIds = vtkIdList::New();
+ vtkIdType newCellId;
+
+ if ( cell->GetCellDimension() == 1 ) {
vtkIdType arcResult = -1;
if(myIsBuildArc) {
arcResult = Build1DArc(cellId, input, output, pts, myMaxArcAngle);
outputCD->CopyData(cd,cellId,newCellId);
}
}
- else if ( cell->GetCellDimension() == 2 ) {
+ else if ( cell->GetCellDimension() == 2 ) {
if(!myIsBuildArc) {
aCellType = VTK_TRIANGLE;
numFacePts = 3;
BuildArcedPolygon(cellId,input,output,true);
}
}
- else //3D nonlinear cell
+ else //3D nonlinear cell
{
- aCellType = VTK_TRIANGLE;
- numFacePts = 3;
- for (int j=0; j < cell->GetNumberOfFaces(); j++){
- vtkCell *face = cell->GetFace(j);
- input->GetCellNeighbors(cellId, face->PointIds, cellIds);
- if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ) {
- face->Triangulate(0,lpts,coords);
- for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
- aNewPts[0] = lpts->GetId(i);
- aNewPts[1] = lpts->GetId(i+1);
- aNewPts[2] = lpts->GetId(i+2);
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
- outputCD->CopyData(cd,cellId,newCellId);
+ aCellType = VTK_TRIANGLE;
+ numFacePts = 3;
+ for (int j=0; j < cell->GetNumberOfFaces(); j++){
+ vtkCell *face = cell->GetFace(j);
+ input->GetCellNeighbors(cellId, face->PointIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ) {
+ face->Triangulate(0,lpts,coords);
+ for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
+ aNewPts[0] = lpts->GetId(i);
+ aNewPts[1] = lpts->GetId(i+1);
+ aNewPts[2] = lpts->GetId(i+2);
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
}
}
}
} //3d nonlinear cell
- cellIds->Delete();
- coords->Delete();
- lpts->Delete();
- break;
+ cellIds->Delete();
+ coords->Delete();
+ lpts->Delete();
+ break;
}else{
- switch(aCellType){
- case VTK_QUADRATIC_EDGE: {
+ switch(aCellType){
+ case VTK_QUADRATIC_EDGE: {
vtkIdType arcResult =-1;
if(myIsBuildArc) {
arcResult = Build1DArc(cellId, input, output, pts,myMaxArcAngle);
if(!myIsBuildArc || arcResult == -1) {
aCellType = VTK_POLY_LINE;
numFacePts = 3;
-
+
aNewPts[0] = pts[0];
aNewPts[2] = pts[1];
aNewPts[1] = pts[2];
-
+
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
}
if(myStoreMapping)
myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
- break;
- }
- case VTK_QUADRATIC_TRIANGLE: {
+
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+ }
+ case VTK_QUADRATIC_TRIANGLE: {
if(!myIsBuildArc) {
aCellType = VTK_POLYGON;
numFacePts = 6;
aNewPts[3] = pts[4];
aNewPts[4] = pts[2];
aNewPts[5] = pts[5];
-
+
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
}
else
BuildArcedPolygon(cellId,input,output);
break;
- }
- case VTK_QUADRATIC_QUAD: {
+ }
+ case VTK_QUADRATIC_QUAD: {
if(!myIsBuildArc) {
aCellType = VTK_POLYGON;
numFacePts = 8;
aNewPts[5] = pts[6];
aNewPts[6] = pts[3];
aNewPts[7] = pts[7];
-
+
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
}
else
BuildArcedPolygon(cellId,input,output);
break;
- }
- case VTK_QUADRATIC_TETRA: {
- aCellType = VTK_POLYGON;
- numFacePts = 6;
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[4];
- aNewPts[2] = pts[1];
- aNewPts[3] = pts[5];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[6];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[7];
- aNewPts[2] = pts[3];
- aNewPts[3] = pts[8];
- aNewPts[4] = pts[1];
- aNewPts[5] = pts[4];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[1];
- aNewPts[1] = pts[8];
- aNewPts[2] = pts[3];
- aNewPts[3] = pts[9];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[5];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[2];
- aNewPts[1] = pts[9];
- aNewPts[2] = pts[3];
- aNewPts[3] = pts[7];
- aNewPts[4] = pts[0];
- aNewPts[5] = pts[6];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- break;
- }
+ }
+ case VTK_QUADRATIC_TETRA: {
+ aCellType = VTK_POLYGON;
+ numFacePts = 6;
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[4];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[5];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[6];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[7];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[8];
+ aNewPts[4] = pts[1];
+ aNewPts[5] = pts[4];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[1];
+ aNewPts[1] = pts[8];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[9];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[5];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[2];
+ aNewPts[1] = pts[9];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[7];
+ aNewPts[4] = pts[0];
+ aNewPts[5] = pts[6];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ break;
+ }
case VTK_QUADRATIC_WEDGE: {
aCellType = VTK_POLYGON;
- numFacePts = 6;
+ numFacePts = 6;
//---------------------------------------------------------------
//Face 1
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[6];
- aNewPts[2] = pts[1];
- aNewPts[3] = pts[7];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[8];
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[6];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[7];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[8];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
//---------------------------------------------------------------
//Face 2
aNewPts[0] = pts[3];
- aNewPts[1] = pts[9];
- aNewPts[2] = pts[4];
- aNewPts[3] = pts[10];
- aNewPts[4] = pts[5];
- aNewPts[5] = pts[11];
+ aNewPts[1] = pts[9];
+ aNewPts[2] = pts[4];
+ aNewPts[3] = pts[10];
+ aNewPts[4] = pts[5];
+ aNewPts[5] = pts[11];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
//---------------------------------------------------------------
//Face 3
numFacePts = 8;
aNewPts[0] = pts[0];
- aNewPts[1] = pts[8];
- aNewPts[2] = pts[2];
- aNewPts[3] = pts[14];
- aNewPts[4] = pts[5];
- aNewPts[5] = pts[11];
- aNewPts[6] = pts[3];
- aNewPts[7] = pts[12];
+ aNewPts[1] = pts[8];
+ aNewPts[2] = pts[2];
+ aNewPts[3] = pts[14];
+ aNewPts[4] = pts[5];
+ aNewPts[5] = pts[11];
+ aNewPts[6] = pts[3];
+ aNewPts[7] = pts[12];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
//---------------------------------------------------------------
//Face 4
aNewPts[0] = pts[1];
- aNewPts[1] = pts[13];
- aNewPts[2] = pts[4];
- aNewPts[3] = pts[10];
- aNewPts[4] = pts[5];
- aNewPts[5] = pts[14];
- aNewPts[6] = pts[2];
- aNewPts[7] = pts[7];
+ aNewPts[1] = pts[13];
+ aNewPts[2] = pts[4];
+ aNewPts[3] = pts[10];
+ aNewPts[4] = pts[5];
+ aNewPts[5] = pts[14];
+ aNewPts[6] = pts[2];
+ aNewPts[7] = pts[7];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,newCellId);
//---------------------------------------------------------------
//Face 5
aNewPts[0] = pts[0];
- aNewPts[1] = pts[12];
- aNewPts[2] = pts[3];
- aNewPts[3] = pts[9];
- aNewPts[4] = pts[4];
- aNewPts[5] = pts[13];
+ aNewPts[1] = pts[12];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[9];
+ aNewPts[4] = pts[4];
+ aNewPts[5] = pts[13];
aNewPts[6] = pts[1];
aNewPts[7] = pts[6];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+ }
+ case VTK_QUADRATIC_HEXAHEDRON: {
+ aCellType = VTK_POLYGON;
+ numFacePts = 8;
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[8];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[17];
+ aNewPts[4] = pts[5];
+ aNewPts[5] = pts[12];
+ aNewPts[6] = pts[4];
+ aNewPts[7] = pts[16];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[1];
+ aNewPts[1] = pts[9];
+ aNewPts[2] = pts[2];
+ aNewPts[3] = pts[18];
+ aNewPts[4] = pts[6];
+ aNewPts[5] = pts[13];
+ aNewPts[6] = pts[5];
+ aNewPts[7] = pts[17];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[2];
+ aNewPts[1] = pts[10];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[19];
+ aNewPts[4] = pts[7];
+ aNewPts[5] = pts[14];
+ aNewPts[6] = pts[6];
+ aNewPts[7] = pts[18];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[3];
+ aNewPts[1] = pts[11];
+ aNewPts[2] = pts[0];
+ aNewPts[3] = pts[16];
+ aNewPts[4] = pts[4];
+ aNewPts[5] = pts[15];
+ aNewPts[6] = pts[7];
+ aNewPts[7] = pts[19];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[8];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[9];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[10];
+ aNewPts[6] = pts[3];
+ aNewPts[7] = pts[11];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[4];
+ aNewPts[1] = pts[12];
+ aNewPts[2] = pts[5];
+ aNewPts[3] = pts[13];
+ aNewPts[4] = pts[6];
+ aNewPts[5] = pts[14];
+ aNewPts[6] = pts[7];
+ aNewPts[7] = pts[15];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
break;
}
- case VTK_QUADRATIC_HEXAHEDRON: {
- aCellType = VTK_POLYGON;
- numFacePts = 8;
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[8];
- aNewPts[2] = pts[1];
- aNewPts[3] = pts[17];
- aNewPts[4] = pts[5];
- aNewPts[5] = pts[12];
- aNewPts[6] = pts[4];
- aNewPts[7] = pts[16];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[1];
- aNewPts[1] = pts[9];
- aNewPts[2] = pts[2];
- aNewPts[3] = pts[18];
- aNewPts[4] = pts[6];
- aNewPts[5] = pts[13];
- aNewPts[6] = pts[5];
- aNewPts[7] = pts[17];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[2];
- aNewPts[1] = pts[10];
- aNewPts[2] = pts[3];
- aNewPts[3] = pts[19];
- aNewPts[4] = pts[7];
- aNewPts[5] = pts[14];
- aNewPts[6] = pts[6];
- aNewPts[7] = pts[18];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[3];
- aNewPts[1] = pts[11];
- aNewPts[2] = pts[0];
- aNewPts[3] = pts[16];
- aNewPts[4] = pts[4];
- aNewPts[5] = pts[15];
- aNewPts[6] = pts[7];
- aNewPts[7] = pts[19];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[8];
- aNewPts[2] = pts[1];
- aNewPts[3] = pts[9];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[10];
- aNewPts[6] = pts[3];
- aNewPts[7] = pts[11];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[4];
- aNewPts[1] = pts[12];
- aNewPts[2] = pts[5];
- aNewPts[3] = pts[13];
- aNewPts[4] = pts[6];
- aNewPts[5] = pts[14];
- aNewPts[6] = pts[7];
- aNewPts[7] = pts[15];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- break;
- }
- case VTK_QUADRATIC_PYRAMID: {
- aCellType = VTK_POLYGON;
- numFacePts = 6;
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[8];
- aNewPts[2] = pts[3];
- aNewPts[3] = pts[12];
- aNewPts[4] = pts[4];
- aNewPts[5] = pts[9];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[9];
- aNewPts[2] = pts[4];
- aNewPts[3] = pts[10];
- aNewPts[4] = pts[1];
- aNewPts[5] = pts[5];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[1];
- aNewPts[1] = pts[10];
- aNewPts[2] = pts[4];
- aNewPts[3] = pts[11];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[6];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
- aNewPts[0] = pts[2];
- aNewPts[1] = pts[11];
- aNewPts[2] = pts[4];
- aNewPts[3] = pts[12];
- aNewPts[4] = pts[3];
- aNewPts[5] = pts[7];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- //---------------------------------------------------------------
+ case VTK_QUADRATIC_PYRAMID: {
+ aCellType = VTK_POLYGON;
+ numFacePts = 6;
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[8];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[12];
+ aNewPts[4] = pts[4];
+ aNewPts[5] = pts[9];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[9];
+ aNewPts[2] = pts[4];
+ aNewPts[3] = pts[10];
+ aNewPts[4] = pts[1];
+ aNewPts[5] = pts[5];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[1];
+ aNewPts[1] = pts[10];
+ aNewPts[2] = pts[4];
+ aNewPts[3] = pts[11];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[6];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[2];
+ aNewPts[1] = pts[11];
+ aNewPts[2] = pts[4];
+ aNewPts[3] = pts[12];
+ aNewPts[4] = pts[3];
+ aNewPts[5] = pts[7];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
numFacePts = 8;
- aNewPts[0] = pts[0];
- aNewPts[1] = pts[5];
- aNewPts[2] = pts[1];
- aNewPts[3] = pts[6];
- aNewPts[4] = pts[2];
- aNewPts[5] = pts[7];
- aNewPts[6] = pts[3];
- aNewPts[7] = pts[8];
-
- newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
- if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
-
- outputCD->CopyData(cd,cellId,newCellId);
-
- break;
- }}
- }
- } //switch
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[5];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[6];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[7];
+ aNewPts[6] = pts[3];
+ aNewPts[7] = pts[8];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ break;
+ }}
+ }
+ } //switch
} //if visible
} //for all cells
aNewPts[2] = output->GetPoints()->InsertNextPoint(coords->GetPoint(i+2));
if(outputScalars) {
- outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i)]);
- outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i+1)]);
- outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i+2)]);
+ outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i)]);
+ outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i+1)]);
+ outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i+2)]);
}
aTriangleId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ myVTK2ObjIds.push_back(cellId);
outputCD->CopyData(cd,cellId,aTriangleId);
}
pts->Delete();
aNbPoints = MergevtkPoints(aCollection, aScalarCollection, output->GetPoints(), aPntId2ScalarValue, aNewPoints);
if(outputScalars)
for(vtkIdType i = 0; i < aNbPoints; i++)
- outputScalars->InsertNextTuple1(aPntId2ScalarValue[aNewPoints[i]]);
+ outputScalars->InsertNextTuple1(aPntId2ScalarValue[aNewPoints[i]]);
newCellId = output->InsertNextCell(aCellType,aNbPoints,aNewPoints);
outputCD->CopyData(cd,cellId,newCellId);
float aMinDist = 1000000.0, aDist = 0;
for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
- int subId; float pcoords[3], closestPoint[3], weights[3];
- aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
- if (aDist < aMinDist) {
- aMinDist = aDist;
- anEdgeId = i;
- }
+ int subId; float pcoords[3], closestPoint[3], weights[3];
+ aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
+ if (aDist < aMinDist) {
+ aMinDist = aDist;
+ anEdgeId = i;
+ }
}
}
}
*\param theWidth - width..
*/
void VTKViewer_InteractorStyle::setPreselectionProp(const double& theRed, const double& theGreen,
- const double& theBlue, const int& theWidth)
+ const double& theBlue, const int& theWidth)
{
if ( myPreSelectionActor->GetProperty() == 0 )
return;
}
double newAngle = atan2((double)(y - this->CurrentRenderer->GetCenter()[1]),
- (double)(x - this->CurrentRenderer->GetCenter()[0]));
+ (double)(x - this->CurrentRenderer->GetCenter()[0]));
double oldAngle = atan2((double)(oldY -this->CurrentRenderer->GetCenter()[1]),
- (double)(oldX - this->CurrentRenderer->GetCenter()[0]));
+ (double)(oldX - this->CurrentRenderer->GetCenter()[0]));
newAngle *= this->RadianToDegree;
oldAngle *= this->RadianToDegree;
*\param y - y coordinate
*/
void VTKViewer_InteractorStyle::OnMouseMove(int vtkNotUsed(ctrl),
- int shift,
- int x, int y)
+ int shift,
+ int x, int y)
{
myShiftState = shift;
if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
*\param y - y coordinate
*/
void VTKViewer_InteractorStyle::OnLeftButtonDown(int ctrl, int shift,
- int x, int y)
+ int x, int y)
{
if (this->HasObserver(vtkCommand::LeftButtonPressEvent)) {
this->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
*\param y - y coordinate (not used)
*/
void VTKViewer_InteractorStyle::OnLeftButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
{
myShiftState = shift;
// finishing current viewer operation
*\param y - y coordinate
*/
void VTKViewer_InteractorStyle::OnMiddleButtonDown(int ctrl,
- int shift,
- int x, int y)
+ int shift,
+ int x, int y)
{
if (this->HasObserver(vtkCommand::MiddleButtonPressEvent))
{
*\param y - y coordinate (not used)
*/
void VTKViewer_InteractorStyle::OnMiddleButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
{
myShiftState = shift;
// finishing current viewer operation
*\param y - y coordinate
*/
void VTKViewer_InteractorStyle::OnRightButtonDown(int ctrl,
- int shift,
- int x, int y)
+ int shift,
+ int x, int y)
{
if (this->HasObserver(vtkCommand::RightButtonPressEvent))
{
*\param y - y coordinate (not used)
*/
void VTKViewer_InteractorStyle::OnRightButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
{
myShiftState = shift;
// finishing current viewer operation
}
else {
if (myPoint == myOtherPoint) {
- // process point selection
+ // process point selection
int w, h, x, y;
m_Interactor->GetSize(w, h);
x = myPoint.x();
y = h - myPoint.y() - 1;
this->FindPokedRenderer(x, y);
- m_Interactor->StartPickCallback();
+ m_Interactor->StartPickCallback();
- vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
+ vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
- SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor());
+ SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor());
if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) {
- int aVtkId = picker->GetCellId();
- if ( aVtkId >= 0 && SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
- int anObjId = SActor->GetElemObjId(aVtkId);
- if(anObjId >= 0){
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if(aSelectionMode != EdgeOfCellSelection) {
- if(CheckDimensionId(aSelectionMode,SActor,anObjId)){
- if (IsSelected(IO,aSel)) {
- // This IO is already in the selection
- aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
- } else {
- if (!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
- aSel->AddIObject( IO, false );
- }
- }
- }else{
- if (!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- int anEdgeId = GetEdgeId(picker,SActor,anObjId);
- if (anEdgeId >= 0) {
- aSel->AddOrRemoveIndex( IO, anObjId, true, false);
- aSel->AddOrRemoveIndex( IO, -anEdgeId-1, true, true );
- aSel->AddIObject( IO, false );
- }
- }
- }
- } else {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
+ int aVtkId = picker->GetCellId();
+ if ( aVtkId >= 0 && SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
+ int anObjId = SActor->GetElemObjId(aVtkId);
+ if(anObjId >= 0){
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(aSelectionMode != EdgeOfCellSelection) {
+ if(CheckDimensionId(aSelectionMode,SActor,anObjId)){
+ if (IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ } else {
+ if (!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ aSel->AddIObject( IO, false );
+ }
+ }
+ }else{
+ if (!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ int anEdgeId = GetEdgeId(picker,SActor,anObjId);
+ if (anEdgeId >= 0) {
+ aSel->AddOrRemoveIndex( IO, anObjId, true, false);
+ aSel->AddOrRemoveIndex( IO, -anEdgeId-1, true, true );
+ aSel->AddIObject( IO, false );
+ }
+ }
+ }
+ } else {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
} else if ( vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker) ) {
- int aVtkId = picker->GetPointId();
- if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
- if ( SActor && SActor->hasIO() ) {
- int anObjId = SActor->GetNodeObjId(aVtkId);
- if(anObjId >= 0){
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if(IsSelected(IO,aSel)) {
- // This IO is already in the selection
- aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
- } else {
- if(!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
- aSel->AddIObject( IO, false );
- }
- }
- }
- } else {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- } else {
- if ( SActor && SActor->hasIO() ) {
- this->PropPicked++;
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if(IsSelected(IO,aSel)) {
- // This IO is already in the selection
- if(myShiftState) {
- aSel->RemoveIObject(IO);
- }
- }
- else {
- if(!myShiftState) {
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- aSel->AddIObject( IO, false );
- }
- }else{
- // No selection clear all
- this->PropPicked = 0;
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
- }
- m_Interactor->EndPickCallback();
+ int aVtkId = picker->GetPointId();
+ if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
+ if ( SActor && SActor->hasIO() ) {
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ if(anObjId >= 0){
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ } else {
+ if(!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ aSel->AddIObject( IO, false );
+ }
+ }
+ }
+ } else {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ } else {
+ if ( SActor && SActor->hasIO() ) {
+ this->PropPicked++;
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ if(myShiftState) {
+ aSel->RemoveIObject(IO);
+ }
+ }
+ else {
+ if(!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ aSel->AddIObject( IO, false );
+ }
+ }else{
+ // No selection clear all
+ this->PropPicked = 0;
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ }
+ m_Interactor->EndPickCallback();
} else {
//processing rectangle selection
- QString aComponentDataType = SUIT_Application::getDesktop()->getComponentDataType();
- if(aSelActiveCompOnly && aComponentDataType.isEmpty()) return;
- m_Interactor->StartPickCallback();
-
- if (!myShiftState) {
- this->PropPicked = 0;
- this->HighlightProp( NULL );
- aSel->ClearIObjects();
- }
-
- // Compute bounds
- // vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
- QRect rect(myPoint, myOtherPoint);
- rect = rect.normalize();
- int w, h;
- m_Interactor->GetSize(w, h);
- int x1, y1, x2, y2;
- x1 = rect.left();
- y1 = h - rect.top() - 1;
- x2 = rect.right();
- y2 = h - rect.bottom() - 1;
-
- switch (aSelectionMode) {
- case NodeSelection: {
- if ( vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(m_Interactor->GetPicker()) ) {
- vtkActorCollection* aListActors = this->CurrentRenderer->GetActors();
- aListActors->InitTraversal();
- while (vtkActor* aActor = aListActors->GetNextActor()) {
- if (!aActor->GetVisibility())
- continue;
- if(SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor)) {
- if (SActor->hasIO()) {
- Handle(SALOME_InteractiveObject) IO = SActor->getIO();
- if (IO.IsNull())
- continue;
- if (aSelActiveCompOnly && aComponentDataType != IO->getComponentDataType())
- continue;
- if (vtkDataSet* aDataSet = SActor->GetInput()) {
- SALOME_Selection::TContainerOfId anIndices;
- for(int i = 0; i < aDataSet->GetNumberOfPoints(); i++) {
- float aPoint[3];
- aDataSet->GetPoint(i,aPoint);
- if (IsInRect(aPoint,x1,y1,x2,y2)){
- float aDisp[3];
- ComputeWorldToDisplay(aPoint[0],aPoint[1],aPoint[2],aDisp);
- if(aPointPicker->Pick(aDisp[0],aDisp[1],0.0,CurrentRenderer)){
- if(vtkActorCollection *anActorCollection = aPointPicker->GetActors()){
- if(anActorCollection->IsItemPresent(SActor)){
- float aPickedPoint[3];
- aPointPicker->GetMapperPosition(aPickedPoint);
- vtkIdType aVtkId = aDataSet->FindPoint(aPickedPoint);
- if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ){
- int anObjId = SActor->GetNodeObjId(aVtkId);
- anIndices.insert(anObjId);
- }
- }
- }
- }
- }
- }
- if (!anIndices.empty()) {
- aSel->AddOrRemoveIndex(IO, anIndices, true, false);
- aSel->AddIObject(IO, false);
- anIndices.clear();
- }else{
- aSel->RemoveIObject(IO, false);
- }
- }
- }
- }
- }
- }
- break;
- }
- case CellSelection:
- case EdgeOfCellSelection:
- case EdgeSelection:
- case FaceSelection:
- case VolumeSelection:
- {
- vtkSmartPointer<VTKViewer_CellRectPicker> picker = VTKViewer_CellRectPicker::New();
- picker->SetTolerance(0.001);
- picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
-
- vtkActorCollection* aListActors = picker->GetActors();
- aListActors->InitTraversal();
- while(vtkActor* aActor = aListActors->GetNextActor()) {
- if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
- if (aSActor->hasIO()) {
- Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
- if (aSelActiveCompOnly && aComponentDataType != aIO->getComponentDataType())
- continue;
- VTKViewer_CellDataSet cellList = picker->GetCellData(aActor);
- if ( !cellList.empty() ) {
- SALOME_Selection::TContainerOfId anIndexes;
- VTKViewer_CellDataSet::iterator it;
- for ( it = cellList.begin(); it != cellList.end(); ++it ) {
- int aCellId = (*it).cellId;
-
- if ( !IsValid( aSActor, aCellId ) )
- continue;
-
- int anObjId = aSActor->GetElemObjId(aCellId);
- if (anObjId != -1){
- if ( CheckDimensionId(aSelectionMode,aSActor,anObjId) ) {
- anIndexes.insert(anObjId);
- }
- }
- }
- aSel->AddOrRemoveIndex(aIO, anIndexes, true, false);
- aSel->AddIObject(aIO, false);
- }
- }
- }
- }
- }
- break;
- case ActorSelection: // objects selection
- {
- vtkSmartPointer<VTKViewer_RectPicker> picker = VTKViewer_RectPicker::New();
- picker->SetTolerance(0.001);
- picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
-
- vtkActorCollection* aListActors = picker->GetActors();
- SALOME_ListIO aListIO;
- aListActors->InitTraversal();
- while(vtkActor* aActor = aListActors->GetNextActor()) {
- if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
- if (aSActor->hasIO()) {
- Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
- if (!IsStored(aIO,aListIO))
- aListIO.Append(aIO);
- }
- }
- }
- if (!aListIO.IsEmpty()) {
- SALOME_ListIteratorOfListIO It(aListIO);
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- this->PropPicked++;
- aSel->AddIObject( IOS, false );
- }
- }
- } // end case 4
- } //end switch
- m_Interactor->EndPickCallback();
- }
- aActiveStudy->update3dViewers();
+ QString aComponentDataType = SUIT_Application::getDesktop()->getComponentDataType();
+ if(aSelActiveCompOnly && aComponentDataType.isEmpty()) return;
+ m_Interactor->StartPickCallback();
+
+ if (!myShiftState) {
+ this->PropPicked = 0;
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+
+ // Compute bounds
+ // vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
+ QRect rect(myPoint, myOtherPoint);
+ rect = rect.normalize();
+ int w, h;
+ m_Interactor->GetSize(w, h);
+ int x1, y1, x2, y2;
+ x1 = rect.left();
+ y1 = h - rect.top() - 1;
+ x2 = rect.right();
+ y2 = h - rect.bottom() - 1;
+
+ switch (aSelectionMode) {
+ case NodeSelection: {
+ if ( vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(m_Interactor->GetPicker()) ) {
+ vtkActorCollection* aListActors = this->CurrentRenderer->GetActors();
+ aListActors->InitTraversal();
+ while (vtkActor* aActor = aListActors->GetNextActor()) {
+ if (!aActor->GetVisibility())
+ continue;
+ if(SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor)) {
+ if (SActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if (IO.IsNull())
+ continue;
+ if (aSelActiveCompOnly && aComponentDataType != IO->getComponentDataType())
+ continue;
+ if (vtkDataSet* aDataSet = SActor->GetInput()) {
+ SALOME_Selection::TContainerOfId anIndices;
+ for(int i = 0; i < aDataSet->GetNumberOfPoints(); i++) {
+ float aPoint[3];
+ aDataSet->GetPoint(i,aPoint);
+ if (IsInRect(aPoint,x1,y1,x2,y2)){
+ float aDisp[3];
+ ComputeWorldToDisplay(aPoint[0],aPoint[1],aPoint[2],aDisp);
+ if(aPointPicker->Pick(aDisp[0],aDisp[1],0.0,CurrentRenderer)){
+ if(vtkActorCollection *anActorCollection = aPointPicker->GetActors()){
+ if(anActorCollection->IsItemPresent(SActor)){
+ float aPickedPoint[3];
+ aPointPicker->GetMapperPosition(aPickedPoint);
+ vtkIdType aVtkId = aDataSet->FindPoint(aPickedPoint);
+ if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ){
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ anIndices.insert(anObjId);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (!anIndices.empty()) {
+ aSel->AddOrRemoveIndex(IO, anIndices, true, false);
+ aSel->AddIObject(IO, false);
+ anIndices.clear();
+ }else{
+ aSel->RemoveIObject(IO, false);
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ case CellSelection:
+ case EdgeOfCellSelection:
+ case EdgeSelection:
+ case FaceSelection:
+ case VolumeSelection:
+ {
+ vtkSmartPointer<VTKViewer_CellRectPicker> picker = VTKViewer_CellRectPicker::New();
+ picker->SetTolerance(0.001);
+ picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
+
+ vtkActorCollection* aListActors = picker->GetActors();
+ aListActors->InitTraversal();
+ while(vtkActor* aActor = aListActors->GetNextActor()) {
+ if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
+ if (aSActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
+ if (aSelActiveCompOnly && aComponentDataType != aIO->getComponentDataType())
+ continue;
+ VTKViewer_CellDataSet cellList = picker->GetCellData(aActor);
+ if ( !cellList.empty() ) {
+ SALOME_Selection::TContainerOfId anIndexes;
+ VTKViewer_CellDataSet::iterator it;
+ for ( it = cellList.begin(); it != cellList.end(); ++it ) {
+ int aCellId = (*it).cellId;
+
+ if ( !IsValid( aSActor, aCellId ) )
+ continue;
+
+ int anObjId = aSActor->GetElemObjId(aCellId);
+ if (anObjId != -1){
+ if ( CheckDimensionId(aSelectionMode,aSActor,anObjId) ) {
+ anIndexes.insert(anObjId);
+ }
+ }
+ }
+ aSel->AddOrRemoveIndex(aIO, anIndexes, true, false);
+ aSel->AddIObject(aIO, false);
+ }
+ }
+ }
+ }
+ }
+ break;
+ case ActorSelection: // objects selection
+ {
+ vtkSmartPointer<VTKViewer_RectPicker> picker = VTKViewer_RectPicker::New();
+ picker->SetTolerance(0.001);
+ picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
+
+ vtkActorCollection* aListActors = picker->GetActors();
+ SALOME_ListIO aListIO;
+ aListActors->InitTraversal();
+ while(vtkActor* aActor = aListActors->GetNextActor()) {
+ if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
+ if (aSActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
+ if (!IsStored(aIO,aListIO))
+ aListIO.Append(aIO);
+ }
+ }
+ }
+ if (!aListIO.IsEmpty()) {
+ SALOME_ListIteratorOfListIO It(aListIO);
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IOS = It.Value();
+ this->PropPicked++;
+ aSel->AddIObject( IOS, false );
+ }
+ }
+ } // end case 4
+ } //end switch
+ m_Interactor->EndPickCallback();
+ }
+ aActiveStudy->update3dViewers();
}
}
break;
if ( aVtkId >= 0 ) {
int anObjId = SActor->GetElemObjId(aVtkId);
if ( SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
- bool anIsSameObjId = (mySelectedActor == SActor && myElemId == anObjId);
- bool aResult = anIsSameObjId;
- if(!anIsSameObjId) {
- if(aSelectionMode != EdgeOfCellSelection) {
- aResult = CheckDimensionId(aSelectionMode,SActor,anObjId);
- if(aResult){
- mySelectedActor = SActor;
- myElemId = anObjId;
- m_Interactor->setCellData(anObjId,SActor,myPreSelectionActor);
- }
- }
- }
- if(aSelectionMode == EdgeOfCellSelection){
- int anEdgeId = GetEdgeId(picker,SActor,anObjId);
- bool anIsSameEdgeId = (myEdgeId != anEdgeId) && anIsSameObjId;
- aResult = anIsSameEdgeId;
- if(!anIsSameEdgeId) {
- aResult = (anEdgeId >= 0);
- if (aResult) {
- mySelectedActor = SActor;
- myEdgeId = anEdgeId;
- myElemId = anObjId;
- m_Interactor->setEdgeData(anObjId,SActor,-anEdgeId-1,myPreSelectionActor);
- }
- }
- }
- if(aResult) {
- myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
- myPreSelectionActor->SetVisibility(true);
- }
+ bool anIsSameObjId = (mySelectedActor == SActor && myElemId == anObjId);
+ bool aResult = anIsSameObjId;
+ if(!anIsSameObjId) {
+ if(aSelectionMode != EdgeOfCellSelection) {
+ aResult = CheckDimensionId(aSelectionMode,SActor,anObjId);
+ if(aResult){
+ mySelectedActor = SActor;
+ myElemId = anObjId;
+ m_Interactor->setCellData(anObjId,SActor,myPreSelectionActor);
+ }
+ }
+ }
+ if(aSelectionMode == EdgeOfCellSelection){
+ int anEdgeId = GetEdgeId(picker,SActor,anObjId);
+ bool anIsSameEdgeId = (myEdgeId != anEdgeId) && anIsSameObjId;
+ aResult = anIsSameEdgeId;
+ if(!anIsSameEdgeId) {
+ aResult = (anEdgeId >= 0);
+ if (aResult) {
+ mySelectedActor = SActor;
+ myEdgeId = anEdgeId;
+ myElemId = anObjId;
+ m_Interactor->setEdgeData(anObjId,SActor,-anEdgeId-1,myPreSelectionActor);
+ }
+ }
+ }
+ if(aResult) {
+ myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
+ myPreSelectionActor->SetVisibility(true);
+ }
}
}
}
int aVtkId = picker->GetPointId();
if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
if ( SActor && SActor->hasIO() ) {
- int anObjId = SActor->GetNodeObjId(aVtkId);
- bool anIsSameObjId = (mySelectedActor == SActor && myNodeId == anObjId);
- if(!anIsSameObjId) {
- mySelectedActor = SActor;
- myNodeId = anObjId;
- m_Interactor->setPointData(anObjId,SActor,myPreSelectionActor);
- }
- myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
- myPreSelectionActor->SetVisibility(true);
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ bool anIsSameObjId = (mySelectedActor == SActor && myNodeId == anObjId);
+ if(!anIsSameObjId) {
+ mySelectedActor = SActor;
+ myNodeId = anObjId;
+ m_Interactor->setPointData(anObjId,SActor,myPreSelectionActor);
+ }
+ myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
+ myPreSelectionActor->SetVisibility(true);
}
}
}
else if ( vtkPicker::SafeDownCast(aPicker) ) {
if ( SActor ) {
if ( myPreViewActor != SActor ) {
- if ( myPreViewActor != NULL ) {
- myPreViewActor->SetPreSelected( false );
- }
- myPreViewActor = SActor;
-
- if ( SActor->hasIO() ) {
- Handle( SALOME_InteractiveObject) IO = SActor->getIO();
- if ( !IsSelected(IO,Sel) ) {
+ if ( myPreViewActor != NULL ) {
+ myPreViewActor->SetPreSelected( false );
+ }
+ myPreViewActor = SActor;
+
+ if ( SActor->hasIO() ) {
+ Handle( SALOME_InteractiveObject) IO = SActor->getIO();
+ if ( !IsSelected(IO,Sel) ) {
// Find All actors with same IO
- vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
- theActors->InitTraversal();
- while( vtkActor *ac = theActors->GetNextActor() ) {
- if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
- if ( anActor->hasIO() ) {
- Handle(SALOME_InteractiveObject) IOS = anActor->getIO();
- if(IO->isSame(IOS)) {
- anActor->SetPreSelected( true );
- }
- }
- }
- }
- }
- }
+ vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
+ theActors->InitTraversal();
+ while( vtkActor *ac = theActors->GetNextActor() ) {
+ if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
+ if ( anActor->hasIO() ) {
+ Handle(SALOME_InteractiveObject) IOS = anActor->getIO();
+ if(IO->isSame(IOS)) {
+ anActor->SetPreSelected( true );
+ }
+ }
+ }
+ }
+ }
+ }
}
} else {
myPreViewActor = NULL;
cam->GetFocalPoint(viewFocus);
this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1],
- viewFocus[2], viewFocus);
+ viewFocus[2], viewFocus);
focalDepth = viewFocus[2];
this->ComputeDisplayToWorld(vtkFloatingPointType(toX), vtkFloatingPointType(toY),
- focalDepth, newPickPoint);
+ focalDepth, newPickPoint);
this->ComputeDisplayToWorld(vtkFloatingPointType(fromX),vtkFloatingPointType(fromY),
- focalDepth, oldPickPoint);
+ focalDepth, oldPickPoint);
// camera motion is reversed
motionVector[0] = oldPickPoint[0] - newPickPoint[0];
cam->GetFocalPoint(viewFocus);
cam->GetPosition(viewPoint);
cam->SetFocalPoint(motionVector[0] + viewFocus[0],
- motionVector[1] + viewFocus[1],
- motionVector[2] + viewFocus[2]);
+ motionVector[1] + viewFocus[1],
+ motionVector[2] + viewFocus[2]);
cam->SetPosition(motionVector[0] + viewPoint[0],
- motionVector[1] + viewPoint[1],
- motionVector[2] + viewPoint[2]);
+ motionVector[1] + viewPoint[1],
+ motionVector[2] + viewPoint[2]);
}
/*! Checks: is the given Actor within display coordinates?*/
bool VTKViewer_InteractorStyle::IsInRect(vtkActor* theActor,
- const int left, const int top,
- const int right, const int bottom)
+ const int left, const int top,
+ const int right, const int bottom)
{
vtkFloatingPointType* aBounds = theActor->GetBounds();
vtkFloatingPointType aMin[3], aMax[3];
/*! Checks: is the given Cell within display coordinates?*/
bool VTKViewer_InteractorStyle::IsInRect(vtkCell* theCell,
- const int left, const int top,
- const int right, const int bottom)
+ const int left, const int top,
+ const int right, const int bottom)
{
vtkFloatingPointType* aBounds = theCell->GetBounds();
vtkFloatingPointType aMin[3], aMax[3];
/*!Checks: is given point \a thePoint in rectangle*/
bool VTKViewer_InteractorStyle::IsInRect(vtkFloatingPointType* thePoint,
- const int left, const int top,
- const int right, const int bottom)
+ const int left, const int top,
+ const int right, const int bottom)
{
vtkFloatingPointType aPnt[3];
ComputeWorldToDisplay(thePoint[0], thePoint[1], thePoint[2], aPnt);
void setTriedron(VTKViewer_Trihedron* theTrihedron);
void setPreselectionProp(const double& theRed = 0, const double& theGreen = 1,
- const double& theBlue = 1, const int& theWidth = 5);
+ const double& theBlue = 1, const int& theWidth = 5);
// Generic event bindings must be overridden in subclasses
void OnMouseMove (int ctrl, int shift, int x, int y);
void Place(const int theX, const int theY);
void TranslateView(int toX, int toY, int fromX, int fromY);
bool IsInRect(vtkActor* theActor,
- const int left, const int top,
- const int right, const int bottom);
+ const int left, const int top,
+ const int right, const int bottom);
bool IsInRect(vtkCell* theCell,
- const int left, const int top,
- const int right, const int bottom);
+ const int left, const int top,
+ const int right, const int bottom);
bool IsInRect(vtkFloatingPointType* thePoint,
- const int left, const int top,
- const int right, const int bottom);
+ const int left, const int top,
+ const int right, const int bottom);
int State;
vtkFloatingPointType MotionFactor;
vtkRenderer * theRenderer = theRenderers->GetNextItem();
theRenderer->GetBackground(backint);
- QColor selColor = QColorDialog::getColor ( QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255)), NULL );
+ QColor selColor = QColorDialog::getColor ( QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255)), NULL );
if ( selColor.isValid() ) {
theRenderer->SetBackground( selColor.red()/255., selColor.green()/255., selColor.blue()/255. );
/* VSR : PAL5420 ---------------------------------------------------
return ;
}
myInteractorStyle->OnLeftButtonDown((event->modifiers() & Qt::ControlModifier),
- (event->modifiers() & Qt::ShiftModifier),
- event->x(), event->y());
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y());
}
/*!Reaction on left button releases.\n
return ;
}
myInteractorStyle->OnLeftButtonUp( (event->modifiers() & Qt::ControlModifier),
- (event->modifiers() & Qt::ShiftModifier),
- event->x(), event->y() ) ;
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() ) ;
}
/*!Reaction on middle button pressed.\n
return ;
}
myInteractorStyle->OnMiddleButtonDown((event->modifiers() & Qt::ControlModifier),
- (event->modifiers() & Qt::ShiftModifier),
- event->x(), event->y() ) ;
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() ) ;
}
/*!Reaction on middle button released.\n
return ;
}
myInteractorStyle->OnMiddleButtonUp( (event->modifiers() & Qt::ControlModifier),
- (event->modifiers() & Qt::ShiftModifier),
- event->x(), event->y() ) ;
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() ) ;
}
/*!Reaction on right button pressed.\n
return ;
}
myInteractorStyle->OnRightButtonDown( (event->modifiers() & Qt::ControlModifier),
- (event->modifiers() & Qt::ShiftModifier),
- event->x(), event->y() ) ;
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() ) ;
}
/*!Reaction on right button released.\n
}
bool isOperation = myInteractorStyle->CurrentState() != VTK_INTERACTOR_STYLE_CAMERA_NONE;
myInteractorStyle->OnRightButtonUp( (event->modifiers() & Qt::ControlModifier),
- (event->modifiers() & Qt::ShiftModifier),
- event->x(), event->y() );
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() );
if ( !isOperation )
{
QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
{
using namespace VTK;
ForEach<VTKViewer_Actor>(theCollection,
- TSetFunction<VTKViewer_Actor,int>
- (&VTKViewer_Actor::setDisplayMode,0));
+ TSetFunction<VTKViewer_Actor,int>
+ (&VTKViewer_Actor::setDisplayMode,0));
emit RenderWindowModified();
}
{
using namespace VTK;
ForEach<VTKViewer_Actor>(theCollection,
- TSetFunction<VTKViewer_Actor,int>
- (&VTKViewer_Actor::setDisplayMode,1));
+ TSetFunction<VTKViewer_Actor,int>
+ (&VTKViewer_Actor::setDisplayMode,1));
emit RenderWindowModified();
}
* \li Emit render window modified, if flag \a update - true.
*/
bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
- VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor,
- TUpdateActor theFun, bool hilight, bool update)
+ VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor,
+ TUpdateActor theFun, bool hilight, bool update)
{
if(theMapIndex.Extent() == 0) return false;
/*!Sets actors data.*/
void VTKViewer_RenderWindowInteractor::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
- VTKViewer_Actor * theMapActor,
- VTKViewer_Actor * theActor,
- TUpdateActor theFun)
+ VTKViewer_Actor * theMapActor,
+ VTKViewer_Actor * theActor,
+ TUpdateActor theFun)
{
(*theFun)(theMapIndex,theMapActor,theActor);
vtkFloatingPointType aPos[3];
/** @name Selection Management */
//@{
bool highlightCell(const TColStd_IndexedMapOfInteger& MapIndex,
- VTKViewer_Actor* theMapActor,
- bool hilight,
- bool update = true );
+ VTKViewer_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
bool highlightEdge(const TColStd_IndexedMapOfInteger& MapIndex,
- VTKViewer_Actor* theMapActor,
- bool hilight,
- bool update = true );
+ VTKViewer_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
bool highlightPoint(const TColStd_IndexedMapOfInteger& MapIndex,
- VTKViewer_Actor* theMapActor,
- bool hilight,
- bool update = true );
+ VTKViewer_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
void unHighlightSubSelection();
bool unHighlightAll();
//void SetSelectionMode(Selection_Mode mode);
void SetSelectionProp(const double& theRed = 1, const double& theGreen = 1,
- const double& theBlue = 0, const int& theWidth = 5);
+ const double& theBlue = 0, const int& theWidth = 5);
void SetSelectionTolerance(const double& theTolNodes = 0.025, const double& theTolCell = 0.001);
//@}
void setViewWindow( VTKViewer_ViewWindow* theViewWnd );
void setCellData(const int& theIndex,
- VTKViewer_Actor* theMapActor,
- VTKViewer_Actor* theActor) {}
+ VTKViewer_Actor* theMapActor,
+ VTKViewer_Actor* theActor) {}
void setEdgeData(const int& theCellIndex,
- VTKViewer_Actor* theMapActor,
- const int& theEdgeIndex,
- VTKViewer_Actor* theActor ) {} //NB
+ VTKViewer_Actor* theMapActor,
+ const int& theEdgeIndex,
+ VTKViewer_Actor* theActor ) {} //NB
void setPointData(const int& theIndex,
- VTKViewer_Actor* theMapActor,
- VTKViewer_Actor* theActor) {}
+ VTKViewer_Actor* theMapActor,
+ VTKViewer_Actor* theActor) {}
typedef void (*TUpdateActor)(const TColStd_IndexedMapOfInteger& theMapIndex,
- VTKViewer_Actor* theMapActor,
- VTKViewer_Actor* theActor);
+ VTKViewer_Actor* theMapActor,
+ VTKViewer_Actor* theActor);
protected:
VTKViewer_RenderWindowInteractor();
VTKViewer_InteractorStyle* myInteractorStyle;
bool highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
- VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor,
- TUpdateActor theFun, bool hilight, bool update);
+ VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor,
+ TUpdateActor theFun, bool hilight, bool update);
void setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
- VTKViewer_Actor* theMapActor,
- VTKViewer_Actor *theActor,
- TUpdateActor theFun);
+ VTKViewer_Actor* theMapActor,
+ VTKViewer_Actor *theActor,
+ TUpdateActor theFun);
/*! Timer used during various mouse events to figure
* out mouse movements.
oldId = ptIds->GetId(i);
newId = newPts->InsertNextPoint(pt);
if(myStoreMapping)
- myVTK2ObjIds.push_back(oldId);
+ myVTK2ObjIds.push_back(oldId);
newPtIds->InsertId(i,newId);
outPD->CopyData(pd, oldId, newId);
double aScale[3];
this->GetMatrixScale(aScale);
return (fabs(aScale[0] - 1.0) < EPS &&
- fabs(aScale[1] - 1.0) < EPS &&
- fabs(aScale[2] - 1.0) < EPS);
+ fabs(aScale[1] - 1.0) < EPS &&
+ fabs(aScale[2] - 1.0) < EPS);
}
#include "VTKViewer_Algorithm.h"
// VTK Includes
+#include <vtkConfigure.h>
#include <vtkMath.h>
#include <vtkMapper.h>
#include <vtkDataSet.h>
#include <vtkLineSource.h>
#include <vtkConeSource.h>
#include <vtkPolyDataMapper.h>
+#include <vtkPolyDataMapper2D.h>
#include <vtkVectorText.h>
+#include <vtkTextActor.h>
+#include <vtkTextMapper.h>
+#include <vtkTextProperty.h>
// QT includes
#include <QtGlobal>
theRenderer->ViewToWorld(P[0][0],P[0][1],P[0][2]);
theRenderer->ViewToWorld(P[1][0],P[1][1],P[1][2]);
vtkFloatingPointType aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+
- (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+
- (P[1][2]-P[0][2])*(P[1][2]-P[0][2]));
+ (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+
+ (P[1][2]-P[0][2])*(P[1][2]-P[0][2]));
int* aSize = theRenderer->GetRenderWindow()->GetSize();
vtkFloatingPointType aWinDiag = sqrt(vtkFloatingPointType(aSize[0]*aSize[0]+aSize[1]*aSize[1]));
vtkDataSet* aDataSet = GetMapper()->GetInput();
vtkStandardNewMacro(VTKViewer_LineActor);
+#ifdef IPAL21440
+vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,vtkTextActor);
+#else
vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,VTKViewer_UnScaledActor);
+#endif
vtkCxxSetObjectMacro(VTKViewer_LineActor,ArrowActor,vtkFollower);
/*!Adds Label and Arrow actors to \a theRenderer.*/
void VTKViewer_LineActor::Render(vtkRenderer *theRenderer)
{
+#ifndef IPAL21440
if(LabelActor && LabelActor->GetVisibility()){
LabelActor->Modified();
LabelActor->Render(theRenderer);
}
+#endif
if(ArrowActor && ArrowActor->GetVisibility()){
ArrowActor->Modified();
ArrowActor->Render(theRenderer);
myLineActor->SetArrowActor(myArrowActor);
/*! \li Initialize the Label pipe-line representation */
+#ifdef IPAL21440
+ myTextMapper = vtkTextMapper::New();
+
+ myLabelActor = vtkTextActor::New();
+ myLabelActor->SetMapper(myTextMapper);
+ myLabelActor->ScaledTextOff();
+ myLabelActor->PickableOff();
+
+ vtkCoordinate* aCoord = vtkCoordinate::New();
+ myLabelActor->GetPositionCoordinate()->SetReferenceCoordinate( aCoord );
+ aCoord->Delete();
+#else
myVectorText = vtkVectorText::New();
myMapper[2] = vtkPolyDataMapper::New();
myLabelActor->SetSize(aLabelActorSize);
myLabelActor->PickableOff();
//myLabelActor->DebugOn();
+#endif
myLineActor->SetLabelActor(myLabelActor);
myMapper[0]->RemoveAllInputs();
myMapper[0]->Delete();
- myVectorText->Delete();
-
/*! \li Destroy of the Arrow pipe-line representation */
myArrowActor->Delete();
/*! \li Destroy of the Line pipe-line representation */
myLineActor->Delete();
+#ifdef IPAL21440
+ myTextMapper->RemoveAllInputs();
+ myTextMapper->Delete();
+#else
+ myVectorText->Delete();
+
myMapper[2]->RemoveAllInputs();
myMapper[2]->Delete();
+#endif
myLineSource->Delete();
}
/*! Set camera for myLabelActor
*/
void VTKViewer_Axis::SetCamera(vtkCamera* theCamera){
+#ifndef IPAL21440
myLabelActor->SetCamera(theCamera);
+#endif
}
-/*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
+/*! Sets color for actors: myLineActor,myLabelActor,myArrowActor
*/
-void VTKViewer_Axis::SetProperty(vtkProperty* theProperty){
- myLabelActor->SetProperty(theProperty);
- myArrowActor->SetProperty(theProperty);
- myLineActor->SetProperty(theProperty);
+void VTKViewer_Axis::SetColor(double theRed, double theGreen, double theBlue)
+{
+ // Set color property for arrow and line actors
+ vtkProperty* aProperty = vtkProperty::New();
+ aProperty->SetColor(theRed, theGreen, theBlue);
+
+ myArrowActor->SetProperty(aProperty);
+ myLineActor->SetProperty(aProperty);
+#ifndef IPAL21440
+ myLabelActor->SetProperty(aProperty);
+#endif
+
+ aProperty->Delete();
+
+ // Set color property for label actor
+#ifdef IPAL21440
+ vtkTextProperty* aTextProperty = vtkTextProperty::New();
+ aTextProperty->SetColor(theRed, theGreen, theBlue);
+
+ myLabelActor->SetTextProperty(aTextProperty);
+
+ aTextProperty->Delete();
+#endif
}
/*! Set size of VTKViewer_Axis
myArrowActor->SetOrientation(myRot);
myArrowActor->SetScale(theSize / 10.);
+#ifdef IPAL21440
+ if( vtkCoordinate* aCoord = myLabelActor->GetPositionCoordinate()->GetReferenceCoordinate() )
+ aCoord->SetValue( aPosition );
+#else
myLabelActor->SetPosition(0.0,0.0,0.0);
myLabelActor->AddPosition(aPosition);
+#endif
}
/*! Check if actor belongs to the axis object
{
return theActor == myLineActor ||
theActor == myArrowActor ||
+#ifdef IPAL21440
+ false;
+#else
theActor == myLabelActor;
+#endif
}
/*! \class VTKViewer_XAxis
VTKViewer_XAxis::VTKViewer_XAxis(){
myDir[0] = 1.0; myDir[1] = 0.0; myDir[2] = 0.0;
myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 0.0;
+#ifdef IPAL21440
+ myTextMapper->SetInput("X");
+#else
myVectorText->SetText("X");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(1.0,0.0,0.0);
- SetProperty(aProperty);
- aProperty->Delete();
+#endif
+ SetColor(1.0,0.0,0.0);
}
/*! \class VTKViewer_YAxis
{
myDir[0] = 0.0; myDir[1] = 1.0; myDir[2] = 0.0;
myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 90.;
+#ifdef IPAL21440
+ myTextMapper->SetInput("Y");
+#else
myVectorText->SetText("Y");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(0.0,1.0,0.0);
- SetProperty(aProperty);
- aProperty->Delete();
+#endif
+ SetColor(0.0,1.0,0.0);
}
/*! \class VTKViewer_ZAxis
{
myDir[0] = 0.0; myDir[1] = 0.0; myDir[2] = 1.0;
myRot[0] = 0.0; myRot[1] = -90; myRot[2] = 0.0;
+#ifdef IPAL21440
+ myTextMapper->SetInput("Z");
+#else
myVectorText->SetText("Z");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(0.0,0.0,1.0);
- SetProperty(aProperty);
- aProperty->Delete();
+#endif
+ SetColor(0.0,0.0,1.0);
}
vtkStandardNewMacro(VTKViewer_Trihedron);
aCollection->InitTraversal();
int aCount = 0;
while(vtkActor* prop = aCollection->GetNextActor()) {
- if( prop->GetVisibility())
+ if( prop->GetVisibility()) {
if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(prop)) {
if(!anActor->IsInfinitive())
- aCount++;
+ aCount++;
}
else if ( !OwnActor( anActor ) ) {
- aCount++;
+ aCount++;
}
//int aCount = theRenderer->VisibleActorCount();
//SetVisibility(aVis);
+ }
}
return aCount;
}
class vtkLineSource;
class vtkConeSource;
class vtkVectorText;
+class vtkTextActor;
+class vtkTextMapper;
class VTKViewer_Axis;
+#if !defined(VTK_XVERSION)
+#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
+#endif
+
+// VTKViewer_UnScaledActor is temporarily replaced with simple vtkTextActor
+// This workaround caused by the bug with disappeared labels of the trihedron
+// reproduced after migration from qt-4.4.3 to qt-4.5.2
+#if (VTK_XVERSION < 0x050200)
+#define IPAL21440
+#endif
+
/*! \class vtkFollower
* See <a href="http://www.vtk.org/">vtk documentation</a>
*/
/*!Create new instance of VTKViewer_LineActor.*/
static VTKViewer_LineActor *New();
- /*! Sets Lable actor.
+#ifdef IPAL21440
+ /*! Sets Label actor.
+ * \param theLabelActor - vtkTextActor
+ */
+ void SetLabelActor(vtkTextActor* theLabelActor);
+#else
+ /*! Sets Label actor.
* \param theLabelActor - VTKViewer_UnScaledActor
*/
void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
+#endif
/*! Sets Arrow actor.
* \param theLabelActor - VTKViewer_UnScaledActor
}
/*!Label actor pointer*/
+#ifdef IPAL21440
+ vtkTextActor* LabelActor;
+#else
VTKViewer_UnScaledActor* LabelActor;
+#endif
/*!Arrow actor pointer*/
vtkFollower* ArrowActor;
*/
virtual void SetCamera(vtkCamera* theCamera);
- /*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
+ /*! Sets color for actors: myLineActor,myLabelActor,myArrowActor
+ * \param theRed - red component of the color
+ * \param theGreen - green component of the color
+ * \param theBlue - blue component of the color
*/
- virtual void SetProperty(vtkProperty* theProperty);
+ virtual void SetColor(double theRed, double theGreen, double theBlue);
/*! Set size of VTKViewer_Axis
*/
/*! Get label actor.
* \retval Return myLabelActor.
*/
+#ifdef IPAL21440
+ virtual vtkTextActor* GetLabel() { return myLabelActor; }
+#else
virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; }
+#endif
/*! Get arrow actor.
* \retval Return myArrowActor
/*! VTKViewer_UnScaledActor actor pointer
*/
+#ifdef IPAL21440
+ vtkTextActor *myLabelActor;
+#else
VTKViewer_UnScaledActor *myLabelActor;
+#endif
/*! \li myMapper[0] - for the Line pipe-line representation
* \li myMapper[1] - for the Arrow pipe-line representation
*/
vtkConeSource *myConeSource;
+#ifdef IPAL21440
+ /*! vtkTextMapper pointer (Label)
+ */
+ vtkTextMapper *myTextMapper;
+#else
/*! VTKViewer_VectorText pointer (Label)
*/
vtkVectorText* myVectorText;
+#endif
};
#endif
/*!@see vtkRenderer::ResetCamera(vtkFloatingPointType bounds[6]) method*/
void
ResetCamera(vtkRenderer* theRenderer,
- int theUsingZeroFocalPoint)
+ int theUsingZeroFocalPoint)
{
if(!theRenderer)
return;
vtkFloatingPointType aWidth =
sqrt((aBounds[1]-aBounds[0])*(aBounds[1]-aBounds[0]) +
- (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) +
- (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4]));
+ (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) +
+ (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4]));
if(aWidth < MIN_DISTANCE)
return;
// update the camera
aCamera->SetPosition(aCenter[0]+aDistance*aViewPlaneNormal[0],
- aCenter[1]+aDistance*aViewPlaneNormal[1],
- aCenter[2]+aDistance*aViewPlaneNormal[2]);
+ aCenter[1]+aDistance*aViewPlaneNormal[1],
+ aCenter[2]+aDistance*aViewPlaneNormal[2]);
// find size of the window
int* aWinSize = theRenderer->GetSize();
/*! Compute the bounds of the visible props*/
int
ComputeVisiblePropBounds(vtkRenderer* theRenderer,
- vtkFloatingPointType theBounds[6])
+ vtkFloatingPointType theBounds[6])
{
int aCount = 0;
if(aProp->GetVisibility() && aProp->GetMapper() && vtkMath::AreBoundsInitialized(aProp->GetBounds())){
if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(aProp))
if(anActor->IsInfinitive())
- continue;
-
+ continue;
+
vtkFloatingPointType *aBounds = aProp->GetBounds();
static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT;
// make sure we haven't got bogus bounds
if ( aBounds != NULL &&
- aBounds[0] > -MAX_DISTANCE && aBounds[1] < MAX_DISTANCE &&
- aBounds[2] > -MAX_DISTANCE && aBounds[3] < MAX_DISTANCE &&
- aBounds[4] > -MAX_DISTANCE && aBounds[5] < MAX_DISTANCE )
+ aBounds[0] > -MAX_DISTANCE && aBounds[1] < MAX_DISTANCE &&
+ aBounds[2] > -MAX_DISTANCE && aBounds[3] < MAX_DISTANCE &&
+ aBounds[4] > -MAX_DISTANCE && aBounds[5] < MAX_DISTANCE )
{
- aCount++;
+ aCount++;
- theBounds[0] = min(aBounds[0],theBounds[0]);
- theBounds[2] = min(aBounds[2],theBounds[2]);
- theBounds[4] = min(aBounds[4],theBounds[4]);
+ theBounds[0] = min(aBounds[0],theBounds[0]);
+ theBounds[2] = min(aBounds[2],theBounds[2]);
+ theBounds[4] = min(aBounds[4],theBounds[4]);
- theBounds[1] = max(aBounds[1],theBounds[1]);
- theBounds[3] = max(aBounds[3],theBounds[3]);
- theBounds[5] = max(aBounds[5],theBounds[5]);
+ theBounds[1] = max(aBounds[1],theBounds[1]);
+ theBounds[3] = max(aBounds[3],theBounds[3]);
+ theBounds[5] = max(aBounds[5],theBounds[5]);
}//not bogus
}
/*!Compute trihedron size.*/
bool
ComputeTrihedronSize( vtkRenderer* theRenderer,
- vtkFloatingPointType& theNewSize,
- const vtkFloatingPointType theSize,
- const vtkFloatingPointType theSizeInPercents )
+ vtkFloatingPointType& theNewSize,
+ const vtkFloatingPointType theSize,
+ const vtkFloatingPointType theSizeInPercents )
{
// calculating diagonal of visible props of the renderer
vtkFloatingPointType bnd[ 6 ];
if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(anAct))
if(anActor->GetVisibility() && !anActor->IsInfinitive())
{
- vtkFloatingPointType *aBounds = anActor->GetBounds();
- if(aBounds[0] > -VTK_LARGE_FLOAT && aBounds[1] < VTK_LARGE_FLOAT &&
- aBounds[2] > -VTK_LARGE_FLOAT && aBounds[3] < VTK_LARGE_FLOAT &&
- aBounds[4] > -VTK_LARGE_FLOAT && aBounds[5] < VTK_LARGE_FLOAT)
- isAny = true;
+ vtkFloatingPointType *aBounds = anActor->GetBounds();
+ if(aBounds[0] > -VTK_LARGE_FLOAT && aBounds[1] < VTK_LARGE_FLOAT &&
+ aBounds[2] > -VTK_LARGE_FLOAT && aBounds[3] < VTK_LARGE_FLOAT &&
+ aBounds[4] > -VTK_LARGE_FLOAT && aBounds[5] < VTK_LARGE_FLOAT)
+ isAny = true;
}
return !isAny;
{
if(anActor->GetVisibility() && !anActor->IsInfinitive())
{
- vtkFloatingPointType *aBounds = anActor->GetBounds();
- if(aBounds[0] > -VTK_LARGE_FLOAT && aBounds[1] < VTK_LARGE_FLOAT &&
- aBounds[2] > -VTK_LARGE_FLOAT && aBounds[3] < VTK_LARGE_FLOAT &&
- aBounds[4] > -VTK_LARGE_FLOAT && aBounds[5] < VTK_LARGE_FLOAT)
- {
- for(int i = 0; i < 5; i = i + 2){
- if(aBounds[i] < aNewBndBox[i])
- aNewBndBox[i] = aBounds[i];
- if(aBounds[i+1] > aNewBndBox[i+1])
- aNewBndBox[i+1] = aBounds[i+1];
- }
- isAny = true;
- }
+ vtkFloatingPointType *aBounds = anActor->GetBounds();
+ if(aBounds[0] > -VTK_LARGE_FLOAT && aBounds[1] < VTK_LARGE_FLOAT &&
+ aBounds[2] > -VTK_LARGE_FLOAT && aBounds[3] < VTK_LARGE_FLOAT &&
+ aBounds[4] > -VTK_LARGE_FLOAT && aBounds[5] < VTK_LARGE_FLOAT)
+ {
+ for(int i = 0; i < 5; i = i + 2){
+ if(aBounds[i] < aNewBndBox[i])
+ aNewBndBox[i] = aBounds[i];
+ if(aBounds[i+1] > aNewBndBox[i+1])
+ aNewBndBox[i+1] = aBounds[i+1];
+ }
+ isAny = true;
+ }
}
}
}
vtkFloatingPointType aWidth =
sqrt((aNewBndBox[1]-aNewBndBox[0])*(aNewBndBox[1]-aNewBndBox[0]) +
- (aNewBndBox[3]-aNewBndBox[2])*(aNewBndBox[3]-aNewBndBox[2]) +
- (aNewBndBox[5]-aNewBndBox[4])*(aNewBndBox[5]-aNewBndBox[4]));
+ (aNewBndBox[3]-aNewBndBox[2])*(aNewBndBox[3]-aNewBndBox[2]) +
+ (aNewBndBox[5]-aNewBndBox[4])*(aNewBndBox[5]-aNewBndBox[4]));
if(aWidth < MIN_DISTANCE)
return false;
vtkFloatingPointType aBounds[6];
int aCount = ComputeVisiblePropBounds(theRenderer,aBounds);
printf("aNewBndBox[0] = %f, aNewBndBox[1] = %f,\naNewBndBox[2] = %f, aNewBndBox[3] = %f,\naNewBndBox[4] = %f, aNewBndBox[5] = %f\n",
- aBounds[0],aBounds[1],aBounds[2],aBounds[3],aBounds[4],aBounds[5]);
+ aBounds[0],aBounds[1],aBounds[2],aBounds[3],aBounds[4],aBounds[5]);
printf("aCount = %d\n",aCount);
if(aCount){
vtkFloatingPointType aWidth =
sqrt((aBounds[1]-aBounds[0])*(aBounds[1]-aBounds[0]) +
- (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) +
- (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4]));
+ (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) +
+ (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4]));
if(aWidth < MIN_DISTANCE)
return false;
extern
void
ResetCamera(vtkRenderer* theRenderer,
- int theUsingZeroFocalPoint = false);
+ int theUsingZeroFocalPoint = false);
VTKVIEWER_EXPORT
extern
int
ComputeVisiblePropBounds(vtkRenderer* theRenderer,
- vtkFloatingPointType theBounds[6]);
+ vtkFloatingPointType theBounds[6]);
VTKVIEWER_EXPORT
extern
extern
bool
ComputeTrihedronSize(vtkRenderer* theRenderer,
- vtkFloatingPointType& theNewSize,
- const vtkFloatingPointType theSize,
- const vtkFloatingPointType theSizeInPercents);
+ vtkFloatingPointType& theNewSize,
+ const vtkFloatingPointType theSize,
+ const vtkFloatingPointType theSizeInPercents);
VTKVIEWER_EXPORT
extern
VTKVIEWER_EXPORT
extern
bool ComputeBBCenter(vtkRenderer* theRenderer,
- vtkFloatingPointType theCenter[3]);
+ vtkFloatingPointType theCenter[3]);
#endif
/*! Construction*/
VTKViewer_ViewWindow::VTKViewer_ViewWindow( SUIT_Desktop* theDesktop,
VTKViewer_Viewer* theModel,
- VTKViewer_InteractorStyle* iStyle,
- VTKViewer_RenderWindowInteractor* rw )
+ VTKViewer_InteractorStyle* iStyle,
+ VTKViewer_RenderWindowInteractor* rw )
: SUIT_ViewWindow( theDesktop )
{
myModel = theModel;
setCentralWidget( myRenderWindow );
myToolBar = new QtxToolBar( true, tr("LBL_TOOLBAR_LABEL"), this );
+ myToolBar->setFloatable( false );
createActions();
createToolBar();
QString retStr;
retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e",
- pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1],
- viewUp[2], parScale, scale[0], scale[1], scale[2] );
+ pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1],
+ viewUp[2], parScale, scale[0], scale[1], scale[2] );
return retStr;
}
public:
VTKViewer_ViewWindow( SUIT_Desktop*, VTKViewer_Viewer*,
VTKViewer_InteractorStyle* = 0,
- VTKViewer_RenderWindowInteractor* = 0 );
+ VTKViewer_RenderWindowInteractor* = 0 );
virtual ~VTKViewer_ViewWindow();
/*!Gets tool bar.*/
/*!Gets renderer.*/
vtkRenderer* getRenderer() { return myRenderer; }
/*!Gets render window.*/
- VTKViewer_RenderWindow* getRenderWindow() { return myRenderWindow; }
+ VTKViewer_RenderWindow* getRenderWindow() { return myRenderWindow; }
/*!Gets render window interactor.*/
VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; }
bool isTrihedronDisplayed();