From 1f68e40c77251b740da081cb51bfcac73fb81ed2 Mon Sep 17 00:00:00 2001 From: catdog2 Date: Sun, 2 Nov 2008 20:34:58 +0000 Subject: [PATCH] #1 fixed und einiges mehr git-svn-id: http://svn.lsim.tuxzone.org/trunk@10 4bec179b-ab65-46ed-a5f8-55b8b5c735d0 --- lsim.kdevelop | 4 ++-- lsim.kdevelop.pcs | Bin 103930 -> 105570 bytes lsim.kdevses | 24 ++++++++++++++++++------ src/expdoublespinbox.cpp | 22 ++++++++++++++++++---- src/expdoublespinbox.h | 12 ++++++++---- src/fielditem.cpp | 9 +++++++++ src/fielditem.h | 5 +++-- src/graphicsellipseitem.cpp | 29 +++++++++++++++++++++++++++-- src/graphicsellipseitem.h | 35 ++++++++++++++++++++++++++++------- src/homobfielditem.cpp | 11 +++++++++++ src/homobfielditem.h | 2 ++ src/homobfieldwidget.cpp | 7 +++++++ src/homoefieldwidget.cpp | 21 +++++++++++++-------- src/lsim.cpp | 11 +++++++++-- src/lsim.h | 1 + src/simulscene.cpp | 5 +++++ src/simulscene.h | 1 + 17 files changed, 162 insertions(+), 37 deletions(-) diff --git a/lsim.kdevelop b/lsim.kdevelop index 40b7388..dd1595c 100644 --- a/lsim.kdevelop +++ b/lsim.kdevelop @@ -70,8 +70,8 @@ set m_,_ theValue - true - true + false + false false diff --git a/lsim.kdevelop.pcs b/lsim.kdevelop.pcs index 64a536041a18c3e4f3697bbce0c920ea3b919f80..690f6af43eb92c36ad75269ea3661f94b93c27a9 100644 GIT binary patch delta 3647 zcmb7H4^)&@7JqjJ#`$2rVL%WN!9fO*bae1fiZ}`?hLrM0Lqn85f`T9n|NO(Qf~4sx zC~$M%*4fP3wzI9|pZ!kzDV9N7Mr*d&DfgtVsE2hc&CpYw)iU?KZ$7Nkp3}A;=W*}5 zzx(dH_ucp2eRJo4>B>=4+cM+rj~;AavBEsxGWmJN0_J1khm+715QA;eCc~%~FmTc% zSP3S>gEg2^G70-;hu{h7&U+f8D+x@qs?um z6^xw>)Y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d08fcd0..20800a1 100644 --- a/src/expdoublespinbox.cpp +++ b/src/expdoublespinbox.cpp @@ -28,7 +28,8 @@ ExpDoubleSpinBox::ExpDoubleSpinBox() : QDoubleSpinBox() { setPositiveExp(4); - setNegativeExp(3); + setNegativeExp(3); + setDisplayDecimals(decimals()); } @@ -44,14 +45,14 @@ QString ExpDoubleSpinBox::textFromValue ( double val ) const { //qDebug() << val; if((val < pow(10,getPositiveExp()) && val > 1) || (val > -pow(10,getPositiveExp()) && val < -1) || val == 0) { //return QDoubleSpinBox::textFromValue ( val ); - return QString("%L1").arg(val,0,'f',decimals()); + return QString("%L1").arg(val,0,'f',getDisplayDecimals()); } else if ( (val >= pow(10, -getNegativeExp()) && val <= 1 ) || (val <= -pow(10, -getNegativeExp()) && val >= -1 ) ){ //return QDoubleSpinBox::textFromValue ( val ); - return QString("%L1").arg(val,0,'f',decimals()); + return QString("%L1").arg(val,0,'f',getDisplayDecimals()); } else { - return QString("%L1").arg(val,0,'e',decimals()); + return QString("%L1").arg(val,0,'e',getDisplayDecimals()); } //return QDoubleSpinBox::textFromValue ( val ); } @@ -97,3 +98,16 @@ void ExpDoubleSpinBox::stepBy ( int steps ) { } + + +int ExpDoubleSpinBox::getDisplayDecimals() const { + return displayDecimals; +} + + +void ExpDoubleSpinBox::setDisplayDecimals ( int theValue ) { + if (displayDecimals == theValue) return; + //Nicht mehr anzeigen, als die gneauigkeit zulaesst + if (theValue > decimals()) theValue = decimals(); + displayDecimals = theValue; +} diff --git a/src/expdoublespinbox.h b/src/expdoublespinbox.h index f698b01..54dc823 100644 --- a/src/expdoublespinbox.h +++ b/src/expdoublespinbox.h @@ -40,21 +40,25 @@ class ExpDoubleSpinBox : public QDoubleSpinBox { virtual QValidator::State validate ( QString & input, int & pos ) const; virtual void stepBy ( int steps ); - ///welche kommastelle soll noch ohne exponentialdarstellungen dargestellt werden + void setNegativeExp (int exponent); - ///welche kommastelle soll noch ohne exponentialdarstellungen dargestellt werden const int getNegativeExp () const; - ///ab welchem positiven exponenten soll exponentialdarstellung benutzt werden void setPositiveExp (int exponent); - ///ab welchem positiven exponenten soll exponentialdarstellung benutzt werden const int getPositiveExp () const; + void setDisplayDecimals ( int theValue ); + int getDisplayDecimals() const; + protected: virtual QDoubleSpinBox::StepEnabled stepEnabled () const; private: + ///welche kommastelle soll noch ohne exponentialdarstellungen dargestellt werden int negativeExp; + ///ab welchem positiven exponenten soll exponentialdarstellung benutzt werden int positiveExp; + ///Wie viele Decimals sollen angezeigt werden (default: displayDecimals=decimals default) + int displayDecimals; }; #endif diff --git a/src/fielditem.cpp b/src/fielditem.cpp index b5d1a5a..758dd4d 100644 --- a/src/fielditem.cpp +++ b/src/fielditem.cpp @@ -20,6 +20,7 @@ #include "fielditem.h" #include "homoefielditem.h" #include "homobfielditem.h" +#include #include FieldItem::FieldItem() @@ -122,6 +123,14 @@ QRectF FieldItem::rect() const { return getRectF(); } +void FieldItem::wheelEvent(QGraphicsSceneWheelEvent * event) { + if (event->modifiers() == Qt::ShiftModifier) { + setRotation(getRotation()+( (event->delta()/abs(event->delta()))) ); + } + else if (event->modifiers() == Qt::ControlModifier) { + setRotation(getRotation()+( (event->delta()/abs(event->delta()))*5 )); + } +} /*! \fn FieldItem::getRotation() diff --git a/src/fielditem.h b/src/fielditem.h index 260675c..94273fa 100644 --- a/src/fielditem.h +++ b/src/fielditem.h @@ -28,6 +28,7 @@ @author Peter Dahlberg */ class QPointF; +class QGraphicsSceneWheelEvent; class FieldItem :public QObject, public QGraphicsItem { Q_OBJECT public: @@ -52,10 +53,10 @@ class FieldItem :public QObject, public QGraphicsItem { \param item Das zu pruefende Item */ static bool isFieldItem(QGraphicsItem *item); - int getRotation(); + int getRotation(); protected: - + virtual void wheelEvent(QGraphicsSceneWheelEvent * event); QPointF myScenePos; int myRotation; QRectF sizeRect; diff --git a/src/graphicsellipseitem.cpp b/src/graphicsellipseitem.cpp index c6aca63..6f07ac3 100644 --- a/src/graphicsellipseitem.cpp +++ b/src/graphicsellipseitem.cpp @@ -128,10 +128,11 @@ double GraphicsEllipseItem::getMasse(double speed) { void GraphicsEllipseItem::setMasse ( const double& theValue ) { if (masse == theValue) return; masse = theValue; + emit masseChanged(theValue); } -long double GraphicsEllipseItem::getCharge() const { +double GraphicsEllipseItem::getCharge() const { return charge; } @@ -139,6 +140,7 @@ long double GraphicsEllipseItem::getCharge() const { void GraphicsEllipseItem::setCharge ( const long double& theValue ) { if (charge == theValue) return; charge = theValue; + emit chargeChanged(theValue); } QWidget * GraphicsEllipseItem::getDockWidget() const @@ -148,4 +150,27 @@ QWidget * GraphicsEllipseItem::getDockWidget() const QList * GraphicsEllipseItem::getCurrProbePath() { return currProbePath; -} \ No newline at end of file +} + +double GraphicsEllipseItem::getStartSpeedX() const { + return startSpeedX; +} + + +void GraphicsEllipseItem::setStartSpeedX ( double theValue ) { + if (startSpeedX == theValue) return; + startSpeedX = theValue; + emit startSpeedXChanged(theValue); +} + + +double GraphicsEllipseItem::getStartSpeedY() const { + return startSpeedY; +} + + +void GraphicsEllipseItem::setStartSpeedY ( double theValue ) { + if (startSpeedY == theValue) return; + startSpeedY = theValue; + emit startSpeedYChanged(theValue); +} diff --git a/src/graphicsellipseitem.h b/src/graphicsellipseitem.h index a7bb558..df62f45 100644 --- a/src/graphicsellipseitem.h +++ b/src/graphicsellipseitem.h @@ -21,18 +21,31 @@ #define GRAPHICSELLIPSEITEM_H #include +#include class ProbeChargeWidget; /** @author Peter Dahlberg */ + class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem { + Q_OBJECT public: GraphicsEllipseItem(); QWidget* getDockWidget() const; ~GraphicsEllipseItem(); QList * getCurrProbePath(); + + double getCharge() const; + double getStartSpeedX() const; + double getStartSpeedY() const; + + //! Gibt die Masse zurück + /*! + \param speed alles != 0 relativistisch + */ + double getMasse(double speed); @@ -53,6 +66,10 @@ class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem { double charge; ///Zugeordnetes Probe Charge Widget ProbeChargeWidget* myProbeChargeWidget; + ///Startgeschwindigkeit des teilchens in x-Richtung + double startSpeedX; + ///Startgeschwindigkeit des teilchens in y-Richtung + double startSpeedY; public slots: @@ -64,16 +81,20 @@ class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem { void setMasse ( const double& theValue ); - //! Gibt die Masse zurück - /*! - \param speed alles != 0 relativistisch - */ - double getMasse(double speed); - void setCharge ( const long double& theValue ); + + void setStartSpeedX ( double theValue ); + void setStartSpeedY ( double theValue ); + signals: + void startSpeedXChanged(double speed); + void startSpeedYChanged(double speed); + void masseChanged(double masse); + void chargeChanged(double Charge); - long double getCharge() const; + + + }; diff --git a/src/homobfielditem.cpp b/src/homobfielditem.cpp index a049e6b..87d11cf 100644 --- a/src/homobfielditem.cpp +++ b/src/homobfielditem.cpp @@ -23,6 +23,7 @@ #include #include #include +#include HomoBFieldItem::HomoBFieldItem(QRectF sizeRect): FieldItem() { setRectF(sizeRect); @@ -189,3 +190,13 @@ void HomoBFieldItem::setFluxDensity ( double theValue ) { fluxDensity = theValue; emit fluxDensityChanged(theValue); } + + + +/*! + \fn HomoBFieldItem::wheelEvent ( QGraphicsSceneWheelEvent * event ) + */ +void HomoBFieldItem::wheelEvent ( QGraphicsSceneWheelEvent * event ) +{ + event->ignore(); +} diff --git a/src/homobfielditem.h b/src/homobfielditem.h index cdcc2aa..e90e728 100644 --- a/src/homobfielditem.h +++ b/src/homobfielditem.h @@ -76,6 +76,8 @@ class HomoBFieldItem : public FieldItem { +protected: + void wheelEvent ( QGraphicsSceneWheelEvent * event ); }; #endif diff --git a/src/homobfieldwidget.cpp b/src/homobfieldwidget.cpp index 766988b..6ada381 100644 --- a/src/homobfieldwidget.cpp +++ b/src/homobfieldwidget.cpp @@ -37,11 +37,13 @@ void HomoBFieldWidget::createWidget() { QDoubleSpinBox *heightBox = new QDoubleSpinBox; heightBox->setRange(HomoBFieldItem::MinimumHeight, 5000); + heightBox->setKeyboardTracking(false); connect(homoBField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) ); connect(heightBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setRectFHeight(double)) ); QDoubleSpinBox *widthBox = new QDoubleSpinBox; widthBox->setRange(HomoBFieldItem::MinimumWidth, 5000); + widthBox->setKeyboardTracking(false); connect(homoBField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) ); connect(widthBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setRectFWidth(double)) ); @@ -52,11 +54,13 @@ void HomoBFieldWidget::createWidget() { QDoubleSpinBox *posXBox = new QDoubleSpinBox; posXBox->setRange(-5000, 5000); + posXBox->setKeyboardTracking(false); connect(homoBField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) ); connect(posXBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosX(double)) ); QDoubleSpinBox *posYBox = new QDoubleSpinBox; posYBox->setRange(-5000, 5000); + posYBox->setKeyboardTracking(false); connect(homoBField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) ); connect(posYBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosY(double)) ); @@ -82,6 +86,9 @@ void HomoBFieldWidget::createWidget() { ExpDoubleSpinBox* fieldFluxDensityBox = new ExpDoubleSpinBox; fieldFluxDensityBox->setRange(-1e+200,1e+200); + fieldFluxDensityBox->setDecimals(40); + fieldFluxDensityBox->setDisplayDecimals(2); + fieldFluxDensityBox->setKeyboardTracking(false); connect(homoBField ,SIGNAL(fluxDensityChanged(double)),fieldFluxDensityBox, SLOT(setValue(double)) ); connect(fieldFluxDensityBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setFluxDensity(double)) ); diff --git a/src/homoefieldwidget.cpp b/src/homoefieldwidget.cpp index a821207..2ed1f6e 100644 --- a/src/homoefieldwidget.cpp +++ b/src/homoefieldwidget.cpp @@ -44,19 +44,16 @@ HomoEFieldWidget::~HomoEFieldWidget() { */ void HomoEFieldWidget::createWidget() { - QDial *rotationDial = new QDial; - rotationDial->setRange(0,359); - rotationDial->setNotchesVisible(true); - rotationDial->setWrapping(true); - QDoubleSpinBox *heightBox = new QDoubleSpinBox; heightBox->setRange(HomoEFieldItem::MinimumHeight, 5000); + heightBox->setKeyboardTracking(false); connect(homoEField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) ); connect(heightBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFHeight(double)) ); QDoubleSpinBox *widthBox = new QDoubleSpinBox; widthBox->setRange(HomoEFieldItem::MinimumWidth, 5000); + widthBox->setKeyboardTracking(false); connect(homoEField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) ); connect(widthBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFWidth(double)) ); @@ -68,11 +65,13 @@ void HomoEFieldWidget::createWidget() QDoubleSpinBox *posXBox = new QDoubleSpinBox; posXBox->setRange(-5000, 5000); + posXBox->setKeyboardTracking(false); connect(homoEField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) ); connect(posXBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosX(double)) ); QDoubleSpinBox *posYBox = new QDoubleSpinBox; posYBox->setRange(-5000, 5000); + posYBox->setKeyboardTracking(false); connect(homoEField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) ); connect(posYBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosY(double)) ); @@ -80,10 +79,10 @@ void HomoEFieldWidget::createWidget() rotationBox->setRange(0,359); rotationBox->setSuffix("\260"); rotationBox->setWrapping(true); - connect(rotationDial, SIGNAL(valueChanged(int)),rotationBox ,SIGNAL(valueChanged(int)) ); - connect(rotationDial, SIGNAL(valueChanged(int)),rotationBox,SLOT(setValue(int)) ); + rotationBox->setKeyboardTracking(false); + connect(rotationBox, SIGNAL(valueChanged(int)),homoEField ,SLOT(setRotation(int)) ); - connect(rotationBox, SIGNAL(valueChanged(int)),rotationDial ,SLOT(setValue(int)) ); + connect(homoEField, SIGNAL(rotationChanged(int)),rotationBox ,SLOT(setValue(int)) ); QGridLayout* geomGridLayout = new QGridLayout; @@ -110,11 +109,17 @@ void HomoEFieldWidget::createWidget() ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox; fieldPowerBox->setRange(-1e+200,1e+200); + fieldPowerBox->setDecimals(35); + fieldPowerBox->setDisplayDecimals(3); + fieldPowerBox->setKeyboardTracking(false); connect(homoEField ,SIGNAL(fieldPowerChanged(double)),fieldPowerBox, SLOT(setValue(double)) ); connect(fieldPowerBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setFieldPower(double)) ); ExpDoubleSpinBox* voltageBox = new ExpDoubleSpinBox; voltageBox->setRange(-1e+200,1e+200); + fieldPowerBox->setDecimals(35); + fieldPowerBox->setDisplayDecimals(3); + voltageBox->setKeyboardTracking(false); QGridLayout* constGridLayout = new QGridLayout; //constGridLayout->setSizeConstraint(QLayout::SetFixedSize); diff --git a/src/lsim.cpp b/src/lsim.cpp index c67fdf2..f9b0d31 100644 --- a/src/lsim.cpp +++ b/src/lsim.cpp @@ -82,6 +82,10 @@ void lsim::createActions() { acts.timerStart->setStatusTip (tr ("Timer starten")); connect (acts.timerStart, SIGNAL (triggered()), simulscene, SLOT (startTimer())); + acts.timerStop = new QAction (tr ("Timer Stop"), this); + acts.timerStop->setStatusTip (tr ("Timer stoppen")); + connect (acts.timerStop, SIGNAL (triggered()), simulscene, SLOT (stopTimer())); + acts.exitAct = new QAction (tr ("Beenden"), this); acts.exitAct->setStatusTip (tr ("Die Anwendung beenden")); connect (acts.exitAct, SIGNAL (triggered()), qApp, SLOT (quit())); @@ -136,6 +140,7 @@ void lsim::createToolBars() { editToolBar = addToolBar (tr ("Edit")); editToolBar->addAction(acts.timerStart); + editToolBar->addAction(acts.timerStop); editToolBar->addSeparator(); editToolBar->addAction(acts.itemEditModeAct); editToolBar->addAction(acts.insertEFieldItemAct); @@ -157,8 +162,9 @@ void lsim::createDocks() { ExpDoubleSpinBox *time_step_box = new ExpDoubleSpinBox; - time_step_box->setRange(-pow(10,33), pow(10,33)); + time_step_box->setRange(-pow(10,66), pow(10,66)); time_step_box->setDecimals(30); + time_step_box->setDisplayDecimals(10); time_step_box->setKeyboardTracking(false); time_step_box->setValue(simulscene->getTimePerStep()); @@ -167,8 +173,9 @@ void lsim::createDocks() { ExpDoubleSpinBox *meter_per_px_box = new ExpDoubleSpinBox; - meter_per_px_box->setRange(-pow(10,33), pow(10,33)); + meter_per_px_box->setRange(-pow(10,66), pow(10,66)); meter_per_px_box->setDecimals(30); + meter_per_px_box->setDisplayDecimals(10); meter_per_px_box->setKeyboardTracking(false); meter_per_px_box->setValue(simulscene->getMeterPerPx()); connect(meter_per_px_box, SIGNAL(valueChanged(double)),simulscene, SLOT(setMeterPerPx(double))); diff --git a/src/lsim.h b/src/lsim.h index 4ad65c7..adda2ba 100644 --- a/src/lsim.h +++ b/src/lsim.h @@ -79,6 +79,7 @@ class lsim: public QMainWindow { QAction *oglEnable; QAction *oglDisable; QAction *timerStart; + QAction *timerStop; QAction *itemEditModeAct; QAction *insertEFieldItemAct; diff --git a/src/simulscene.cpp b/src/simulscene.cpp index 9b6bf27..fc33ce9 100644 --- a/src/simulscene.cpp +++ b/src/simulscene.cpp @@ -93,6 +93,8 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) { } void SimulScene::startTimer() { + timer->setCurrentTime(0); + ani->clear(); for (int i=0; isetPosAt(i/200.0, QPointF(x , 0.5 * ay * pow(( (x/1000) /vx),2) *1000 )); ani->setPosAt(i/(double)getSteps(), ellipse1->getCurrProbePath()->at(i) ); @@ -100,6 +102,9 @@ void SimulScene::startTimer() { } timer->start(); } +void SimulScene::stopTimer() { + timer->stop(); +} void SimulScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) { switch(myMode) { diff --git a/src/simulscene.h b/src/simulscene.h index 646bd0f..841d7d0 100644 --- a/src/simulscene.h +++ b/src/simulscene.h @@ -60,6 +60,7 @@ class SimulScene : public QGraphicsScene { public slots: void setSceneMode(SceneMode mode); void startTimer(); + void stopTimer(); void deleteSelectedFieldItems(); void setTimePerStep(double time); ///starte die Berechnung der teilchenbahn(en)