修改翻译文件和尾迹工程

This commit is contained in:
brige 2026-03-21 09:12:30 +08:00
parent f8665a2e5d
commit 81cf0e828b
10 changed files with 470 additions and 35 deletions

View File

@ -1,6 +1,7 @@
#include "RecourceHelper.h" #include "RecourceHelper.h"
#include <QApplication> #include <QApplication>
#include <QFileInfo>
#include <QLocale> #include <QLocale>
#include <QFontDatabase> #include <QFontDatabase>
@ -93,22 +94,40 @@ void RecourceHelper::Init() {
LOG_WARN("fontName count <= 0 error"); LOG_WARN("fontName count <= 0 error");
} }
const QString appName = QApplication::applicationDisplayName();
#ifndef NDEBUG
const QString transName = QString("./%1_%2.qm").arg(appName, QLocale().name());
#else
const QString appDirPath = QApplication::applicationDirPath(); const QString appDirPath = QApplication::applicationDirPath();
const QString transName = QString("%1/translations/%2_zh_CN.qm").arg(appDirPath, appName/*, QLocale().name()*/); QStringList appNames;
#endif const QString displayName = QApplication::applicationDisplayName().trimmed();
qDebug() << transName; const QString appName = QApplication::applicationName().trimmed();
bool success = trans_.load(transName); const QString exeBaseName = QFileInfo(QApplication::applicationFilePath()).completeBaseName().trimmed();
if (!displayName.isEmpty()) {
appNames << displayName;
}
if (!appName.isEmpty() && !appNames.contains(appName)) {
appNames << appName;
}
if (!exeBaseName.isEmpty() && !appNames.contains(exeBaseName)) {
appNames << exeBaseName;
}
if (!appNames.contains(QStringLiteral("Dyt"))) {
appNames << QStringLiteral("Dyt");
}
bool success = false;
for (const QString& name : appNames) {
const QString transName = QString("%1/translations/%2_zh_CN.qm").arg(appDirPath, name);
qDebug() << transName;
success = trans_.load(transName);
if (success) {
break;
}
}
if (success) { if (success) {
QApplication::installTranslator(&trans_); QApplication::installTranslator(&trans_);
} else { } else {
LOG_WARN("load translations error: {}", transName.toStdString()); LOG_WARN("load translations error from app translation directory");
} }
const QString systemTransName = QString("./translations/qt_zh_CN.qm")/*.arg( QLocale::system().name())*/; const QString systemTransName = QString("%1/translations/qt_zh_CN.qm").arg(appDirPath);
success = systemTrans_.load(systemTransName); success = systemTrans_.load(systemTransName);
if (success) { if (success) {
QApplication::installTranslator(&systemTrans_); QApplication::installTranslator(&systemTrans_);

View File

@ -151,3 +151,17 @@ void PathComponent::SetPath(const QString& path) {
const QString& PathComponent::GetPath() const { const QString& PathComponent::GetPath() const {
return path_; return path_;
} }
bool PathComponent::GetFirstPathLocation(osg::Vec3d* location) const {
if (nullptr == location || nullptr == transformPath_) {
return false;
}
const std::vector<Transform>& transforms = transformPath_->GetTransforms();
if (transforms.empty()) {
return false;
}
*location = transforms.front().GetLocation();
return true;
}

View File

@ -24,6 +24,7 @@ public:
void SetPath(const QString& path); void SetPath(const QString& path);
const QString& GetPath() const; const QString& GetPath() const;
bool GetFirstPathLocation(osg::Vec3d* location) const;
protected: protected:
class TransformPath* transformPath_{nullptr}; class TransformPath* transformPath_{nullptr};
@ -32,4 +33,4 @@ protected:
osg::ref_ptr<osg::AnimationPath> animationPath_; osg::ref_ptr<osg::AnimationPath> animationPath_;
QString path_; QString path_;
}; };

View File

@ -10,6 +10,7 @@
#include "common/SpdLogger.h" #include "common/SpdLogger.h"
#include "entities/Entity.h" #include "entities/Entity.h"
#include "entities/PathComponent.h"
#include "scene/SceneContent.h" #include "scene/SceneContent.h"
#include "utils/StringUtils.h" #include "utils/StringUtils.h"
#include "workspace/WorkSpace.h" #include "workspace/WorkSpace.h"
@ -47,6 +48,18 @@ bool TrajectoryTraceComponent::SetAttribute(const char* name, const char* value)
} else if (0 == strcmp(name, "visible")) { } else if (0 == strcmp(name, "visible")) {
SetTraceVisible(0 == strcmp(value, "true")); SetTraceVisible(0 == strcmp(value, "true"));
return true; return true;
} else if (0 == strcmp(name, "dashed")) {
SetDashed(0 == strcmp(value, "true"));
return true;
} else if (0 == strcmp(name, "dashLength")) {
SetDashLength(atof(value));
return true;
} else if (0 == strcmp(name, "gapLength")) {
SetGapLength(atof(value));
return true;
} else if (0 == strcmp(name, "dashScrollSpeed")) {
SetDashScrollSpeed(atof(value));
return true;
} }
return SceneComponent::SetAttribute(name, value); return SceneComponent::SetAttribute(name, value);
@ -60,6 +73,10 @@ bool TrajectoryTraceComponent::SaveAttribute(tinyxml2::XMLElement* element) {
element->SetAttribute("maxPoints", maxPoints_); element->SetAttribute("maxPoints", maxPoints_);
element->SetAttribute("tailDuration", std::to_string(tailDuration_).c_str()); element->SetAttribute("tailDuration", std::to_string(tailDuration_).c_str());
element->SetAttribute("visible", traceVisible_ ? "true" : "false"); element->SetAttribute("visible", traceVisible_ ? "true" : "false");
element->SetAttribute("dashed", dashed_ ? "true" : "false");
element->SetAttribute("dashLength", std::to_string(dashLength_).c_str());
element->SetAttribute("gapLength", std::to_string(gapLength_).c_str());
element->SetAttribute("dashScrollSpeed", std::to_string(dashScrollSpeed_).c_str());
return SceneComponent::SaveAttribute(element); return SceneComponent::SaveAttribute(element);
} }
@ -85,32 +102,51 @@ void TrajectoryTraceComponent::Update(double dt) {
return; return;
} }
/* elapsedTime_ += dt; elapsedTime_ += dt;
sampleAccum_ += dt; sampleAccum_ += dt;
TrimExpiredPoints(); TrimExpiredPoints();
if (sampleAccum_ < sampleInterval_) {
return;
}
sampleAccum_ = 0.0;*/
const osg::Vec3d currentPos = entity->GetTransform()->GetLocation(); const osg::Vec3d currentPos = entity->GetTransform()->GetLocation();
if (!hasLastSample_) { if (!hasLastSample_) {
osg::Vec3d initialPos = currentPos;
if (PathComponent* pathComponent = entity->GetComponent<PathComponent>()) {
pathComponent->GetFirstPathLocation(&initialPos);
}
EnsureAttachedToScene();
if (!AppendPoint(initialPos)) {
return;
}
if (!AppendPoint(currentPos)) {
return;
}
lastSamplePos_ = currentPos; lastSamplePos_ = currentPos;
hasLastSample_ = true; hasLastSample_ = true;
sampleAccum_ = 0.0;
return; return;
} }
/*const osg::Vec3d delta = currentPos - lastSamplePos_;
if (delta.length2() < minMoveDistance_ * minMoveDistance_) {
return;
}*/
EnsureAttachedToScene(); EnsureAttachedToScene();
if (vertices_->empty()) { if (vertices_->empty()) {
if (!AppendPoint(lastSamplePos_)) { if (!AppendPoint(lastSamplePos_)) {
return; return;
} }
if (!AppendPoint(currentPos)) {
return;
}
} else if (!UpdateTailPoint(currentPos)) {
return;
} }
if (sampleAccum_ < sampleInterval_) {
return;
}
const osg::Vec3d delta = currentPos - lastSamplePos_;
if (delta.length2() < minMoveDistance_ * minMoveDistance_) {
return;
}
sampleAccum_ = 0.0;
if (!AppendPoint(currentPos)) { if (!AppendPoint(currentPos)) {
return; return;
} }
@ -206,6 +242,41 @@ bool TrajectoryTraceComponent::IsTraceVisible() const {
return traceVisible_; return traceVisible_;
} }
void TrajectoryTraceComponent::SetDashed(bool dashed) {
dashed_ = dashed;
UpdateStyle();
}
bool TrajectoryTraceComponent::IsDashed() const {
return dashed_;
}
void TrajectoryTraceComponent::SetDashLength(double length) {
dashLength_ = std::max(1.0, length);
UpdateStyle();
}
double TrajectoryTraceComponent::GetDashLength() const {
return dashLength_;
}
void TrajectoryTraceComponent::SetGapLength(double length) {
gapLength_ = std::max(1.0, length);
UpdateStyle();
}
double TrajectoryTraceComponent::GetGapLength() const {
return gapLength_;
}
void TrajectoryTraceComponent::SetDashScrollSpeed(double speed) {
dashScrollSpeed_ = speed;
}
double TrajectoryTraceComponent::GetDashScrollSpeed() const {
return dashScrollSpeed_;
}
void TrajectoryTraceComponent::ClearTrace() { void TrajectoryTraceComponent::ClearTrace() {
InitializeGeometry(); InitializeGeometry();
@ -234,6 +305,7 @@ void TrajectoryTraceComponent::InitializeGeometry() {
colors_ = new osg::Vec4Array; colors_ = new osg::Vec4Array;
drawArrays_ = new osg::DrawArrays(GL_LINE_STRIP, 0, 0); drawArrays_ = new osg::DrawArrays(GL_LINE_STRIP, 0, 0);
lineWidthState_ = new osg::LineWidth(lineWidth_); lineWidthState_ = new osg::LineWidth(lineWidth_);
lineStippleState_ = new osg::LineStipple(1, 0xFFFF);
geometry_->setDataVariance(osg::Object::DYNAMIC); geometry_->setDataVariance(osg::Object::DYNAMIC);
geometry_->setUseDisplayList(false); geometry_->setUseDisplayList(false);
@ -251,10 +323,12 @@ void TrajectoryTraceComponent::InitializeGeometry() {
stateSet->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); stateSet->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
stateSet->setAttributeAndModes(new osg::Depth(osg::Depth::LEQUAL, 0.0, 1.0, false)); stateSet->setAttributeAndModes(new osg::Depth(osg::Depth::LEQUAL, 0.0, 1.0, false));
stateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); stateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
stateSet->setAttributeAndModes(lineStippleState_.get(), osg::StateAttribute::OFF);
geode_->addDrawable(geometry_.get()); geode_->addDrawable(geometry_.get());
mt_->addChild(geode_.get()); mt_->addChild(geode_.get());
geode_->setNodeMask(traceVisible_ ? 0xffffffff : 0x0); geode_->setNodeMask(traceVisible_ ? 0xffffffff : 0x0);
UpdateStyle();
} }
void TrajectoryTraceComponent::EnsureAttachedToScene() { void TrajectoryTraceComponent::EnsureAttachedToScene() {
@ -299,6 +373,38 @@ bool TrajectoryTraceComponent::AppendPoint(const osg::Vec3d& geoPoint) {
return true; return true;
} }
bool TrajectoryTraceComponent::UpdateTailPoint(const osg::Vec3d& geoPoint) {
InitializeGeometry();
if (!vertices_.valid() || vertices_->empty()) {
return AppendPoint(geoPoint);
}
osg::Vec3d worldPoint;
if (!ConvertGeoPointToWorld(geoPoint, worldPoint)) {
return false;
}
vertices_->back() = worldPoint;
if (!sampleTimes_.empty()) {
sampleTimes_.back() = elapsedTime_;
}
drawArrays_->setCount(static_cast<GLsizei>(vertices_->size()));
vertices_->dirty();
geometry_->dirtyBound();
if (geode_.valid()) {
geode_->dirtyBound();
}
if (mt_.valid()) {
mt_->dirtyBound();
}
if (attachedToScene_ && mt_->getNumParents() == 0) {
AttachTraceToScene();
}
return true;
}
bool TrajectoryTraceComponent::ConvertGeoPointToWorld(const osg::Vec3d& geoPoint, osg::Vec3d& worldPoint) const { bool TrajectoryTraceComponent::ConvertGeoPointToWorld(const osg::Vec3d& geoPoint, osg::Vec3d& worldPoint) const {
if (nullptr == g_srs_) { if (nullptr == g_srs_) {
LOG_WARN("TrajectoryTraceComponent::ConvertGeoPointToWorld - g_srs_ is nullptr"); LOG_WARN("TrajectoryTraceComponent::ConvertGeoPointToWorld - g_srs_ is nullptr");
@ -380,4 +486,35 @@ void TrajectoryTraceComponent::UpdateStyle() {
if (lineWidthState_.valid()) { if (lineWidthState_.valid()) {
lineWidthState_->setWidth(lineWidth_); lineWidthState_->setWidth(lineWidth_);
} }
if (lineStippleState_.valid() && geode_.valid()) {
const double cycle = std::max(1.0, dashLength_ + gapLength_);
double factorValue = cycle / std::max(1.0f, lineWidth_);
if (factorValue < 1.0) {
factorValue = 1.0;
} else if (factorValue > 255.0) {
factorValue = 255.0;
}
int factor = static_cast<int>(factorValue);
int onBits = static_cast<int>(std::round(16.0 * dashLength_ / cycle));
if (onBits < 1) {
onBits = 1;
} else if (onBits > 15) {
onBits = 15;
}
unsigned short pattern = 0;
for (int i = 0; i < 16; ++i) {
if (i < onBits) {
pattern |= static_cast<unsigned short>(1u << i);
}
}
if (!dashed_) {
pattern = 0xFFFF;
geode_->getOrCreateStateSet()->setAttributeAndModes(lineStippleState_.get(), osg::StateAttribute::OFF);
} else {
geode_->getOrCreateStateSet()->setAttributeAndModes(lineStippleState_.get(), osg::StateAttribute::ON);
}
lineStippleState_->setFactor(factor);
lineStippleState_->setPattern(pattern);
}
} }

View File

@ -3,6 +3,7 @@
#include "entities/SceneComponent.h" #include "entities/SceneComponent.h"
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/LineStipple>
#include <osg/LineWidth> #include <osg/LineWidth>
#include <osg/Vec4> #include <osg/Vec4>
#include <deque> #include <deque>
@ -47,12 +48,25 @@ public:
void SetTraceVisible(bool visible); void SetTraceVisible(bool visible);
bool IsTraceVisible() const; bool IsTraceVisible() const;
void SetDashed(bool dashed);
bool IsDashed() const;
void SetDashLength(double length);
double GetDashLength() const;
void SetGapLength(double length);
double GetGapLength() const;
void SetDashScrollSpeed(double speed);
double GetDashScrollSpeed() const;
void ClearTrace(); void ClearTrace();
private: private:
void InitializeGeometry(); void InitializeGeometry();
void EnsureAttachedToScene(); void EnsureAttachedToScene();
bool AppendPoint(const osg::Vec3d& geoPoint); bool AppendPoint(const osg::Vec3d& geoPoint);
bool UpdateTailPoint(const osg::Vec3d& geoPoint);
bool ConvertGeoPointToWorld(const osg::Vec3d& geoPoint, osg::Vec3d& worldPoint) const; bool ConvertGeoPointToWorld(const osg::Vec3d& geoPoint, osg::Vec3d& worldPoint) const;
void AttachTraceToScene(); void AttachTraceToScene();
void TrimExpiredPoints(); void TrimExpiredPoints();
@ -65,6 +79,7 @@ private:
osg::ref_ptr<osg::Vec4Array> colors_; osg::ref_ptr<osg::Vec4Array> colors_;
osg::ref_ptr<osg::DrawArrays> drawArrays_; osg::ref_ptr<osg::DrawArrays> drawArrays_;
osg::ref_ptr<osg::LineWidth> lineWidthState_; osg::ref_ptr<osg::LineWidth> lineWidthState_;
osg::ref_ptr<osg::LineStipple> lineStippleState_;
osg::Vec4 color_{1.0f, 0.8f, 0.1f, 1.0f}; osg::Vec4 color_{1.0f, 0.8f, 0.1f, 1.0f};
float lineWidth_{2.0f}; float lineWidth_{2.0f};
@ -73,6 +88,10 @@ private:
int maxPoints_{5000}; int maxPoints_{5000};
double tailDuration_{30.0}; double tailDuration_{30.0};
bool traceVisible_{true}; bool traceVisible_{true};
bool dashed_{false};
double dashLength_{150.0};
double gapLength_{100.0};
double dashScrollSpeed_{0.0};
double sampleAccum_{0.0}; double sampleAccum_{0.0};
double elapsedTime_{0.0}; double elapsedTime_{0.0};

View File

@ -33,6 +33,8 @@ int main(int argc, char* argv[]) {
Application app(argc, argv); Application app(argc, argv);
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
app.setApplicationName("Dyt");
app.setApplicationDisplayName("Dyt");
InstallCrashHandler(); InstallCrashHandler();
const float DEFAULT_DPI = 96.0; const float DEFAULT_DPI = 96.0;

View File

@ -3108,47 +3108,47 @@
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9959"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9959"/>
<source>ConeWaveComponent</source> <source>ConeWaveComponent</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10056"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10056"/>
<source>Height</source> <source>Height</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10063"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10063"/>
<source>Radius</source> <source>Radius</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10070"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10070"/>
<source>waveCount</source> <source>waveCount</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10080"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10080"/>
<source>waveSpeed</source> <source>waveSpeed</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10087"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10087"/>
<source>baseColor</source> <source>baseColor</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10094"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10094"/>
<source>waveColor</source> <source>waveColor</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10101"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10101"/>
<source>ringBrightAlpha</source> <source>ringBrightAlpha</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10108"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10108"/>
<source>ringDarkAlpha</source> <source>ringDarkAlpha</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
</context> </context>
<context> <context>
@ -3323,27 +3323,87 @@
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10300"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10300"/>
<source>DashedLineComponent</source> <source>DashedLineComponent</source>
<translation></translation> <translation>线</translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10378"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10378"/>
<source>Start</source> <source>Start</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10385"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10385"/>
<source>End</source> <source>End</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10392"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10392"/>
<source>Radius</source> <source>Radius</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10399"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10399"/>
<source>Color</source> <source>Color</source>
<translation></translation> <translation></translation>
</message>
</context>
<context>
<name>QtTrajectoryTraceComponentManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10322"/>
<source>TrajectoryTraceComponent</source>
<translation></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10394"/>
<source>LineWidth</source>
<translation>线</translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10402"/>
<source>SampleInterval</source>
<translation></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10410"/>
<source>MinMoveDistance</source>
<translation></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10418"/>
<source>MaxPoints</source>
<translation></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10426"/>
<source>TailDuration</source>
<translation></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10434"/>
<source>Visible</source>
<translation></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10441"/>
<source>Dashed</source>
<translation>线</translation>
</message>
<message>
<source>DashLength</source>
<translation>线</translation>
</message>
<message>
<source>GapLength</source>
<translation></translation>
</message>
<message>
<source>DashScrollSpeed</source>
<translation></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10448"/>
<source>Color</source>
<translation></translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -10202,7 +10202,11 @@ public:
QMap<const QtProperty*, QtProperty*> m_properyToMinMoveDistance; QMap<const QtProperty*, QtProperty*> m_properyToMinMoveDistance;
QMap<const QtProperty*, QtProperty*> m_properyToMaxPoints; QMap<const QtProperty*, QtProperty*> m_properyToMaxPoints;
QMap<const QtProperty*, QtProperty*> m_properyToTailDuration; QMap<const QtProperty*, QtProperty*> m_properyToTailDuration;
QMap<const QtProperty*, QtProperty*> m_properyToDashLength;
QMap<const QtProperty*, QtProperty*> m_properyToGapLength;
QMap<const QtProperty*, QtProperty*> m_properyToDashScrollSpeed;
QMap<const QtProperty*, QtProperty*> m_properyToVisible; QMap<const QtProperty*, QtProperty*> m_properyToVisible;
QMap<const QtProperty*, QtProperty*> m_properyToDashed;
QMap<const QtProperty*, QtProperty*> m_properyToColor; QMap<const QtProperty*, QtProperty*> m_properyToColor;
QMap<const QtProperty*, QtProperty*> m_lineWidthToPropery; QMap<const QtProperty*, QtProperty*> m_lineWidthToPropery;
@ -10210,7 +10214,11 @@ public:
QMap<const QtProperty*, QtProperty*> m_minMoveDistanceToPropery; QMap<const QtProperty*, QtProperty*> m_minMoveDistanceToPropery;
QMap<const QtProperty*, QtProperty*> m_maxPointsToPropery; QMap<const QtProperty*, QtProperty*> m_maxPointsToPropery;
QMap<const QtProperty*, QtProperty*> m_tailDurationToPropery; QMap<const QtProperty*, QtProperty*> m_tailDurationToPropery;
QMap<const QtProperty*, QtProperty*> m_dashLengthToPropery;
QMap<const QtProperty*, QtProperty*> m_gapLengthToPropery;
QMap<const QtProperty*, QtProperty*> m_dashScrollSpeedToPropery;
QMap<const QtProperty*, QtProperty*> m_visibleToPropery; QMap<const QtProperty*, QtProperty*> m_visibleToPropery;
QMap<const QtProperty*, QtProperty*> m_dashedToPropery;
QMap<const QtProperty*, QtProperty*> m_colorToPropery; QMap<const QtProperty*, QtProperty*> m_colorToPropery;
}; };
@ -10227,6 +10235,22 @@ void QtTrajectoryTraceComponentManagerPrivate::slotDoubleChanged(QtProperty* pro
QTrajectoryTraceComponentAttribute c = m_values[prop]; QTrajectoryTraceComponentAttribute c = m_values[prop];
c.SetMinMoveDistance(value); c.SetMinMoveDistance(value);
q_ptr->setValue(prop, c); q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_tailDurationToPropery.value(property, 0)) {
QTrajectoryTraceComponentAttribute c = m_values[prop];
c.SetTailDuration(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_dashLengthToPropery.value(property, 0)) {
QTrajectoryTraceComponentAttribute c = m_values[prop];
c.SetDashLength(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_gapLengthToPropery.value(property, 0)) {
QTrajectoryTraceComponentAttribute c = m_values[prop];
c.SetGapLength(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_dashScrollSpeedToPropery.value(property, 0)) {
QTrajectoryTraceComponentAttribute c = m_values[prop];
c.SetDashScrollSpeed(value);
q_ptr->setValue(prop, c);
} }
} }
@ -10243,6 +10267,10 @@ void QtTrajectoryTraceComponentManagerPrivate::slotBoolChanged(QtProperty* prope
QTrajectoryTraceComponentAttribute c = m_values[prop]; QTrajectoryTraceComponentAttribute c = m_values[prop];
c.SetVisible(value); c.SetVisible(value);
q_ptr->setValue(prop, c); q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_dashedToPropery.value(property, 0)) {
QTrajectoryTraceComponentAttribute c = m_values[prop];
c.SetDashed(value);
q_ptr->setValue(prop, c);
} }
} }
@ -10275,10 +10303,26 @@ void QtTrajectoryTraceComponentManagerPrivate::slotPropertyDestroyed(QtProperty*
m_tailDurationToPropery[subProp] = 0; m_tailDurationToPropery[subProp] = 0;
m_tailDurationToPropery.remove(property); m_tailDurationToPropery.remove(property);
} }
if (QtProperty* subProp = m_dashLengthToPropery.value(property, nullptr)) {
m_dashLengthToPropery[subProp] = 0;
m_dashLengthToPropery.remove(property);
}
if (QtProperty* subProp = m_gapLengthToPropery.value(property, nullptr)) {
m_gapLengthToPropery[subProp] = 0;
m_gapLengthToPropery.remove(property);
}
if (QtProperty* subProp = m_dashScrollSpeedToPropery.value(property, nullptr)) {
m_dashScrollSpeedToPropery[subProp] = 0;
m_dashScrollSpeedToPropery.remove(property);
}
if (QtProperty* subProp = m_visibleToPropery.value(property, nullptr)) { if (QtProperty* subProp = m_visibleToPropery.value(property, nullptr)) {
m_visibleToPropery[subProp] = 0; m_visibleToPropery[subProp] = 0;
m_visibleToPropery.remove(property); m_visibleToPropery.remove(property);
} }
if (QtProperty* subProp = m_dashedToPropery.value(property, nullptr)) {
m_dashedToPropery[subProp] = 0;
m_dashedToPropery.remove(property);
}
if (QtProperty* subProp = m_colorToPropery.value(property, nullptr)) { if (QtProperty* subProp = m_colorToPropery.value(property, nullptr)) {
m_colorToPropery[subProp] = 0; m_colorToPropery[subProp] = 0;
m_colorToPropery.remove(property); m_colorToPropery.remove(property);
@ -10379,7 +10423,11 @@ void QtTrajectoryTraceComponentManager::setValue(QtProperty* property, const QTr
d_ptr->m_doubleProperyManager->setValue(d_ptr->m_properyToMinMoveDistance[property], value.GetMinMoveDistance()); d_ptr->m_doubleProperyManager->setValue(d_ptr->m_properyToMinMoveDistance[property], value.GetMinMoveDistance());
d_ptr->m_intProperyManager->setValue(d_ptr->m_properyToMaxPoints[property], value.GetMaxPoints()); d_ptr->m_intProperyManager->setValue(d_ptr->m_properyToMaxPoints[property], value.GetMaxPoints());
d_ptr->m_doubleProperyManager->setValue(d_ptr->m_properyToTailDuration[property], value.GetTailDuration()); d_ptr->m_doubleProperyManager->setValue(d_ptr->m_properyToTailDuration[property], value.GetTailDuration());
d_ptr->m_doubleProperyManager->setValue(d_ptr->m_properyToDashLength[property], value.GetDashLength());
d_ptr->m_doubleProperyManager->setValue(d_ptr->m_properyToGapLength[property], value.GetGapLength());
d_ptr->m_doubleProperyManager->setValue(d_ptr->m_properyToDashScrollSpeed[property], value.GetDashScrollSpeed());
d_ptr->m_boolProperyManager->setValue(d_ptr->m_properyToVisible[property], value.IsVisible()); d_ptr->m_boolProperyManager->setValue(d_ptr->m_properyToVisible[property], value.IsVisible());
d_ptr->m_boolProperyManager->setValue(d_ptr->m_properyToDashed[property], value.IsDashed());
d_ptr->m_colorProperyManager->setValue(d_ptr->m_properyToColor[property], value.GetColor()); d_ptr->m_colorProperyManager->setValue(d_ptr->m_properyToColor[property], value.GetColor());
emit propertyChanged(property); emit propertyChanged(property);
@ -10430,6 +10478,30 @@ void QtTrajectoryTraceComponentManager::initializeProperty(QtProperty* property)
d_ptr->m_tailDurationToPropery[prop] = property; d_ptr->m_tailDurationToPropery[prop] = property;
property->addSubProperty(prop); property->addSubProperty(prop);
prop = d_ptr->m_doubleProperyManager->addProperty();
prop->setPropertyName(tr("DashLength"));
d_ptr->m_doubleProperyManager->setValueOnly(prop, val.GetDashLength());
d_ptr->m_doubleProperyManager->setRange(prop, 1.0, 1000000.0);
d_ptr->m_properyToDashLength[property] = prop;
d_ptr->m_dashLengthToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_doubleProperyManager->addProperty();
prop->setPropertyName(tr("GapLength"));
d_ptr->m_doubleProperyManager->setValueOnly(prop, val.GetGapLength());
d_ptr->m_doubleProperyManager->setRange(prop, 1.0, 1000000.0);
d_ptr->m_properyToGapLength[property] = prop;
d_ptr->m_gapLengthToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_doubleProperyManager->addProperty();
prop->setPropertyName(tr("DashScrollSpeed"));
d_ptr->m_doubleProperyManager->setValueOnly(prop, val.GetDashScrollSpeed());
d_ptr->m_doubleProperyManager->setRange(prop, -1000000.0, 1000000.0);
d_ptr->m_properyToDashScrollSpeed[property] = prop;
d_ptr->m_dashScrollSpeedToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_boolProperyManager->addProperty(); prop = d_ptr->m_boolProperyManager->addProperty();
prop->setPropertyName(tr("Visible")); prop->setPropertyName(tr("Visible"));
d_ptr->m_boolProperyManager->setValue(prop, val.IsVisible()); d_ptr->m_boolProperyManager->setValue(prop, val.IsVisible());
@ -10437,6 +10509,13 @@ void QtTrajectoryTraceComponentManager::initializeProperty(QtProperty* property)
d_ptr->m_visibleToPropery[prop] = property; d_ptr->m_visibleToPropery[prop] = property;
property->addSubProperty(prop); property->addSubProperty(prop);
prop = d_ptr->m_boolProperyManager->addProperty();
prop->setPropertyName(tr("Dashed"));
d_ptr->m_boolProperyManager->setValue(prop, val.IsDashed());
d_ptr->m_properyToDashed[property] = prop;
d_ptr->m_dashedToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_colorProperyManager->addProperty(); prop = d_ptr->m_colorProperyManager->addProperty();
prop->setPropertyName(tr("Color")); prop->setPropertyName(tr("Color"));
d_ptr->m_colorProperyManager->setValue(prop, val.GetColor()); d_ptr->m_colorProperyManager->setValue(prop, val.GetColor());
@ -10481,6 +10560,27 @@ void QtTrajectoryTraceComponentManager::uninitializeProperty(QtProperty* propert
} }
d_ptr->m_properyToTailDuration.remove(property); d_ptr->m_properyToTailDuration.remove(property);
prop = d_ptr->m_dashLengthToPropery[property];
if (prop) {
d_ptr->m_dashLengthToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToDashLength.remove(property);
prop = d_ptr->m_gapLengthToPropery[property];
if (prop) {
d_ptr->m_gapLengthToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToGapLength.remove(property);
prop = d_ptr->m_dashScrollSpeedToPropery[property];
if (prop) {
d_ptr->m_dashScrollSpeedToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToDashScrollSpeed.remove(property);
prop = d_ptr->m_visibleToPropery[property]; prop = d_ptr->m_visibleToPropery[property];
if (prop) { if (prop) {
d_ptr->m_visibleToPropery.remove(prop); d_ptr->m_visibleToPropery.remove(prop);
@ -10488,6 +10588,13 @@ void QtTrajectoryTraceComponentManager::uninitializeProperty(QtProperty* propert
} }
d_ptr->m_properyToVisible.remove(property); d_ptr->m_properyToVisible.remove(property);
prop = d_ptr->m_dashedToPropery[property];
if (prop) {
d_ptr->m_dashedToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToDashed.remove(property);
prop = d_ptr->m_colorToPropery[property]; prop = d_ptr->m_colorToPropery[property];
if (prop) { if (prop) {
d_ptr->m_colorToPropery.remove(prop); d_ptr->m_colorToPropery.remove(prop);

View File

@ -593,6 +593,70 @@ bool QTrajectoryTraceComponentAttribute::IsVisible() const {
return object_->IsTraceVisible(); return object_->IsTraceVisible();
} }
void QTrajectoryTraceComponentAttribute::SetDashed(bool dashed) {
if (nullptr == object_) {
return;
}
object_->SetDashed(dashed);
}
bool QTrajectoryTraceComponentAttribute::IsDashed() const {
if (nullptr == object_) {
return false;
}
return object_->IsDashed();
}
void QTrajectoryTraceComponentAttribute::SetDashLength(double length) {
if (nullptr == object_) {
return;
}
object_->SetDashLength(length);
}
double QTrajectoryTraceComponentAttribute::GetDashLength() const {
if (nullptr == object_) {
return 150.0;
}
return object_->GetDashLength();
}
void QTrajectoryTraceComponentAttribute::SetGapLength(double length) {
if (nullptr == object_) {
return;
}
object_->SetGapLength(length);
}
double QTrajectoryTraceComponentAttribute::GetGapLength() const {
if (nullptr == object_) {
return 100.0;
}
return object_->GetGapLength();
}
void QTrajectoryTraceComponentAttribute::SetDashScrollSpeed(double speed) {
if (nullptr == object_) {
return;
}
object_->SetDashScrollSpeed(speed);
}
double QTrajectoryTraceComponentAttribute::GetDashScrollSpeed() const {
if (nullptr == object_) {
return 0.0;
}
return object_->GetDashScrollSpeed();
}
bool QTrajectoryTraceComponentAttribute::operator==(const QTrajectoryTraceComponentAttribute& other) { bool QTrajectoryTraceComponentAttribute::operator==(const QTrajectoryTraceComponentAttribute& other) {
return object_ == other.object_; return object_ == other.object_;
} }

View File

@ -264,6 +264,18 @@ public:
void SetVisible(bool visible); void SetVisible(bool visible);
bool IsVisible() const; bool IsVisible() const;
void SetDashed(bool dashed);
bool IsDashed() const;
void SetDashLength(double length);
double GetDashLength() const;
void SetGapLength(double length);
double GetGapLength() const;
void SetDashScrollSpeed(double speed);
double GetDashScrollSpeed() const;
private: private:
class TrajectoryTraceComponent* object_{ nullptr }; class TrajectoryTraceComponent* object_{ nullptr };
}; };