增加了表面选择功能

pull/1/head
剑古敛锋 2024-07-07 23:13:48 +08:00
parent e271b483f8
commit bfbce27096
19 changed files with 304 additions and 44 deletions

View File

@ -49,13 +49,13 @@ namespace MainWidget
if (_isGeo)
_ui->ConplanarCheckBox->setCheckable(false);
if (_model == ModuleBase::MeshNode || _model == ModuleBase::BoxMeshNode)
if (_model == ModuleBase::MeshNode || _model == ModuleBase::BoxMeshNode||_model==ModuleBase::BoxMeshSurfaceNode)
{
_ui->typeComboBox->setCurrentIndex(0);
_ui->label_id->setText(tr("PointId : "));
_ui->typeComboBox->setEnabled(false);
}
else if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell)
else if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell||_model==ModuleBase::BoxMeshSurfaceCell)
{
_ui->typeComboBox->setCurrentIndex(1);
_ui->label_id->setText(tr("CellId : "));
@ -289,7 +289,7 @@ namespace MainWidget
QString idstring = memList.join(";"); // id 节点列表
QString type = "Node";
if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell)
if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell||_model==ModuleBase::BoxMeshSurfaceCell)
type = "Element";
QString name = this->getNameFromUi();
QString code = QString("MainWindow.createSet(\"%1\",\"%2\",\"%3\")").arg(name).arg(type).arg(idstring);

View File

@ -2,7 +2,9 @@
* ============================================================================
* Program: LAMPCAE
*
* FastCAE
* Copyright (c)
* All rights reserved.
* See License or http://www.LAMPCAE.com/index.html for details.
*
* BSD 3-Clause License
*

View File

@ -7,6 +7,7 @@
#include "MeshData/meshKernal.h"
#include "Settings/BusAPI.h"
#include "Settings/GraphOption.h"
#include "Common/DebugLogger.h"
#include <vtkActor.h>
#include <vtkDataSetMapper.h>
#include <vtkDataSet.h>
@ -140,13 +141,13 @@ namespace MainWidget
QList<int> members = _highLightSelectItems.values();
if (vObjs == nullptr)
continue;
if (_selectModel == ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode)
if (_selectModel == ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode)
{
QColor c = Setting::BusAPI::instance()->getGraphOption()->getMeshNodeColor();
vObjs->setPointDisplayColor(members, c);
}
else if (_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell)
else if (_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell)
{
QColor c = Setting::BusAPI::instance()->getGraphOption()->getMeshFaceColor();
vObjs->setCellDisplayColor(members, c);
@ -354,10 +355,21 @@ namespace MainWidget
acs[EDGEACTOR]->SetPickable(false);
acs[FACEACTOR]->SetPickable(false);
if (m == ModuleBase::MeshNode || m == ModuleBase::BoxMeshNode)
if(m == ModuleBase::MeshNode || m == ModuleBase::BoxMeshNode
|| m == ModuleBase::BoxMeshSurfaceNode) {
acs[POINTACTOR]->SetPickable(true);
else if (m == ModuleBase::MeshCell || m == ModuleBase::BoxMeshCell)
DebugInfo(QString("acs[POINTACTOR]->SetPickable(true) %1 \n")
.arg(_selectModel)
.toLocal8Bit()
.data());
} else if(m == ModuleBase::MeshCell || m == ModuleBase::BoxMeshCell
|| m == ModuleBase::BoxMeshSurfaceCell) {
acs[FACEACTOR]->SetPickable(true);
DebugInfo(QString("acs[FACEACTOR]->SetPickable(true) %1 \n")
.arg(_selectModel)
.toLocal8Bit()
.data());
} else{};
}
}
@ -380,10 +392,10 @@ namespace MainWidget
if(members.isEmpty()){
continue;
}
if(_selectModel == ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode) { // 绘制 points
if(_selectModel == ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode) { // 绘制 points
vObjs->setPointDisplayColor(members, c,true);
} else if(_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell) { // 绘制cell
} else if(_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell) { // 绘制cell
vObjs->setCellDisplayColor(members, c,true);
}

View File

@ -2,7 +2,9 @@
* ============================================================================
* Program: LAMPCAE
*
* FastCAE
* Copyright (c)
* All rights reserved.
* See License or http://www.LAMPCAE.com/index.html for details.
*
* BSD 3-Clause License
*

View File

@ -369,6 +369,9 @@ namespace GUI {
_ui->actionSelectMeshCell->setVisible(on);
_ui->actionBoxMeshCell->setVisible(on);
_ui->actionBoxMeshNode->setVisible(on);
_ui->actionBoxMeshSurfaceNode->setVisible(on);
_ui->actionBoxMeshSurfaceCell->setVisible(on);
}
} // namespace GUI

