stopper fertig
git-svn-id: http://svn.lsim.tuxzone.org/trunk@21 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
@@ -129,6 +129,7 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) {
|
|||||||
speedListY->append(newspeedY);
|
speedListY->append(newspeedY);
|
||||||
|
|
||||||
if (i%path_entry_step == 0 || i==steps) flightPath.lineTo(newPoint);
|
if (i%path_entry_step == 0 || i==steps) flightPath.lineTo(newPoint);
|
||||||
|
if (myScene->stopsHere(currProbePath->at(i-1),newPoint)) break;
|
||||||
|
|
||||||
}
|
}
|
||||||
qDebug()<< difftime(time(0),start_time);
|
qDebug()<< difftime(time(0),start_time);
|
||||||
|
|||||||
@@ -755,6 +755,7 @@ void SimulScene::startCalculation() {
|
|||||||
//Feld Item Listen erzeugen (viel schneller, als jedes mal items(point) durchlaufen)
|
//Feld Item Listen erzeugen (viel schneller, als jedes mal items(point) durchlaufen)
|
||||||
calcEFieldList.clear();
|
calcEFieldList.clear();
|
||||||
calcBFieldList.clear();
|
calcBFieldList.clear();
|
||||||
|
calcStopperList.clear();
|
||||||
for(int i = 0; i < items().size(); ++i) {
|
for(int i = 0; i < items().size(); ++i) {
|
||||||
//HomoEFieldItems Abarbeiten
|
//HomoEFieldItems Abarbeiten
|
||||||
if (qgraphicsitem_cast<HomoEFieldItem*> (items().at(i)) != 0) {
|
if (qgraphicsitem_cast<HomoEFieldItem*> (items().at(i)) != 0) {
|
||||||
@@ -764,6 +765,10 @@ void SimulScene::startCalculation() {
|
|||||||
if (qgraphicsitem_cast<HomoBFieldItem*> (items().at(i)) != 0) {
|
if (qgraphicsitem_cast<HomoBFieldItem*> (items().at(i)) != 0) {
|
||||||
calcBFieldList << qgraphicsitem_cast<HomoBFieldItem*>(items().at(i));
|
calcBFieldList << qgraphicsitem_cast<HomoBFieldItem*>(items().at(i));
|
||||||
}
|
}
|
||||||
|
//StopperItems Abarbeiten
|
||||||
|
if (qgraphicsitem_cast<StopperItem*> (items().at(i)) != 0) {
|
||||||
|
calcStopperList << qgraphicsitem_cast<StopperItem*>(items().at(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -850,6 +855,17 @@ double SimulScene::getPowerAt(QPointF point, double charge, double speedX, doubl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SimulScene::stopsHere(const QPointF &p1, const QPointF &p2) {
|
||||||
|
QPainterPath myPath(p1);
|
||||||
|
myPath.lineTo(p2);
|
||||||
|
|
||||||
|
for (int i = 0; i< calcStopperList.count(); ++i) {
|
||||||
|
QPainterPath itemPath = calcStopperList.at(i)->mapFromScene(myPath);
|
||||||
|
if (calcStopperList.at(i)->collidesWithPath(itemPath/*,Qt::IntersectsItemShape*/)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
double SimulScene::getMeterPerPx() const {
|
double SimulScene::getMeterPerPx() const {
|
||||||
return meterPerPx;
|
return meterPerPx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class SimulScene : public QGraphicsScene {
|
|||||||
\param xy rückgabe in x oder y-Richtung
|
\param xy rückgabe in x oder y-Richtung
|
||||||
*/
|
*/
|
||||||
double getPowerAt(QPointF point, double charge, double speedX, double speedY, char xy);
|
double getPowerAt(QPointF point, double charge, double speedX, double speedY, char xy);
|
||||||
|
bool stopsHere(const QPointF &p1,const QPointF &p2);
|
||||||
|
|
||||||
QWidget* getProbeDockWidget() const;
|
QWidget* getProbeDockWidget() const;
|
||||||
|
|
||||||
@@ -171,6 +172,7 @@ class SimulScene : public QGraphicsScene {
|
|||||||
|
|
||||||
QList<HomoEFieldItem*> calcEFieldList;
|
QList<HomoEFieldItem*> calcEFieldList;
|
||||||
QList<HomoBFieldItem*> calcBFieldList;
|
QList<HomoBFieldItem*> calcBFieldList;
|
||||||
|
QList<StopperItem*> calcStopperList;
|
||||||
|
|
||||||
static const qreal FieldDefaultZValue = 10.0; //default z-value fuer Felder
|
static const qreal FieldDefaultZValue = 10.0; //default z-value fuer Felder
|
||||||
static const qreal FieldZStep = 1e-10; //schritt, um den der z-index erhoeht wird
|
static const qreal FieldZStep = 1e-10; //schritt, um den der z-index erhoeht wird
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
StopperItem::StopperItem(QPointF start, QPointF end): FieldItem() {
|
StopperItem::StopperItem(QPointF start, QPointF end): FieldItem() {
|
||||||
setLine(QLineF(start,end));
|
setLine(QLineF(start,end));
|
||||||
stopperWidget = new StopperWidget(0,0,this);
|
stopperWidget = new StopperWidget(0,0,this);
|
||||||
setOuterPenWidth (2);
|
setOuterPenWidth (0);
|
||||||
setFlag(ItemIsMovable);
|
setFlag(ItemIsMovable);
|
||||||
setFlag(ItemIsSelectable);
|
setFlag(ItemIsSelectable);
|
||||||
setFlag(ItemIsFocusable);
|
setFlag(ItemIsFocusable);
|
||||||
|
|||||||
Reference in New Issue
Block a user