diff --git a/lsim.kdevelop b/lsim.kdevelop
index dd1595c..ee263e1 100644
--- a/lsim.kdevelop
+++ b/lsim.kdevelop
@@ -155,7 +155,7 @@
false
-
+ -style Plastique
/mnt/sdb1/c++/lsim
diff --git a/lsim.kdevelop.pcs b/lsim.kdevelop.pcs
index 1dd25db..bede536 100644
Binary files a/lsim.kdevelop.pcs and b/lsim.kdevelop.pcs differ
diff --git a/lsim.kdevses b/lsim.kdevses
index 6ee4192..2e62509 100644
--- a/lsim.kdevses
+++ b/lsim.kdevses
@@ -1,79 +1,19 @@
-
-
-
+
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/graphicsellipseitem.cpp b/src/graphicsellipseitem.cpp
index e8a2412..66663ae 100644
--- a/src/graphicsellipseitem.cpp
+++ b/src/graphicsellipseitem.cpp
@@ -21,6 +21,8 @@
#include
#include
#include
+#include
+#include
#include
#include "simulscene.h"
#include "probechargewidget.h"
@@ -40,7 +42,7 @@ GraphicsEllipseItem::GraphicsEllipseItem() {
currProbePath = new QList;
speedListX = new QList;
speedListY = new QList;
-
+
}
void GraphicsEllipseItem::timerEvent ( QTimerEvent * event ) {
static double vx;
@@ -89,6 +91,9 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) {
speedListX->append(startSpeedX);
speedListY->append(startSpeedY);
+ //startpunkt in den Pfad setzen
+ flightPath = QPainterPath(startPoint);
+
for(int i = 1; i< steps;++i) {
double myMasse = getMasse( sqrt( speedListX->at(i-1)*speedListX->at(i-1) + speedListY->at(i-1)*speedListY->at(i-1) ) );
@@ -110,10 +115,13 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) {
double deltaDistX = (deltaDistXconst + deltaDistXaccel);
double deltaDistY = (deltaDistYconst + deltaDistYaccel);
+
+ QPointF newPoint(currProbePath->at(i-1).x() + deltaDistX/meterPerPx ,currProbePath->at(i-1).y() + deltaDistY/meterPerPx);
- currProbePath->append(QPointF(currProbePath->at(i-1).x() + deltaDistX/meterPerPx ,currProbePath->at(i-1).y() + deltaDistY/meterPerPx));
+ currProbePath->append(newPoint);
speedListX->append(newspeedX);
speedListY->append(newspeedY);
+ /*if(i%10 == 0)*/ flightPath.lineTo(newPoint);
}
@@ -204,3 +212,14 @@ void GraphicsEllipseItem::setScenePosX(double newPosX)
{
moveBy(newPosX - scenePos().x(),0 );
}
+
+
+QPainterPath GraphicsEllipseItem::getFlightPath() const {
+ return flightPath;
+}
+
+
+void GraphicsEllipseItem::setFlightPath ( const QPainterPath& theValue ) {
+ if (flightPath==theValue) return;
+ flightPath = theValue;
+}
diff --git a/src/graphicsellipseitem.h b/src/graphicsellipseitem.h
index 3f66ab1..c25ad0f 100644
--- a/src/graphicsellipseitem.h
+++ b/src/graphicsellipseitem.h
@@ -23,6 +23,8 @@
#include
#include
class ProbeChargeWidget;
+class QPainterPath;
+class QGraphicsPathItem;
/**
@author Peter Dahlberg
@@ -47,7 +49,7 @@ class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem {
*/
double getMasse(double speed);
-
+ QPainterPath getFlightPath() const;
protected:
@@ -73,6 +75,8 @@ class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem {
QPointF myScenePos;
+ ///Pfad der Flugbahn
+ QPainterPath flightPath;
public slots:
//! Berechnet die Bewegung der Probeladung
@@ -90,6 +94,9 @@ class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem {
void setScenePosY(double newPosY);
void setScenePosX(double newPosX);
void handleSceneChange(const QList & /*region*/);
+
+ void setFlightPath ( const QPainterPath& theValue );
+
signals:
void startSpeedXChanged(double speed);
void startSpeedYChanged(double speed);
diff --git a/src/homobfieldwidget.cpp b/src/homobfieldwidget.cpp
index 4dc20af..16deb0a 100644
--- a/src/homobfieldwidget.cpp
+++ b/src/homobfieldwidget.cpp
@@ -85,7 +85,7 @@ void HomoBFieldWidget::createWidget() {
QLabel* fieldFluxDensityLabel = new QLabel(tr("Flussdichte(B):"));
ExpDoubleSpinBox* fieldFluxDensityBox = new ExpDoubleSpinBox;
- fieldFluxDensityBox->setRange(-1e+200,1e+200);
+ fieldFluxDensityBox->setRange(0,1e+200);
fieldFluxDensityBox->setDecimals(40);
fieldFluxDensityBox->setDisplayDecimals(3);
fieldFluxDensityBox->setKeyboardTracking(false);
diff --git a/src/homoefieldwidget.cpp b/src/homoefieldwidget.cpp
index d01afba..f07b82b 100644
--- a/src/homoefieldwidget.cpp
+++ b/src/homoefieldwidget.cpp
@@ -108,7 +108,7 @@ void HomoEFieldWidget::createWidget()
QLabel* voltageLabel = new QLabel(tr("Spannung:"));
ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox;
- fieldPowerBox->setRange(-1e+200,1e+200);
+ fieldPowerBox->setRange(0,1e+200);
fieldPowerBox->setDecimals(35);
fieldPowerBox->setDisplayDecimals(3);
fieldPowerBox->setKeyboardTracking(false);
diff --git a/src/probechargewidget.cpp b/src/probechargewidget.cpp
index 97dbbc3..0986f5c 100644
--- a/src/probechargewidget.cpp
+++ b/src/probechargewidget.cpp
@@ -112,7 +112,7 @@ void ProbeChargeWidget::createWidget()
ExpDoubleSpinBox* masseBox = new ExpDoubleSpinBox;
- masseBox->setRange(-1e+200,1e+200);
+ masseBox->setRange(0,1e+200);
masseBox->setDecimals(50);
masseBox->setDisplayDecimals(3);
masseBox->setKeyboardTracking(false);
diff --git a/src/simulscene.cpp b/src/simulscene.cpp
index f0ae3b9..a473644 100644
--- a/src/simulscene.cpp
+++ b/src/simulscene.cpp
@@ -33,7 +33,8 @@
#include
#include
#include
-
+#include
+#include
SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
@@ -49,6 +50,10 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
currHomoBfieldEditItem = 0;
createResizeRects();
+
+ //path Item Erstellen
+ pathItem1 = addPath(QPainterPath());
+
addLine(0,-298,0,298,QPen(Qt::green, 1, Qt::SolidLine) )->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
addLine(-398,0,398,0,QPen(Qt::green, 1, Qt::SolidLine) )->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
@@ -90,15 +95,15 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
ani->setItem(ellipse1);
ani->setTimeLine(timer);
-
}
void SimulScene::startTimer() {
timer->setCurrentTime(0);
ani->clear();
- for (int i=0; igetCurrProbePath()->count();
+ 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) );
+ ani->setPosAt(i/(double)currSteps, ellipse1->getCurrProbePath()->at(i) );
//qDebug()<< getSteps();
}
timer->start();
@@ -582,7 +587,8 @@ void SimulScene::setTimePerStep(double time) {
\fn SimulScene::startCalculation()
*/
void SimulScene::startCalculation() {
- ellipse1->calculateProbePath(ellipse1->pos());
+ ellipse1->calculateProbePath(ellipse1->pos());
+ pathItem1->setPath(ellipse1->getFlightPath());
}
@@ -667,3 +673,8 @@ void SimulScene::setMeterPerPx ( double theValue ) {
QWidget* SimulScene::getProbeDockWidget() const {
return ellipse1->getDockWidget();
}
+
+void SimulScene::setFlightPathVisible(bool visible) {
+ pathItem1->setVisible(visible);
+ emit flightPathVisibilityChanged(visible);
+}
\ No newline at end of file
diff --git a/src/simulscene.h b/src/simulscene.h
index 841d7d0..5bf8a9b 100644
--- a/src/simulscene.h
+++ b/src/simulscene.h
@@ -29,6 +29,8 @@ class QGraphicsRectItem;
class QGraphicsItemGroup;
class GraphicsEllipseItem;
class QGraphicsItemAnimation;
+class QGraphicsPathItem;
+class QPainterPath;
/**
@author Peter Dahlberg
@@ -69,16 +71,19 @@ class SimulScene : public QGraphicsScene {
void setMeterPerPx ( double theValue );
double getMeterPerPx() const;
+ void setFlightPathVisible(bool visible = true);
private slots:
void displayResizeRects(bool move = false);
///does the same as displayResizeRects(true)
void moveResizeRects();
+
signals:
void sceneModeChanged(int mode);
void stepsChanged(int steps);
void timePerStepChanged(double timePerStep);
void meterPerPxChanged(double meterPerPx);
+ void flightPathVisibilityChanged(bool visible);
private:
QTimeLine *timer;
@@ -101,6 +106,8 @@ class SimulScene : public QGraphicsScene {
GraphicsEllipseItem *ellipse1;
QGraphicsItemAnimation *ani;
+
+ QGraphicsPathItem *pathItem1;
//rechtecke zur groesenaenderung