diff --git a/src/entities/SceneComponent.h b/src/entities/SceneComponent.h index ad120efc..4791c4d8 100644 --- a/src/entities/SceneComponent.h +++ b/src/entities/SceneComponent.h @@ -38,7 +38,7 @@ public: template T* GetComponent() { for (auto& componet : children_) { - if (componet->GetTypeName() == T::GetTypeName()) { + if (componet->GetSelfTypeName() == T::GetTypeName()) { return reinterpret_cast(componet); } } diff --git a/src/entities/TrajectoryTraceComponent.cpp b/src/entities/TrajectoryTraceComponent.cpp index 4b8195d0..487b81d5 100644 --- a/src/entities/TrajectoryTraceComponent.cpp +++ b/src/entities/TrajectoryTraceComponent.cpp @@ -91,6 +91,7 @@ void TrajectoryTraceComponent::Begin() { sampleAccum_ = 0.0; elapsedTime_ = 0.0; hasLastSample_ = false; + traceRestartPending_ = false; attachedToScene_ = false; ClearTrace(); } @@ -108,6 +109,14 @@ void TrajectoryTraceComponent::Update(double dt) { TrimExpiredPoints(); const osg::Vec3d currentPos = entity->GetTransform()->GetLocation(); + if (traceRestartPending_) { + lastSamplePos_ = currentPos; + hasLastSample_ = true; + sampleAccum_ = 0.0; + traceRestartPending_ = false; + return; + } + if (!hasLastSample_) { osg::Vec3d initialPos = currentPos; if (PathComponent* pathComponent = entity->GetComponent()) { @@ -279,9 +288,17 @@ double TrajectoryTraceComponent::GetDashScrollSpeed() const { void TrajectoryTraceComponent::ClearTrace() { InitializeGeometry(); + Entity* entity = GetEntity(); + if (nullptr != entity && nullptr != entity->GetTransform()) { + lastSamplePos_ = entity->GetTransform()->GetLocation(); + } + vertices_->clear(); renderVertices_->clear(); sampleTimes_.clear(); + hasLastSample_ = true; + sampleAccum_ = 0.0; + traceRestartPending_ = true; DirtyGeometry(); } @@ -457,6 +474,7 @@ void TrajectoryTraceComponent::DirtyGeometry() { RebuildRenderGeometry(); renderVertices_->dirty(); + geometry_->dirtyDisplayList(); geometry_->dirtyBound(); if (geode_.valid()) { geode_->dirtyBound(); diff --git a/src/entities/TrajectoryTraceComponent.h b/src/entities/TrajectoryTraceComponent.h index d7753acb..46b13b19 100644 --- a/src/entities/TrajectoryTraceComponent.h +++ b/src/entities/TrajectoryTraceComponent.h @@ -99,6 +99,7 @@ private: double elapsedTime_{0.0}; osg::Vec3d lastSamplePos_{0.0, 0.0, 0.0}; bool hasLastSample_{false}; + bool traceRestartPending_{false}; bool attachedToScene_{false}; std::deque sampleTimes_; }; diff --git a/src/translations/Dyt_zh_CN.qm b/src/translations/Dyt_zh_CN.qm index f021687e..a0018d65 100644 Binary files a/src/translations/Dyt_zh_CN.qm and b/src/translations/Dyt_zh_CN.qm differ diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts index dad2c612..1b1e36f4 100644 --- a/src/translations/Dyt_zh_CN.ts +++ b/src/translations/Dyt_zh_CN.ts @@ -2227,6 +2227,56 @@ + + FontSettingDialog + + + + 字体设置 + + + + + 斜体 + + + + + + AaBb中文预览 + + + + + 下划线 + + + + + 删除线 + + + + + 应用 + + + + + 确定 + + + + + 重置 + + + + + 取消 + + + FrameTitleBar @@ -2266,22 +2316,22 @@ - + file manager 文件管理 - + simu manager 仿真管理 - + play manager 回放管理 - + system manager 系统管理 @@ -2317,117 +2367,127 @@ ModelTreeWidget - + Curves 曲线图表集 - + Surfaces 曲面图表集 - + Tables 表格图表集 - + Lights 信号灯图表集 - + Polars 极坐标图表集 - + Images 图像图表集 - + Delete File 删除 - + Add boke Entity - + Add lsjhqt Entity - + Add nimizi Entity - + Add tkdlj Entity - + Add jiaofan Entity - + Add satellite Entity - + Confirm 确认 - + Delete this file entry from workspace? 从工作区中删除? - + Prompt 提示 - + Delete failed 删除失败 - + Release Track 释放 - + Track 跟踪 - + Add Label Component 添加标签组件 - + Add Mesh Component 添加网格体组件 - + Add Path Component 添加路径组件 - + + Add Trajectory Trace Component + 添加轨迹组件 + + + + Clear Trajectory Trace + 清理轨迹 + + + Delete 删除 @@ -2858,12 +2918,12 @@ 后缀 - + ModelBase 模型 - + color base 颜色 @@ -2969,68 +3029,68 @@ Save Workspace 保存工作区间 - - - - Curve[%1] - - - Surface[%1] + Curve[%1] - Table[%1] + Surface[%1] - Light[%1] + Table[%1] - Polar[%1] + + Light[%1] - + Polar[%1] + + + + + Image[%1] - + Curve[%1] Name - + Curve[%1] Color - + Curve[%1] WaveStart - + Curve[%1] WaveStop - + Curve[%1] ReportX - + Curve[%1] ReportY @@ -3054,12 +3114,12 @@ QtBoolPropertyManager - + True - + False @@ -3083,22 +3143,22 @@ QtColorPropertyManager - + Red - + Green - + Blue - + Alpha @@ -3106,47 +3166,47 @@ QtConeWaveComponentManager - + ConeWaveComponent 锥波组件 - + Height 高度 - + Radius 半径 - + waveCount 波纹数量 - + waveSpeed 波纹速度 - + baseColor 基础颜色 - + waveColor 波纹颜色 - + ringBrightAlpha 亮环透明度 - + ringDarkAlpha 暗环透明度 @@ -3252,68 +3312,68 @@ QtCurveEntryPropertyManager - - + + Curve[%1] Name - - + + Curve[%1] Color - - + + Curve[%1] WaveStart - - + + Curve[%1] WaveStop - - + + Curve[%1] ReportX - - + + Curve[%1] ReportY - + Name - + ChartType - + Wave - + Report - + Curves - + Count @@ -3321,87 +3381,27 @@ QtDashedLineComponentManager - + DashedLineComponent 虚线组件 - + Start 起点 - + End 终点 - + Radius 半径 - - Color - 颜色 - - - - QtTrajectoryTraceComponentManager - - - TrajectoryTraceComponent - 尾迹组件 - - - - LineWidth - 线宽 - - - - SampleInterval - 采样间隔 - - - - MinMoveDistance - 最小移动距离 - - - - MaxPoints - 最大点数 - - - - TailDuration - 尾迹时长 - - - - Visible - 显示 - - - - Dashed - 虚线 - - - DashLength - 虚线段长度 - - - GapLength - 间隔长度 - - - DashScrollSpeed - 滚动速度 - - - + Color 颜色 @@ -3417,17 +3417,17 @@ QtEntityPropertyManager - + Name 名称 - + Visible 显示 - + Transform 变换 @@ -3448,37 +3448,37 @@ QtFontPropertyManager - + Family - + Point Size - + Bold - + Italic - + Underline - + Strikeout - + Kerning @@ -3486,22 +3486,22 @@ QtLocalePropertyManager - + <Invalid> - + %1, %2 - + Language - + Country @@ -3509,12 +3509,12 @@ QtMeshComponetManager - + MeshComponent 网格体组件 - + Mesh 网格体 @@ -3522,27 +3522,27 @@ QtModelBasePropertyManager - + Name 名称 - + Description 说明 - + Inflow 流入 - + InnerBottomElevation 内底标高 - + Visible 显示 @@ -3563,12 +3563,12 @@ QtPathComponentManager - + PathComponent 路径组件 - + Path 路径 @@ -3576,17 +3576,17 @@ QtPointFPropertyManager - + (%1, %2) - + X - + Y @@ -3594,17 +3594,17 @@ QtPointPropertyManager - + (%1, %2) - + X - + Y @@ -3622,12 +3622,12 @@ - + [%1, %2, %3] - + [%1, %2, %3] [%4, %5, %6] [%7, %8, %9] @@ -3635,27 +3635,27 @@ QtRectFPropertyManager - + [(%1, %2), %3 x %4] - + X - + Y - + Width - + Height @@ -3663,27 +3663,27 @@ QtRectPropertyManager - + [(%1, %2), %3 x %4] - + X - + Y - + Width - + Height @@ -3691,17 +3691,17 @@ QtSizeFPropertyManager - + %1 x %2 - + Width - + Height @@ -3709,33 +3709,33 @@ QtSizePolicyPropertyManager - + <Invalid> - + [%1, %2, %3, %4] - + Horizontal Policy - + Vertical Policy - + Horizontal Stretch - + Vertical Stretch @@ -3743,21 +3743,84 @@ QtSizePropertyManager - + %1 x %2 - + Width - + Height + + QtTrajectoryTraceComponentManager + + + TrajectoryTraceComponent + 尾迹组件 + + + + LineWidth + 线宽 + + + + SampleInterval + 采样间隔 + + + + MinMoveDistance + 最小移动距离 + + + + MaxPoints + 最大点数 + + + + TailDuration + 尾迹时长 + + + + Visible + 显示 + + + + Dashed + 虚线 + + + + DashLength + 虚线段长度 + + + + GapLength + 间隔长度 + + + + DashScrollSpeed + 滚动速度 + + + + Color + 颜色 + + QtTransfromEditWidget @@ -3769,17 +3832,17 @@ QtTransfromPropertyManager - + Location 位置 - + Rotation 旋转 - + Scale 缩放 @@ -3800,17 +3863,17 @@ QtVec3PropertyManager - + X - + Y - + Z @@ -3818,132 +3881,132 @@ QtWorkspacePropertyManager - + Name 名称 - + Description 说明 - + CommondPath 命令路径 - + HomeViewpoint 复位视点 - + Longitude 经度 - + Latitude 纬度 - + Altitude 高度 - + Heading 航向 - + Pitch 俯仰 - + Range 距离 - + Simulation Time 仿真时间 - + Simulation Start 开始 - + Simulation End 结束 - + Simulation Step 步长 - + Count 数目 - + Curve[%1] - + Surface[%1] - + Table[%1] - + Light[%1] - + Image[%1] - + Curves - + Surfaces - + Tables - + Lights - + Polars - + Images @@ -4036,12 +4099,12 @@ UI设置 - + question 提问 - + are you sure to exit 真的要退出吗?