33 lines
1.2 KiB
C++
33 lines
1.2 KiB
C++
#include "Axis_p.h"
|
|
#include "../base/Memory.h"
|
|
namespace renderive {
|
|
RENDERIVE_DEFINE_RENDERABLE_BINDING(Axis, Axis_Private, Axis_Render_State, Axis_Input_Data, "Axis")
|
|
RENDERIVE_DEFINE_STATE_PROP(Axis, Axis_Render_State, int, label_precision)
|
|
RENDERIVE_DEFINE_STATE_PROP(Axis, Axis_Render_State, double, coord_start)
|
|
double Axis::coord_length() {
|
|
return d()->edit_state_value(&Axis_Render_State::coord_length);
|
|
}
|
|
void Axis::set_coord_length(double value) {
|
|
if (value == 0.0)
|
|
return;
|
|
d()->set_state_value(&Axis_Render_State::coord_length, value);
|
|
}
|
|
void Axis::set_coord_range(Range range) {
|
|
if (range.length() == 0.0)
|
|
return;
|
|
Render_Edit_Lease<Axis_Private, Axis_Render_State> edit(d());
|
|
edit->coord_start = range.origin;
|
|
edit->coord_length = range.target - range.origin;
|
|
}
|
|
Axis::Builder::Builder(std::shared_ptr<Renderable> parent, Orientation orientation) {
|
|
ASSERT(parent && parent->attached_to_plot(), "Axis build error! parent invalid");
|
|
this->parent = parent;
|
|
this->orientation = orientation;
|
|
}
|
|
std::shared_ptr<Axis> Axis::Builder::build() {
|
|
auto ret = renderive::make_shared<Axis>();
|
|
Axis::Builder_T<Axis::Builder>::set(ret.get());
|
|
return ret;
|
|
}
|
|
} // namespace renderive
|