Pfandanzeige

git-svn-id: http://svn.lsim.tuxzone.org/trunk@12 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
catdog2
2008-11-11 20:31:04 +00:00
parent c8ca381faa
commit 9730481953
10 changed files with 64 additions and 80 deletions

View File

@@ -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;
}