View File

@ -314,9 +314,12 @@ namespace GUI {
connect(_ui->actionSelectMeshNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 单点
connect(_ui->actionSelectMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 多选
connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper,SLOT(map())); // 多选
connect(_ui->actionBoxMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionBoxMeshSurfaceNode, SIGNAL(triggered()), _selectSignalMapper,SLOT(map())); // 多选
connect(_ui->actionBoxMeshSurfaceCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
_selectSignalMapper->setMapping(_ui->actionSelectOff, (int)ModuleBase::SelectModel::None);
//_selectSignalMapper->setMapping(_ui->actionSelectGeoBody,
//(int)ModuleBase::SelectModel::GeometryBody);
@ -329,6 +332,10 @@ namespace GUI {
(int)ModuleBase::SelectModel::BoxMeshNode);
_selectSignalMapper->setMapping(_ui->actionBoxMeshCell,
(int)ModuleBase::SelectModel::BoxMeshCell);
_selectSignalMapper->setMapping(_ui->actionBoxMeshSurfaceNode,
(int)ModuleBase::SelectModel::BoxMeshSurfaceNode);
_selectSignalMapper->setMapping(_ui->actionBoxMeshSurfaceCell,
(int)ModuleBase::SelectModel::BoxMeshSurfaceCell);
connect(_selectSignalMapper, SIGNAL(mapped(int)), this,
SIGNAL(selectModelChangedSig(int))); // 选择模式更改信号
@ -354,6 +361,7 @@ namespace GUI {
connect(_ui->actionSelectFace, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map()));
connect(_ui->actionSelectGeometryBody, SIGNAL(triggered()), _selectGeometryModeMapper,
SLOT(map()));
_selectGeometryModeMapper->setMapping(_ui->actionSelectOff,
(int)ModuleBase::SelectModel::None);
_selectGeometryModeMapper->setMapping(_ui->actionSelectPoint,
@ -365,6 +373,9 @@ namespace GUI {
_selectGeometryModeMapper->setMapping(_ui->actionSelectGeometryBody,
(int)ModuleBase::SelectModel::GeometryWinBody);
connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this,
SLOT(selectGeometryModelChanged(int)));
connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this,
@ -1046,7 +1057,8 @@ namespace GUI {
_ui->actionSelectMeshCell->setChecked(false);
_ui->actionBoxMeshNode->setChecked(false);
_ui->actionBoxMeshCell->setChecked(false);
_ui->actionBoxMeshSurfaceNode->setChecked(false);
_ui->actionBoxMeshSurfaceCell->setChecked(false);
switch(model) {
case(int)ModuleBase::SelectModel::None:
_ui->actionSelectOff->setChecked(true);
@ -1063,7 +1075,12 @@ namespace GUI {
case(int)ModuleBase::SelectModel::BoxMeshCell:
_ui->actionBoxMeshCell->setChecked(true);
break;
case(int)ModuleBase::SelectModel::BoxMeshSurfaceNode:
_ui->actionBoxMeshSurfaceNode->setChecked(true);
break;
case(int)ModuleBase::SelectModel::BoxMeshSurfaceCell:
_ui->actionBoxMeshSurfaceCell->setChecked(true);
break;
default:
break;
}
@ -1669,22 +1686,24 @@ namespace GUI {
DebugInfo("on_actionLoadPointCloudText\n");
// emit this->actionLoadPointCloudText(this);
}
//"forest", "crop", "grass", "uav", "water", "dwater", "road", "geo", "radi", "soil", "land", "vegetation", "water_scene"
void MainWindow::on_actionLoadPreForestMeshFile_triggereds() {
DebugInfo("on_actionLoadPreForestMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "Forest");
emit this->on_loadPreMeshFile(this, "forest");
}
void MainWindow::on_actionLoadPreCropMeshFile_triggereds() {
DebugInfo("on_actionLoadPreCropMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "Crop");
emit this->on_loadPreMeshFile(this, "crop");
}
void MainWindow::on_actionLoadPreGrasslandMeshFile_triggereds() {
DebugInfo("on_actionLoadPreGrasslandMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "Grassland");
emit this->on_loadPreMeshFile(this, "grass");
}
void MainWindow::on_actionLoadPreWaterBodyMeshFile_triggereds() {
DebugInfo("on_actionLoadPreWaterBodyMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "WaterBody");
emit this->on_loadPreMeshFile(this, "water");
}
void MainWindow::on_actionLoadPreSoilMeshFile_triggereds() {
DebugInfo("on_actionLoadPreSoilMeshFile_triggered\n");
@ -1692,15 +1711,15 @@ namespace GUI {
}
void MainWindow::on_actionLoadPreDynamicWaterBodyMeshFile_triggereds() {
DebugInfo("on_actionLoadPreDynamicWaterBodyMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "DynamicWater");
emit this->on_loadPreMeshFile(this, "dwater");
}
void MainWindow::on_actionLoadPreRoadMeshFile_triggereds() {
DebugInfo("on_actionLoadPreRoadMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "Road");
emit this->on_loadPreMeshFile(this, "road");
}
void MainWindow::on_actionLoadPreArtificialMeshFile_triggereds() {
DebugInfo("on_actionLoadPreArtificialMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "Artificial");
emit this->on_loadPreMeshFile(this, "uav");
}
void MainWindow::on_actionLoadForestPointCloudFile_triggereds() {
DebugInfo("on_actionLoadForestPointCloudFile_triggered\n"); // 加载点云
@ -1712,12 +1731,11 @@ namespace GUI {
}
void MainWindow::on_actionLoadGeometricCorrectionFile_triggereds() {
DebugInfo("on_actionLoadGeometricCorrectionFile_triggered\n");
emit this->on_loadPreMeshFile(this, "GeometricCorrection");
emit this->on_loadPreMeshFile(this, "geo");
}
void MainWindow::on_actionLoadRadioModelFile_triggereds() {
DebugInfo("on_actionLoadRadioModelFile_triggered\n");
emit this->on_loadPreMeshFile(this, "RadioModel");
emit this->on_loadPreMeshFile(this, "radi");
}
} // namespace GUI

View File

@ -99,6 +99,8 @@
<addaction name="actionSelectMeshCell"/>
<addaction name="actionBoxMeshNode"/>
<addaction name="actionBoxMeshCell"/>
<addaction name="actionBoxMeshSurfaceNode"/>
<addaction name="actionBoxMeshSurfaceCell"/>
<addaction name="separator"/>
<addaction name="actionSelectPoint"/>
<addaction name="actionSelectCurve"/>
@ -272,7 +274,7 @@
<x>0</x>
<y>0</y>
<width>1185</width>
<height>26</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -381,6 +383,8 @@
<addaction name="actionSelectMeshCell"/>
<addaction name="actionBoxMeshNode"/>
<addaction name="actionBoxMeshCell"/>
<addaction name="actionBoxMeshSurfaceNode"/>
<addaction name="actionBoxMeshSurfaceCell"/>
</widget>
<addaction name="actionSurfaceMesh"/>
<addaction name="actionSolidMesh"/>
@ -2694,6 +2698,30 @@
<string>加载点云文本文件</string>
</property>
</action>
<action name="actionBoxMeshSurfaceNode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/mesh/mesh/select_vertex.png</normaloff>:/mesh/mesh/select_vertex.png</iconset>
</property>
<property name="text">
<string>BoxMeshSurfaceNode</string>
</property>
</action>
<action name="actionBoxMeshSurfaceCell">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/mesh/mesh/select_face.png</normaloff>:/mesh/mesh/select_face.png</iconset>
</property>
<property name="text">
<string>BoxMeshSurfaceCell</string>
</property>
</action>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>

View File

@ -593,6 +593,8 @@ namespace GUI {
ui->actionSelectMeshCell->setEnabled(false);
ui->actionBoxMeshNode->setEnabled(false);
ui->actionBoxMeshCell->setEnabled(false);
ui->actionBoxMeshSurfaceNode->setEnabled(false);
ui->actionBoxMeshSurfaceCell->setEnabled(false);
// ui->actionSelectGeoBody->setEnabled(false);
ui->actionGenMesh->setEnabled(false);
ui->actionSurfaceMesh->setEnabled(false);
@ -661,6 +663,8 @@ namespace GUI {
// ui->actionSelectGeoBody->setEnabled(true);
ui->actionBoxMeshNode->setEnabled(true);
ui->actionBoxMeshCell->setEnabled(true);
ui->actionBoxMeshSurfaceNode->setEnabled(true);
ui->actionBoxMeshSurfaceCell->setEnabled(true);
}
if(ngeo > 0 && subwins->isPreWindowOpened()) {
ui->actionSurfaceMesh->setEnabled(true);

View File

@ -53,6 +53,8 @@ namespace ModuleBase
BoxMeshNode,
BoxMeshCell,
DrawSketch,
BoxMeshSurfaceNode, // 表面点
BoxMeshSurfaceCell // 表面网格
};
/**

View File

@ -40,6 +40,32 @@
#include <vtkCellData.h>
#include "Geometry/geometryData.h"
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyleRubberBandPick.h>
#include <vtkAreaPicker.h>
#include <vtkCommand.h>
#include <vtkCallbackCommand.h>
#include <vtkIdFilter.h>
#include <vtkExtractPolyDataGeometry.h>
#include <vtkSphereSource.h>
#include <vtkPlanes.h>
#include <vtkDataSetMapper.h>
#include <vtkProperty.h>
#include <vtkCellLocator.h>
#include <vtkCamera.h>
#include <vtkPolyDataConnectivityFilter.h>
#include <vtkThresholdPoints.h>
#include <vtkPolyDataNormals.h>
#include <vtkSelectVisiblePoints.h>
#include <vtkExtractSelectedPolyDataIds.h>
#include <vtkConnectivityFilter.h>
#include "Common/DebugLogger.h"
namespace ModuleBase
{
@ -76,7 +102,7 @@ namespace ModuleBase
_mainWindow = mw;
_parent = p;
// connect(this, SIGNAL(clearAllHighLight()), mw, SIGNAL(clearAllHighLight()));
connect(mw, SIGNAL(selectModelChangedSig(int)), this, SLOT(setSelectModel(int)));
connect(mw, SIGNAL(selectModelChangedSig(int)), this, SLOT(setSelectModel(int))); // 绑定主窗体 与 本类的setSelectModel槽
// connect(this, SIGNAL(dispalyInfo(DataProperty::PropertyList*)), mw, SIGNAL(updateProperty(DataProperty::PropertyList*)));
}
@ -85,6 +111,7 @@ namespace ModuleBase
*/
void PropPickerInteractionStyle::setSelectModel(int m)
{
DebugInfo(QString("PropPickerInteractionStyle::setSelectModel %1 \n ").arg(m).toLocal8Bit().data());
_selectModel = (SelectModel)m;
this->CurrentMode = 0;
if (_actor != nullptr)
@ -111,6 +138,8 @@ namespace ModuleBase
break;
case ModuleBase::BoxMeshNode:
case ModuleBase::BoxMeshCell:
case ModuleBase::BoxMeshSurfaceNode:
case ModuleBase::BoxMeshSurfaceCell:
case ModuleBase::DrawSketch:
this->CurrentMode = 1;
break;
@ -188,6 +217,12 @@ namespace ModuleBase
case ModuleBase::BoxMeshCell:
// boxSelectMeshCell();
break;
case ModuleBase::BoxMeshSurfaceNode:
//boxSelectMeshNode();
break;
case ModuleBase::BoxMeshSurfaceCell:
//boxSelectMeshCell();
break;
default:
break;
}
@ -198,11 +233,12 @@ namespace ModuleBase
*/
void PropPickerInteractionStyle::OnLeftButtonUp()
{
DebugInfo(QString("void PropPickerInteractionStyle::OnLeftButtonUp %1 \n").arg(_selectModel).toLocal8Bit().data());
vtkInteractorStyleRubberBandPick::OnLeftButtonUp();
if (_selectModel == None && !_mouseMoved)
emit this->clearAllHighLight();
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode) && (_selectModel != DrawSketch))
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode) && (_selectModel != DrawSketch)&&(_selectModel != BoxMeshSurfaceNode)&&(_selectModel != BoxMeshSurfaceCell))
return;
if (this->CurrentMode == 0)
return;
@ -211,7 +247,7 @@ namespace ModuleBase
int *endPos = this->GetInteractor()->GetEventPosition();
_endPos[0] = endPos[0];
_endPos[1] = endPos[1];
// qDebug() << "end " << _endPos[0] << " " << _endPos[1];
qDebug() << "end " << _endPos[0] << " " << _endPos[1];
if (_selectModel != DrawSketch)
{
vtkActor *ac = nullptr;
@ -228,6 +264,12 @@ namespace ModuleBase
case ModuleBase::BoxMeshCell:
boxSelectMeshCell();
break;
case ModuleBase::BoxMeshSurfaceNode:
boxSelectMeshSurfaceNode();
break;
case ModuleBase::BoxMeshSurfaceCell:
boxSelectMeshSurfaceCell();
break;
case ModuleBase::DrawSketch:
_coordinate->SetCoordinateSystemToDisplay();
_coordinate->SetValue(endPos[0], endPos[1], 0);
@ -235,6 +277,7 @@ namespace ModuleBase
emit mouseReleasePoint(d);
break;
}
_mouseMoved = false;
_leftButtonDown = false;
}
@ -452,7 +495,128 @@ namespace ModuleBase
}
emit highLight(&_selectItems); // 绑定高亮事件
}
void PropPickerInteractionStyle::boxSelectMeshSurfaceNode() {
emit clearAllHighLight();
_selectItems.clear();
int range[4];
this->getBoxRange(range);
vtkActorCollection *actors = _renderer->GetActors();
actors->InitTraversal(); // 初始化指针
const int nac = actors->GetNumberOfItems();
for (int i = 0; i < nac; ++i)
{
vtkActor *actor = actors->GetNextActor();
if (actor == nullptr)
if (!actor->GetVisibility())
continue;
if (!actor->GetPickable())
continue;
vtkMapper *mapper = actor->GetMapper();
if (mapper == nullptr)
continue;
vtkDataSet *dataset = mapper->GetInputAsDataSet();
if (dataset == nullptr)
continue;
vtkDataArray *IDS = dataset->GetCellData()->GetArray("IDS");
if (IDS == nullptr)
continue;
// 进行可见性分析
vtkSmartPointer<vtkSelectVisiblePoints> visiblePointsFilter = vtkSmartPointer<vtkSelectVisiblePoints>::New();
visiblePointsFilter->SetInputData(dataset);
visiblePointsFilter->SetRenderer(_renderer);
visiblePointsFilter->Update();
if (!visiblePointsFilter->GetOutput()->GetPolys())
{
continue;
}
vtkDataSet* visibleData = visiblePointsFilter->GetOutput();
this->selectMesh(visibleData, range);
}
emit highLight(&_selectItems); // 绑定高亮事件
}
void PropPickerInteractionStyle::boxSelectMeshSurfaceCell() {
DebugInfo("void PropPickerInteractionStyle::boxSelectMeshSurfaceCell() start\n");
emit clearAllHighLight();
_selectItems.clear();
int range[4];
this->getBoxRange(range);
vtkActorCollection *actors = _renderer->GetActors();
actors->InitTraversal(); // 初始化指针
const int nac = actors->GetNumberOfItems();
for (int i = 0; i < nac; ++i)
{
vtkActor *actor = actors->GetNextActor();
if (actor == nullptr)
if (!actor->GetVisibility())
continue;
if (!actor->GetPickable())
continue;
vtkMapper *mapper = actor->GetMapper();
if (mapper == nullptr)
continue;
vtkDataSet *dataset = mapper->GetInputAsDataSet();
if (dataset == nullptr)
continue;
vtkDataArray *IDS = dataset->GetCellData()->GetArray("IDS");
if (nullptr==IDS )
continue;
// 进行可见性分析
vtkSmartPointer<vtkSelectVisiblePoints> visiblePointsFilter = vtkSmartPointer<vtkSelectVisiblePoints>::New();
visiblePointsFilter->SetInputData(dataset);
visiblePointsFilter->SetRenderer(_renderer);
visiblePointsFilter->Update();
vtkDataSet* visiablePoints=visiblePointsFilter->GetOutput();
// 选择范围分析
QMultiHash<int,int> visiable_select{};
vtkRenderer *render = this->GetInteractor()->GetRenderWindow()->GetRenderers()->GetFirstRenderer();
vtkSmartPointer<vtkCoordinate> coordinate = vtkSmartPointer<vtkCoordinate>::New();
coordinate->SetCoordinateSystemToWorld();
vtkDataArray *ids = visiablePoints->GetPointData()->GetArray("IDS");
const int npoint = visiablePoints->GetNumberOfPoints();
for (int i = 0; i < npoint; ++i)
{
double coor[3];
visiablePoints->GetPoint(i, coor);
coordinate->SetValue(coor);
int *va = coordinate->GetComputedDisplayValue(render);
if (isPointInRange(va, range))
{
double *k_id = ids->GetTuple2(i);
visiable_select.insert(k_id[0], k_id[1]); // kernelid pid
}
}
// 计算联通单元
size_t ncell=dataset->GetNumberOfCells();
vtkDataArray* cids=dataset->GetCellData()->GetArray("IDS");
vtkDataArray* pids=dataset->GetPointData()->GetArray("IDS");
for(size_t cellId=0;cellId<ncell;cellId++){
vtkCell* cell = dataset->GetCell(cellId);
double* c_id=cids->GetTuple2(cellId);
vtkIdList* pointIds = cell->GetPointIds();
for (vtkIdType j = 0; j < pointIds->GetNumberOfIds(); ++j)
{
vtkIdType pointId = pointIds->GetId(j);
double *k_id = pids->GetTuple2(pointId);
if(visiable_select.contains(k_id[0],k_id[1])){ // 存在就保存
_selectItems.insert(c_id[0],c_id[1]);
break;
}else{}
}
}
}
emit highLight(&_selectItems); // 绑定高亮事件
DebugInfo("void PropPickerInteractionStyle::boxSelectMeshSurfaceCell() finish\n");
}
/*
*/
@ -489,9 +653,7 @@ namespace ModuleBase
vtkSmartPointer<vtkCoordinate> coordinate = vtkSmartPointer<vtkCoordinate>::New();
coordinate->SetCoordinateSystemToWorld();
/*int* va = */ coordinate->GetComputedDisplayValue(render);
if (_selectModel == BoxMeshNode)
if (_selectModel == ModuleBase::BoxMeshNode)
{
vtkDataArray *ids = dataSet->GetPointData()->GetArray("IDS");
const int npoint = dataSet->GetNumberOfPoints();
@ -509,7 +671,7 @@ namespace ModuleBase
}
}
}
else if (_selectModel == BoxMeshCell)
else if (_selectModel == ModuleBase::BoxMeshCell)
{
vtkDataArray *ids = dataSet->GetCellData()->GetArray("IDS");
const int ncell = dataSet->GetNumberOfCells();
@ -524,7 +686,7 @@ namespace ModuleBase
cell->EvaluateLocation(subid, pcenter, coor, w);
coordinate->SetValue(coor);
int *va = coordinate->GetComputedDisplayValue(render);
int *va = coordinate->GetComputedDisplayValue(render); // 坐标->窗口坐标
if (isPointInRange(va, range))
{
double *k_id = ids->GetTuple2(i);
@ -533,7 +695,26 @@ namespace ModuleBase
}
}
}
else if(_selectModel==ModuleBase::BoxMeshSurfaceNode){ // 表面点
vtkDataArray *ids = dataSet->GetPointData()->GetArray("IDS");
const int npoint = dataSet->GetNumberOfPoints();
for (int i = 0; i < npoint; ++i)
{
double coor[3];
dataSet->GetPoint(i, coor);
coordinate->SetValue(coor);
int *va = coordinate->GetComputedDisplayValue(render);
if (isPointInRange(va, range))
{
double *k_id = ids->GetTuple2(i);
_selectItems.insert(k_id[0], k_id[1]); // kernelid pid
//pselectids->SetTuple1(i, 1);
}
}
}
else if(_selectModel==ModuleBase::BoxMeshSurfaceCell){
}
qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"PropPickerInteractionStyle::selectMesh finish,size: "+QString::number(_selectItems.size());
}
@ -544,7 +725,6 @@ namespace ModuleBase
{
bool isx = p[0] >= range[0] && p[0] <= range[1] ? true : false;
bool isy = p[1] >= range[2] && p[1] <= range[3] ? true : false;
return isx && isy;
}
@ -556,7 +736,7 @@ namespace ModuleBase
_mouseMoved = false;
_leftButtonDown = false;
vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode))
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode)&&(_selectModel != BoxMeshSurfaceNode)&&(_selectModel != BoxMeshSurfaceCell))
return;
if (this->CurrentMode == 0)
@ -579,7 +759,7 @@ namespace ModuleBase
return;
}
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode))
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode)&&(_selectModel != BoxMeshSurfaceNode)&&(_selectModel != BoxMeshSurfaceCell))
return;
this->CurrentMode = 1;
}
@ -730,4 +910,5 @@ namespace ModuleBase
same = false;
return same;
}
}

