void MeshPartition::setVolume(QString volume_name) { m_Grid = GuiMainWindow::pointer()->getGrid(); resetOrientation(m_Grid); VolumeDefinition V = GuiMainWindow::pointer()->getVol(volume_name); QList<vtkIdType> cls; EG_VTKDCC(vtkIntArray, cell_code, m_Grid, "cell_code"); EG_VTKDCC(vtkIntArray, cell_orgdir, m_Grid, "cell_orgdir"); EG_VTKDCC(vtkIntArray, cell_curdir, m_Grid, "cell_curdir"); EG_VTKDCC(vtkIntArray, cell_voldir, m_Grid, "cell_voldir"); for (vtkIdType id_cell = 0; id_cell < m_Grid->GetNumberOfCells(); ++id_cell) { if (isSurface(id_cell, m_Grid)) { int bc = cell_code->GetValue(id_cell); cell_voldir->SetValue(id_cell, 0); if (V.getSign(bc) != 0) { cls.append(id_cell); if (V.getSign(bc) == -1) { cell_voldir->SetValue(id_cell, 1); } } } else { if (cell_code->GetValue(id_cell) == V.getVC()) { cls.append(id_cell); } } } setCells(cls); }
///// resetView ////////////////////////////////////////////////////////////// void GLView::resetView(const bool update) /// Resets translation/orientation/zoom of the scene. { centerView(false); resetOrientation(false); zoomFit(); // calls setModified() if(update) updateGL(); }
void JpegContent::setImage(const QImage& image) { d->mRawData.clear(); d->mImage = image; d->mSize = image.size(); d->mExifData["Exif.Photo.PixelXDimension"] = image.width(); d->mExifData["Exif.Photo.PixelYDimension"] = image.height(); resetOrientation(); d->mPendingTransformation = false; d->mTransformMatrix = QMatrix(); }
void SolverThread::stepPhysics(float dt) { computeForces(); clearStiffnessAssembly(); if(bUseStiffnessWarping) updateOrientation(); else resetOrientation(); stiffnessAssembly(); // addPlasticityForce(dt); dynamicsAssembly(dt); #if SOLVEONGPU solveGpu(m_V, m_stiffnessMatrix); #else solve(m_V); #endif updatePosition(dt); #if ENABLE_DBG dbglg.write("Re"); unsigned totalTetrahedra = m_mesh->numTetrahedra(); FEMTetrahedronMesh::Tetrahedron * tetrahedra = m_mesh->tetrahedra(); for(unsigned k=0;k<totalTetrahedra;k++) { dbglg.write(k); dbglg.write(tetrahedra[k].Re.str()); } dbglg.writeMat33(m_stiffnessMatrix->valueBuf(), m_stiffnessMatrix->numNonZero(), "K "); dbglg.write("Rhs"); unsigned totalPoints = m_mesh->numPoints(); for(unsigned k=0;k<totalPoints;k++) { dbglg.write(k); dbglg.write(rightHandSide()[k].str()); dbglg.newLine(); } dbglg.write("F0"); for(unsigned k=0;k<totalPoints;k++) { dbglg.write(k); dbglg.write(m_F0[k].str()); dbglg.newLine(); } #endif }
void GuiEditBoundaryConditions::before() { if (!m_BcMap) EG_BUG; resetOrientation(m_Grid); while (m_Ui.T->rowCount()) m_Ui.T->removeRow(0); foreach(int i, m_BoundaryCodes) { BoundaryCondition bc = (*m_BcMap)[i]; m_Ui.T->insertRow(m_Ui.T->rowCount()); int r = m_Ui.T->rowCount() - 1; m_Ui.T->setItem(r, 0, new QTableWidgetItem()); m_Ui.T->item(r, 0)->setFlags(m_Ui.T->item(r, 0)->flags() & (~Qt::ItemIsSelectable)); m_Ui.T->item(r, 0)->setFlags(m_Ui.T->item(r, 0)->flags() & (~Qt::ItemIsEditable)); m_Ui.T->setItem(r, 1, new QTableWidgetItem()); m_Ui.T->setItem(r, 2, new QTableWidgetItem()); QString idx; idx.setNum(i); m_Ui.T->item(r, 0)->setText(idx); QString name = bc.getName(); if (name == "unknown") name = QString("BC") + idx; m_Ui.T->item(r, 1)->setText(name); m_Ui.T->item(r, 2)->setText(bc.getType()); }
/************************************************************************ * This procedure is called when the Reset orientation button is pressed. * It resets the angles and prints them in their entries. ************************************************************************/ void resetOrientationButtonPressed(GtkWidget *widget, struct Context *context) { resetOrientation(); triggerImageRedraw(widget, context); }
void AppWindow::createActions() { // Creates a new action for quiting and pushes it onto the menu actions vector QAction* quitAct = new QAction(tr("&Quit"), this); m_menu_actions.push_back(quitAct); // We set the accelerator keys // Alternatively, you could use: setShortcuts(Qt::CTRL + Qt::Key_P); quitAct->setShortcuts(QKeySequence::Quit); // Set the tip quitAct->setStatusTip(tr("Exits the file")); // Connect the action with the signal and slot designated connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); // Application menu QAction* resetPositionAct = new QAction(tr("Reset Pos&ition"), this); m_menu_actions.push_back(resetPositionAct); resetPositionAct->setShortcut(QKeySequence(Qt::Key_I)); connect(resetPositionAct, SIGNAL(triggered()), m_viewer, SLOT(resetPosition())); QAction* resetOrientationAct = new QAction(tr("Reset &Orientation"), this); m_menu_actions.push_back(resetOrientationAct); resetOrientationAct->setShortcut(QKeySequence(Qt::Key_O)); connect(resetOrientationAct, SIGNAL(triggered()), m_viewer, SLOT(resetOrientation())); QAction* resetAllAct = new QAction(tr("Reset &All"), this); m_menu_actions.push_back(resetAllAct); resetAllAct->setShortcut(QKeySequence(Qt::Key_A)); connect(resetAllAct, SIGNAL(triggered()), m_viewer, SLOT(resetAll())); // Mode menu QAction* posOriAct = new QAction(tr("&Position/Orientation"), this); m_menu_mode_actions.push_back(posOriAct); posOriAct->setShortcut(QKeySequence(Qt::Key_P)); posOriAct->setCheckable(true); connect(posOriAct, SIGNAL(triggered()), m_viewer, SLOT(setToPositionOrientation())); QAction* jointsAct = new QAction(tr("&Joints"), this); m_menu_mode_actions.push_back(jointsAct); jointsAct->setShortcut(QKeySequence(Qt::Key_J)); jointsAct->setCheckable(true); connect(jointsAct, SIGNAL(triggered()), m_viewer, SLOT(setToJoints())); QActionGroup* modeActionGroup = new QActionGroup(this); modeActionGroup->addAction(posOriAct); modeActionGroup->addAction(jointsAct); modeActionGroup->setExclusive(true); posOriAct->setChecked(true); // Edit menu QAction* undoAct = new QAction(tr("&Undo"), this); m_menu_edit_actions.push_back(undoAct); undoAct->setShortcut(QKeySequence(Qt::Key_U)); connect(undoAct, SIGNAL(triggered()), m_viewer, SLOT(undo())); QAction* redoAct = new QAction(tr("&Redo"), this); m_menu_edit_actions.push_back(redoAct); redoAct->setShortcut(QKeySequence(Qt::Key_R)); connect(redoAct, SIGNAL(triggered()), m_viewer, SLOT(redo())); // Options menu QAction* circleAct = new QAction(tr("&Circle"), this); m_menu_options_actions.push_back(circleAct); circleAct->setShortcut(QKeySequence(Qt::Key_C)); circleAct->setCheckable(true); connect(circleAct, SIGNAL(triggered()), m_viewer, SLOT(setToCircle())); QAction* zBufferAct = new QAction(tr("&Z-buffer"), this); m_menu_options_actions.push_back(zBufferAct); zBufferAct->setShortcut(QKeySequence(Qt::Key_Z)); zBufferAct->setCheckable(true); connect(zBufferAct, SIGNAL(triggered()), m_viewer, SLOT(setToZBuffer())); QAction* backfaceCullAct = new QAction(tr("&Backface cull"), this); m_menu_options_actions.push_back(backfaceCullAct); backfaceCullAct->setShortcut(QKeySequence(Qt::Key_B)); connect(backfaceCullAct, SIGNAL(triggered()), m_viewer, SLOT(setToBackfaceCull())); backfaceCullAct->setCheckable(true); QAction* frontfaceCullAct = new QAction(tr("&Frontface cull"), this); m_menu_options_actions.push_back(frontfaceCullAct); frontfaceCullAct->setShortcut(QKeySequence(Qt::Key_F)); connect(frontfaceCullAct, SIGNAL(triggered()), m_viewer, SLOT(setToFrontfaceCull())); frontfaceCullAct->setCheckable(true); }