Compare commits

...

2 Commits

Author SHA1 Message Date
875bf988c4 Merge branch 'master' of http://192.168.1.10:13521/PM/DYT 2024-12-29 20:28:36 +08:00
1cf00050fc modify attribute and dyt 2024-12-29 20:28:06 +08:00
11 changed files with 193 additions and 119 deletions

View File

@ -105,7 +105,7 @@ INCLUDE_DIRECTORIES(
if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /Od")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
foreach(var
@ -179,7 +179,7 @@ if(${QT_VERSION_MAJOR} LESS 6)
PRIVATE
Qt${QT_VERSION_MAJOR}::WinExtras
)
endif()
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ProjectDIR}/bin)

View File

@ -1,5 +1,8 @@
#pragma once
#include <cmath>
#include <limits>
extern const char* CONFIG_PATH;
#define Q_REGISTER_METATYPE(T) \
@ -16,3 +19,25 @@ static struct T##MetaTypeRegister { \
#else
#define FORCE_INLINE inline
#endif
#define dyt_check(condition) \
do { \
if (!(condition)) { \
LOG_ERROR("Check failed: {}", #condition); \
abort(); \
} \
} while (0)
FORCE_INLINE bool IsValid(double value) {
constexpr double epsilon = std::numeric_limits<double>::epsilon();
return std::abs(value) > epsilon;
}
FORCE_INLINE bool IsDecimalValid(double value) {
double intPart;
double fractionalPart = std::modf(value, &intPart);
return IsValid(fractionalPart);
}

View File

@ -6,6 +6,8 @@
#include "entities/Entity.h"
#include "utils/OsgUtils.h"
#include "scene/SceneContent.h"
SceneComponent::SceneComponent(SceneComponent* parent)
: Component(parent) {
@ -130,15 +132,27 @@ void SceneComponent::AttachScene(Entity* entity) {
return;
}
/* OsgScene* scene = workspace->GetActiveScene();
#if USE_OCEAN
OsgScene* scene = workspace->GetActiveScene();
#else
OEScene* scene = workspace->GetActiveScene();
#endif
if (nullptr == scene) {
LOG_WARN("scene is nullptr");
return;
}
UpdateLocationAndRotation();
scene->AddToOceanScene(mt_);*/
#if USE_OCEAN
scene->AddToScene(mt_);
#else
if (!geo_) {
geo_ = new osgEarth::GeoTransform;
geo_->addChild(mt_);
}
scene->AddToScene(geo_);
#endif
UpdateLocationAndRotation();
}
void SceneComponent::AttachParent(Entity* entity) {
@ -175,8 +189,15 @@ void SceneComponent::UpdateLocationAndRotation() {
const osg::Vec3& s = transform_.GetScale();
const osg::Vec3& t = transform_.GetLocation();
osg::Quat quat = OsgUtils::HPRToQuat(r);
osg::Matrix matrix = osg::Matrix::scale(s) * osg::Matrix::rotate(quat) * osg::Matrix::translate(t);
mt_->setMatrix(matrix);
osg::Matrix matrix = osg::Matrix::scale(s) * osg::Matrix::rotate(quat);
if (!geo_.valid()) {
matrix *= osg::Matrix::translate(t);
mt_->setMatrix(matrix);
} else {
mt_->setMatrix(matrix);
osgEarth::GeoPoint pos(g_srs_, t);
geo_->setPosition(pos);
}
}
void SceneComponent::RemoveRender() {

View File

@ -5,6 +5,8 @@
#include "utils/Transform.h"
#include <osgEarth/GeoTransform>
#include "osg/Vec3"
#include "osg/MatrixTransform"
@ -41,7 +43,7 @@ public:
}
osg::MatrixTransform* GetMatrixTransform() const {
return mt_.get();
return geo_.valid() ? geo_.get() : mt_.get();
}
const Transform* GetTransform() const {
return &transform_;
@ -66,6 +68,10 @@ protected:
std::vector<SceneComponent*> children_;
osg::ref_ptr<osg::MatrixTransform> mt_;
#ifndef USE_OCEAN
osg::ref_ptr<osgEarth::GeoTransform> geo_{nullptr};
#endif
protected:
Transform transform_;
};

View File

@ -2,6 +2,10 @@
#include <osgDB/ReadFile>
#ifndef USE_OCEAN
#include <osgEarth/Registry>
#endif
#include "common/SpdLogger.h"
#include "common/RecourceHelper.h"
@ -55,6 +59,9 @@ osg::MatrixTransform* MeshManager::ReadNode(const std::string& file) {
return nullptr;
}
#ifndef USE_OCEAN
osgEarth::Registry::shaderGenerator().run(node);
#endif
nodes_[file] = node;
osg::MatrixTransform* mt = new osg::MatrixTransform;

View File

@ -13,11 +13,14 @@
#include <osgShadow/ViewDependentShadowMap>
#include <osgViewer/ViewerEventHandlers>
#include "config.h"
#include "common/SpdLogger.h"
#include "common/RecourceHelper.h"
#include "scene/ScopedTimer.h"
#include "viewer/OsgView.h"
const osgEarth::SpatialReference* g_srs_{ nullptr };
OEScene::OEScene() {
osgDB::FilePathList& pathList = osgDB::Registry::instance()->getDataFilePathList();
@ -57,9 +60,10 @@ void OEScene::AttachView(OsgView* view) {
entityRoot_ = new osg::Group;
if (earthMapNode_) {
earthMapNode_->addChild(entityRoot_);
g_srs_ = earthMapNode_->getMapSRS();
dyt_check(nullptr != g_srs_);
}
skyDome_ = osgEarth::SkyNode::create();
if (!earthMapNode_) {
LOG_WARN("eart map node is nullptr");
@ -81,16 +85,6 @@ void OEScene::AttachView(OsgView* view) {
LOG_INFO("node is not group");
}
}
//osg::Group* parent = earthMapNode_->getParent(0);
/*osg::Group* parent = earthMapNode_->getParent(0);
if (nullptr == parent) {
skyDome_->addChild(earthMapNode_);
parent->addChild(skyDome_);
parent->removeChild(earthMapNode_);
} else {
}*/
skyDome_->attach(view->GetView());

View File

@ -709,12 +709,12 @@
<context>
<name>QtBoolPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="1658"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="1665"/>
<source>True</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="1659"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="1666"/>
<source>False</source>
<translation type="unfinished"></translation>
</message>
@ -738,22 +738,22 @@
<context>
<name>QtColorPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6655"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6662"/>
<source>Red</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6663"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6670"/>
<source>Green</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6671"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6678"/>
<source>Blue</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6679"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6686"/>
<source>Alpha</source>
<translation type="unfinished"></translation>
</message>
@ -761,33 +761,33 @@
<context>
<name>QtConeWaveComponentManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8347"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8356"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8354"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8363"/>
<source>ConeWaveComponent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8437"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8444"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8444"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8451"/>
<source>Radius</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8451"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8458"/>
<source>Color1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8458"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8465"/>
<source>Color2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8465"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8472"/>
<source>Color3</source>
<translation type="unfinished"></translation>
</message>
@ -893,28 +893,28 @@
<context>
<name>QtDashedLineComponentManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8636"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8645"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8643"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8652"/>
<source>DashedLineComponent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8714"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8721"/>
<source>Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8721"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8728"/>
<source>End</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8728"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8735"/>
<source>Radius</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8735"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8742"/>
<source>Color</source>
<translation type="unfinished"></translation>
</message>
@ -930,12 +930,12 @@
<context>
<name>QtEntityPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7858"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7865"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7865"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7872"/>
<source>Transform</source>
<translation type="unfinished"></translation>
</message>
@ -956,37 +956,37 @@
<context>
<name>QtFontPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6314"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6321"/>
<source>Family</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6332"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6339"/>
<source>Point Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6340"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6347"/>
<source>Bold</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6347"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6354"/>
<source>Italic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6354"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6361"/>
<source>Underline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6361"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6368"/>
<source>Strikeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6368"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6375"/>
<source>Kerning</source>
<translation type="unfinished"></translation>
</message>
@ -994,22 +994,22 @@
<context>
<name>QtLocalePropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2747"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2754"/>
<source>&lt;Invalid&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2755"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2762"/>
<source>%1, %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2805"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2812"/>
<source>Language</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2813"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2820"/>
<source>Country</source>
<translation type="unfinished"></translation>
</message>
@ -1017,13 +1017,13 @@
<context>
<name>QtMeshComponetManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7972"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7981"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7979"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7988"/>
<source>MeshComponent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8054"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8061"/>
<source>Mesh</source>
<translation type="unfinished"></translation>
</message>
@ -1031,22 +1031,22 @@
<context>
<name>QtModelBasePropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7445"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7452"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7452"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7459"/>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7459"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7466"/>
<source>Inflow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7466"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7473"/>
<source>InnerBottomElevation</source>
<translation type="unfinished"></translation>
</message>
@ -1067,13 +1067,13 @@
<context>
<name>QtPathComponentManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8131"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8140"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8138"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8147"/>
<source>PathComponent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8213"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8220"/>
<source>Path</source>
<translation type="unfinished"></translation>
</message>
@ -1081,17 +1081,17 @@
<context>
<name>QtPointFPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3233"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3240"/>
<source>(%1, %2)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3304"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3311"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3312"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3319"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
@ -1099,17 +1099,17 @@
<context>
<name>QtPointPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2988"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2995"/>
<source>(%1, %2)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3025"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3032"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3032"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3039"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
@ -1127,12 +1127,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7004"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7011"/>
<source>[%1, %2, %3]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7221"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7228"/>
<source>[%1, %2, %3] [%4, %5, %6] [%7, %8, %9]</source>
<translation type="unfinished"></translation>
</message>
@ -1140,27 +1140,27 @@
<context>
<name>QtRectFPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4766"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4773"/>
<source>[(%1, %2), %3 x %4]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4922"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4929"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4930"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4937"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4938"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4945"/>
<source>Width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4947"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4954"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
@ -1168,27 +1168,27 @@
<context>
<name>QtRectPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4327"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4334"/>
<source>[(%1, %2), %3 x %4]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4447"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4454"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4454"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4461"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4461"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4468"/>
<source>Width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4469"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4476"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
@ -1196,17 +1196,17 @@
<context>
<name>QtSizeFPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3926"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3933"/>
<source>%1 x %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4056"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4063"/>
<source>Width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4065"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4072"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
@ -1214,33 +1214,33 @@
<context>
<name>QtSizePolicyPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5805"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5806"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5812"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5813"/>
<source>&lt;Invalid&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5807"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5814"/>
<source>[%1, %2, %3, %4]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5852"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5859"/>
<source>Horizontal Policy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5861"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5868"/>
<source>Vertical Policy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5870"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5877"/>
<source>Horizontal Stretch</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5878"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5885"/>
<source>Vertical Stretch</source>
<translation type="unfinished"></translation>
</message>
@ -1248,17 +1248,17 @@
<context>
<name>QtSizePropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3557"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3564"/>
<source>%1 x %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3653"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3660"/>
<source>Width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3661"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3668"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
@ -1274,17 +1274,17 @@
<context>
<name>QtTransfromPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7232"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7239"/>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7239"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7246"/>
<source>Rotation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7246"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7253"/>
<source>Scale</source>
<translation type="unfinished"></translation>
</message>
@ -1305,17 +1305,17 @@
<context>
<name>QtVec3PropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7013"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7020"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7020"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7027"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7027"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7034"/>
<source>Z</source>
<translation type="unfinished"></translation>
</message>
@ -1323,17 +1323,17 @@
<context>
<name>QtWorkspacePropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7658"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7665"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7665"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7672"/>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7672"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7679"/>
<source>Timestep</source>
<translation type="unfinished"></translation>
</message>

View File

@ -57,6 +57,7 @@
#include <limits.h>
#include <float.h>
#include "config.h"
#include "entities/EntitiesManager.h"
#include "entities/MeshComponent.h"
#include "entities/PathComponent.h"
@ -941,7 +942,7 @@ public:
double minVal{ -DBL_MAX };
double maxVal{ DBL_MAX };
double singleStep{ 1 };
int decimals{ 2 };
int decimals{ 6 };
bool isInitialed{ false };
double minimumValue() const { return minVal; }
double maximumValue() const { return maxVal; }
@ -1104,7 +1105,13 @@ QString QtDoublePropertyManager::valueText(const QtProperty* property) const
const QtDoublePropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
if (it == d_ptr->m_values.constEnd())
return QString();
return QString::number(it.value().val, 'f', it.value().decimals);
int decimals = it.value().decimals;
if (!IsDecimalValid(it.value().val)) {
decimals = 2;
}
return QString::number(it.value().val, 'f', decimals);
}
/*!

View File

@ -31,11 +31,11 @@ WorkSpace::WorkSpace(const QString& name, QObject* parent)
}
void WorkSpace::ViewReize(int width, int height) {
/* if (nullptr != activeScene_ && nullptr != activeScene_->GetOceanScene()) {
activeScene_->GetOceanScene()->setScreenDims(osg::Vec2s(width * 2, height * 2));
if (nullptr != activeScene_) {
//activeScene_->GetOceanScene()->setScreenDims(osg::Vec2s(width * 2, height * 2));
} else {
LOG_WARN("secen_:{} or ocean is nullptr", spdlog::fmt_lib::ptr(activeScene_.get()));
}*/
}
}
bool WorkSpace::CreateScene(const std::string& scene) {
@ -91,13 +91,23 @@ void WorkSpace::RemoveEntity(Entity* entity) {
}
}
//OsgScene* WorkSpace::GetActiveScene() const {
// if (!activeScene_.valid()) {
// return nullptr;
// }
//
// return activeScene_.get();
//}
#if USE_OCEAN
OsgScene* WorkSpace::GetActiveScene() const {
if (!activeScene_.valid()) {
return nullptr;
}
return activeScene_.get();
}
#else
OEScene* WorkSpace::GetActiveScene() const {
if (!activeScene_.valid()) {
return nullptr;
}
return activeScene_.get();
}
#endif
bool WorkSpace::SetTimestep(Timestep* timestep) {
if (!timestep) {

View File

@ -46,7 +46,11 @@ public:
void ViewReize(int width, int height);
bool CreateScene(const std::string& scene);
//OsgScene* GetActiveScene() const;
#if USE_OCEAN
OsgScene* GetActiveScene() const;
#else
OEScene* GetActiveScene() const;
#endif
bool SetTimestep(class Timestep* timestep);
bool SetTimestepPath(const QString& path);

View File

@ -9,17 +9,17 @@
<lamp path="workspace/Lamp.txt"/>
<entities>
<Entity uuid="{3c48c04e-a1ac-485d-9ab8-4436b9881a3d}" name="船1">
<MeshComponent mesh="boke/boke.ive" location="50.000000,80.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="5.000000,5.000000,5.000000">
<MeshComponent mesh="boke/boke.ive" location="120.000000,25.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="1000.000000,1000.000000,1000.000000">
<PathComponent path="workspace/chuan1.txt" location="0.000000,0.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="1.000000,1.000000,1.000000"/>
</MeshComponent>
</Entity>
<Entity uuid="{3c48c04e-a1ac-485d-9ab8-4436b9881a4d}" name="船2">
<MeshComponent mesh="boke/boke.ive" location="10.000000,30.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="5.000000,5.000000,5.000000">
<MeshComponent mesh="boke/boke.ive" location="120.000000,25.000100,0.000000" rotation="0.000000,0.000000,0.000000" scale="1000.000000,1000.000000,1000.000000">
<PathComponent path="workspace/chuan2.txt" location="0.000000,0.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="1.000000,1.000000,1.000000"/>
</MeshComponent>
</Entity>
<Entity uuid="{3c48c04e-a1ac-485d-9fb8-4436b9881a4d}" name="船3">
<MeshComponent mesh="boke/boke.ive" location="90.000000,30.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="5.000000,5.000000,5.000000">
<MeshComponent mesh="boke/boke.ive" location="120.000000,25.003000,0.000000" rotation="0.000000,0.000000,0.000000" scale="1000.000000,1000.000000,1000.000000">
<PathComponent path="workspace/chuan3.txt" location="0.000000,0.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="1.000000,1.000000,1.000000"/>
</MeshComponent>
<Entity uuid="{3c48c04e-a1ac-485d-9ab8-4436b9851a4d}" name="船5">
@ -29,7 +29,7 @@
</Entity>
</Entity>
<Entity uuid="{b99a4401-9cc6-493e-a42e-655b81997eb3}" name="卫星">
<MeshComponent mesh="satellite/satellite.ive" location="0.000000,0.000000,100.000000" rotation="0.000000,0.000000,0.000000" scale="1.000000,1.000000,1.000000" uuid="{5b764fc4-89ad-4bac-b961-abf310a552fd}">
<MeshComponent mesh="satellite/satellite.ive" location="120.000000,25.000000,10000.000000" rotation="0.000000,0.000000,0.000000" scale="1.000000,1.000000,1.000000" uuid="{5b764fc4-89ad-4bac-b961-abf310a552fd}">
<ConeWaveComponent color1="1.000000,0.200000,0.500000,0.200000" color2="0.000000,0.200000,0.500000,0.200000" color3="0.000000,1.000000,0.500000,1.000000" radius="70.000000" height="100.000000" event="workspace/jiaof.evnet.txt" location="0.000000,0.000000,0.000000" rotation="0.000000,0.000000,0.000000" scale="1.000000,1.000000,1.000000" uuid="{7a962b9c-e572-48f4-9e64-fb1742010bf6}"/>
</MeshComponent>
</Entity>