View File

@ -125,7 +125,8 @@ namespace ModuleBase
void clickSelectMeshCell();
void boxSelectMeshNode(); // 框选 Node
void boxSelectMeshCell();// 框选 cell
void boxSelectMeshSurfaceNode(); // 框选 Node
void boxSelectMeshSurfaceCell();// 框选 cell
// xmin xmax ymin ymax
void getBoxRange(int *);
void selectMesh(vtkDataSet *dataset, int *range);
@ -154,6 +155,9 @@ namespace ModuleBase
vtkActor *_preGeoSeltctActor{};
vtkCoordinate *_coordinate{};
// QList<vtkActor*> _tempActorContainer{};
// QMultiHash<vtkActor*, double*> _actorPickedPoints{};
//

View File

@ -235,7 +235,6 @@ namespace ModuleBase
vtkSmartPointer<vtkCubeAxesActor> _cubeAxesActor{};
vtkSmartPointer<vtkRenderWindow> _renderWindow{};
vtkSmartPointer< vtkRenderWindowInteractor > _interactor{};
vtkSmartPointer<vtkOrientationMarkerWidget> _axesWidget{};
vtkSmartPointer<vtkTextWidget> _textWidget{};
vtkSmartPointer<vtkScalarBarWidget> _scalarBarWidget{};
@ -249,6 +248,8 @@ namespace ModuleBase
/*** 点云处理***/
pcl::visualization::PCLVisualizer::Ptr _viewer; // 点云显示共享指针
protected:
void mouseMoveEvent(QMouseEvent* event) override;
};

