Pfandanzeige
git-svn-id: http://svn.lsim.tuxzone.org/trunk@12 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
@@ -155,7 +155,7 @@
|
||||
<autokdesu>false</autokdesu>
|
||||
<envvars/>
|
||||
<runarguments>
|
||||
<lsim/>
|
||||
<lsim>-style Plastique</lsim>
|
||||
</runarguments>
|
||||
<cwd>
|
||||
<lsim>/mnt/sdb1/c++/lsim</lsim>
|
||||
|
||||
Binary file not shown.
76
lsim.kdevses
76
lsim.kdevses
@@ -1,79 +1,19 @@
|
||||
<?xml version = '1.0' encoding = 'UTF-8'?>
|
||||
<!DOCTYPE KDevPrjSession>
|
||||
<KDevPrjSession>
|
||||
<DocsAndViews NumberOfDocuments="24" >
|
||||
<Doc0 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homoefielditem.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
<DocsAndViews NumberOfDocuments="4" >
|
||||
<Doc0 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.h" >
|
||||
<View0 Encoding="" line="35" Type="Source" />
|
||||
</Doc0>
|
||||
<Doc1 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsellipseitem.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
<Doc1 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.cpp" >
|
||||
<View0 Encoding="" line="94" Type="Source" />
|
||||
</Doc1>
|
||||
<Doc2 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsellipseitem.h" >
|
||||
<View0 Encoding="" line="30" Type="Source" />
|
||||
<View0 Encoding="" line="51" Type="Source" />
|
||||
</Doc2>
|
||||
<Doc3 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.cpp" >
|
||||
<View0 Encoding="UTF-8" Type="Source" />
|
||||
<Doc3 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsellipseitem.cpp" >
|
||||
<View0 Encoding="" line="216" Type="Source" />
|
||||
</Doc3>
|
||||
<Doc4 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/constants.h" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc4>
|
||||
<Doc5 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homoefielditem.h" >
|
||||
<View0 Encoding="" line="31" Type="Source" />
|
||||
</Doc5>
|
||||
<Doc6 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc6>
|
||||
<Doc7 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.h" >
|
||||
<View0 Encoding="" line="81" Type="Source" />
|
||||
</Doc7>
|
||||
<Doc8 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.h" >
|
||||
<View0 Encoding="" line="41" Type="Source" />
|
||||
</Doc8>
|
||||
<Doc9 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/probechargewidget.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc9>
|
||||
<Doc10 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/probechargewidget.h" >
|
||||
<View0 Encoding="" line="31" Type="Source" />
|
||||
</Doc10>
|
||||
<Doc11 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homoefieldwidget.h" >
|
||||
<View0 Encoding="" line="33" Type="Source" />
|
||||
</Doc11>
|
||||
<Doc12 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homoefieldwidget.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc12>
|
||||
<Doc13 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/lsim.pro" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc13>
|
||||
<Doc14 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsview.h" >
|
||||
<View0 Encoding="" line="15" Type="Source" />
|
||||
</Doc14>
|
||||
<Doc15 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/expdoublespinbox.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc15>
|
||||
<Doc16 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/fielditem.h" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc16>
|
||||
<Doc17 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/fielditem.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc17>
|
||||
<Doc18 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfieldwidget.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc18>
|
||||
<Doc19 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfielditem.h" >
|
||||
<View0 Encoding="" line="29" Type="Source" />
|
||||
</Doc19>
|
||||
<Doc20 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfieldwidget.h" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc20>
|
||||
<Doc21 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsview.cpp" >
|
||||
<View0 Encoding="" line="36" Type="Source" />
|
||||
</Doc21>
|
||||
<Doc22 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/expdoublespinbox.h" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc22>
|
||||
<Doc23 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfielditem.cpp" >
|
||||
<View0 Encoding="" line="32" Type="Source" />
|
||||
</Doc23>
|
||||
</DocsAndViews>
|
||||
<pluginList>
|
||||
<kdevdebugger>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <QDrag>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QMimeData>
|
||||
#include <QPainterPath>
|
||||
#include <QGraphicsPathItem>
|
||||
#include <QDebug>
|
||||
#include "simulscene.h"
|
||||
#include "probechargewidget.h"
|
||||
@@ -40,7 +42,7 @@ GraphicsEllipseItem::GraphicsEllipseItem() {
|
||||
currProbePath = new QList<QPointF>;
|
||||
speedListX = new QList<double>;
|
||||
speedListY = new QList<double>;
|
||||
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <QGraphicsEllipseItem>
|
||||
#include <QObject>
|
||||
class ProbeChargeWidget;
|
||||
class QPainterPath;
|
||||
class QGraphicsPathItem;
|
||||
|
||||
/**
|
||||
@author Peter Dahlberg <pdahlberg@gmail.com>
|
||||
@@ -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<QRectF> & /*region*/);
|
||||
|
||||
void setFlightPath ( const QPainterPath& theValue );
|
||||
|
||||
signals:
|
||||
void startSpeedXChanged(double speed);
|
||||
void startSpeedYChanged(double speed);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QKeyEvent>
|
||||
#include <QGraphicsItemGroup>
|
||||
|
||||
#include <QPainterPath>
|
||||
#include <QGraphicsPathItem>
|
||||
|
||||
|
||||
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; i<getSteps(); ++i) {
|
||||
int currSteps = ellipse1->getCurrProbePath()->count();
|
||||
for (int i=0; i<currSteps; ++i) {
|
||||
//ani->setPosAt(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);
|
||||
}
|
||||
@@ -29,6 +29,8 @@ class QGraphicsRectItem;
|
||||
class QGraphicsItemGroup;
|
||||
class GraphicsEllipseItem;
|
||||
class QGraphicsItemAnimation;
|
||||
class QGraphicsPathItem;
|
||||
class QPainterPath;
|
||||
|
||||
/**
|
||||
@author Peter Dahlberg <pdahlberg@gmail.com>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user