diff --git a/lsim.kdevelop.pcs b/lsim.kdevelop.pcs index bede536..5b5de97 100644 Binary files a/lsim.kdevelop.pcs and b/lsim.kdevelop.pcs differ diff --git a/lsim.kdevses b/lsim.kdevses index 2e62509..fc1be8b 100644 --- a/lsim.kdevses +++ b/lsim.kdevses @@ -1,19 +1,25 @@ - + - + - + - + + + + + + + diff --git a/lsim.tag b/lsim.tag index 7a3f672..096d24e 100644 --- a/lsim.tag +++ b/lsim.tag @@ -252,6 +252,26 @@ [] + + moc_graphicsellipseitem.cpp + /mnt/sdb1/c++/lsim/src/ + moc__graphicsellipseitem_8cpp + graphicsellipseitem.h + + static QT_BEGIN_MOC_NAMESPACE const uint + qt_meta_data_GraphicsEllipseItem + moc__graphicsellipseitem_8cpp.html + 7a420d39c97f6c6a807b8b13097760c2 + [] + + + static const char + qt_meta_stringdata_GraphicsEllipseItem + moc__graphicsellipseitem_8cpp.html + ec943eb354cf5c270edb9ae531f4bcf6 + [] + + moc_graphicsview.cpp /mnt/sdb1/c++/lsim/src/ @@ -570,6 +590,20 @@ 72fd535bd8226c8d6957c61f8b540533 () const + + void + setDisplayDecimals + classExpDoubleSpinBox.html + 8db051482a63d8a8ca78d230e93f7880 + (int theValue) + + + int + getDisplayDecimals + classExpDoubleSpinBox.html + 43ab08ed497441e3ea23b96e4ad9e1a6 + () const + virtual QDoubleSpinBox::StepEnabled stepEnabled @@ -591,6 +625,13 @@ b5b74897fb840c451265e2aac1f2fbd4 + + int + displayDecimals + classExpDoubleSpinBox.html + afad6f01498806cbb460d729eec53faf + + FieldItem @@ -763,6 +804,13 @@ 4642adc434298f0fc0c9f5e9e75666ed (QGraphicsItem *item) + + virtual void + wheelEvent + classFieldItem.html + 10c79fa0b47e07e35e276e85d58e0878 + (QGraphicsSceneWheelEvent *event) + QPointF myScenePos @@ -792,8 +840,8 @@ void calculateProbePath classGraphicsEllipseItem.html - 2cdad5fc83d96af73ae8c136b53e5fe1 - (QPointF startPoint=QPointF(0, 0), double startSpeedX=0, double startSpeedY=0) + 6a2deb321fc5196c441a8f8b89b43fb4 + (QPointF startPoint=QPointF(0, 0)) void @@ -802,26 +850,103 @@ 7230ec257dd669949e9d3ada7a51923a (const double &theValue) - - double - getMasse - classGraphicsEllipseItem.html - edd61d768890e05097cac9285ff63aba - (double speed) - void setCharge classGraphicsEllipseItem.html - fb65dbef1a6c2a46d43957655e6c3942 - (const long double &theValue) + 1d5b324628b73a3da5b0c864cf8630a5 + (const double &theValue) - long double - getCharge + void + setStartSpeedX classGraphicsEllipseItem.html - 1f873b91eb795f77342cba8430bc0dd5 - () const + 3a90229a6cd448ad8c2ecc1c173c214a + (double theValue) + + + void + setStartSpeedY + classGraphicsEllipseItem.html + 776b2265625e4ef50afad2f5d3e9b9a7 + (double theValue) + + + void + setScenePosY + classGraphicsEllipseItem.html + 2076f345c5b2841953809e665e22ceb5 + (double newPosY) + + + void + setScenePosX + classGraphicsEllipseItem.html + 3ffee0531e48adc8f9d9fef0db79473d + (double newPosX) + + + void + handleSceneChange + classGraphicsEllipseItem.html + cc5753c7193a85cb7e3fc69aeed7df11 + (const QList< QRectF > &) + + + void + setFlightPath + classGraphicsEllipseItem.html + e8c50bea63a7e0a4e4cb80cab277906b + (const QPainterPath &theValue) + + + void + startSpeedXChanged + classGraphicsEllipseItem.html + 84901ac57b2171f9a0df5a0863332fe3 + (double speed) + + + void + startSpeedYChanged + classGraphicsEllipseItem.html + 772b99820f776f62156f5caf8af22b2e + (double speed) + + + void + masseChanged + classGraphicsEllipseItem.html + b2fe738f18ee90d63d09b575c356dadb + (double masse) + + + void + chargeChanged + classGraphicsEllipseItem.html + 7a6cb698db7b4bed7386df3d9f60b6fb + (double Charge) + + + void + ScenePosChanged + classGraphicsEllipseItem.html + 754ecb303588efafc1bc6e17e701358c + (QPointF newpos) + + + void + ScenePosXChanged + classGraphicsEllipseItem.html + abcdcc33150b34498a7b8da26d044c5b + (double newX) + + + void + ScenePosYChanged + classGraphicsEllipseItem.html + 5aeccf41db0391d25f2da1357986c479 + (double newY) @@ -851,6 +976,41 @@ 130f0b45e6fe641c29928e51b468418b () + + double + getCharge + classGraphicsEllipseItem.html + 201122c3425a9cd56b9213d6968bd3f6 + () const + + + double + getStartSpeedX + classGraphicsEllipseItem.html + 9f04be533240195d2dc87244262f1808 + () const + + + double + getStartSpeedY + classGraphicsEllipseItem.html + e2fff1f0c10a454b6f9b7695d1ee4b39 + () const + + + double + getMasse + classGraphicsEllipseItem.html + edd61d768890e05097cac9285ff63aba + (double speed) + + + QPainterPath + getFlightPath + classGraphicsEllipseItem.html + 2e652c4e80a854b57ae6fc765ed77920 + () const + void mousePressEvent @@ -907,6 +1067,34 @@ afa81f63289aa4d4624f38015b37d643 + + double + startSpeedX + classGraphicsEllipseItem.html + 72602152d2a445aad22958cc816f1308 + + + + double + startSpeedY + classGraphicsEllipseItem.html + 2aab36c74f1e052f672ef50a5fcab2a4 + + + + QPointF + myScenePos + classGraphicsEllipseItem.html + 032ca02363fb03fd2a778ea109133250 + + + + QPainterPath + flightPath + classGraphicsEllipseItem.html + e498c2f89012d31c2c12f3a4c6e9154e + + GraphicsView @@ -983,6 +1171,13 @@ 6a5ecd467c67a3a358bfe853dd19335f (bool theValue) + + void + setFluxDensity + classHomoBFieldItem.html + 5fc3191fef621a3c3d3e239f338ae347 + (double theValue) + void directionChanged @@ -990,6 +1185,13 @@ 432f975078b7fddcf1e2a470491d8e10 (bool theValue) + + void + fluxDensityChanged + classHomoBFieldItem.html + 911669c9afda72705b801ab2d4745163 + (double theValue) + HomoBFieldItem @@ -1060,6 +1262,20 @@ efb3cf5f1132b110f698519878afdc76 () const + + double + getFluxDensity + classHomoBFieldItem.html + 7310d5af24b8a1f1955db694f3638fe6 + () const + + + void + wheelEvent + classHomoBFieldItem.html + 0a75d5844cf88d92d3ec8a09434d798e + (QGraphicsSceneWheelEvent *event) + int fieldLineDistance @@ -1088,6 +1304,13 @@ 35bec97190b75fa64b7876533c4ef8a5 + + double + fluxDensity + classHomoBFieldItem.html + caf386ad7e2013f9a9ee32df346da659 + + HomoBFieldWidget @@ -1513,6 +1736,13 @@ 9546761515a2022d7a29c570fd6fa1d6 + + QAction * + timerStop + structlsim_1_1Actions.html + e21383d2adcb3d34d4b631b7b130da53 + + QAction * itemEditModeAct @@ -1620,6 +1850,13 @@ b3adfc8c3b2313c9c80414e0ac3ba6b2 () + + void + stopTimer + classSimulScene.html + e586360d85b6eea44cb7def1a2b3ab8a + () + void deleteSelectedFieldItems @@ -1662,6 +1899,13 @@ 501a15eebf6fdb98bff8984a370c3197 () const + + void + setFlightPathVisible + classSimulScene.html + e5957131232c8d3139975f909f49b43c + (bool visible=true) + void sceneModeChanged @@ -1690,6 +1934,13 @@ e2a1abff3b5f2b7f1fdc7d97d39a7e41 (double meterPerPx) + + void + flightPathVisibilityChanged + classSimulScene.html + 8cb739462a0a96f444f046187e3f09c3 + (bool visible) + SimulScene @@ -1729,8 +1980,8 @@ double getPowerAt classSimulScene.html - 31ffa4052da42a3b5b193e9dde0e1e1c - (QPointF point, double charge, char xy) + a50c6c3080a5103b0c404a8eb903fdfc + (QPointF point, double charge, double speedX, double speedY, char xy) QWidget * @@ -1739,6 +1990,13 @@ db0106ca0245b674a71c50c93e901df3 () const + + bool + getFlightPathShouldBeVisible + classSimulScene.html + c54f4ebbd92179d82efe817fe3a6060d + () const + void mousePressEvent @@ -1802,6 +2060,13 @@ cc0c5530431faa20ed6334ff621b7f19 + + bool + flightPathShouldBeVisible + classSimulScene.html + 47000919efbe8cd348cdaffdbd35fabe + + SceneMode myMode @@ -1879,6 +2144,13 @@ fbc2ba594bd06cb4581d4c649ddf9efb + + QGraphicsPathItem * + pathItem1 + classSimulScene.html + fad34d48dea97fe1050a503fa07c2c97 + + resizeRects reRects diff --git a/src/graphicsellipseitem.cpp b/src/graphicsellipseitem.cpp index 66663ae..91ddbe2 100644 --- a/src/graphicsellipseitem.cpp +++ b/src/graphicsellipseitem.cpp @@ -94,12 +94,16 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) { //startpunkt in den Pfad setzen flightPath = QPainterPath(startPoint); - + int debugTime = 0; + time_t start_time = time(0); 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) ) ); //qDebug()<< myMasse; + time_t timeb = time(0); double powerX = myScene->getPowerAt(currProbePath->at(i-1), charge, speedListX->at(i-1),speedListY->at(i-1), 'x'); double powerY = myScene->getPowerAt(currProbePath->at(i-1), charge, speedListX->at(i-1),speedListY->at(i-1), 'y'); + time_t timea = time(0); + debugTime += difftime(timea,timeb); double newspeedX = speedListX->at(i-1) + (powerX/myMasse * (timePerStep/1000.0)); double newspeedY = speedListY->at(i-1) + (powerY/myMasse * (timePerStep/1000.0)); @@ -121,15 +125,17 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) { currProbePath->append(newPoint); speedListX->append(newspeedX); speedListY->append(newspeedY); - /*if(i%10 == 0)*/ flightPath.lineTo(newPoint); + flightPath.lineTo(newPoint); } + qDebug()<< difftime(time(0),start_time); + qDebug()<< debugTime; - qDebug()<< "Probe Path: " <<*currProbePath; - qDebug()<< "speed x: "<<*speedListX; - qDebug()<< "speed y: "<<*speedListY; - qDebug()<at(12); + //qDebug()<< "Probe Path: " <<*currProbePath; + //qDebug()<< "speed x: "<<*speedListX; + //qDebug()<< "speed y: "<<*speedListY; + //qDebug()<at(12); //qDebug()<<"power x: "<< (double)myScene->getPowerAt(QPointF(0,0), charge, 'x'); //qDebug()<<"power y: " << (double)myScene->getPowerAt(QPointF(0,0), charge, 'y'); @@ -137,7 +143,7 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) { double GraphicsEllipseItem::getMasse(double speed) { - if(speed == 0) return masse; + if(speed < SPEED_OF_LIGHT/10.0) return masse; else { return masse / (sqrt(1- ( (speed/SPEED_OF_LIGHT)*(speed/SPEED_OF_LIGHT)))); diff --git a/src/homobfielditem.cpp b/src/homobfielditem.cpp index 87d11cf..d87a082 100644 --- a/src/homobfielditem.cpp +++ b/src/homobfielditem.cpp @@ -54,7 +54,8 @@ QRectF HomoBFieldItem::getRectF() const } void HomoBFieldItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { - Qt::GlobalColor linecolor = Qt::red; + //Qt::GlobalColor linecolor = Qt::red; + QColor linecolor(92,105,118); painter->setPen(linecolor); if (isSelected()) painter->setBrush(Qt::Dense6Pattern); //selection deutlich machen painter->drawRect(sizeRect); diff --git a/src/simulscene.cpp b/src/simulscene.cpp index a473644..60ee700 100644 --- a/src/simulscene.cpp +++ b/src/simulscene.cpp @@ -40,7 +40,7 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) { //variablen initialisieren setTimePerStep(0.00001); - setSteps(1000); + setSteps(21234); //setMeterPerPx(1/1000.0); setMeterPerPx(1); @@ -52,7 +52,11 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) { createResizeRects(); //path Item Erstellen - pathItem1 = addPath(QPainterPath()); + pathItem1 = addPath(QPainterPath(), QPen(QColor(255,137,11), 1, Qt::SolidLine)); + pathItem1->setZValue(100); + //pathItem1->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + + setFlightPathVisible(); addLine(0,-298,0,298,QPen(Qt::green, 1, Qt::SolidLine) )->setCacheMode(QGraphicsItem::DeviceCoordinateCache); @@ -77,7 +81,7 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) { ellipse1->setRect(-2,-2,5,5); ellipse1->setPen(Qt::NoPen); ellipse1->setBrush(Qt::red); - ellipse1->setZValue(1); + ellipse1->setZValue(200); //ellipse1->scale(4,4); ellipse1->setAcceptDrops(true); connect(this,SIGNAL(changed(QList)),ellipse1,SLOT(handleSceneChange(QList))); @@ -98,14 +102,8 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) { } void SimulScene::startTimer() { + timer->setCurrentTime(0); - ani->clear(); - int currSteps = ellipse1->getCurrProbePath()->count(); - for (int i=0; isetPosAt(i/200.0, QPointF(x , 0.5 * ay * pow(( (x/1000) /vx),2) *1000 )); - ani->setPosAt(i/(double)currSteps, ellipse1->getCurrProbePath()->at(i) ); - //qDebug()<< getSteps(); - } timer->start(); } void SimulScene::stopTimer() { @@ -587,8 +585,24 @@ void SimulScene::setTimePerStep(double time) { \fn SimulScene::startCalculation() */ void SimulScene::startCalculation() { + pathItem1->setPath(QPainterPath()); ellipse1->calculateProbePath(ellipse1->pos()); pathItem1->setPath(ellipse1->getFlightPath()); + + //animationspfad berechnen + time_t anitimeb = time(0); + ani->clear(); + int currSteps = ellipse1->getCurrProbePath()->count(); + int entry_step = ceil(currSteps/2500.0); //jeder entry_step(te) step wird eingetragen + for (int i=0; isetPosAt(i/(double)currSteps, ellipse1->getCurrProbePath()->at(i) ); + } + //qDebug()<< getSteps(); + } + time_t anitimea = time(0); + qDebug()<< "animationszeit" <