View File

@ -124,13 +124,12 @@ namespace MeshData {
void MeshDataExchangePlugin::on_TestLoadModelImport()
{
WBFZ::DialogImportModelDataset* dialog=new WBFZ::DialogImportModelDataset(_mainwindow);
dialog->importPreViewModel("D:\\WBFZCPP\\LAMPCAETest\\modle\\crop.stl");
dialog->exec();
// dialog->importMeshModelToMainWindows("D:\\WBFZCPP\\LAMPCAETest\\modle\\crop.stl");
}
void MeshDataExchangePlugin::on_LoadPreMeshFileDialog(GUI::MainWindow* _m, QString _fileType) {
// emit this->on_loadPreMeshFile(this, "radi");
WBFZ::DialogImportModelDataset* dialog=new WBFZ::DialogImportModelDataset(_mainwindow);
dialog->filterModel(_fileType);
dialog->setCurrentCatorgy(_fileType);
dialog->exec();
}

View File

@ -52,6 +52,7 @@ namespace LAMPToolBox {
}
void RasterToolBox::on_RasterProject_trigged() {
emit _mainwindows->printMessageToMessageWindow("Raster Projector");
RasterToolBase::DialogRasterProjectConvert* dlg=new RasterToolBase::DialogRasterProjectConvert(_mainwindows);
dlg->show();
}

View File

@ -18,8 +18,8 @@ include_directories(C:/PCL/3rdParty/FLANN/include)
include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3)
include_directories(C:/PCL/include/pcl-1.14)
# qt5
include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml)
## qt5
#include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml)
# json
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../json)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -406,6 +406,9 @@
</qresource>
<qresource prefix="mesh">
<file>mesh/delete_face.png</file>
<file>mesh/select_face.png</file>
<file>mesh/select_face_connected.png</file>
<file>mesh/select_vertex.png</file>
<file>mesh/delete_facevert.png</file>
<file>mesh/delete_vert.png</file>
</qresource>