Skip to content

Commit

Permalink
- svg icons instead of png
Browse files Browse the repository at this point in the history
  • Loading branch information
vwaurich committed Sep 28, 2016
1 parent 0fd534d commit ba0860b
Show file tree
Hide file tree
Showing 24 changed files with 1,124 additions and 117 deletions.
16 changes: 8 additions & 8 deletions OMEdit/OMEditGUI/Animation/AnimationWindow.cpp
Expand Up @@ -72,15 +72,15 @@ AnimationWindow::AnimationWindow(PlotWindowContainer *pPlotWindowContainer)
mpUpdateTimer->start(100);
// actions and widgets for the toolbar
int toolbarIconSize = mpPlotWindowContainer->getMainWindow()->getOptionsDialog()->getGeneralSettingsPage()->getToolbarIconSizeSpinBox()->value();
mpAnimationChooseFileAction = new QAction(QIcon(":/Resources/icons/openFile.png"), Helper::animationChooseFile, this);
mpAnimationChooseFileAction = new QAction(QIcon(":/Resources/icons/open.svg"), Helper::animationChooseFile, this);
mpAnimationChooseFileAction->setStatusTip(Helper::animationChooseFileTip);
mpAnimationInitializeAction = new QAction(QIcon(":/Resources/icons/initialize.png"), Helper::animationInitialize, this);
mpAnimationInitializeAction = new QAction(QIcon(":/Resources/icons/initialize.svg"), Helper::animationInitialize, this);
mpAnimationInitializeAction->setStatusTip(Helper::animationInitializeTip);
mpAnimationInitializeAction->setEnabled(false);
mpAnimationPlayAction = new QAction(QIcon(":/Resources/icons/play.png"), Helper::animationPlay, this);
mpAnimationPlayAction = new QAction(QIcon(":/Resources/icons/play_animation.svg"), Helper::animationPlay, this);
mpAnimationPlayAction->setStatusTip(Helper::animationPlayTip);
mpAnimationPlayAction->setEnabled(false);
mpAnimationPauseAction = new QAction(QIcon(":/Resources/icons/pause.png"), Helper::animationPause, this);
mpAnimationPauseAction = new QAction(QIcon(":/Resources/icons/pause.svg"), Helper::animationPause, this);
mpAnimationPauseAction->setStatusTip(Helper::animationPauseTip);
mpAnimationPauseAction->setEnabled(false);
mpAnimationSlider = new QSlider(Qt::Horizontal);
Expand All @@ -99,10 +99,10 @@ AnimationWindow::AnimationWindow(PlotWindowContainer *pPlotWindowContainer)
mpSpeedUpEdit->setMaximumSize(QSize(toolbarIconSize*2, toolbarIconSize));
mpSpeedUpEdit->setEnabled(false);
mpPerspectiveDropDownBox = new QComboBox(this);
mpPerspectiveDropDownBox->addItem(QIcon(":/Resources/icons/perspective0.png"), QString("to home position"));
mpPerspectiveDropDownBox->addItem(QIcon(":/Resources/icons/perspective2.png"),QString("normal to x-y plane"));
mpPerspectiveDropDownBox->addItem(QIcon(":/Resources/icons/perspective1.png"),QString("normal to y-z plane"));
mpPerspectiveDropDownBox->addItem(QIcon(":/Resources/icons/perspective3.png"),QString("normal to x-z plane"));
mpPerspectiveDropDownBox->addItem(QIcon(":/Resources/icons/perspective0.svg"), QString("to home position"));
mpPerspectiveDropDownBox->addItem(QIcon(":/Resources/icons/perspective2.svg"),QString("normal to x-y plane"));
mpPerspectiveDropDownBox->addItem(QIcon(":/Resources/icons/perspective1.svg"),QString("normal to y-z plane"));
mpPerspectiveDropDownBox->addItem(QIcon(":/Resources/icons/perspective3.svg"),QString("normal to x-z plane"));
//assemble the animation toolbar
mpAnimationToolBar->addAction(mpAnimationChooseFileAction);
mpAnimationToolBar->addSeparator();
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/Animation/Visualizer.cpp
Expand Up @@ -34,6 +34,7 @@

#include "Visualizer.h"


