Merge branch 'new_osg' of http://brigecode.icu:16623/PM/DYTSrouce into new_osg
This commit is contained in:
commit
0da6df6031
@ -72,17 +72,6 @@ void PathComponent::Begin() {
|
|||||||
animationPath_->insert(steps[index], controlPoint);
|
animationPath_->insert(steps[index], controlPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* osg::ref_ptr<osg::AnimationPathCallback> apcb = new osg::AnimationPathCallback;
|
|
||||||
apcb->setAnimationPath(animationPath_);
|
|
||||||
|
|
||||||
osg::MatrixTransform* mt = GetRootComponent()->GetMatrixTransform();
|
|
||||||
if (nullptr == mt) {
|
|
||||||
LOG_WARN("mt is nullptr");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mt->setUpdateCallback(apcb);
|
|
||||||
*/
|
|
||||||
|
|
||||||
deltaTime_ = 0;
|
deltaTime_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +93,6 @@ void PathComponent::Update(double dt) {
|
|||||||
osg::Vec3 angle;
|
osg::Vec3 angle;
|
||||||
OsgUtils::QuatToHPR(cp.getRotation(), &angle);
|
OsgUtils::QuatToHPR(cp.getRotation(), &angle);
|
||||||
transform->SetRotation(angle);
|
transform->SetRotation(angle);
|
||||||
// transform->SetScale(cp.getScale());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathComponent::SetPath(const QString& path) {
|
void PathComponent::SetPath(const QString& path) {
|
||||||
|
|||||||
@ -577,6 +577,8 @@ void PropertyBrowser::InitPropertyManager() {
|
|||||||
browser_->setFactoryForManager(workSpaceManager_->subFilesProperyManager(), filePathFactory);
|
browser_->setFactoryForManager(workSpaceManager_->subFilesProperyManager(), filePathFactory);
|
||||||
// Enable editing for grouped file entry counts
|
// Enable editing for grouped file entry counts
|
||||||
browser_->setFactoryForManager(workSpaceManager_->subIntProperyManager(), spinBoxFactory);
|
browser_->setFactoryForManager(workSpaceManager_->subIntProperyManager(), spinBoxFactory);
|
||||||
|
// Enable editing for Workspace double sub-properties (e.g., HomeViewpoint fields)
|
||||||
|
browser_->setFactoryForManager(workSpaceManager_->subDoubleProperyManager(), doubleSpinBoxFactory);
|
||||||
browser_->setFactoryForManager(entityManager_->subStringProperyManager(), lineEditFactory);
|
browser_->setFactoryForManager(entityManager_->subStringProperyManager(), lineEditFactory);
|
||||||
browser_->setFactoryForManager(entityManager_->subBoolProperyManager(), checkBoxFactory);
|
browser_->setFactoryForManager(entityManager_->subBoolProperyManager(), checkBoxFactory);
|
||||||
browser_->setFactoryForManager(
|
browser_->setFactoryForManager(
|
||||||
|
|||||||
@ -7900,6 +7900,7 @@ public:
|
|||||||
|
|
||||||
void slotStringChanged(QtProperty* property, QString value);
|
void slotStringChanged(QtProperty* property, QString value);
|
||||||
void slotIntChanged(QtProperty* property, int value);
|
void slotIntChanged(QtProperty* property, int value);
|
||||||
|
void slotDoubleChanged(QtProperty* property, double value);
|
||||||
|
|
||||||
void slotPropertyDestroyed(QtProperty* property);
|
void slotPropertyDestroyed(QtProperty* property);
|
||||||
|
|
||||||
@ -7910,6 +7911,7 @@ public:
|
|||||||
QtStringPropertyManager* m_stringProperyManager;
|
QtStringPropertyManager* m_stringProperyManager;
|
||||||
QtFilesPropertyManager* m_filesProperyManager;
|
QtFilesPropertyManager* m_filesProperyManager;
|
||||||
QtIntPropertyManager* m_intProperyManager{ nullptr };
|
QtIntPropertyManager* m_intProperyManager{ nullptr };
|
||||||
|
QtDoublePropertyManager* m_doubleProperyManager{ nullptr };
|
||||||
QtGroupPropertyManager* m_groupProperyManager{ nullptr };
|
QtGroupPropertyManager* m_groupProperyManager{ nullptr };
|
||||||
|
|
||||||
QMap<const QtProperty*, QtProperty*> m_properyToName;
|
QMap<const QtProperty*, QtProperty*> m_properyToName;
|
||||||
@ -7931,6 +7933,23 @@ public:
|
|||||||
QMap<const QtProperty*, QtProperty*> m_reportPathToPropery;
|
QMap<const QtProperty*, QtProperty*> m_reportPathToPropery;
|
||||||
QMap<const QtProperty*, QtProperty*> m_rdPathToPropery;
|
QMap<const QtProperty*, QtProperty*> m_rdPathToPropery;
|
||||||
QMap<const QtProperty*, QtProperty*> m_commondPathToPropery;
|
QMap<const QtProperty*, QtProperty*> m_commondPathToPropery;
|
||||||
|
// Home viewpoint mapping
|
||||||
|
// Group root
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_properyToHomeViewGroup;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_homeViewGroupToPropery;
|
||||||
|
// Components
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_properyToHomeLon;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_homeLonToPropery;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_properyToHomeLat;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_homeLatToPropery;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_properyToHomeAlt;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_homeAltToPropery;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_properyToHomeHeading;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_homeHeadingToPropery;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_properyToHomePitch;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_homePitchToPropery;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_properyToHomeRange;
|
||||||
|
QMap<const QtProperty*, QtProperty*> m_homeRangeToPropery;
|
||||||
|
|
||||||
// Grouped file entries: Curve
|
// Grouped file entries: Curve
|
||||||
QMap<const QtProperty*, QtProperty*> m_properyToCurveGroup;
|
QMap<const QtProperty*, QtProperty*> m_properyToCurveGroup;
|
||||||
@ -8004,6 +8023,9 @@ void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property,
|
|||||||
QWorkspaceAttribute c = m_values[prop];
|
QWorkspaceAttribute c = m_values[prop];
|
||||||
c.SetCommondFilePath(value);
|
c.SetCommondFilePath(value);
|
||||||
q_ptr->setValue(prop, c);
|
q_ptr->setValue(prop, c);
|
||||||
|
} else if (false) {
|
||||||
|
// HomeViewpoint is now managed via grouped double sub-properties;
|
||||||
|
// old string branch removed.
|
||||||
} else if (QtProperty* prop = m_commondPathToPropery.value(property, 0)) {
|
} else if (QtProperty* prop = m_commondPathToPropery.value(property, 0)) {
|
||||||
QWorkspaceAttribute c = m_values[prop];
|
QWorkspaceAttribute c = m_values[prop];
|
||||||
c.SetCommondFilePath(value);
|
c.SetCommondFilePath(value);
|
||||||
@ -8098,6 +8120,34 @@ void QtWorkspacePropertyManagerPrivate::slotIntChanged(QtProperty* property, int
|
|||||||
handleType(FileEntryType::Image, m_imageCountToPropery, m_properyToImagePaths, m_imagePathToPropery, m_imagePathIndex, m_properyToImageGroup);
|
handleType(FileEntryType::Image, m_imageCountToPropery, m_properyToImagePaths, m_imagePathToPropery, m_imagePathIndex, m_properyToImageGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtWorkspacePropertyManagerPrivate::slotDoubleChanged(QtProperty* property, double value) {
|
||||||
|
if (QtProperty* prop = m_homeLonToPropery.value(property, 0)) {
|
||||||
|
QWorkspaceAttribute c = m_values[prop];
|
||||||
|
c.SetHomeViewpointLongitude(value);
|
||||||
|
q_ptr->setValue(prop, c);
|
||||||
|
} else if (QtProperty* prop = m_homeLatToPropery.value(property, 0)) {
|
||||||
|
QWorkspaceAttribute c = m_values[prop];
|
||||||
|
c.SetHomeViewpointLatitude(value);
|
||||||
|
q_ptr->setValue(prop, c);
|
||||||
|
} else if (QtProperty* prop = m_homeAltToPropery.value(property, 0)) {
|
||||||
|
QWorkspaceAttribute c = m_values[prop];
|
||||||
|
c.SetHomeViewpointAltitude(value);
|
||||||
|
q_ptr->setValue(prop, c);
|
||||||
|
} else if (QtProperty* prop = m_homeHeadingToPropery.value(property, 0)) {
|
||||||
|
QWorkspaceAttribute c = m_values[prop];
|
||||||
|
c.SetHomeViewpointHeading(value);
|
||||||
|
q_ptr->setValue(prop, c);
|
||||||
|
} else if (QtProperty* prop = m_homePitchToPropery.value(property, 0)) {
|
||||||
|
QWorkspaceAttribute c = m_values[prop];
|
||||||
|
c.SetHomeViewpointPitch(value);
|
||||||
|
q_ptr->setValue(prop, c);
|
||||||
|
} else if (QtProperty* prop = m_homeRangeToPropery.value(property, 0)) {
|
||||||
|
QWorkspaceAttribute c = m_values[prop];
|
||||||
|
c.SetHomeViewpointRange(value);
|
||||||
|
q_ptr->setValue(prop, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* property) {
|
void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* property) {
|
||||||
if (QtProperty* subProp = m_nameToPropery.value(property, nullptr)) {
|
if (QtProperty* subProp = m_nameToPropery.value(property, nullptr)) {
|
||||||
m_nameToPropery[subProp] = 0;
|
m_nameToPropery[subProp] = 0;
|
||||||
@ -8149,6 +8199,9 @@ QtWorkspacePropertyManager::QtWorkspacePropertyManager(QObject* parent)
|
|||||||
d_ptr->m_intProperyManager = new QtIntPropertyManager(this);
|
d_ptr->m_intProperyManager = new QtIntPropertyManager(this);
|
||||||
connect(d_ptr->m_intProperyManager, SIGNAL(valueChanged(QtProperty*, int)),
|
connect(d_ptr->m_intProperyManager, SIGNAL(valueChanged(QtProperty*, int)),
|
||||||
this, SLOT(slotIntChanged(QtProperty*, int)));
|
this, SLOT(slotIntChanged(QtProperty*, int)));
|
||||||
|
d_ptr->m_doubleProperyManager = new QtDoublePropertyManager(this);
|
||||||
|
connect(d_ptr->m_doubleProperyManager, SIGNAL(valueChanged(QtProperty*, double)),
|
||||||
|
this, SLOT(slotDoubleChanged(QtProperty*, double)));
|
||||||
d_ptr->m_groupProperyManager = new QtGroupPropertyManager(this);
|
d_ptr->m_groupProperyManager = new QtGroupPropertyManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8183,6 +8236,10 @@ QtIntPropertyManager* QtWorkspacePropertyManager::subIntProperyManager() const {
|
|||||||
return d_ptr->m_intProperyManager;
|
return d_ptr->m_intProperyManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtDoublePropertyManager* QtWorkspacePropertyManager::subDoubleProperyManager() const {
|
||||||
|
return d_ptr->m_doubleProperyManager;
|
||||||
|
}
|
||||||
|
|
||||||
QtGroupPropertyManager* QtWorkspacePropertyManager::subGroupProperyManager() const {
|
QtGroupPropertyManager* QtWorkspacePropertyManager::subGroupProperyManager() const {
|
||||||
return d_ptr->m_groupProperyManager;
|
return d_ptr->m_groupProperyManager;
|
||||||
}
|
}
|
||||||
@ -8231,6 +8288,19 @@ void QtWorkspacePropertyManager::setValue(QtProperty* property, const QWorkspace
|
|||||||
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription());
|
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription());
|
||||||
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep());
|
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep());
|
||||||
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToCommondPath[property], value.GetCommondFilePath());
|
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToCommondPath[property], value.GetCommondFilePath());
|
||||||
|
// Sync HomeViewpoint numeric fields
|
||||||
|
if (QtProperty* p = d_ptr->m_properyToHomeLon.value(property, nullptr))
|
||||||
|
d_ptr->m_doubleProperyManager->setValueOnly(p, value.GetHomeViewpointLongitude());
|
||||||
|
if (QtProperty* p = d_ptr->m_properyToHomeLat.value(property, nullptr))
|
||||||
|
d_ptr->m_doubleProperyManager->setValueOnly(p, value.GetHomeViewpointLatitude());
|
||||||
|
if (QtProperty* p = d_ptr->m_properyToHomeAlt.value(property, nullptr))
|
||||||
|
d_ptr->m_doubleProperyManager->setValueOnly(p, value.GetHomeViewpointAltitude());
|
||||||
|
if (QtProperty* p = d_ptr->m_properyToHomeHeading.value(property, nullptr))
|
||||||
|
d_ptr->m_doubleProperyManager->setValueOnly(p, value.GetHomeViewpointHeading());
|
||||||
|
if (QtProperty* p = d_ptr->m_properyToHomePitch.value(property, nullptr))
|
||||||
|
d_ptr->m_doubleProperyManager->setValueOnly(p, value.GetHomeViewpointPitch());
|
||||||
|
if (QtProperty* p = d_ptr->m_properyToHomeRange.value(property, nullptr))
|
||||||
|
d_ptr->m_doubleProperyManager->setValueOnly(p, value.GetHomeViewpointRange());
|
||||||
|
|
||||||
auto syncGroup = [&](FileEntryType type,
|
auto syncGroup = [&](FileEntryType type,
|
||||||
QMap<const QtProperty*, QtProperty*>& propToGroup,
|
QMap<const QtProperty*, QtProperty*>& propToGroup,
|
||||||
@ -8330,7 +8400,43 @@ void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) {
|
|||||||
d_ptr->m_commondPathToPropery[prop] = property;
|
d_ptr->m_commondPathToPropery[prop] = property;
|
||||||
property->addSubProperty(prop);
|
property->addSubProperty(prop);
|
||||||
|
|
||||||
|
// Home viewpoint group with numeric fields
|
||||||
|
QtProperty* homeGroup = d_ptr->m_groupProperyManager->addProperty();
|
||||||
|
homeGroup->setPropertyName(tr("HomeViewpoint"));
|
||||||
|
d_ptr->m_properyToHomeViewGroup[property] = homeGroup;
|
||||||
|
d_ptr->m_homeViewGroupToPropery[homeGroup] = property;
|
||||||
|
property->addSubProperty(homeGroup);
|
||||||
|
|
||||||
|
auto addDouble = [&](const QString& name, double init,
|
||||||
|
QMap<const QtProperty*, QtProperty*>& propToChild,
|
||||||
|
QMap<const QtProperty*, QtProperty*>& childToProp,
|
||||||
|
double minVal, double maxVal, int decimals, double step) {
|
||||||
|
QtProperty* dp = d_ptr->m_doubleProperyManager->addProperty();
|
||||||
|
dp->setPropertyName(name);
|
||||||
|
d_ptr->m_doubleProperyManager->setValueOnly(dp, init);
|
||||||
|
d_ptr->m_doubleProperyManager->setRange(dp, minVal, maxVal);
|
||||||
|
d_ptr->m_doubleProperyManager->setDecimals(dp, decimals);
|
||||||
|
d_ptr->m_doubleProperyManager->setSingleStep(dp, step);
|
||||||
|
homeGroup->addSubProperty(dp);
|
||||||
|
propToChild[property] = dp;
|
||||||
|
childToProp[dp] = property;
|
||||||
|
};
|
||||||
|
|
||||||
|
addDouble(tr("Longitude"), val.GetHomeViewpointLongitude(), d_ptr->m_properyToHomeLon, d_ptr->m_homeLonToPropery,
|
||||||
|
-180.0, 180.0, 6, 0.0001);
|
||||||
|
addDouble(tr("Latitude"), val.GetHomeViewpointLatitude(), d_ptr->m_properyToHomeLat, d_ptr->m_homeLatToPropery,
|
||||||
|
-90.0, 90.0, 6, 0.0001);
|
||||||
|
addDouble(tr("Altitude"), val.GetHomeViewpointAltitude(), d_ptr->m_properyToHomeAlt, d_ptr->m_homeAltToPropery,
|
||||||
|
-100000.0, 100000.0, 2, 1.0);
|
||||||
|
addDouble(tr("Heading"), val.GetHomeViewpointHeading(), d_ptr->m_properyToHomeHeading, d_ptr->m_homeHeadingToPropery,
|
||||||
|
-360.0, 360.0, 3, 1.0);
|
||||||
|
addDouble(tr("Pitch"), val.GetHomeViewpointPitch(), d_ptr->m_properyToHomePitch, d_ptr->m_homePitchToPropery,
|
||||||
|
-90.0, 90.0, 3, 1.0);
|
||||||
|
addDouble(tr("Range"), val.GetHomeViewpointRange(), d_ptr->m_properyToHomeRange, d_ptr->m_homeRangeToPropery,
|
||||||
|
0.0, 1000000.0, 2, 10.0);
|
||||||
|
|
||||||
// Add grouped file sections
|
// Add grouped file sections
|
||||||
|
#if 0 // Hide resource groups (Curves/Surfaces/Tables/Lights/Polars/Images) in workspace property box
|
||||||
auto addGroup = [&](FileEntryType type, const QString& groupName,
|
auto addGroup = [&](FileEntryType type, const QString& groupName,
|
||||||
QMap<const QtProperty*, QtProperty*>& propToGroup,
|
QMap<const QtProperty*, QtProperty*>& propToGroup,
|
||||||
QMap<const QtProperty*, QtProperty*>& groupToProp,
|
QMap<const QtProperty*, QtProperty*>& groupToProp,
|
||||||
@ -8396,6 +8502,7 @@ void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) {
|
|||||||
addGroup(FileEntryType::Image, tr("Images"), d_ptr->m_properyToImageGroup, d_ptr->m_imageGroupToPropery,
|
addGroup(FileEntryType::Image, tr("Images"), d_ptr->m_properyToImageGroup, d_ptr->m_imageGroupToPropery,
|
||||||
d_ptr->m_properyToImageCount, d_ptr->m_imageCountToPropery,
|
d_ptr->m_properyToImageCount, d_ptr->m_imageCountToPropery,
|
||||||
d_ptr->m_properyToImagePaths, d_ptr->m_imagePathToPropery, d_ptr->m_imagePathIndex);
|
d_ptr->m_properyToImagePaths, d_ptr->m_imagePathToPropery, d_ptr->m_imagePathIndex);
|
||||||
|
#endif // Hide resource groups
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -8465,6 +8572,31 @@ void QtWorkspacePropertyManager::uninitializeProperty(QtProperty* property) {
|
|||||||
}
|
}
|
||||||
d_ptr->m_properyToCommondPath.remove(property);
|
d_ptr->m_properyToCommondPath.remove(property);
|
||||||
|
|
||||||
|
// Home viewpoint cleanup (group + numeric children)
|
||||||
|
// Remove numeric children
|
||||||
|
auto removeChild = [&](QMap<const QtProperty*, QtProperty*>& propToChild,
|
||||||
|
QMap<const QtProperty*, QtProperty*>& childToProp) {
|
||||||
|
QtProperty* child = propToChild.value(property, nullptr);
|
||||||
|
if (child) {
|
||||||
|
childToProp.remove(child);
|
||||||
|
delete child;
|
||||||
|
}
|
||||||
|
propToChild.remove(property);
|
||||||
|
};
|
||||||
|
removeChild(d_ptr->m_properyToHomeLon, d_ptr->m_homeLonToPropery);
|
||||||
|
removeChild(d_ptr->m_properyToHomeLat, d_ptr->m_homeLatToPropery);
|
||||||
|
removeChild(d_ptr->m_properyToHomeAlt, d_ptr->m_homeAltToPropery);
|
||||||
|
removeChild(d_ptr->m_properyToHomeHeading, d_ptr->m_homeHeadingToPropery);
|
||||||
|
removeChild(d_ptr->m_properyToHomePitch, d_ptr->m_homePitchToPropery);
|
||||||
|
removeChild(d_ptr->m_properyToHomeRange, d_ptr->m_homeRangeToPropery);
|
||||||
|
// Remove group root
|
||||||
|
QtProperty* group = d_ptr->m_properyToHomeViewGroup.value(property, nullptr);
|
||||||
|
if (group) {
|
||||||
|
d_ptr->m_homeViewGroupToPropery.remove(group);
|
||||||
|
delete group;
|
||||||
|
}
|
||||||
|
d_ptr->m_properyToHomeViewGroup.remove(property);
|
||||||
|
|
||||||
// Cleanup grouped file properties
|
// Cleanup grouped file properties
|
||||||
auto cleanupGroup = [&](QMap<const QtProperty*, QtProperty*>& propToGroup,
|
auto cleanupGroup = [&](QMap<const QtProperty*, QtProperty*>& propToGroup,
|
||||||
QMap<const QtProperty*, QtProperty*>& groupToProp,
|
QMap<const QtProperty*, QtProperty*>& groupToProp,
|
||||||
|
|||||||
@ -1028,6 +1028,7 @@ public:
|
|||||||
QtStringPropertyManager* subStringProperyManager() const;
|
QtStringPropertyManager* subStringProperyManager() const;
|
||||||
QtFilesPropertyManager* subFilesProperyManager() const;
|
QtFilesPropertyManager* subFilesProperyManager() const;
|
||||||
QtIntPropertyManager* subIntProperyManager() const;
|
QtIntPropertyManager* subIntProperyManager() const;
|
||||||
|
QtDoublePropertyManager* subDoubleProperyManager() const;
|
||||||
QtGroupPropertyManager* subGroupProperyManager() const;
|
QtGroupPropertyManager* subGroupProperyManager() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
@ -1045,6 +1046,7 @@ private:
|
|||||||
Q_DISABLE_COPY_MOVE(QtWorkspacePropertyManager)
|
Q_DISABLE_COPY_MOVE(QtWorkspacePropertyManager)
|
||||||
Q_PRIVATE_SLOT(d_func(), void slotStringChanged(QtProperty*, QString))
|
Q_PRIVATE_SLOT(d_func(), void slotStringChanged(QtProperty*, QString))
|
||||||
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty*, int))
|
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty*, int))
|
||||||
|
Q_PRIVATE_SLOT(d_func(), void slotDoubleChanged(QtProperty*, double))
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#include "utils/Transform.h"
|
#include "utils/Transform.h"
|
||||||
#include "utils/OsgUtils.h"
|
#include "utils/OsgUtils.h"
|
||||||
#include "workspace/WorkSpaceManager.h"
|
#include "workspace/WorkSpaceManager.h"
|
||||||
|
#include "utils/StringUtils.h"
|
||||||
|
|
||||||
|
|
||||||
QWorkspaceAttribute::QWorkspaceAttribute(class WorkSpace* workspace)
|
QWorkspaceAttribute::QWorkspaceAttribute(class WorkSpace* workspace)
|
||||||
@ -112,6 +113,115 @@ const QString QWorkspaceAttribute::GetCommondFilePath() const
|
|||||||
return workspace_->GetCommondFilePath();
|
return workspace_->GetCommondFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWorkspaceAttribute::SetHomeViewpoint(const QString& vp)
|
||||||
|
{
|
||||||
|
if (nullptr == workspace_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Parse CSV string to osgEarth::Viewpoint and apply
|
||||||
|
osgEarth::Viewpoint viewpoint = StringUtils::StringToViewpoint("home", vp.toStdString());
|
||||||
|
workspace_->SetHomeViewpoint(viewpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QWorkspaceAttribute::GetHomeViewpoint() const
|
||||||
|
{
|
||||||
|
if (nullptr == workspace_) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const osgEarth::Viewpoint& vp = workspace_->GetHomeViewpoint();
|
||||||
|
return QString::fromStdString(StringUtils::ViewpointToString(vp));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Typed HomeViewpoint getters/setters ----
|
||||||
|
static void UpdateHomeViewpoint(WorkSpace* ws,
|
||||||
|
double lon, double lat, double alt,
|
||||||
|
double heading, double pitch, double range) {
|
||||||
|
if (!ws) return;
|
||||||
|
osgEarth::Viewpoint vp("home", lon, lat, alt, heading, pitch, range);
|
||||||
|
ws->SetHomeViewpoint(vp);
|
||||||
|
}
|
||||||
|
|
||||||
|
double QWorkspaceAttribute::GetHomeViewpointLongitude() const {
|
||||||
|
if (!workspace_) return 0.0;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& location = vp.focalPoint();
|
||||||
|
return location->x();
|
||||||
|
}
|
||||||
|
|
||||||
|
double QWorkspaceAttribute::GetHomeViewpointLatitude() const {
|
||||||
|
if (!workspace_) return 0.0;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& location = vp.focalPoint();
|
||||||
|
return location->y();
|
||||||
|
}
|
||||||
|
|
||||||
|
double QWorkspaceAttribute::GetHomeViewpointAltitude() const {
|
||||||
|
if (!workspace_) return 0.0;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& location = vp.focalPoint();
|
||||||
|
return location->z();
|
||||||
|
}
|
||||||
|
|
||||||
|
double QWorkspaceAttribute::GetHomeViewpointHeading() const {
|
||||||
|
if (!workspace_) return 0.0;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
return vp.heading().get().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
double QWorkspaceAttribute::GetHomeViewpointPitch() const {
|
||||||
|
if (!workspace_) return 0.0;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
return vp.pitch().get().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
double QWorkspaceAttribute::GetHomeViewpointRange() const {
|
||||||
|
if (!workspace_) return 0.0;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
return vp.range().get().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWorkspaceAttribute::SetHomeViewpointLongitude(double v) {
|
||||||
|
if (!workspace_) return;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& loc = vp.focalPoint();
|
||||||
|
UpdateHomeViewpoint(WorkSpaceManager::Get().GetCurrent(), v, loc->y(), loc->z(), vp.heading().get().getValue(), vp.pitch().get().getValue(), vp.range().get().getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWorkspaceAttribute::SetHomeViewpointLatitude(double v) {
|
||||||
|
if (!workspace_) return;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& loc = vp.focalPoint();
|
||||||
|
UpdateHomeViewpoint(WorkSpaceManager::Get().GetCurrent(), loc->x(), v, loc->z(), vp.heading().get().getValue(), vp.pitch().get().getValue(), vp.range().get().getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWorkspaceAttribute::SetHomeViewpointAltitude(double v) {
|
||||||
|
if (!workspace_) return;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& loc = vp.focalPoint();
|
||||||
|
UpdateHomeViewpoint(WorkSpaceManager::Get().GetCurrent(), loc->x(), loc->y(), v, vp.heading().get().getValue(), vp.pitch().get().getValue(), vp.range().get().getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWorkspaceAttribute::SetHomeViewpointHeading(double v) {
|
||||||
|
if (!workspace_) return;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& loc = vp.focalPoint();
|
||||||
|
UpdateHomeViewpoint(WorkSpaceManager::Get().GetCurrent(), loc->x(), loc->y(), loc->z(), v, vp.pitch().get().getValue(), vp.range().get().getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWorkspaceAttribute::SetHomeViewpointPitch(double v) {
|
||||||
|
if (!workspace_) return;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& loc = vp.focalPoint();
|
||||||
|
UpdateHomeViewpoint(WorkSpaceManager::Get().GetCurrent(), loc->x(), loc->y(), loc->z(), vp.heading().get().getValue(), v, vp.range().get().getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWorkspaceAttribute::SetHomeViewpointRange(double v) {
|
||||||
|
if (!workspace_) return;
|
||||||
|
const auto& vp = workspace_->GetHomeViewpoint();
|
||||||
|
const auto& loc = vp.focalPoint();
|
||||||
|
UpdateHomeViewpoint(WorkSpaceManager::Get().GetCurrent(), loc->x(), loc->y(), loc->z(), vp.heading().get().getValue(), vp.pitch().get().getValue(), v);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<FileEntry>> QWorkspaceAttribute::GetFileEntries(FileEntryType type) const {
|
std::vector<std::shared_ptr<FileEntry>> QWorkspaceAttribute::GetFileEntries(FileEntryType type) const {
|
||||||
if (nullptr == workspace_) {
|
if (nullptr == workspace_) {
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@ -71,6 +71,24 @@ public:
|
|||||||
void SetCommondFilePath(const QString& path);
|
void SetCommondFilePath(const QString& path);
|
||||||
const QString GetCommondFilePath() const;
|
const QString GetCommondFilePath() const;
|
||||||
|
|
||||||
|
// Home viewpoint (CSV string: lon, lat, alt, heading, pitch, range)
|
||||||
|
void SetHomeViewpoint(const QString& vp);
|
||||||
|
QString GetHomeViewpoint() const;
|
||||||
|
|
||||||
|
// Home viewpoint typed getters/setters
|
||||||
|
void SetHomeViewpointLongitude(double v);
|
||||||
|
void SetHomeViewpointLatitude(double v);
|
||||||
|
void SetHomeViewpointAltitude(double v);
|
||||||
|
void SetHomeViewpointHeading(double v);
|
||||||
|
void SetHomeViewpointPitch(double v);
|
||||||
|
void SetHomeViewpointRange(double v);
|
||||||
|
double GetHomeViewpointLongitude() const;
|
||||||
|
double GetHomeViewpointLatitude() const;
|
||||||
|
double GetHomeViewpointAltitude() const;
|
||||||
|
double GetHomeViewpointHeading() const;
|
||||||
|
double GetHomeViewpointPitch() const;
|
||||||
|
double GetHomeViewpointRange() const;
|
||||||
|
|
||||||
// Grouped files API
|
// Grouped files API
|
||||||
std::vector<std::shared_ptr<FileEntry>> GetFileEntries(FileEntryType type) const;
|
std::vector<std::shared_ptr<FileEntry>> GetFileEntries(FileEntryType type) const;
|
||||||
void SetFileEntryCount(FileEntryType type, int count);
|
void SetFileEntryCount(FileEntryType type, int count);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user