feat/vtk-3d-view #7
|
|
@ -9,6 +9,7 @@
|
|||
#include <QString>
|
||||
|
||||
#include <vtkActor.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkBoundingBox.h>
|
||||
#include <vtkCubeAxesActor.h>
|
||||
#include <vtkProp.h>
|
||||
|
|
@ -218,6 +219,17 @@ void VtkSceneView::setAnomalyVisible(const std::string& anomalyId, bool visible)
|
|||
if (it != anomalyProps_.end() && it->second) it->second->SetVisibility(visible ? 1 : 0);
|
||||
}
|
||||
|
||||
void VtkSceneView::setSelectedAnomaly(const std::string& anomalyId) {
|
||||
// 选中者加粗高亮、其余恢复常态(列表↔VTK 联动 R84)。
|
||||
for (auto& kv : anomalyProps_) {
|
||||
if (!kv.second) continue;
|
||||
const bool sel = (kv.first == anomalyId);
|
||||
kv.second->GetProperty()->SetLineWidth(sel ? 5.0 : 2.0);
|
||||
kv.second->GetProperty()->SetPointSize(sel ? 12.0 : 8.0);
|
||||
}
|
||||
if (renderWindow_) renderWindow_->Render();
|
||||
}
|
||||
|
||||
void VtkSceneView::setAxes(geopro::controller::AxesMode mode, geopro::controller::AxesUnit unit,
|
||||
int fontSize) {
|
||||
axesMode_ = mode;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace geopro::render { class Scene; }
|
|||
class vtkRenderer;
|
||||
class vtkRenderWindow;
|
||||
class vtkProp;
|
||||
class vtkActor;
|
||||
|
||||
namespace geopro::app {
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ public:
|
|||
void removeAnomaly(const std::string& anomalyId) override;
|
||||
void clearAnomalies() override;
|
||||
void setAnomalyVisible(const std::string& anomalyId, bool visible) override;
|
||||
void setSelectedAnomaly(const std::string& anomalyId) override;
|
||||
void setAxes(geopro::controller::AxesMode mode, geopro::controller::AxesUnit unit,
|
||||
int fontSize) override;
|
||||
void applyCameraView(geopro::controller::ViewDir dir) override;
|
||||
|
|
@ -111,7 +113,7 @@ private:
|
|||
std::map<std::string, std::vector<vtkSmartPointer<vtkProp>>> dsProps_;
|
||||
std::vector<vtkSmartPointer<vtkProp>> miscProps_;
|
||||
std::string volumeOwnerDs_; // 当前 currentVolumeImage_ 归属的 ds(其被移除时置空切片源)
|
||||
std::map<std::string, vtkSmartPointer<vtkProp>> anomalyProps_; // 异常 id → 3D actor
|
||||
std::map<std::string, vtkSmartPointer<vtkActor>> anomalyProps_; // 异常 id → 3D actor
|
||||
};
|
||||
|
||||
} // namespace geopro::app
|
||||
|
|
|
|||
|
|
@ -780,6 +780,11 @@ void buildWorkbench(QMainWindow& window, geopro::data::LocalSampleRepository& re
|
|||
sceneView->setAnomalyVisible(id.toStdString(), vis);
|
||||
renderWindowPtr->Render();
|
||||
});
|
||||
// 列表选中异常 → VTK 高亮联动(R84,list→VTK)。
|
||||
QObject::connect(ca, &geopro::app::Column3DAnalysis::anomalySelected, vtkWidget,
|
||||
[sceneView](const QString& id) {
|
||||
sceneView->setSelectedAnomaly(id.toStdString());
|
||||
});
|
||||
// 删除异常 → 删 mock + 刷新渲染/列表。
|
||||
QObject::connect(ca, &geopro::app::Column3DAnalysis::anomalyDeleteRequested, &window,
|
||||
[scene3dRepo, refreshAnomalies](const QString& id) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ public:
|
|||
virtual void removeAnomaly(const std::string& anomalyId) = 0;
|
||||
virtual void clearAnomalies() = 0;
|
||||
virtual void setAnomalyVisible(const std::string& anomalyId, bool visible) = 0;
|
||||
// 高亮选中的异常(列表↔VTK 联动 R84):选中者加粗高亮、其余恢复;空 id = 全不选。
|
||||
virtual void setSelectedAnomaly(const std::string& anomalyId) = 0;
|
||||
|
||||
// 坐标轴设置(P2):显示方式 + 刻度单位 + 字号。视图据当前场景包围盒重建坐标轴 prop。
|
||||
// None 模式 = 移除坐标轴;rebuild 时由控制器在 clear 后重新下发当前坐标轴设置。
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ struct FakeView : I3dSceneView {
|
|||
void removeAnomaly(const std::string&) override {}
|
||||
void clearAnomalies() override {}
|
||||
void setAnomalyVisible(const std::string&, bool) override {}
|
||||
void setSelectedAnomaly(const std::string&) override {}
|
||||
|
||||
int props() const { return surveyLines + curtains + volumes + terrains; }
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue