Back to index

salome-geom  6.5.0
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
EntityGUI_PictureImportDlg Class Reference

#include <EntityGUI_PictureImportDlg.h>

List of all members.

Public Member Functions

 EntityGUI_PictureImportDlg (GeometryGUI *, QWidget *=0, bool=false, Qt::WindowFlags=0)
 ~EntityGUI_PictureImportDlg ()

Protected Member Functions

virtual GEOM::GEOM_IOperations_ptr createOperation ()
virtual bool execute (ObjectList &)

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void FileSelectionClicked ()

Private Member Functions

void Init ()

Private Attributes

QGroupBox * GroupSelFile
QPushButton * myPushButton
QLineEdit * myLineEdit

Detailed Description

Definition at line 38 of file EntityGUI_PictureImportDlg.h.


Constructor & Destructor Documentation

EntityGUI_PictureImportDlg::EntityGUI_PictureImportDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0,
bool  modal = false,
Qt::WindowFlags  fl = 0 
)

Definition at line 53 of file EntityGUI_PictureImportDlg.cxx.

  : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
  QPixmap image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_IMPORT_PICTURE")));
  setWindowTitle( tr( "GEOM_IMPORT_PICT_TITLE" ) );
  mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PICTURE" ) );

  mainFrame()->RadioButton1->setIcon(image0);
  mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
  mainFrame()->RadioButton2->close();
  mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
  mainFrame()->RadioButton3->close();

  QGroupBox* GroupFileSel = new QGroupBox( centralWidget() );
  GroupFileSel->setTitle( tr( "GEOM_FILE" ) );
  QHBoxLayout* myFileSelGrpLayout = new QHBoxLayout(GroupFileSel );
  myPushButton = new QPushButton( GroupFileSel );
  myLineEdit = new QLineEdit( GroupFileSel );
  myPushButton->setText("...");
  
  myFileSelGrpLayout->addWidget( myLineEdit, 1);
  myFileSelGrpLayout->addWidget( myPushButton, 0);
  
  QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
  layout->setMargin( 0 ); layout->setSpacing( 6 );
  layout->addWidget( GroupFileSel );

  setHelpFileName( "import_picture_page.html" );

  Init();
}

Here is the call graph for this function:

Definition at line 91 of file EntityGUI_PictureImportDlg.cxx.

{  
}

Member Function Documentation

bool EntityGUI_PictureImportDlg::ClickOnApply ( ) [private, slot]

Definition at line 147 of file EntityGUI_PictureImportDlg.cxx.

{
  MESSAGE("EntityGUI_PictureImportDlg::ClickOnApply()")
  if ( !onAccept() )
    return false;
  
  initName();
  myLineEdit->setText( "" );

  return true;
}

Here is the caller graph for this function:

void EntityGUI_PictureImportDlg::ClickOnOk ( ) [private, slot]

Definition at line 135 of file EntityGUI_PictureImportDlg.cxx.

{
  MESSAGE("EntityGUI_PictureImportDlg::ClickOnOk()")
  setIsApplyAndClose( true );
  if ( ClickOnApply() )
    ClickOnCancel();
}

Here is the call graph for this function:

Here is the caller graph for this function:

GEOM::GEOM_IOperations_ptr EntityGUI_PictureImportDlg::createOperation ( ) [protected, virtual]

Definition at line 163 of file EntityGUI_PictureImportDlg.cxx.

{
  return myGeomGUI->GetGeomGen()->GetIBlocksOperations( getStudyId() );
}
bool EntityGUI_PictureImportDlg::execute ( ObjectList objects) [protected, virtual]

Definition at line 172 of file EntityGUI_PictureImportDlg.cxx.

{
  bool res = false;
  
  GEOM::GEOM_Object_var anObj;
  GEOM::GEOM_IBasicOperations_var aBasicOperations = myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
  GEOM::GEOM_IBlocksOperations_var aBlocksOperations = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() );
  QString theImgFileName = myLineEdit->text();
  if ( theImgFileName.isEmpty() )
    return res;
  
  QPixmap* pixmap = new QPixmap(theImgFileName); 
  int height            =  pixmap->height();
  int width             =  pixmap->width();
  
  GEOM::GEOM_Object_var P1 = aBasicOperations->MakePointXYZ( -0.5*width, -0.5*height, 0 );
  GEOM::GEOM_Object_var P2 = aBasicOperations->MakePointXYZ( -0.5*width,  0.5*height, 0 );
  GEOM::GEOM_Object_var P3 = aBasicOperations->MakePointXYZ(  0.5*width,  0.5*height, 0 );
  GEOM::GEOM_Object_var P4 = aBasicOperations->MakePointXYZ(  0.5*width, -0.5*height, 0 );
  
  GEOM::GEOM_Object_var aFace = aBlocksOperations->MakeQuad4Vertices(P1,P2,P3,P4);
  getDisplayer()->SetTexture(theImgFileName.toStdString());
  
  if ( !aFace->_is_nil() )
  {
    objects.push_back( aFace._retn() );
  }
  
  res=true;
 

  return res;
}

Definition at line 124 of file EntityGUI_PictureImportDlg.cxx.

{
  QString selFile = QFileDialog::getOpenFileName(this,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_TEXTURE_FILES"));
  if ( ! selFile.isEmpty() )
    myLineEdit->setText(selFile);
}

Here is the caller graph for this function:

Definition at line 100 of file EntityGUI_PictureImportDlg.cxx.

{
  connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
  connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
  connect( myPushButton,   SIGNAL( clicked() ), this, SLOT( FileSelectionClicked() ) );
  
  resize(100,100);
  
  gp_Pnt aOrigin = gp_Pnt(0, 0, 0);
  gp_Dir aDirZ = gp_Dir(0, 0, 1);
  gp_Dir aDirX = gp_Dir(1, 0, 0);
  
  gp_Ax3 aGlobalCS = gp_Ax3(aOrigin, aDirZ, aDirX);
  
  myGeomGUI->SetWorkingPlane( aGlobalCS );
  myGeomGUI->ActiveWorkingPlane();
  
  initName( tr( "GEOM_PICTURE" ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 58 of file EntityGUI_PictureImportDlg.h.

Definition at line 60 of file EntityGUI_PictureImportDlg.h.

Definition at line 59 of file EntityGUI_PictureImportDlg.h.


The documentation for this class was generated from the following files: