resources/occ_view_clipping.png \
resources/occ_view_clipping_pressed.png \
resources/occ_view_scaling.png \
+ resources/occ_view_ambient.png \
resources/occ_view_fitall.png \
resources/occ_view_fitarea.png \
resources/occ_view_front.png \
#include <QApplication>
#include <V3d_Plane.hxx>
+#include <V3d_Light.hxx>
#include <gp_Dir.hxx>
#include <gp_Pln.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
aAction->setStatusTip(tr("DSC_SCALING"));
connect(aAction, SIGNAL(triggered()), this, SLOT(onAxialScale()));
toolMgr()->registerAction( aAction, AxialScaleId );
+
+ // Active only ambient light or not
+ aAction = new QtxAction(tr("MNU_AMBIENT"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_AMBIENT" ) ),
+ tr( "MNU_AMBIENT" ), 0, this);
+ aAction->setStatusTip(tr("DSC_AMBIENT"));
+ connect(aAction, SIGNAL(triggered()), this, SLOT(onAmbientToogle()));
+ toolMgr()->registerAction( aAction, AmbientId );
}
/*!
toolMgr()->append( toolMgr()->separator(), tid );
toolMgr()->append( ClippingId, tid );
toolMgr()->append( AxialScaleId, tid );
+ toolMgr()->append( AmbientId, tid );
}
/*!
myScalingDlg->show();
}
+void OCCViewer_ViewWindow::onAmbientToogle()
+{
+ Handle(V3d_Viewer) viewer = myViewPort->getViewer();
+ viewer->InitDefinedLights();
+ while(viewer->MoreDefinedLights())
+ {
+ Handle(V3d_Light) light = viewer->DefinedLight();
+ if(light->Type() != V3d_AMBIENT)
+ {
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if( aView3d->IsActiveLight(light) ) viewer->SetLightOff(light);
+ else viewer->SetLightOn(light);
+ }
+ viewer->NextDefinedLights();
+ }
+ viewer->Update();
+}
+
/*!
\brief Store view parameters.
*/
enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
ChangeRotationPointId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
- TrihedronShowId, AxialScaleId };
+ TrihedronShowId, AxialScaleId, AmbientId };
enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE,
PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
void onCloneView();
void onClipping( bool on );
void onAxialScale();
+ void onAmbientToogle();
void onMemorizeView();
void onRestoreView();
void onTrihedronShow();
<source>ICON_OCCVIEWER_SCALING</source>
<translation>occ_view_scaling.png</translation>
</message>
+ <message>
+ <source>ICON_OCCVIEWER_AMBIENT</source>
+ <translation>occ_view_ambient.png</translation>
+ </message>
</context>
</TS>
<source>MNU_SCALING</source>
<translation>Scaling</translation>
</message>
+ <message>
+ <source>DSC_AMBIENT</source>
+ <translation>Toogle keep only ambient light</translation>
+ </message>
+ <message>
+ <source>MNU_AMBIENT</source>
+ <translation>Toogle keep only ambient light</translation>
+ </message>
<message>
<source>OCC_IMAGE_FILES</source>
<translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>