コード例 #1
0
ファイル: MshView.cpp プロジェクト: envinf/ogs
void MshView::contextMenuEvent( QContextMenuEvent* event )
{
    QModelIndex index = this->selectionModel()->currentIndex();
    MshItem* item = dynamic_cast<MshItem*>(static_cast<TreeItem*>(index.internalPointer()));

    if (item)
    {
        unsigned mesh_dim (item->getMesh()->getDimension());

        QMenu menu;
        QMenu direct_cond_menu("DIRECT Conditions");
        QAction*    editMeshAction = menu.addAction("Edit mesh...");
        QAction*  editValuesAction = menu.addAction("Edit material groups...");
        QAction* meshQualityAction = menu.addAction("Calculate element quality...");
        QAction* surfaceMeshAction (nullptr);
        QAction* tetgenExportAction (nullptr);
        if (mesh_dim==3)
        {
            surfaceMeshAction = menu.addAction("Extract surface...");
            tetgenExportAction = menu.addAction("Export to TetGen...");
        }
        QAction* mesh2geoAction (nullptr);
        QAction* shapeExportAction (nullptr);
        if (mesh_dim==2)
        {
            mesh2geoAction = menu.addAction("Convert to geometry");
            shapeExportAction = menu.addAction("Export to Shapefile...");
        }

        menu.addSeparator();
        //menu.addMenu(&direct_cond_menu);
        QAction*   addDirectAction = direct_cond_menu.addAction("Add...");
        QAction*  loadDirectAction = direct_cond_menu.addAction("Load...");
        //menu.addSeparator();
        connect(editMeshAction,         SIGNAL(triggered()), this, SLOT(openMeshEditDialog()));
        connect(editValuesAction,       SIGNAL(triggered()), this, SLOT(openValuesEditDialog()));
        connect(meshQualityAction,      SIGNAL(triggered()), this, SLOT(checkMeshQuality()));
        if (mesh_dim==3)
        {
            connect(surfaceMeshAction,  SIGNAL(triggered()), this, SLOT(extractSurfaceMesh()));
            connect(tetgenExportAction, SIGNAL(triggered()), this, SLOT(exportToTetGen()));
        }
        connect(addDirectAction,	    SIGNAL(triggered()), this, SLOT(addDIRECTSourceTerms()));
        connect(loadDirectAction,       SIGNAL(triggered()), this, SLOT(loadDIRECTSourceTerms()));
        if (mesh_dim==2)
        {
            connect(mesh2geoAction,     SIGNAL(triggered()), this, SLOT(convertMeshToGeometry()));
            connect(shapeExportAction,  SIGNAL(triggered()), this, SLOT(exportToShapefile()));
        }
        menu.exec(event->globalPos());
    }
}
コード例 #2
0
ファイル: VtkVisPipeline.cpp プロジェクト: JobstM/ogs
void VtkVisPipeline::removeSourceItem(MshModel* model, const QModelIndex &idx)
{
	MshItem* sItem = static_cast<MshItem*>(model->getItem(idx));

	for (int i = 0; i < _rootItem->childCount(); i++)
	{
		VtkVisPipelineItem* item = static_cast<VtkVisPipelineItem*>(getItem(index(i, 0)));
		if (item->algorithm() == sItem->vtkSource())
		{
			removePipelineItem(index(i, 0));
			return;
		}
	}
}
コード例 #3
0
ファイル: MshView.cpp プロジェクト: envinf/ogs
void MshView::checkMeshQuality ()
{
    QModelIndex index = this->selectionModel()->currentIndex();
    MshItem* item = static_cast<MshItem*>(static_cast<MshModel*>(this->model())->getItem(index));
    emit qualityCheckRequested(item->vtkSource());
}