OMVisualBase::OMVisualBase(const std::string& modelFile, const std::string& path)
: _shapes(),
_modelFile(modelFile),
Expand Down
146 changes: 73 additions & 73 deletions OMEdit/OMEditGUI/Animation/VisualizerMAT.cpp
Expand Up @@ -86,81 +86,81 @@ void VisualizerMAT::readMat(const std::string& modelFile, const std::string& pat

void VisualizerMAT::updateVisAttributes(const double time)
{
std::cout<<"updateVisAttributes at "<<time <<std::endl;
// Update all shapes.
unsigned int shapeIdx = 0;
rAndT rT;
osg::ref_ptr<osg::Node> child = nullptr;
ModelicaMatReader* tmpReaderPtr = &_matReader;
try
//std::cout<<"updateVisAttributes at "<<time <<std::endl;
// Update all shapes.
unsigned int shapeIdx = 0;
rAndT rT;
osg::ref_ptr<osg::Node> child = nullptr;
ModelicaMatReader* tmpReaderPtr = &_matReader;
try
{
for (auto& shape : _baseData->_shapes)
{
for (auto& shape : _baseData->_shapes)
{
//std::cout<<"shape "<<shape._id <<std::endl;

// Get the values for the scene graph objects
updateObjectAttributeMAT(&shape._length, time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._width, time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._height, time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._lDir[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._lDir[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._lDir[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._wDir[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._wDir[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._wDir[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._r[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._r[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._r[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._rShape[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._rShape[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._rShape[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._T[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[2], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[3], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[4], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[5], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[6], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[7], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[8], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._color[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._color[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._color[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._specCoeff, time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._extra, time, tmpReaderPtr);

rT = rotateModelica2OSG(osg::Vec3f(shape._r[0].exp, shape._r[1].exp, shape._r[2].exp),
osg::Vec3f(shape._rShape[0].exp, shape._rShape[1].exp, shape._rShape[2].exp),
osg::Matrix3(shape._T[0].exp, shape._T[1].exp, shape._T[2].exp,
shape._T[3].exp, shape._T[4].exp, shape._T[5].exp,
shape._T[6].exp, shape._T[7].exp, shape._T[8].exp),
osg::Vec3f(shape._lDir[0].exp, shape._lDir[1].exp, shape._lDir[2].exp),
osg::Vec3f(shape._wDir[0].exp, shape._wDir[1].exp, shape._wDir[2].exp),
shape._length.exp,/* shape._width.exp, shape._height.exp,*/ shape._type);

assemblePokeMatrix(shape._mat, rT._T, rT._r);
// Update the shapes.
_nodeUpdater->_shape = shape;
//shape.dumpVisAttributes();
// Get the scene graph nodes and stuff.
child = _viewerStuff->getScene().getRootNode()->getChild(shapeIdx); // the transformation
child->accept(*_nodeUpdater);
++shapeIdx;
}
}
catch (std::exception& ex)
{
std::string msg = "Error in VisualizerMAT::updateVisAttributes at time point " + std::to_string(time)
+ "\n" + std::string(ex.what());
throw(msg);
//std::cout<<"shape "<<shape._id <<std::endl;

// Get the values for the scene graph objects
updateObjectAttributeMAT(&shape._length, time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._width, time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._height, time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._lDir[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._lDir[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._lDir[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._wDir[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._wDir[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._wDir[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._r[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._r[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._r[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._rShape[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._rShape[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._rShape[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._T[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[2], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[3], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[4], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[5], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[6], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[7], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._T[8], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._color[0], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._color[1], time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._color[2], time, tmpReaderPtr);

updateObjectAttributeMAT(&shape._specCoeff, time, tmpReaderPtr);
updateObjectAttributeMAT(&shape._extra, time, tmpReaderPtr);

rT = rotateModelica2OSG(osg::Vec3f(shape._r[0].exp, shape._r[1].exp, shape._r[2].exp),
osg::Vec3f(shape._rShape[0].exp, shape._rShape[1].exp, shape._rShape[2].exp),
osg::Matrix3(shape._T[0].exp, shape._T[1].exp, shape._T[2].exp,
shape._T[3].exp, shape._T[4].exp, shape._T[5].exp,
shape._T[6].exp, shape._T[7].exp, shape._T[8].exp),
osg::Vec3f(shape._lDir[0].exp, shape._lDir[1].exp, shape._lDir[2].exp),
osg::Vec3f(shape._wDir[0].exp, shape._wDir[1].exp, shape._wDir[2].exp),
shape._length.exp,/* shape._width.exp, shape._height.exp,*/ shape._type);

assemblePokeMatrix(shape._mat, rT._T, rT._r);
// Update the shapes.
_nodeUpdater->_shape = shape;
//shape.dumpVisAttributes();
// Get the scene graph nodes and stuff.
child = _viewerStuff->getScene().getRootNode()->getChild(shapeIdx); // the transformation
child->accept(*_nodeUpdater);
++shapeIdx;
}
}
catch (std::exception& ex)
{
std::string msg = "Error in VisualizerMAT::updateVisAttributes at time point " + std::to_string(time)
+ "\n" + std::string(ex.what());
throw(msg);
}
}

void VisualizerMAT::updateScene(const double time)
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -2515,7 +2515,7 @@ void MainWindow::createActions()
mpSimulateWithAlgorithmicDebuggerAction->setEnabled(false);
connect(mpSimulateWithAlgorithmicDebuggerAction, SIGNAL(triggered()), SLOT(simulateModelWithAlgorithmicDebugger()));
// simulate with animation action
mpSimulateWithAnimationAction = new QAction(QIcon(":/Resources/icons/simulate-animation.png"), Helper::simulateWithAnimation, this);
mpSimulateWithAnimationAction = new QAction(QIcon(":/Resources/icons/simulate-animation.svg"), Helper::simulateWithAnimation, this);
mpSimulateWithAnimationAction->setStatusTip(Helper::simulateWithAnimationTip);
mpSimulateWithAnimationAction->setEnabled(false);
connect(mpSimulateWithAnimationAction, SIGNAL(triggered()), SLOT(simulateModelWithAnimation()));
Expand Down Expand Up @@ -2692,7 +2692,7 @@ void MainWindow::createActions()
mpNewParametricPlotWindowAction->setStatusTip(tr("Inserts new parametric plot window"));
connect(mpNewParametricPlotWindowAction, SIGNAL(triggered()), mpPlotWindowContainer, SLOT(addParametricPlotWindow()));
// new mpAnimationWindowAction plot action
mpNewAnimationWindowAction = new QAction(QIcon(":/Resources/icons/animation.png"), tr("New Animation Window"), this);
mpNewAnimationWindowAction = new QAction(QIcon(":/Resources/icons/animation.svg"), tr("New Animation Window"), this);
mpNewAnimationWindowAction->setStatusTip(tr("Inserts new animation window"));
connect(mpNewAnimationWindowAction, SIGNAL(triggered()), mpPlotWindowContainer, SLOT(addAnimationWindow()));
// export variables action
Expand Down
46 changes: 23 additions & 23 deletions OMEdit/OMEditGUI/Plotting/PlotWindowContainer.cpp
Expand Up @@ -90,12 +90,12 @@ PlotWindow* PlotWindowContainer::getCurrentWindow()
return 0;
}
else {
bool isPlotWidget = (0 != subWindowList(QMdiArea::ActivationHistoryOrder).last()->widget()->objectName().compare(QString("animationWidget")));
//std::cout<<"isPlotWidget "<<isPlotWidget<<std::endl;
if (isPlotWidget)
bool isPlotWidget = (0 != subWindowList(QMdiArea::ActivationHistoryOrder).last()->widget()->objectName().compare(QString("animationWidget")));
//std::cout<<"isPlotWidget "<<isPlotWidget<<std::endl;
if (isPlotWidget)
return qobject_cast<PlotWindow*>(subWindowList(QMdiArea::ActivationHistoryOrder).last()->widget());
else
return 0;
else
return 0;
}
}

Expand All @@ -110,15 +110,15 @@ AnimationWindow* PlotWindowContainer::getCurrentAnimationWindow()
return 0;
}
else {
bool isAnimationWidget = (0 == subWindowList(QMdiArea::ActivationHistoryOrder).last()->widget()->objectName().compare(QString("animationWidget")));
std::cout<<"isAnimationWidget "<<isAnimationWidget<<std::endl;
if (isAnimationWidget)
{
bool isAnimationWidget = (0 == subWindowList(QMdiArea::ActivationHistoryOrder).last()->widget()->objectName().compare(QString("animationWidget")));
std::cout<<"isAnimationWidget "<<isAnimationWidget<<std::endl;
if (isAnimationWidget)
{
std::cout<<"this was good\n"<<std::endl;
return qobject_cast<AnimationWindow*>(subWindowList(QMdiArea::ActivationHistoryOrder).last()->widget());
}
else
return 0;
}
else
return 0;
}
}

Expand All @@ -132,16 +132,16 @@ bool PlotWindowContainer::eventFilter(QObject *pObject, QEvent *pEvent)
{
bool isPlotWidget = (0 != pObject->objectName().compare(QString("animationWidget")));
if (isPlotWidget){
PlotWindow *pPlotWindow = qobject_cast<PlotWindow*>(pObject);
if (pPlotWindow && pEvent->type() == QEvent::Paint) {
QPainter painter (pPlotWindow);
painter.setPen(Qt::gray);
QRect rectangle = pPlotWindow->rect();
rectangle.setWidth(pPlotWindow->rect().width() - 1);
rectangle.setHeight(pPlotWindow->rect().height() - 1);
painter.drawRect(rectangle);
return true;
}
PlotWindow *pPlotWindow = qobject_cast<PlotWindow*>(pObject);
if (pPlotWindow && pEvent->type() == QEvent::Paint) {
QPainter painter (pPlotWindow);
painter.setPen(Qt::gray);
QRect rectangle = pPlotWindow->rect();
rectangle.setWidth(pPlotWindow->rect().width() - 1);
rectangle.setHeight(pPlotWindow->rect().height() - 1);
painter.drawRect(rectangle);
return true;
}
}
return QMdiArea::eventFilter(pObject, pEvent);
}
Expand Down Expand Up @@ -304,6 +304,6 @@ void PlotWindowContainer::updatePlotWindows(QString variable)
void PlotWindowContainer::addAnimationWindow(){
AnimationWindow *pAnimation = new AnimationWindow(this);
QMdiSubWindow *pSubWindow = addSubWindow(pAnimation);
pSubWindow->setWindowIcon(QIcon(":/Resources/icons/animation.png"));
pSubWindow->setWindowIcon(QIcon(":/Resources/icons/animation.svg"));
pAnimation->show();
}
96 changes: 96 additions & 0 deletions OMEdit/OMEditGUI/Resources/icons/animation.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed OMEdit/OMEditGUI/Resources/icons/initialize.png
Binary file not shown.

0 comments on commit ba0860b

Please sign in to comment.