diff --git a/src/common/RecourceHelper.cpp b/src/common/RecourceHelper.cpp index b85d170e..406f4751 100644 --- a/src/common/RecourceHelper.cpp +++ b/src/common/RecourceHelper.cpp @@ -1,6 +1,7 @@ #include "RecourceHelper.h" #include +#include #include #include @@ -93,22 +94,40 @@ void RecourceHelper::Init() { 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 transName = QString("%1/translations/%2_zh_CN.qm").arg(appDirPath, appName/*, QLocale().name()*/); -#endif - qDebug() << transName; - bool success = trans_.load(transName); + QStringList appNames; + const QString displayName = QApplication::applicationDisplayName().trimmed(); + const QString appName = QApplication::applicationName().trimmed(); + 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) { QApplication::installTranslator(&trans_); } 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); if (success) { QApplication::installTranslator(&systemTrans_); diff --git a/src/entities/PathComponent.cpp b/src/entities/PathComponent.cpp index 014b1be7..203b918f 100644 --- a/src/entities/PathComponent.cpp +++ b/src/entities/PathComponent.cpp @@ -151,3 +151,17 @@ void PathComponent::SetPath(const QString& path) { const QString& PathComponent::GetPath() const { return path_; } + +bool PathComponent::GetFirstPathLocation(osg::Vec3d* location) const { + if (nullptr == location || nullptr == transformPath_) { + return false; + } + + const std::vector& transforms = transformPath_->GetTransforms(); + if (transforms.empty()) { + return false; + } + + *location = transforms.front().GetLocation(); + return true; +} diff --git a/src/entities/PathComponent.h b/src/entities/PathComponent.h index fabefb53..7af67672 100644 --- a/src/entities/PathComponent.h +++ b/src/entities/PathComponent.h @@ -24,6 +24,7 @@ public: void SetPath(const QString& path); const QString& GetPath() const; + bool GetFirstPathLocation(osg::Vec3d* location) const; protected: class TransformPath* transformPath_{nullptr}; @@ -32,4 +33,4 @@ protected: osg::ref_ptr animationPath_; QString path_; -}; \ No newline at end of file +}; diff --git a/src/entities/TrajectoryTraceComponent.cpp b/src/entities/TrajectoryTraceComponent.cpp index 8a6bf8ee..f4b0296b 100644 --- a/src/entities/TrajectoryTraceComponent.cpp +++ b/src/entities/TrajectoryTraceComponent.cpp @@ -10,6 +10,7 @@ #include "common/SpdLogger.h" #include "entities/Entity.h" +#include "entities/PathComponent.h" #include "scene/SceneContent.h" #include "utils/StringUtils.h" #include "workspace/WorkSpace.h" @@ -47,6 +48,18 @@ bool TrajectoryTraceComponent::SetAttribute(const char* name, const char* value) } else if (0 == strcmp(name, "visible")) { SetTraceVisible(0 == strcmp(value, "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); @@ -60,6 +73,10 @@ bool TrajectoryTraceComponent::SaveAttribute(tinyxml2::XMLElement* element) { element->SetAttribute("maxPoints", maxPoints_); element->SetAttribute("tailDuration", std::to_string(tailDuration_).c_str()); 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); } @@ -85,32 +102,51 @@ void TrajectoryTraceComponent::Update(double dt) { return; } - /* elapsedTime_ += dt; + elapsedTime_ += dt; sampleAccum_ += dt; TrimExpiredPoints(); - if (sampleAccum_ < sampleInterval_) { - return; - } - sampleAccum_ = 0.0;*/ const osg::Vec3d currentPos = entity->GetTransform()->GetLocation(); if (!hasLastSample_) { + osg::Vec3d initialPos = currentPos; + if (PathComponent* pathComponent = entity->GetComponent()) { + pathComponent->GetFirstPathLocation(&initialPos); + } + EnsureAttachedToScene(); + if (!AppendPoint(initialPos)) { + return; + } + if (!AppendPoint(currentPos)) { + return; + } lastSamplePos_ = currentPos; hasLastSample_ = true; + sampleAccum_ = 0.0; return; } - /*const osg::Vec3d delta = currentPos - lastSamplePos_; - if (delta.length2() < minMoveDistance_ * minMoveDistance_) { - return; - }*/ - EnsureAttachedToScene(); if (vertices_->empty()) { if (!AppendPoint(lastSamplePos_)) { 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)) { return; } @@ -206,6 +242,41 @@ bool TrajectoryTraceComponent::IsTraceVisible() const { 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() { InitializeGeometry(); @@ -234,6 +305,7 @@ void TrajectoryTraceComponent::InitializeGeometry() { colors_ = new osg::Vec4Array; drawArrays_ = new osg::DrawArrays(GL_LINE_STRIP, 0, 0); lineWidthState_ = new osg::LineWidth(lineWidth_); + lineStippleState_ = new osg::LineStipple(1, 0xFFFF); geometry_->setDataVariance(osg::Object::DYNAMIC); 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::Depth(osg::Depth::LEQUAL, 0.0, 1.0, false)); stateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); + stateSet->setAttributeAndModes(lineStippleState_.get(), osg::StateAttribute::OFF); geode_->addDrawable(geometry_.get()); mt_->addChild(geode_.get()); geode_->setNodeMask(traceVisible_ ? 0xffffffff : 0x0); + UpdateStyle(); } void TrajectoryTraceComponent::EnsureAttachedToScene() { @@ -299,6 +373,38 @@ bool TrajectoryTraceComponent::AppendPoint(const osg::Vec3d& geoPoint) { 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(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 { if (nullptr == g_srs_) { LOG_WARN("TrajectoryTraceComponent::ConvertGeoPointToWorld - g_srs_ is nullptr"); @@ -380,4 +486,35 @@ void TrajectoryTraceComponent::UpdateStyle() { if (lineWidthState_.valid()) { 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(factorValue); + int onBits = static_cast(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(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); + } } diff --git a/src/entities/TrajectoryTraceComponent.h b/src/entities/TrajectoryTraceComponent.h index 93a66cf9..58b22cc9 100644 --- a/src/entities/TrajectoryTraceComponent.h +++ b/src/entities/TrajectoryTraceComponent.h @@ -3,6 +3,7 @@ #include "entities/SceneComponent.h" #include +#include #include #include #include @@ -47,12 +48,25 @@ public: void SetTraceVisible(bool visible); 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(); private: void InitializeGeometry(); void EnsureAttachedToScene(); bool AppendPoint(const osg::Vec3d& geoPoint); + bool UpdateTailPoint(const osg::Vec3d& geoPoint); bool ConvertGeoPointToWorld(const osg::Vec3d& geoPoint, osg::Vec3d& worldPoint) const; void AttachTraceToScene(); void TrimExpiredPoints(); @@ -65,6 +79,7 @@ private: osg::ref_ptr colors_; osg::ref_ptr drawArrays_; osg::ref_ptr lineWidthState_; + osg::ref_ptr lineStippleState_; osg::Vec4 color_{1.0f, 0.8f, 0.1f, 1.0f}; float lineWidth_{2.0f}; @@ -73,6 +88,10 @@ private: int maxPoints_{5000}; double tailDuration_{30.0}; bool traceVisible_{true}; + bool dashed_{false}; + double dashLength_{150.0}; + double gapLength_{100.0}; + double dashScrollSpeed_{0.0}; double sampleAccum_{0.0}; double elapsedTime_{0.0}; diff --git a/src/main.cpp b/src/main.cpp index 2eb46d5f..8a210eaa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,8 @@ int main(int argc, char* argv[]) { Application app(argc, argv); app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); + app.setApplicationName("Dyt"); + app.setApplicationDisplayName("Dyt"); InstallCrashHandler(); const float DEFAULT_DPI = 96.0; diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts index 76891f29..dad2c612 100644 --- a/src/translations/Dyt_zh_CN.ts +++ b/src/translations/Dyt_zh_CN.ts @@ -3108,47 +3108,47 @@ ConeWaveComponent - + 锥波组件 Height - + 高度 Radius - + 半径 waveCount - + 波纹数量 waveSpeed - + 波纹速度 baseColor - + 基础颜色 waveColor - + 波纹颜色 ringBrightAlpha - + 亮环透明度 ringDarkAlpha - + 暗环透明度 @@ -3323,27 +3323,87 @@ DashedLineComponent - + 虚线组件 Start - + 起点 End - + 终点 Radius - + 半径 Color - + 颜色 + + + + QtTrajectoryTraceComponentManager + + + TrajectoryTraceComponent + 尾迹组件 + + + + LineWidth + 线宽 + + + + SampleInterval + 采样间隔 + + + + MinMoveDistance + 最小移动距离 + + + + MaxPoints + 最大点数 + + + + TailDuration + 尾迹时长 + + + + Visible + 显示 + + + + Dashed + 虚线 + + + DashLength + 虚线段长度 + + + GapLength + 间隔长度 + + + DashScrollSpeed + 滚动速度 + + + + Color + 颜色 diff --git a/src/ui/PropertyBrowser/qtpropertymanager.cpp b/src/ui/PropertyBrowser/qtpropertymanager.cpp index 26412cce..3693c6dd 100644 --- a/src/ui/PropertyBrowser/qtpropertymanager.cpp +++ b/src/ui/PropertyBrowser/qtpropertymanager.cpp @@ -10202,7 +10202,11 @@ public: QMap m_properyToMinMoveDistance; QMap m_properyToMaxPoints; QMap m_properyToTailDuration; + QMap m_properyToDashLength; + QMap m_properyToGapLength; + QMap m_properyToDashScrollSpeed; QMap m_properyToVisible; + QMap m_properyToDashed; QMap m_properyToColor; QMap m_lineWidthToPropery; @@ -10210,7 +10214,11 @@ public: QMap m_minMoveDistanceToPropery; QMap m_maxPointsToPropery; QMap m_tailDurationToPropery; + QMap m_dashLengthToPropery; + QMap m_gapLengthToPropery; + QMap m_dashScrollSpeedToPropery; QMap m_visibleToPropery; + QMap m_dashedToPropery; QMap m_colorToPropery; }; @@ -10227,6 +10235,22 @@ void QtTrajectoryTraceComponentManagerPrivate::slotDoubleChanged(QtProperty* pro QTrajectoryTraceComponentAttribute c = m_values[prop]; c.SetMinMoveDistance(value); 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]; c.SetVisible(value); 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.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)) { m_visibleToPropery[subProp] = 0; 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)) { m_colorToPropery[subProp] = 0; 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_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_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_properyToDashed[property], value.IsDashed()); d_ptr->m_colorProperyManager->setValue(d_ptr->m_properyToColor[property], value.GetColor()); emit propertyChanged(property); @@ -10430,6 +10478,30 @@ void QtTrajectoryTraceComponentManager::initializeProperty(QtProperty* property) d_ptr->m_tailDurationToPropery[prop] = property; 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->setPropertyName(tr("Visible")); d_ptr->m_boolProperyManager->setValue(prop, val.IsVisible()); @@ -10437,6 +10509,13 @@ void QtTrajectoryTraceComponentManager::initializeProperty(QtProperty* property) d_ptr->m_visibleToPropery[prop] = property; 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->setPropertyName(tr("Color")); d_ptr->m_colorProperyManager->setValue(prop, val.GetColor()); @@ -10481,6 +10560,27 @@ void QtTrajectoryTraceComponentManager::uninitializeProperty(QtProperty* propert } 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]; if (prop) { d_ptr->m_visibleToPropery.remove(prop); @@ -10488,6 +10588,13 @@ void QtTrajectoryTraceComponentManager::uninitializeProperty(QtProperty* propert } 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]; if (prop) { d_ptr->m_colorToPropery.remove(prop); diff --git a/src/ui/PropertyBrowser/qtworkspaceattribute.cpp b/src/ui/PropertyBrowser/qtworkspaceattribute.cpp index 9b52d82b..6c5e6f79 100644 --- a/src/ui/PropertyBrowser/qtworkspaceattribute.cpp +++ b/src/ui/PropertyBrowser/qtworkspaceattribute.cpp @@ -593,6 +593,70 @@ bool QTrajectoryTraceComponentAttribute::IsVisible() const { 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) { return object_ == other.object_; } diff --git a/src/ui/PropertyBrowser/qtworkspaceattribute.h b/src/ui/PropertyBrowser/qtworkspaceattribute.h index 2daec57b..f38201b9 100644 --- a/src/ui/PropertyBrowser/qtworkspaceattribute.h +++ b/src/ui/PropertyBrowser/qtworkspaceattribute.h @@ -264,6 +264,18 @@ public: void SetVisible(bool visible); 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: class TrajectoryTraceComponent* object_{ nullptr }; };