修改翻译文件和尾迹工程
This commit is contained in:
parent
f8665a2e5d
commit
81cf0e828b
@ -1,6 +1,7 @@
|
||||
#include "RecourceHelper.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QLocale>
|
||||
|
||||
#include <QFontDatabase>
|
||||
@ -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
|
||||
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;
|
||||
bool success = trans_.load(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_);
|
||||
|
||||
@ -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<Transform>& transforms = transformPath_->GetTransforms();
|
||||
if (transforms.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*location = transforms.front().GetLocation();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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_) {
|
||||
lastSamplePos_ = currentPos;
|
||||
hasLastSample_ = true;
|
||||
osg::Vec3d initialPos = currentPos;
|
||||
if (PathComponent* pathComponent = entity->GetComponent<PathComponent>()) {
|
||||
pathComponent->GetFirstPathLocation(&initialPos);
|
||||
}
|
||||
EnsureAttachedToScene();
|
||||
if (!AppendPoint(initialPos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*const osg::Vec3d delta = currentPos - lastSamplePos_;
|
||||
if (delta.length2() < minMoveDistance_ * minMoveDistance_) {
|
||||
if (!AppendPoint(currentPos)) {
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
lastSamplePos_ = currentPos;
|
||||
hasLastSample_ = true;
|
||||
sampleAccum_ = 0.0;
|
||||
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<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 {
|
||||
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<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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "entities/SceneComponent.h"
|
||||
|
||||
#include <osg/Geometry>
|
||||
#include <osg/LineStipple>
|
||||
#include <osg/LineWidth>
|
||||
#include <osg/Vec4>
|
||||
#include <deque>
|
||||
@ -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<osg::Vec4Array> colors_;
|
||||
osg::ref_ptr<osg::DrawArrays> drawArrays_;
|
||||
osg::ref_ptr<osg::LineWidth> lineWidthState_;
|
||||
osg::ref_ptr<osg::LineStipple> 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};
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -3108,47 +3108,47 @@
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9959"/>
|
||||
<source>ConeWaveComponent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>锥波组件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10056"/>
|
||||
<source>Height</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>高度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10063"/>
|
||||
<source>Radius</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>半径</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10070"/>
|
||||
<source>waveCount</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>波纹数量</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10080"/>
|
||||
<source>waveSpeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>波纹速度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10087"/>
|
||||
<source>baseColor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>基础颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10094"/>
|
||||
<source>waveColor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>波纹颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10101"/>
|
||||
<source>ringBrightAlpha</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>亮环透明度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10108"/>
|
||||
<source>ringDarkAlpha</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>暗环透明度</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -3323,27 +3323,87 @@
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10300"/>
|
||||
<source>DashedLineComponent</source>
|
||||
<translation></translation>
|
||||
<translation>虚线组件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10378"/>
|
||||
<source>Start</source>
|
||||
<translation></translation>
|
||||
<translation>起点</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10385"/>
|
||||
<source>End</source>
|
||||
<translation></translation>
|
||||
<translation>终点</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10392"/>
|
||||
<source>Radius</source>
|
||||
<translation></translation>
|
||||
<translation>半径</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="10399"/>
|
||||
<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>
|
||||
</context>
|
||||
<context>
|
||||
|
||||
@ -10202,7 +10202,11 @@ public:
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToMinMoveDistance;
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToMaxPoints;
|
||||
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_properyToDashed;
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToColor;
|
||||
|
||||
QMap<const QtProperty*, QtProperty*> m_lineWidthToPropery;
|
||||
@ -10210,7 +10214,11 @@ public:
|
||||
QMap<const QtProperty*, QtProperty*> m_minMoveDistanceToPropery;
|
||||
QMap<const QtProperty*, QtProperty*> m_maxPointsToPropery;
|
||||
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_dashedToPropery;
|
||||
QMap<const QtProperty*, QtProperty*> 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);
|
||||
|
||||
@ -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_;
|
||||
}
|
||||
|
||||
@ -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 };
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user