edit mode/simul mode
git-svn-id: http://svn.lsim.tuxzone.org/trunk@23 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
Binary file not shown.
25
lsim.kdevses
25
lsim.kdevses
@@ -1,28 +1,37 @@
|
|||||||
<?xml version = '1.0' encoding = 'UTF-8'?>
|
<?xml version = '1.0' encoding = 'UTF-8'?>
|
||||||
<!DOCTYPE KDevPrjSession>
|
<!DOCTYPE KDevPrjSession>
|
||||||
<KDevPrjSession>
|
<KDevPrjSession>
|
||||||
<DocsAndViews NumberOfDocuments="7" >
|
<DocsAndViews NumberOfDocuments="10" >
|
||||||
<Doc0 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.h" >
|
<Doc0 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.h" >
|
||||||
<View0 Encoding="" line="55" Type="Source" />
|
<View0 Encoding="" line="45" Type="Source" />
|
||||||
</Doc0>
|
</Doc0>
|
||||||
<Doc1 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.cpp" >
|
<Doc1 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.cpp" >
|
||||||
<View0 Encoding="" line="312" Type="Source" />
|
<View0 Encoding="" line="116" Type="Source" />
|
||||||
</Doc1>
|
</Doc1>
|
||||||
<Doc2 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsellipseitem.h" >
|
<Doc2 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsellipseitem.h" >
|
||||||
<View0 Encoding="" line="32" Type="Source" />
|
<View0 Encoding="" Type="Source" />
|
||||||
</Doc2>
|
</Doc2>
|
||||||
<Doc3 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsellipseitem.cpp" >
|
<Doc3 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsellipseitem.cpp" >
|
||||||
<View0 Encoding="" line="134" Type="Source" />
|
<View0 Encoding="" line="126" Type="Source" />
|
||||||
</Doc3>
|
</Doc3>
|
||||||
<Doc4 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.h" >
|
<Doc4 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.h" >
|
||||||
<View0 Encoding="" Type="Source" />
|
<View0 Encoding="" line="61" Type="Source" />
|
||||||
</Doc4>
|
</Doc4>
|
||||||
<Doc5 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.cpp" >
|
<Doc5 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.cpp" >
|
||||||
<View0 Encoding="" line="387" Type="Source" />
|
<View0 Encoding="" line="241" Type="Source" />
|
||||||
</Doc5>
|
</Doc5>
|
||||||
<Doc6 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/probechargewidget.cpp" >
|
<Doc6 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/probechargewidget.cpp" >
|
||||||
<View0 Encoding="" line="24" Type="Source" />
|
<View0 Encoding="" line="114" Type="Source" />
|
||||||
</Doc6>
|
</Doc6>
|
||||||
|
<Doc7 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/stopperitem.h" >
|
||||||
|
<View0 Encoding="" line="31" Type="Source" />
|
||||||
|
</Doc7>
|
||||||
|
<Doc8 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/stopperitem.cpp" >
|
||||||
|
<View0 Encoding="" line="33" Type="Source" />
|
||||||
|
</Doc8>
|
||||||
|
<Doc9 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/constants.h" >
|
||||||
|
<View0 Encoding="" line="26" Type="Source" />
|
||||||
|
</Doc9>
|
||||||
</DocsAndViews>
|
</DocsAndViews>
|
||||||
<pluginList>
|
<pluginList>
|
||||||
<kdevdebugger>
|
<kdevdebugger>
|
||||||
|
|||||||
@@ -124,12 +124,14 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) {
|
|||||||
|
|
||||||
QPointF newPoint(currProbePath->at(i-1).x() + deltaDistX/meterPerPx ,currProbePath->at(i-1).y() + deltaDistY/meterPerPx);
|
QPointF newPoint(currProbePath->at(i-1).x() + deltaDistX/meterPerPx ,currProbePath->at(i-1).y() + deltaDistY/meterPerPx);
|
||||||
|
|
||||||
|
if (myScene->stopsHere(currProbePath->at(i-1),newPoint)) break;
|
||||||
|
|
||||||
currProbePath->append(newPoint);
|
currProbePath->append(newPoint);
|
||||||
speedListX->append(newspeedX);
|
speedListX->append(newspeedX);
|
||||||
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);
|
||||||
|
|||||||
218
src/lsim.cpp
218
src/lsim.cpp
@@ -48,6 +48,7 @@ lsim::lsim() {
|
|||||||
createToolBars();
|
createToolBars();
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
createDocks();
|
createDocks();
|
||||||
|
setMode(EditMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lsim::closeEvent (QCloseEvent *event) {
|
void lsim::closeEvent (QCloseEvent *event) {
|
||||||
@@ -161,6 +162,24 @@ void lsim::createActions() {
|
|||||||
connect (modeChangeActGroup, SIGNAL (triggered(QAction*)), this, SLOT (actModeSwitcher(QAction*)));
|
connect (modeChangeActGroup, SIGNAL (triggered(QAction*)), this, SLOT (actModeSwitcher(QAction*)));
|
||||||
connect (simulscene, SIGNAL(sceneModeChanged(int)) , this, SLOT(setSceneMode(int)));
|
connect (simulscene, SIGNAL(sceneModeChanged(int)) , this, SLOT(setSceneMode(int)));
|
||||||
|
|
||||||
|
|
||||||
|
//Window Mode
|
||||||
|
acts.editModeAct = new QAction (tr ("Edit Mode"), this);
|
||||||
|
acts.editModeAct->setStatusTip (tr ("Edit Mode"));
|
||||||
|
acts.editModeAct->setCheckable(true);
|
||||||
|
acts.editModeAct->setData(QVariant(lsim::EditMode));
|
||||||
|
|
||||||
|
acts.simulationModeAct = new QAction (tr ("Simulation Mode"), this);
|
||||||
|
acts.simulationModeAct->setStatusTip (tr ("Simulation Mode"));
|
||||||
|
acts.simulationModeAct->setCheckable(true);
|
||||||
|
acts.simulationModeAct->setData(QVariant(lsim::SimulationMode));
|
||||||
|
|
||||||
|
windowModeActGroup = new QActionGroup(this);
|
||||||
|
windowModeActGroup->addAction(acts.editModeAct);
|
||||||
|
windowModeActGroup->addAction(acts.simulationModeAct);
|
||||||
|
connect (windowModeActGroup, SIGNAL (triggered(QAction*)), this, SLOT (actWindowModeSwitcher(QAction*)));
|
||||||
|
//connect (simulscene, SIGNAL(sceneModeChanged(int)) , this, SLOT(setSceneMode(int)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lsim::createMenus() {
|
void lsim::createMenus() {
|
||||||
@@ -183,28 +202,76 @@ void lsim::createMenus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void lsim::createToolBars() {
|
void lsim::createToolBars() {
|
||||||
fileToolBar = addToolBar (tr ("File"));
|
windowModeBar = new QToolBar(tr("Modus"));
|
||||||
fileToolBar->addAction(acts.calculate);
|
windowModeBar->addAction(acts.editModeAct);
|
||||||
fileToolBar->addSeparator();
|
windowModeBar->addAction(acts.simulationModeAct);
|
||||||
fileToolBar->addAction(acts.timerStart);
|
|
||||||
fileToolBar->addAction(acts.timerStop);
|
|
||||||
|
|
||||||
editToolBar = addToolBar (tr ("Edit"));
|
timerControlBar = new QToolBar (tr ("Timer"));
|
||||||
|
timerControlBar->addAction(acts.timerStart);
|
||||||
|
timerControlBar->addAction(acts.timerStop);
|
||||||
|
|
||||||
editToolBar->addAction(acts.itemEditModeAct);
|
sceneModeBar = new QToolBar (tr ("Edit"));
|
||||||
editToolBar->addAction(acts.insertEFieldItemAct);
|
sceneModeBar->addAction(acts.itemEditModeAct);
|
||||||
editToolBar->addAction(acts.insertBFieldItemAct);
|
sceneModeBar->addAction(acts.insertEFieldItemAct);
|
||||||
editToolBar->addAction(acts.insertStopperItemAct);
|
sceneModeBar->addAction(acts.insertBFieldItemAct);
|
||||||
editToolBar->addAction(acts.probeChargeItemPlaceAct);
|
sceneModeBar->addAction(acts.insertStopperItemAct);
|
||||||
|
sceneModeBar->addAction(acts.probeChargeItemPlaceAct);
|
||||||
|
|
||||||
upDownToolBar=addToolBar(tr("updown"));
|
upDownBar = new QToolBar(tr("Feldanordnungsreihenfolge"));
|
||||||
upDownToolBar->addAction(acts.moveItemOnBottom);
|
upDownBar->addAction(acts.moveItemOnBottom);
|
||||||
upDownToolBar->addAction(acts.moveItemDown);
|
upDownBar->addAction(acts.moveItemDown);
|
||||||
upDownToolBar->addAction(acts.moveItemUp);
|
upDownBar->addAction(acts.moveItemUp);
|
||||||
upDownToolBar->addAction(acts.moveItemOnTop);
|
upDownBar->addAction(acts.moveItemOnTop);
|
||||||
|
|
||||||
|
addToolBar(windowModeBar);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lsim::initWindowMode(WindowMode newMode) {
|
||||||
|
removeToolBar(timerControlBar);
|
||||||
|
removeToolBar(sceneModeBar);
|
||||||
|
removeToolBar(upDownBar);
|
||||||
|
removeDockWidget(fieldItemEditDock);
|
||||||
|
removeDockWidget(probeItemDock);
|
||||||
|
removeDockWidget(sceneDock);
|
||||||
|
removeDockWidget(simulOptDock);
|
||||||
|
gview->setDragMode(QGraphicsView::NoDrag);
|
||||||
|
gview->setInteractive(true);
|
||||||
|
if (newMode == lsim::EditMode) {
|
||||||
|
simulscene->clearFlightPath();
|
||||||
|
acts.timerStop->trigger();
|
||||||
|
sceneModeBar->setVisible(true);
|
||||||
|
upDownBar->setVisible(true);
|
||||||
|
fieldItemEditDock->setVisible(true);
|
||||||
|
probeItemDock->setVisible(true);
|
||||||
|
sceneDock->setVisible(true);
|
||||||
|
|
||||||
|
addToolBar(sceneModeBar);
|
||||||
|
addToolBar(upDownBar);
|
||||||
|
addDockWidget(Qt::LeftDockWidgetArea,fieldItemEditDock);
|
||||||
|
addDockWidget(Qt::LeftDockWidgetArea,probeItemDock);
|
||||||
|
addDockWidget(Qt::LeftDockWidgetArea,sceneDock);
|
||||||
|
tabifyDockWidget(probeItemDock,fieldItemEditDock);
|
||||||
|
tabifyDockWidget(fieldItemEditDock, sceneDock);
|
||||||
|
|
||||||
|
} else if (newMode == lsim::SimulationMode) {
|
||||||
|
timerControlBar->setVisible(true);
|
||||||
|
addToolBar(timerControlBar);
|
||||||
|
gview->setDragMode(QGraphicsView::ScrollHandDrag);
|
||||||
|
gview->setInteractive (false);
|
||||||
|
|
||||||
|
addDockWidget(Qt::LeftDockWidgetArea,simulOptDock);
|
||||||
|
simulOptDock->setVisible(true);
|
||||||
|
|
||||||
|
acts.itemEditModeAct->trigger();
|
||||||
|
simulscene->clearSelection();
|
||||||
|
acts.calculate->trigger();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void lsim::createStatusBar() {
|
void lsim::createStatusBar() {
|
||||||
statusBar()->showMessage (tr ("Willkommen zu lsim"));
|
statusBar()->showMessage (tr ("Willkommen zu lsim"));
|
||||||
}
|
}
|
||||||
@@ -247,6 +314,41 @@ void lsim::createDocks() {
|
|||||||
connect(meter_per_px_box, SIGNAL(valueChanged(double)),simulscene, SLOT(setMeterPerPx(double)));
|
connect(meter_per_px_box, SIGNAL(valueChanged(double)),simulscene, SLOT(setMeterPerPx(double)));
|
||||||
connect(simulscene, SIGNAL(meterPerPxChanged(double)),meter_per_px_box, SLOT(setValue( double )));
|
connect(simulscene, SIGNAL(meterPerPxChanged(double)),meter_per_px_box, SLOT(setValue( double )));
|
||||||
|
|
||||||
|
//description labels
|
||||||
|
QLabel *time_per_step_label = new QLabel(tr("Zeit pro Schritt:"));
|
||||||
|
QLabel *steps_label = new QLabel(tr("Schritte:"));
|
||||||
|
QLabel *meter_per_pixel_label = new QLabel(tr("Ein Pixel entspricht:"));
|
||||||
|
|
||||||
|
//Scene settings Layout
|
||||||
|
QGridLayout *sceneGridLayout = new QGridLayout;
|
||||||
|
sceneGridLayout->addWidget(steps_label,0,0,Qt::AlignRight);
|
||||||
|
sceneGridLayout->addWidget(steps_box,0,1);
|
||||||
|
sceneGridLayout->addWidget(time_per_step_label,1,0,Qt::AlignRight);
|
||||||
|
sceneGridLayout->addWidget(time_step_box,1,1);
|
||||||
|
sceneGridLayout->addWidget(meter_per_pixel_label,2,0,Qt::AlignRight);
|
||||||
|
sceneGridLayout->addWidget(meter_per_px_box,2,1);
|
||||||
|
|
||||||
|
|
||||||
|
QGroupBox *sceneGroupBox = new QGroupBox(tr("Allgemeines"));
|
||||||
|
sceneGroupBox->setLayout(sceneGridLayout);
|
||||||
|
|
||||||
|
QVBoxLayout *allgVBoxLayout = new QVBoxLayout();
|
||||||
|
allgVBoxLayout->addWidget(sceneGroupBox);
|
||||||
|
allgVBoxLayout->addStretch();
|
||||||
|
|
||||||
|
QWidget *allgWidget = new QWidget;
|
||||||
|
allgWidget->setLayout(allgVBoxLayout);
|
||||||
|
|
||||||
|
sceneDock = new QDockWidget(tr("Allgemeines"), this);
|
||||||
|
sceneDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||||
|
sceneDock->setWidget((allgWidget));
|
||||||
|
//sceneDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
|
//addDockWidget(Qt::LeftDockWidgetArea, sceneDock);
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//FlugbahnAnzeigeBox
|
//FlugbahnAnzeigeBox
|
||||||
QCheckBox *flight_path_box = new QCheckBox("");
|
QCheckBox *flight_path_box = new QCheckBox("");
|
||||||
flight_path_box->setChecked(simulscene->isFlightPathVisible());
|
flight_path_box->setChecked(simulscene->isFlightPathVisible());
|
||||||
@@ -264,49 +366,39 @@ void lsim::createDocks() {
|
|||||||
|
|
||||||
|
|
||||||
//description labels
|
//description labels
|
||||||
QLabel *time_per_step_label = new QLabel(tr("Zeit pro Schritt:"));
|
|
||||||
QLabel *steps_label = new QLabel(tr("Schritte:"));
|
|
||||||
QLabel *meter_per_pixel_label = new QLabel(tr("Ein Pixel entspricht:"));
|
|
||||||
QLabel *flight_path_label = new QLabel(tr("Flugbahn anzeigen:"));
|
QLabel *flight_path_label = new QLabel(tr("Flugbahn anzeigen:"));
|
||||||
QLabel *timer_label = new QLabel(tr("L\344nge der Animation:"));
|
QLabel *timer_label = new QLabel(tr("L\344nge der Animation:"));
|
||||||
|
|
||||||
//Scene settings Layout
|
//grid layout
|
||||||
QGridLayout *sceneGridLayout = new QGridLayout;
|
QGridLayout *simulOptGridLayout = new QGridLayout;
|
||||||
sceneGridLayout->addWidget(steps_label,0,0,Qt::AlignRight);
|
simulOptGridLayout->addWidget(flight_path_label,3,0,Qt::AlignRight);
|
||||||
sceneGridLayout->addWidget(steps_box,0,1);
|
simulOptGridLayout->addWidget(flight_path_box,3,1);
|
||||||
sceneGridLayout->addWidget(time_per_step_label,1,0,Qt::AlignRight);
|
simulOptGridLayout->addWidget(timer_label,4,0,Qt::AlignRight);
|
||||||
sceneGridLayout->addWidget(time_step_box,1,1);
|
simulOptGridLayout->addWidget(timer_box,4,1);
|
||||||
sceneGridLayout->addWidget(meter_per_pixel_label,2,0,Qt::AlignRight);
|
|
||||||
sceneGridLayout->addWidget(meter_per_px_box,2,1);
|
|
||||||
sceneGridLayout->addWidget(flight_path_label,3,0,Qt::AlignRight);
|
|
||||||
sceneGridLayout->addWidget(flight_path_box,3,1);
|
|
||||||
sceneGridLayout->addWidget(timer_label,4,0,Qt::AlignRight);
|
|
||||||
sceneGridLayout->addWidget(timer_box,4,1);
|
|
||||||
|
|
||||||
QGroupBox *sceneGroupBox = new QGroupBox(tr("Allgemeines"));
|
QGroupBox *simulOptGroupBox = new QGroupBox(tr("Allgemeines"));
|
||||||
sceneGroupBox->setLayout(sceneGridLayout);
|
simulOptGroupBox->setLayout(simulOptGridLayout);
|
||||||
|
|
||||||
QVBoxLayout *allgVBoxLayout = new QVBoxLayout();
|
QVBoxLayout *simulOptVBoxLayout = new QVBoxLayout();
|
||||||
allgVBoxLayout->addWidget(sceneGroupBox);
|
simulOptVBoxLayout->addWidget(simulOptGroupBox);
|
||||||
allgVBoxLayout->addStretch();
|
simulOptVBoxLayout->addStretch();
|
||||||
|
|
||||||
QWidget *allgWidget = new QWidget;
|
QWidget *simulOptWidget = new QWidget;
|
||||||
allgWidget->setLayout(allgVBoxLayout);
|
simulOptWidget->setLayout(simulOptVBoxLayout);
|
||||||
|
|
||||||
sceneDock = new QDockWidget(tr("Allgemeines"), this);
|
simulOptDock = new QDockWidget(tr("Allgemeines"), this);
|
||||||
sceneDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
|
simulOptDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||||
sceneDock->setWidget((allgWidget));
|
simulOptDock->setWidget(simulOptWidget);
|
||||||
//sceneDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, sceneDock);
|
//************************************************************************
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
fieldItemEditDock = new QDockWidget(tr("Feldeinstellungen"), this);
|
fieldItemEditDock = new QDockWidget(tr("Feldeinstellungen"), this);
|
||||||
fieldItemEditDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
|
fieldItemEditDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||||
fieldItemEditDock->setWidget(new QWidget);
|
fieldItemEditDock->setWidget(new QWidget);
|
||||||
//fieldItemEditDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
//fieldItemEditDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, fieldItemEditDock);
|
//addDockWidget(Qt::LeftDockWidgetArea, fieldItemEditDock);
|
||||||
connect (simulscene, SIGNAL(selectionChanged ()) , this, SLOT(updateDockFieldWidget()));
|
connect (simulscene, SIGNAL(selectionChanged ()) , this, SLOT(updateDockFieldWidget()));
|
||||||
updateDockFieldWidget();
|
updateDockFieldWidget();
|
||||||
|
|
||||||
@@ -314,12 +406,12 @@ void lsim::createDocks() {
|
|||||||
probeItemDock = new QDockWidget(tr("Probleladung"), this);
|
probeItemDock = new QDockWidget(tr("Probleladung"), this);
|
||||||
probeItemDock->setWidget(simulscene->getProbeDockWidget());
|
probeItemDock->setWidget(simulscene->getProbeDockWidget());
|
||||||
//probeItemDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
//probeItemDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, probeItemDock);
|
//addDockWidget(Qt::LeftDockWidgetArea, probeItemDock);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tabifyDockWidget(probeItemDock,fieldItemEditDock);
|
//tabifyDockWidget(probeItemDock,fieldItemEditDock);
|
||||||
tabifyDockWidget(fieldItemEditDock, sceneDock);
|
//tabifyDockWidget(fieldItemEditDock, sceneDock);
|
||||||
setDockOptions(QMainWindow::VerticalTabs);
|
setDockOptions(QMainWindow::VerticalTabs);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -328,6 +420,10 @@ void lsim::actModeSwitcher(QAction *action) {
|
|||||||
simulscene->setSceneMode((SimulScene::SceneMode)action->data().toInt());
|
simulscene->setSceneMode((SimulScene::SceneMode)action->data().toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lsim::actWindowModeSwitcher(QAction *action) {
|
||||||
|
setMode((lsim::WindowMode)action->data().toInt());
|
||||||
|
}
|
||||||
|
|
||||||
void lsim::setSceneMode(int mode) {
|
void lsim::setSceneMode(int mode) {
|
||||||
for (int i=0;i < modeChangeActGroup->actions().count();++i){ //nur das aktuelle checked setzen
|
for (int i=0;i < modeChangeActGroup->actions().count();++i){ //nur das aktuelle checked setzen
|
||||||
if(modeChangeActGroup->actions().at(i)->data().toInt() == mode) {
|
if(modeChangeActGroup->actions().at(i)->data().toInt() == mode) {
|
||||||
@@ -337,6 +433,8 @@ void lsim::setSceneMode(int mode) {
|
|||||||
modeChangeActGroup->actions().at(i)->setChecked(false);
|
modeChangeActGroup->actions().at(i)->setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//Problem mit resizeRects, warum auch immer :(
|
//Problem mit resizeRects, warum auch immer :(
|
||||||
//je nach sceneMode den cursor eintellen
|
//je nach sceneMode den cursor eintellen
|
||||||
@@ -425,4 +523,24 @@ void lsim::handleUpDownActionChanges() {
|
|||||||
acts.moveItemDown->setEnabled(true);
|
acts.moveItemDown->setEnabled(true);
|
||||||
acts.moveItemOnBottom->setEnabled(true);
|
acts.moveItemOnBottom->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lsim::WindowMode lsim::getMode() const {
|
||||||
|
return myMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void lsim::setMode ( const WindowMode& theValue ) {
|
||||||
|
//if(myMode == theValue) return;
|
||||||
|
myMode = theValue;
|
||||||
|
initWindowMode(theValue);
|
||||||
|
for (int i=0;i < windowModeActGroup->actions().count();++i){ //nur das aktuelle checked setzen
|
||||||
|
if(windowModeActGroup->actions().at(i)->data().toInt() == myMode) {
|
||||||
|
windowModeActGroup->actions().at(i)->setChecked(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
windowModeActGroup->actions().at(i)->setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit windowModeChanged(theValue);
|
||||||
|
}
|
||||||
|
|||||||
25
src/lsim.h
25
src/lsim.h
@@ -43,21 +43,30 @@ class lsim: public QMainWindow {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum WindowMode {EditMode,SimulationMode};
|
||||||
lsim();
|
lsim();
|
||||||
~lsim();
|
~lsim();
|
||||||
|
|
||||||
|
void setMode ( const WindowMode& theValue );
|
||||||
|
|
||||||
|
|
||||||
|
lsim::WindowMode getMode() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent (QCloseEvent *event);
|
void closeEvent (QCloseEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void about();
|
void about();
|
||||||
void actModeSwitcher(QAction *action);
|
void actModeSwitcher(QAction *action);
|
||||||
|
void actWindowModeSwitcher(QAction *action);
|
||||||
void setSceneMode(int mode);
|
void setSceneMode(int mode);
|
||||||
void updateDockFieldWidget();
|
void updateDockFieldWidget();
|
||||||
void startCalculation();
|
void startCalculation();
|
||||||
void startTimer();
|
void startTimer();
|
||||||
void handleDockLocationChange();
|
void handleDockLocationChange();
|
||||||
void handleUpDownActionChanges();
|
void handleUpDownActionChanges();
|
||||||
|
void initWindowMode(WindowMode newMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createActions();
|
void createActions();
|
||||||
@@ -74,9 +83,10 @@ class lsim: public QMainWindow {
|
|||||||
QMenu *helpMenu;
|
QMenu *helpMenu;
|
||||||
QMenu *viewMenu;
|
QMenu *viewMenu;
|
||||||
|
|
||||||
QToolBar *fileToolBar;
|
QToolBar *timerControlBar;
|
||||||
QToolBar *editToolBar;
|
QToolBar *sceneModeBar;
|
||||||
QToolBar *upDownToolBar;
|
QToolBar *upDownBar;
|
||||||
|
QToolBar *windowModeBar;
|
||||||
|
|
||||||
struct Actions {
|
struct Actions {
|
||||||
QAction *aboutAct;
|
QAction *aboutAct;
|
||||||
@@ -93,6 +103,9 @@ class lsim: public QMainWindow {
|
|||||||
QAction *moveItemOnTop;
|
QAction *moveItemOnTop;
|
||||||
QAction *moveItemOnBottom;
|
QAction *moveItemOnBottom;
|
||||||
|
|
||||||
|
QAction *editModeAct;
|
||||||
|
QAction *simulationModeAct;
|
||||||
|
|
||||||
QAction *itemEditModeAct;
|
QAction *itemEditModeAct;
|
||||||
QAction *insertEFieldItemAct;
|
QAction *insertEFieldItemAct;
|
||||||
QAction *insertBFieldItemAct;
|
QAction *insertBFieldItemAct;
|
||||||
@@ -102,14 +115,20 @@ class lsim: public QMainWindow {
|
|||||||
Actions acts;
|
Actions acts;
|
||||||
|
|
||||||
QActionGroup *modeChangeActGroup;
|
QActionGroup *modeChangeActGroup;
|
||||||
|
QActionGroup *windowModeActGroup;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QDockWidget *fieldItemEditDock;
|
QDockWidget *fieldItemEditDock;
|
||||||
QDockWidget *probeItemDock;
|
QDockWidget *probeItemDock;
|
||||||
QDockWidget *sceneDock;
|
QDockWidget *sceneDock;
|
||||||
|
QDockWidget *simulOptDock;
|
||||||
|
|
||||||
SimulScene *simulscene;
|
SimulScene *simulscene;
|
||||||
|
|
||||||
|
WindowMode myMode;
|
||||||
|
signals:
|
||||||
|
void windowModeChanged(WindowMode mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ void SimulScene::startTimer() {
|
|||||||
timer->start();
|
timer->start();
|
||||||
}
|
}
|
||||||
void SimulScene::stopTimer() {
|
void SimulScene::stopTimer() {
|
||||||
|
timer->setCurrentTime(0);
|
||||||
timer->stop();
|
timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -750,7 +751,7 @@ void SimulScene::startCalculation() {
|
|||||||
stopTimer();
|
stopTimer();
|
||||||
|
|
||||||
//leeren Pfad setezen
|
//leeren Pfad setezen
|
||||||
pathItem1->setPath(QPainterPath());
|
clearFlightPath();
|
||||||
|
|
||||||
//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();
|
||||||
@@ -1043,3 +1044,7 @@ void SimulScene::moveSelectedFieldItemOnBottom() {
|
|||||||
GraphicsEllipseItem* SimulScene::getProbeChargeItem() {
|
GraphicsEllipseItem* SimulScene::getProbeChargeItem() {
|
||||||
return ellipse1;
|
return ellipse1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SimulScene::clearFlightPath() {
|
||||||
|
pathItem1->setPath(QPainterPath());
|
||||||
|
}
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ class SimulScene : public QGraphicsScene {
|
|||||||
|
|
||||||
GraphicsEllipseItem* getProbeChargeItem();
|
GraphicsEllipseItem* getProbeChargeItem();
|
||||||
|
|
||||||
|
void clearFlightPath();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setSceneMode(SceneMode mode);
|
void setSceneMode(SceneMode mode);
|
||||||
void startTimer();
|
void startTimer();
|
||||||
|
|||||||
Reference in New Issue
Block a user