64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "entities/SceneComponent.h"
|
|
|
|
#include "osg/Vec3"
|
|
#include "osg/Transform"
|
|
|
|
class DashedLineComponent : public SceneComponent {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DashedLineComponent(SceneComponent* parent = nullptr);
|
|
~DashedLineComponent();
|
|
|
|
static std::string GetTypeName();
|
|
std::string GetSelfTypeName() const override {
|
|
return DashedLineComponent::GetTypeName();
|
|
}
|
|
|
|
bool SetAttribute(const char* name, const char* value) override;
|
|
bool SaveAttribute(tinyxml2::XMLElement* element) override;
|
|
|
|
void Begin() override;
|
|
void Update(double dt);
|
|
|
|
void SetRadius(float radius);
|
|
float GetRadius() const;
|
|
|
|
void SetBaseColor(const osg::Vec4& color);
|
|
const osg::Vec4 GetBaseColor() const;
|
|
|
|
void SetStartEntity(const QString& uuid);
|
|
const QString& GetStartEntity() const;
|
|
QString GetStartEntityName() const;
|
|
Entity* GetStartEntityPtr() const {
|
|
return startEntity_.entity_;
|
|
}
|
|
void SetEndEntity(const QString& uuid);
|
|
const QString& GetEndEntity() const;
|
|
Entity* GetEndEntityPtr() const {
|
|
return endEntity_.entity_;
|
|
}
|
|
QString GetEndEntityName() const;
|
|
|
|
void SetTimeAction(const QString& path);
|
|
|
|
protected:
|
|
void AddToRender() override;
|
|
void Initialize();
|
|
|
|
void UpdateEvent();
|
|
|
|
protected:
|
|
osg::ref_ptr<class DashedLine> dashedLine_;
|
|
class TimeAction* timeAction_{ nullptr };
|
|
struct UUIDEntity {
|
|
QString uuid;
|
|
Entity* entity_{ nullptr };
|
|
};
|
|
UUIDEntity startEntity_;
|
|
UUIDEntity endEntity_;
|
|
|
|
};
|