DYTSrouce/src/ui/PropertyBrowser/qtworkspaceattribute.h

360 lines
11 KiB
C++

/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTWORKSPACEATTRIBUTE_H
#define QTWORKSPACEATTRIBUTE_H
#include <QString>
#include <QColor>
#include <osg/Vec3>
#include "workspace/FileEntry.h"
#include <vector>
#include <cstdint>
class QWorkspaceAttribute {
public:
QWorkspaceAttribute() = default;
QWorkspaceAttribute(class WorkSpace* workspace);
QWorkspaceAttribute& operator=(const QWorkspaceAttribute& other);
~QWorkspaceAttribute() = default;
bool operator== (const QWorkspaceAttribute& other);
void SetName(const QString& name);
const QString GetName() const;
void SetDescription(const QString& desc);
const QString GetDescription() const;
// Simulation time (manual range) for playback
void SetSimulationStart(double start);
double GetSimulationStart() const;
void SetSimulationEnd(double end);
double GetSimulationEnd() const;
void SetSimulationRange(double start, double end);
// Playback speed (step multiplier)
void SetSimulationStep(double step);
double GetSimulationStep() const;
// Deprecated fields removed: SimMatlab/MatlabParam/WavePath/ReportPath/RDPath
// Command XML path
void SetCommondFilePath(const QString& path);
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
std::vector<std::shared_ptr<FileEntry>> GetFileEntries(FileEntryType type) const;
void SetFileEntryCount(FileEntryType type, int count);
void SetFileEntryPath(FileEntryType type, int index, const QString& path);
QString GetFileEntryAbsPath(FileEntryType type, int index) const;
private:
class WorkSpace* workspace_{ nullptr };
// Snapshot of workspace files change sequence to detect mutations
std::uint64_t filesSeq_{ 0 };
};
class QTransformAttribute {
public:
QTransformAttribute() = default;
QTransformAttribute(class Transform* entity);
QTransformAttribute& operator=(const QTransformAttribute& other);
~QTransformAttribute() = default;
bool operator== (const QTransformAttribute& other);
bool operator!= (const QTransformAttribute& other);
void SetLocation(const osg::Vec3& l);
const osg::Vec3 GetLocation() const;
void SetRotation(const osg::Vec3& r);
const osg::Vec3 GetRotation() const;
void SetScale(const osg::Vec3& s);
const osg::Vec3 GetScale() const;
private:
class Transform* object_{ nullptr };
};
class QEntityAttribute {
public:
QEntityAttribute() = default;
QEntityAttribute(class Entity* entity);
QEntityAttribute& operator=(const QEntityAttribute& other);
~QEntityAttribute() = default;
bool operator== (const QEntityAttribute& other);
void SetName(const QString& name);
const QString GetName() const;
QTransformAttribute GetTransform() const;
void SetVisible(bool v);
bool IsVisible() const;
private:
class Entity* entity_{ nullptr };
QTransformAttribute* transform_{ nullptr };
bool visible_{ true };
};
class QMeshComponentAttribute {
public:
QMeshComponentAttribute() = default;
QMeshComponentAttribute(class MeshComponent* obj);
QMeshComponentAttribute& operator=(const QMeshComponentAttribute& other);
~QMeshComponentAttribute() = default;
bool operator== (const QMeshComponentAttribute& other);
void SetMesh(const QString& mesh);
QString GetMesh() const;
private:
class MeshComponent* object_{ nullptr };
};
// Curve entry attribute: wraps a single FileEntryCurve for item-level editing
class QCurveEntryAttribute {
public:
QCurveEntryAttribute() = default;
QCurveEntryAttribute(class FileEntryCurve* entry);
QCurveEntryAttribute& operator=(const QCurveEntryAttribute& other);
~QCurveEntryAttribute() = default;
bool operator== (const QCurveEntryAttribute& other);
// Display name of the chart entry
void SetName(const QString& name);
QString GetName() const;
// Chart type
void SetChartType(ChartType type);
ChartType GetChartType() const;
// Curve properties count
int GetCurveCount() const;
void SetCurveCount(int count);
// Per-curve basic fields
QString GetCurveName(int index) const;
void SetCurveName(int index, const QString& name);
QColor GetCurveColor(int index) const;
void SetCurveColor(int index, const QColor& color);
// Wave-specific fields
int GetWaveStart(int index) const;
void SetWaveStart(int index, int start);
int GetWaveStop(int index) const;
void SetWaveStop(int index, int stop);
// Report-specific fields
double GetReportX(int index) const;
void SetReportX(int index, double x);
double GetReportY(int index) const;
void SetReportY(int index, double y);
// Underlying entry access
class FileEntryCurve* GetEntry() const { return entry_; }
private:
class FileEntryCurve* entry_{ nullptr };
};
class QPathComponentAttribute {
public:
QPathComponentAttribute() = default;
QPathComponentAttribute(class PathComponent* obj);
QPathComponentAttribute& operator=(const QPathComponentAttribute& other);
~QPathComponentAttribute() = default;
bool operator== (const QPathComponentAttribute& other);
void SetPath(const QString& path);
QString GetPath() const;
private:
class PathComponent* object_{ nullptr };
};
class QTrajectoryTraceComponentAttribute {
public:
QTrajectoryTraceComponentAttribute() = default;
QTrajectoryTraceComponentAttribute(class TrajectoryTraceComponent* obj);
QTrajectoryTraceComponentAttribute& operator=(const QTrajectoryTraceComponentAttribute& other);
~QTrajectoryTraceComponentAttribute() = default;
bool operator== (const QTrajectoryTraceComponentAttribute& other);
void SetColor(const QColor& c);
QColor GetColor() const;
void SetLineWidth(double width);
double GetLineWidth() const;
void SetSampleInterval(double interval);
double GetSampleInterval() const;
void SetMinMoveDistance(double distance);
double GetMinMoveDistance() const;
void SetMaxPoints(int maxPoints);
int GetMaxPoints() const;
void SetTailDuration(double duration);
double GetTailDuration() const;
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 };
};
class QConeWaveComponentAttribute {
public:
QConeWaveComponentAttribute() = default;
QConeWaveComponentAttribute(class ConeWaveComponent* obj);
QConeWaveComponentAttribute& operator=(const QConeWaveComponentAttribute& other);
~QConeWaveComponentAttribute() = default;
bool operator== (const QConeWaveComponentAttribute& other);
void SetRadius(float r);
float GetRadius() const;
void SetBaseColor(const QColor& c);
QColor GetBaseColor() const;
void SetWaveColor(const QColor& c);
QColor GetWaveColor() const;
void SetRingBrightAlpha(float a);
float GetRingBrightAlpha() const;
void SetRingDarkAlpha(float a);
float GetRingDarkAlpha() const;
void SetHeight(float h);
float GetHeight() const;
void SetWaveCount(int c);
int GetWaveCount() const;
void SetWaveSpeed(float h);
float GetWaveSpeed() const;
private:
class ConeWaveComponent* object_{ nullptr };
};
class QDashedLineComponentAttribute {
public:
QDashedLineComponentAttribute() = default;
QDashedLineComponentAttribute(class DashedLineComponent* obj);
QDashedLineComponentAttribute& operator=(const QDashedLineComponentAttribute& other);
~QDashedLineComponentAttribute() = default;
bool operator== (const QDashedLineComponentAttribute& other);
void SetStart(const QEntityAttribute& start);
const QEntityAttribute& GetStart() const;
void SetStart(const QString& uuid);
//QString GetStart() const;
void SetEnd(const QEntityAttribute& end);
const QEntityAttribute& GetEnd() const {
return endEntity_;
}
void SetEnd(const QString& uuid);
//QString GetEnd() const;
void SetRadius(float r);
float GetRadius() const;
void SetColor(const QColor& c);
QColor GetColor() const;
private:
class DashedLineComponent* object_{ nullptr };
QEntityAttribute startEntity_;
QEntityAttribute endEntity_;
mutable QString startUUid_;
mutable QString startName_;
mutable QString endUUid_;
mutable QString endName_;
};
//Q_DECLARE_SHARED(QModelAttbute)
#endif