diff --git a/src/effects/ConeWave.cpp b/src/effects/ConeWave.cpp index a61b3099..666842cc 100644 --- a/src/effects/ConeWave.cpp +++ b/src/effects/ConeWave.cpp @@ -129,6 +129,8 @@ void ConeWave::SetHeight(float height) { height_ = height; if (cone_.valid()) { cone_->setHeight(height_); + // 更新锥形中心位置以保持顶点在原点 + cone_->setCenter(osg::Vec3(0, 0, -height_/2)); // 强制更新ShapeDrawable if (coneDrawable_.valid()) { coneDrawable_->dirtyDisplayList(); @@ -250,7 +252,8 @@ void ConeWave::SetConeAlpha(float alpha) { void ConeWave::CreateRadarScanWave() { // 使用OSG内置的Cone几何体来创建雷达扫描区域 - cone_ = new osg::Cone(osg::Vec3(0, 0, 0), radius_, height_); + // 创建锥形,锥形顶点在原点,开口向下(负Z方向) + cone_ = new osg::Cone(osg::Vec3(0, 0, -height_/2), radius_, height_); // 设置细分参数,创建开口锥形 osg::TessellationHints* tesselate = new osg::TessellationHints; diff --git a/src/entities/ConeWaveComponent.cpp b/src/entities/ConeWaveComponent.cpp index 293d025e..426fd343 100644 --- a/src/entities/ConeWaveComponent.cpp +++ b/src/entities/ConeWaveComponent.cpp @@ -111,6 +111,11 @@ void ConeWaveComponent::AddToRender() { void ConeWaveComponent::Initialize() { mt_ = new osg::MatrixTransform; + + // 创建旋转矩阵,让锥形向下发射(绕X轴旋转180度) + // osg::Matrix rotationMatrix = osg::Matrix::rotate(osg::PI, osg::Vec3(1, 0, 0)); + // mt_->setMatrix(rotationMatrix); + mt_->addChild(coneWave_); } diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts index 4336d47e..e1ab814e 100644 --- a/src/translations/Dyt_zh_CN.ts +++ b/src/translations/Dyt_zh_CN.ts @@ -892,12 +892,12 @@ QtBoolPropertyManager - + True - + False @@ -921,22 +921,22 @@ QtColorPropertyManager - + Red - + Green - + Blue - + Alpha @@ -944,48 +944,48 @@ QtConeWaveComponentManager - - + + ConeWaveComponent - + Height - + Radius - + waveCount - + waveSpeed - + baseColor - + waveColor - + ringBrightAlpha - + ringDarkAlpha @@ -1091,28 +1091,28 @@ QtDashedLineComponentManager - - + + DashedLineComponent - + Start - + End - + Radius - + Color @@ -1128,12 +1128,12 @@ QtEntityPropertyManager - + Name - + Transform @@ -1154,37 +1154,37 @@ QtFontPropertyManager - + Family - + Point Size - + Bold - + Italic - + Underline - + Strikeout - + Kerning @@ -1192,22 +1192,22 @@ QtLocalePropertyManager - + <Invalid> - + %1, %2 - + Language - + Country @@ -1215,13 +1215,13 @@ QtMeshComponetManager - - + + MeshComponent - + Mesh @@ -1229,22 +1229,22 @@ QtModelBasePropertyManager - + Name - + Description - + Inflow - + InnerBottomElevation @@ -1265,13 +1265,13 @@ QtPathComponentManager - - + + PathComponent - + Path @@ -1279,17 +1279,17 @@ QtPointFPropertyManager - + (%1, %2) - + X - + Y @@ -1297,17 +1297,17 @@ QtPointPropertyManager - + (%1, %2) - + X - + Y @@ -1325,12 +1325,12 @@ - + [%1, %2, %3] - + [%1, %2, %3] [%4, %5, %6] [%7, %8, %9] @@ -1338,27 +1338,27 @@ QtRectFPropertyManager - + [(%1, %2), %3 x %4] - + X - + Y - + Width - + Height @@ -1366,27 +1366,27 @@ QtRectPropertyManager - + [(%1, %2), %3 x %4] - + X - + Y - + Width - + Height @@ -1394,17 +1394,17 @@ QtSizeFPropertyManager - + %1 x %2 - + Width - + Height @@ -1412,33 +1412,33 @@ QtSizePolicyPropertyManager - - + + <Invalid> - + [%1, %2, %3, %4] - + Horizontal Policy - + Vertical Policy - + Horizontal Stretch - + Vertical Stretch @@ -1446,17 +1446,17 @@ QtSizePropertyManager - + %1 x %2 - + Width - + Height @@ -1472,17 +1472,17 @@ QtTransfromPropertyManager - + Location - + Rotation - + Scale @@ -1503,17 +1503,17 @@ QtVec3PropertyManager - + X - + Y - + Z @@ -1521,42 +1521,42 @@ QtWorkspacePropertyManager - + Name - + Description - + Timestep - + SimMatlab - + MatlabParam - + Wave - + RD - + Report diff --git a/src/ui/PropertyBrowser/qtpropertymanager.cpp b/src/ui/PropertyBrowser/qtpropertymanager.cpp index aa8921f1..7f18268e 100644 --- a/src/ui/PropertyBrowser/qtpropertymanager.cpp +++ b/src/ui/PropertyBrowser/qtpropertymanager.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -281,19 +282,24 @@ static void setValueInRange(PropertyManager* manager, PropertyManagerPrivate* ma auto& data = it.value(); - if (data.val == val) + if (data.val == val) { + qDebug() << "setValueInRange: value unchanged, returning"; return; + } const Value oldVal = data.val; data.val = qBound(data.minVal, val, data.maxVal); - if (data.val == oldVal) + if (data.val == oldVal) { + qDebug() << "setValueInRange: value same after bound, returning"; return; + } if (setSubPropertyValue) (managerPrivate->*setSubPropertyValue)(property, data.val); + qDebug() << "setValueInRange: emitting signals for property change"; emit(manager->*propertyChangedSignal)(property); emit(manager->*valueChangedSignal)(property, data.val); } @@ -781,11 +787,16 @@ QString QtIntPropertyManager::valueText(const QtProperty* property) const */ void QtIntPropertyManager::setValue(QtProperty* property, int val) { + qDebug() << "QtIntPropertyManager::setValue called with property:" << property << "value:" << val; + const QtIntPropertyManagerPrivate::PropertyValueMap::iterator it = d_ptr->m_values.find(property); - if (it == d_ptr->m_values.end()) + if (it == d_ptr->m_values.end()) { + qDebug() << "Property not found in m_values!"; return; + } QtIntPropertyManagerPrivate::Data& data = it.value(); + qDebug() << "Current value:" << data.val << "New value:" << val; if (!data.isInitialed) { @@ -8768,11 +8779,19 @@ void QtConeWaveComponentManagerPrivate::slotDoubleChanged(QtProperty* property, } } +#include void QtConeWaveComponentManagerPrivate::slotIntChanged(QtProperty* property, int value) { + qDebug() << "slotIntChanged called with value:" << value; + qDebug() << "Property address:" << property; + qDebug() << "m_waveCountToPropery size:" << m_waveCountToPropery.size(); + if (QtProperty* prop = m_waveCountToPropery.value(property, 0)) { + qDebug() << "Found waveCount property mapping, updating value to:" << value; QConeWaveComponentAttribute c = m_values[prop]; c.SetWaveCount(value); q_ptr->setValue(prop, c); + } else { + qDebug() << "Property not found in m_waveCountToPropery mapping"; } } @@ -8818,6 +8837,10 @@ void QtConeWaveComponentManagerPrivate::slotPropertyDestroyed(QtProperty* proper m_ringBrightAlphaToPropery[subProp] = 0; m_ringBrightAlphaToPropery.remove(property); } + if (QtProperty* subProp = m_ringDarkAlphaToPropery.value(property, nullptr)) { + m_ringDarkAlphaToPropery[subProp] = 0; + m_ringDarkAlphaToPropery.remove(property); + } } QtConeWaveComponentManager::QtConeWaveComponentManager(QObject* parent) @@ -8831,8 +8854,9 @@ QtConeWaveComponentManager::QtConeWaveComponentManager(QObject* parent) this, SLOT(slotPropertyDestroyed(QtProperty*))); d_ptr->m_intProperyManager = new QtIntPropertyManager(this); - connect(d_ptr->m_intProperyManager, SIGNAL(valueChanged(QtProperty*, int)), + bool intConnected = connect(d_ptr->m_intProperyManager, SIGNAL(valueChanged(QtProperty*, int)), this, SLOT(slotIntChanged(QtProperty*, int))); + qDebug() << "Int manager connection result:" << intConnected; connect(d_ptr->m_intProperyManager, SIGNAL(propertyDestroyed(QtProperty*)), this, SLOT(slotPropertyDestroyed(QtProperty*))); @@ -8964,9 +8988,12 @@ void QtConeWaveComponentManager::initializeProperty(QtProperty* property) { prop = d_ptr->m_intProperyManager->addProperty(); prop->setPropertyName(tr("waveCount")); d_ptr->m_intProperyManager->setValueOnly(prop, val.GetWaveCount()); + d_ptr->m_intProperyManager->setRange(prop, 1, 100); d_ptr->m_properyToWaveCount[property] = prop; d_ptr->m_waveCountToPropery[prop] = property; property->addSubProperty(prop); + qDebug() << "Created waveCount property. Prop address:" << prop << "Parent address:" << property; + qDebug() << "m_waveCountToPropery now has" << d_ptr->m_waveCountToPropery.size() << "entries"; prop = d_ptr->m_doubleProperyManager->addProperty(); prop->setPropertyName(tr("waveSpeed"));