modified bug
This commit is contained in:
parent
4fb15b371b
commit
fa982e1f2d
@ -125,6 +125,11 @@ const osg::Vec3& SceneComponent::GetLocation() const {
|
|||||||
return transform_.GetLocation();
|
return transform_.GetLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneComponent::SetScale(const osg::Vec3 & s)
|
||||||
|
{
|
||||||
|
transform_.SetScale(s);
|
||||||
|
}
|
||||||
|
|
||||||
void SceneComponent::AttachScene(Entity* entity) {
|
void SceneComponent::AttachScene(Entity* entity) {
|
||||||
WorkSpace* workspace = entity->GetWorkspace();
|
WorkSpace* workspace = entity->GetWorkspace();
|
||||||
if (nullptr == workspace) {
|
if (nullptr == workspace) {
|
||||||
|
|||||||
@ -57,6 +57,8 @@ public:
|
|||||||
void SetLocation(const osg::Vec3& location);
|
void SetLocation(const osg::Vec3& location);
|
||||||
const osg::Vec3& GetLocation() const;
|
const osg::Vec3& GetLocation() const;
|
||||||
|
|
||||||
|
void SetScale(const osg::Vec3& s);
|
||||||
|
|
||||||
void AttachScene(class Entity* entity);
|
void AttachScene(class Entity* entity);
|
||||||
void AttachParent(class Entity* entity);
|
void AttachParent(class Entity* entity);
|
||||||
void AttachParent(SceneComponent* parent);
|
void AttachParent(SceneComponent* parent);
|
||||||
|
|||||||
@ -42,6 +42,8 @@ MainWindow::MainWindow(QWidget* parent)
|
|||||||
LOG_INFO("MainWindow::MainWindow - Constructor called, about to call InitUI");
|
LOG_INFO("MainWindow::MainWindow - Constructor called, about to call InitUI");
|
||||||
InitUI();
|
InitUI();
|
||||||
LOG_INFO("MainWindow::MainWindow - Constructor completed");
|
LOG_INFO("MainWindow::MainWindow - Constructor completed");
|
||||||
|
|
||||||
|
QTimer::singleShot(1000.0, this, SLOT(slotUpdateShowMax()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
@ -204,3 +206,7 @@ void MainWindow::UninitUI() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::slotUpdateShowMax()
|
||||||
|
{
|
||||||
|
showMaximized();
|
||||||
|
}
|
||||||
@ -36,6 +36,9 @@ public:
|
|||||||
return dataPanelManager_;
|
return dataPanelManager_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void slotUpdateShowMax();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitUI();
|
void InitUI();
|
||||||
void UninitUI();
|
void UninitUI();
|
||||||
|
|||||||
@ -1124,6 +1124,7 @@ void PropertyBrowser::OnFileEntryChange(const QVariant& value) {
|
|||||||
|
|
||||||
QtProperty* pth = stringManager_->addProperty(tr("path"));
|
QtProperty* pth = stringManager_->addProperty(tr("path"));
|
||||||
stringManager_->setValue(pth, im.path);
|
stringManager_->setValue(pth, im.path);
|
||||||
|
pth->setEnabled(false);
|
||||||
item->addSubProperty(pth);
|
item->addSubProperty(pth);
|
||||||
|
|
||||||
stringSetters_[ds] = [img, entry, i](const QString& s)
|
stringSetters_[ds] = [img, entry, i](const QString& s)
|
||||||
|
|||||||
@ -275,9 +275,10 @@ void OsgWidget::OnPresetModelDropped(const QString& modelType, const QString& mo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osg::Viewport* vp = view_->getCamera()->getViewport();
|
||||||
// 将屏幕坐标转换为世界坐标
|
// 将屏幕坐标转换为世界坐标
|
||||||
double longitude, latitude, height;
|
double longitude, latitude, height;
|
||||||
if (!ScreenToWorldCoordinate(static_cast<int>(position.x()), static_cast<int>(position.y()), longitude, latitude, height)) {
|
if (!ScreenToWorldCoordinate(static_cast<int>(position.x()), static_cast<int>(vp->height() - position.y()), longitude, latitude, height)) {
|
||||||
LOG_WARN("OsgWidget::OnPresetModelDropped - Failed to convert screen coordinates to world coordinates");
|
LOG_WARN("OsgWidget::OnPresetModelDropped - Failed to convert screen coordinates to world coordinates");
|
||||||
// 使用默认位置
|
// 使用默认位置
|
||||||
longitude = 0.0;
|
longitude = 0.0;
|
||||||
@ -310,6 +311,7 @@ void OsgWidget::OnPresetModelDropped(const QString& modelType, const QString& mo
|
|||||||
if (rootComponent) {
|
if (rootComponent) {
|
||||||
osg::Vec3 worldPos(longitude, latitude, height);
|
osg::Vec3 worldPos(longitude, latitude, height);
|
||||||
rootComponent->SetLocation(worldPos);
|
rootComponent->SetLocation(worldPos);
|
||||||
|
rootComponent->SetScale(osg::Vec3(1000, 1000, 1000));
|
||||||
LOG_INFO("OsgWidget::OnPresetModelDropped - Set entity position to ({:.6f}, {:.6f}, {:.2f})", longitude, latitude, height);
|
LOG_INFO("OsgWidget::OnPresetModelDropped - Set entity position to ({:.6f}, {:.6f}, {:.2f})", longitude, latitude, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user