添加模型分割
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "core/domain/Project.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QJsonArray>
|
||||
#include <QPixmap>
|
||||
#include <QPointF>
|
||||
#include <QImage>
|
||||
@@ -33,6 +35,17 @@ public:
|
||||
void setTool(Tool tool);
|
||||
Tool tool() const { return m_tool; }
|
||||
|
||||
/// 创建实体的分割方式(在「创」工具被选中后再次单击弹出面板选择)。
|
||||
enum class EntityCreateSegmentMode { Manual, Snap, Sam };
|
||||
Q_ENUM(EntityCreateSegmentMode)
|
||||
void setEntityCreateSegmentMode(EntityCreateSegmentMode m);
|
||||
EntityCreateSegmentMode entityCreateSegmentMode() const { return m_entityCreateSegmentMode; }
|
||||
|
||||
/// 进入/更新「待确认」实体多边形(允许用户在画布上微调)。
|
||||
void setPendingEntityPolygonWorld(const QVector<QPointF>& polyWorld);
|
||||
void clearPendingEntityPolygon();
|
||||
bool hasPendingEntityPolygon() const { return m_pendingPolyWorld.size() >= 3; }
|
||||
|
||||
void resetView();
|
||||
void zoomToFit();
|
||||
|
||||
@@ -81,6 +94,16 @@ signals:
|
||||
void hoveredWorldPosDepthChanged(const QPointF& worldPos, int depthZ);
|
||||
void selectedEntityChanged(bool hasSelection, const QString& id, int depth, const QPointF& originWorld);
|
||||
void requestAddEntity(const core::Project::Entity& entity, const QImage& image);
|
||||
/// 创建实体:将裁剪 RGB、标记叠加层与 SAM 提示发往模型服务,由主窗口收 JSON 轮廓后再 addEntity。
|
||||
void requestSamSegment(
|
||||
const QByteArray& cropRgbPng,
|
||||
const QByteArray& overlayPng,
|
||||
const QPointF& cropTopLeftWorld,
|
||||
const QJsonArray& pointCoords,
|
||||
const QJsonArray& pointLabels,
|
||||
const QJsonArray& boxXyxy);
|
||||
/// 待确认实体:用户按回车/点击空白处确认后触发(由主窗口弹窗命名并落盘)。
|
||||
void requestFinalizePendingEntity(const QVector<QPointF>& polyWorld);
|
||||
void requestMoveEntity(const QString& id, const QPointF& delta);
|
||||
void entityDragActiveChanged(bool on);
|
||||
void selectedEntityPreviewChanged(const QString& id, int depth, const QPointF& originWorld);
|
||||
@@ -106,6 +129,8 @@ private:
|
||||
QPointF viewToWorld(const QPointF& v) const;
|
||||
QPointF worldToView(const QPointF& w) const;
|
||||
QRectF worldRectOfBackground() const;
|
||||
bool isPointNearPendingVertex(const QPointF& worldPos, int* outIndex) const;
|
||||
bool pendingPolygonContains(const QPointF& worldPos) const;
|
||||
|
||||
void tickPresentationZoomAnimation();
|
||||
void tickPresentationHoverAnimation();
|
||||
@@ -159,6 +184,7 @@ private:
|
||||
bool m_presentationPreviewMode = false;
|
||||
|
||||
Tool m_tool = Tool::Move;
|
||||
EntityCreateSegmentMode m_entityCreateSegmentMode = EntityCreateSegmentMode::Manual;
|
||||
qreal m_scale = 1.0;
|
||||
QPointF m_pan; // world 原点对应的 view 坐标偏移(view = world*scale + pan)
|
||||
|
||||
@@ -193,6 +219,13 @@ private:
|
||||
|
||||
int m_currentFrame = 0;
|
||||
|
||||
// —— 创建实体:待确认多边形(可微调)——
|
||||
QVector<QPointF> m_pendingPolyWorld;
|
||||
bool m_pendingDragging = false;
|
||||
bool m_pendingDragWhole = false;
|
||||
int m_pendingDragVertex = -1;
|
||||
QPointF m_pendingLastMouseWorld;
|
||||
|
||||
// —— 预览展示:实体悬停动效、点击聚焦缩放 ——
|
||||
QTimer* m_presZoomTimer = nullptr;
|
||||
QTimer* m_presHoverTimer = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user