TaskTrajectoryDressUpParameter.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2009 Jürgen Riegel <juergen.riegel@web.de>              *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "PreCompiled.h"
00025 
00026 #ifndef _PreComp_
00027 #endif
00028 
00029 #include <QString>
00030 #include <QSlider>
00031 #include "ui_TaskTrajectoryDressUpParameter.h"
00032 #include "TaskTrajectoryDressUpParameter.h"
00033 #include <Gui/Application.h>
00034 #include <Gui/Document.h>
00035 #include <Gui/BitmapFactory.h>
00036 #include <Gui/ViewProvider.h>
00037 #include <Gui/WaitCursor.h>
00038 #include <Base/Console.h>
00039 #include <Gui/Selection.h>
00040 #include <Gui/Placement.h>
00041 
00042 
00043 using namespace RobotGui;
00044 using namespace Gui;
00045 
00046 TaskTrajectoryDressUpParameter::TaskTrajectoryDressUpParameter(Robot::TrajectoryDressUpObject *obj,QWidget *parent)
00047     : TaskBox(Gui::BitmapFactory().pixmap("Robot_TrajectoryDressUp"),
00048       tr("Dress Up Parameter"),
00049       true, 
00050       parent),
00051       pcObject(obj)
00052 {
00053     // we need a separate container widget to add all controls to
00054     proxy = new QWidget(this);
00055     ui = new Ui_TaskTrajectoryDressUpParameter();
00056     ui->setupUi(proxy);
00057     QMetaObject::connectSlotsByName(this);
00058 
00059     this->groupLayout()->addWidget(proxy);
00060 
00061     // pump the actual values in the Gui
00062     ui->doubleSpinBoxSpeed->setValue        (pcObject->Speed.getValue() / 1000.0) ;
00063     ui->doubleSpinBoxAccel->setValue        (pcObject->Acceleration.getValue() / 1000.0) ;
00064     ui->checkBoxUseSpeed  ->setChecked      (pcObject->UseSpeed.getValue()) ;
00065     ui->checkBoxUseAccel  ->setChecked      (pcObject->UseAcceleration.getValue()) ;
00066     ui->comboBoxCont      ->setCurrentIndex (pcObject->ContType.getValue()) ;
00067     ui->comboBoxOrientation->setCurrentIndex (pcObject->AddType.getValue()) ;
00068 
00069     PosAdd = pcObject->PosAdd.getValue();
00070     viewPlacement();
00071 
00072     QObject::connect(ui->toolButtonChoosePlacement,SIGNAL(clicked()),this,SLOT(createPlacementDlg()));
00073 
00074 }
00075 
00076 
00077 
00078 TaskTrajectoryDressUpParameter::~TaskTrajectoryDressUpParameter()
00079 {
00080     delete ui;
00081 }
00082 
00083 void TaskTrajectoryDressUpParameter::writeValues(void)
00084 {
00085     pcObject->Speed.setValue          ( ui->doubleSpinBoxSpeed->value()*1000.0);
00086     pcObject->Acceleration.setValue   ( ui->doubleSpinBoxAccel->value()*1000.0);
00087     pcObject->UseSpeed.setValue       ( ui->checkBoxUseSpeed  ->isChecked()   );
00088     pcObject->UseAcceleration.setValue( ui->checkBoxUseAccel  ->isChecked()   );
00089     pcObject->ContType.setValue       ( ui->comboBoxCont      ->currentIndex());
00090     pcObject->AddType.setValue        ( ui->comboBoxOrientation->currentIndex());
00091     pcObject->PosAdd.setValue(PosAdd);
00092 }
00093 
00094 void TaskTrajectoryDressUpParameter::createPlacementDlg(void)
00095 {
00096     Gui::Dialog::Placement *plc = new Gui::Dialog::Placement();
00097     plc->setPlacement(PosAdd);
00098     if(plc->exec()==QDialog::Accepted){
00099         PosAdd = plc->getPlacement();
00100         viewPlacement();
00101     }
00102 
00103 }
00104 
00105 
00106 void TaskTrajectoryDressUpParameter::viewPlacement(void)
00107 {
00108     double A,B,C;
00109     Base::Vector3d pos = PosAdd.getPosition();
00110     PosAdd.getRotation().getYawPitchRoll(A,B,C);
00111     QString val = QString::fromAscii("(%1,%2,%3),(%4,%5,%6)\n")
00112          .arg(pos.x,0,'g',6)
00113          .arg(pos.y,0,'g',6)
00114          .arg(pos.z,0,'g',6)
00115          .arg(A,0,'g',6)
00116          .arg(B,0,'g',6)
00117          .arg(C,0,'g',6);
00118 
00119     ui->lineEditPlacement->setText(val);
00120 }
00121 
00122 #include "moc_TaskTrajectoryDressUpParameter.cpp"

Generated on Wed Nov 23 19:00:44 2011 for FreeCAD by  doxygen 1.6.1