case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
case GEOMOp::OpColor: // POPUP MENU - COLOR
+ case GEOMOp::OpSetTexture: // POPUP MENU - SETTEXTURE
case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY
case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY
case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY
createGeomAction( GEOMOp::OpVectors, "POP_VECTORS", "", 0, true );
createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" );
createGeomAction( GEOMOp::OpColor, "POP_COLOR" );
+ createGeomAction( GEOMOp::OpSetTexture, "POP_SETTEXTURE" );
createGeomAction( GEOMOp::OpTransparency, "POP_TRANSPARENCY" );
createGeomAction( GEOMOp::OpIsos, "POP_ISOS" );
createGeomAction( GEOMOp::OpAutoColor, "POP_AUTO_COLOR" );
// ---- create popup menus --------------------------
QString clientOCCorVTK = "(client='OCCViewer' or client='VTKViewer')";
+ QString clientOCC = "(client='OCCViewer')";
QString clientOCCorVTK_AndSomeVisible = clientOCCorVTK + " and selcount>0 and isVisible";
+ QString clientOCC_AndSomeVisible = clientOCC + " and selcount>0 and isVisible";
+ QString clientOCCorOB = "(client='ObjectBrowser' or client='OCCViewer')";
QString clientOCCorVTKorOB = "(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer')";
QString clientOCCorVTKorOB_AndSomeVisible = clientOCCorVTKorOB + " and selcount>0 and isVisible";
+ QString clientOCCorOB_AndSomeVisible = clientOCCorOB + " and selcount>0 and isVisible";
QString autoColorPrefix =
"(client='ObjectBrowser' or client='OCCViewer') and type='Shape' and selcount=1 and isOCC=true";
mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpTexture ), dispmodeId, -1 ); // wireframe
- mgr->setRule( action( GEOMOp::OpTexture ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
- mgr->setRule( action( GEOMOp::OpTexture), clientOCCorVTK + " and displaymode='Texture'", QtxPopupMgr::ToggleRule );
+ mgr->setRule( action( GEOMOp::OpTexture ), clientOCC_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpTexture), clientOCC + " and displaymode='Texture'", QtxPopupMgr::ToggleRule );
mgr->insert( separator(), dispmodeId, -1 );
mgr->insert( action( GEOMOp::OpVectors ), dispmodeId, -1 ); // vectors
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
//mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and ( $typeid in {%1} or compoundOfVertices=true ) " ).arg(GEOM::VERTEX).arg(GEOM::COMPOUND), QtxPopupMgr::VisibleRule );
+ mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 ); // texture
+ mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color
mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
#include "GEOMToolsGUI_PublishDlg.h"
#include <GeometryGUI.h>
+#include <GeometryGUI_Operations.h>
#include <GEOM_Displayer.h>
#include <GEOMBase.h>
// QT Includes
#include <QColorDialog>
#include <QInputDialog>
+#include <QFileDialog>
#include <QList>
#include <QGridLayout>
app->updateActions(); //SRN: To update a Save button in the toolbar
}
+void GEOMToolsGUI::OnTexture()
+{
+ SALOME_ListIO selected;
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( app && appStudy ) {
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( aSelMgr ) {
+ aSelMgr->selectedObjects( selected );
+ if ( !selected.IsEmpty() ) {
+ SUIT_ViewWindow* window = app->desktop()->activeWindow();
+ bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
+ int mgrId = window->getViewManager()->getGlobalId();
+ if ( isOCC ) {
+ QString aTexture = QFileDialog::getOpenFileName(window,tr( "SELECT_IMAGE"),QString("/home"), tr("OCC_IMAGE_FILES"));
+ if( !aTexture.isEmpty() )
+ {
+ SUIT_OverrideCursor();
+ OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
+ Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+ Handle(AIS_InteractiveObject) io ;
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ io = GEOMBase::GetAIS( It.Value(), true );
+ if ( !io.IsNull() ) {
+ if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
+ Handle(GEOM_AISShape)::DownCast( io )->SetTextureFileName(TCollection_AsciiString(aTexture.toStdString().c_str()));
+
+ io->Redisplay( Standard_True );
+ }
+ } // for
+ ic->UpdateCurrentViewer();
+ GeometryGUI::Modified();
+ GeometryGUI* myGeomGUI = getGeometryGUI();
+ myGeomGUI->OnGUIEvent(GEOMOp::OpTexture);
+ } // if ( !selFile.isEmpty() )
+ } // if ( isOCC )
+ } // if ( selection not empty )
+ }
+ }
+
+ app->updateActions(); //SRN: To update a Save button in the toolbar
+}
+
void GEOMToolsGUI::OnTransparency()
{
GEOMToolsGUI_TransparencyDlg dlg( SUIT_Session::session()->activeApplication()->desktop() );