#include <Prs3d_LineAspect.hxx>
OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron )
-:SUIT_ViewModel()
+: SUIT_ViewModel(),
+myBgColor( Qt::black )
{
- // init CasCade viewers
+ // init CasCade viewers
myV3dViewer = OCCViewer_VService::Viewer3d( "", (short*) "Viewer3d", "", 1000.,
V3d_XposYnegZpos, true, true );
{
}
+QColor OCCViewer_Viewer::backgroundColor() const
+{
+ return myBgColor;
+}
+
+void OCCViewer_Viewer::setBackgroundColor( const QColor& c )
+{
+ if ( c.isValid() )
+ myBgColor = c;
+}
-SUIT_ViewWindow* OCCViewer_Viewer::createView(SUIT_Desktop* theDesktop)
+SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop )
{
OCCViewer_ViewWindow* res = new OCCViewer_ViewWindow(theDesktop, this);
res->initLayout();
+
+ OCCViewer_ViewPort3d* vp3d = res->getViewPort();
+ if ( vp3d )
+ vp3d->setBackgroundColor( myBgColor );
+
return res;
}
if( update )
myV3dViewer->Update();
}
+
+//****************************************************************
+void OCCViewer_Viewer::toggleTrihedron()
+{
+ setTrihedronShown( !isTrihedronVisible() );
+}
+
+bool OCCViewer_Viewer::isTrihedronVisible() const
+{
+ return !myTrihedron.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed( myTrihedron );
+}
+
+void OCCViewer_Viewer::setTrihedronShown( const bool on )
+{
+ if ( myTrihedron.IsNull() )
+ return;
+
+ if ( on )
+ myAISContext->Display( myTrihedron );
+ else
+ myAISContext->Erase( myTrihedron );
+}
+
+int OCCViewer_Viewer::trihedronSize() const
+{
+ int sz = 0;
+ if ( !myTrihedron.IsNull() )
+ sz = (int)myTrihedron->Size();
+ return sz;
+}
+
+void OCCViewer_Viewer::setTrihedronSize( const int sz )
+{
+ if ( !myTrihedron.IsNull() )
+ myTrihedron->SetSize( sz );
+}
+
+void OCCViewer_Viewer::setIsos( const int u, const int v )
+{
+ Handle(AIS_InteractiveContext) ic = getAISContext();
+ if ( ic.IsNull() )
+ return;
+
+ ic->SetIsoNumber( u, AIS_TOI_IsoU );
+ ic->SetIsoNumber( u, AIS_TOI_IsoV );
+}
+
+void OCCViewer_Viewer::isos( int& u, int& v ) const
+{
+ Handle(AIS_InteractiveContext) ic = getAISContext();
+ if ( !ic.IsNull() )
+ {
+ u = ic->IsoNumber( AIS_TOI_IsoU );
+ v = ic->IsoNumber( AIS_TOI_IsoV );
+ }
+}