57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
#ifndef ULIB_VTK_VIEWPORTPROPERTIES_H
|
|
#define ULIB_VTK_VIEWPORTPROPERTIES_H
|
|
|
|
#include "uLibVtkInterface.h"
|
|
#include "vtkViewport.h"
|
|
#include "Core/Property.h"
|
|
|
|
namespace uLib {
|
|
namespace Vtk {
|
|
|
|
/**
|
|
* @class ViewportProperties
|
|
* @brief Exposes Viewport settings as a uLib::Object for the properties panel.
|
|
*/
|
|
class ViewportProperties : public uLib::Object {
|
|
public:
|
|
uLibTypeMacro(ViewportProperties, uLib::Object)
|
|
|
|
ViewportProperties(Viewport* vp) : m_Viewport(vp)
|
|
{
|
|
SetInstanceName("Viewport Settings");
|
|
|
|
// Initialize properties from viewport
|
|
Font.Set(vp->GetFont());
|
|
Color.Set(vp->GetFontColor());
|
|
GridVisible.Set(vp->GetGridVisible());
|
|
Parallel.Set(vp->GetParallelProjection());
|
|
|
|
// Connect properties to viewport setters
|
|
uLib::Object::connect(&Font, &Property<FontConfig>::Updated, [this](){
|
|
if (m_Viewport) m_Viewport->SetFont(Font.Get());
|
|
});
|
|
uLib::Object::connect(&Color, &Property<Vector3d>::Updated, [this](){
|
|
if (m_Viewport) m_Viewport->SetFontColor(Color.Get());
|
|
});
|
|
uLib::Object::connect(&GridVisible, &Property<bool>::Updated, [this](){
|
|
if (m_Viewport) m_Viewport->SetGridVisible(GridVisible.Get());
|
|
});
|
|
uLib::Object::connect(&Parallel, &Property<bool>::Updated, [this](){
|
|
if (m_Viewport) m_Viewport->SetParallelProjection(Parallel.Get());
|
|
});
|
|
}
|
|
|
|
ULIB_PROPERTY(FontConfig, Font, FontConfig())
|
|
ULIB_PROPERTY(Vector3d, Color, Vector3d(1.0, 1.0, 1.0))
|
|
ULIB_PROPERTY(bool, GridVisible, true)
|
|
ULIB_PROPERTY(bool, Parallel, false)
|
|
|
|
private:
|
|
Viewport* m_Viewport;
|
|
};
|
|
|
|
} // namespace Vtk
|
|
} // namespace uLib
|
|
|
|
#endif // ULIB_VTK_VIEWPORTPROPERTIES_H
|