Definition at line 30 of file axis.
◆ style_item_t
Definition at line 704 of file axis.
◆ style_t
Definition at line 705 of file axis.
◆ axis() [1/2]
Definition at line 208 of file axis.
◆ ~axis()
virtual tools::sg::axis::~axis |
( |
| ) |
|
|
inlinevirtual |
Definition at line 247 of file axis.
◆ axis() [2/2]
tools::sg::axis::axis |
( |
const axis & |
a_from | ) |
|
|
inline |
Definition at line 249 of file axis.
◆ avoid_labels_overlap()
void tools::sg::axis::avoid_labels_overlap |
( |
std::ostream & |
a_out | ) |
|
|
inlineprotected |
Definition at line 831 of file axis.
833 float first_scale = 1;
836 float second_scale = 1.1f;
838 (*it)->mul_scale(second_scale,second_scale,1);
844 float a = (second_overlap-first_overlap)/(second_scale-first_scale);
845 float b = first_overlap-a*first_scale;
848 float wanted_scale = (-wanted_gap-b)/a;
849 if(wanted_scale<=0) wanted_scale = 1;
850 wanted_scale /= second_scale;
852 (*it)->mul_scale(wanted_scale,wanted_scale,1);
856 (*it)->mul_scale(1.0f/second_scale,1.0f/second_scale,1);
◆ bbox()
virtual void tools::sg::axis::bbox |
( |
bbox_action & |
a_action | ) |
|
|
inlinevirtual |
◆ calculate_ticks_hippo()
static float tools::sg::axis::calculate_ticks_hippo |
( |
float |
aSize, |
|
|
float & |
a_mag |
|
) |
| |
|
inlinestaticprotected |
Definition at line 1052 of file axis.
1053 unsigned int MIN_TICKS = 4;
1057 aSize =
ffabs(aSize);
1058 if (aSize == 0.0) aSize = 1.0;
1062 if (aSize/
fpow(10.0,a_mag) < MIN_TICKS) (a_mag)--;
1068 static const float goodTicks[] = {10.0, 5.0, 4.0, 2.0, 1.0};
1070 aSize/(tickSize=goodTicks[tickIndex]*
fpow(10.0,a_mag))<MIN_TICKS;
1073 if (tickIndex == 0) a_mag++;
◆ compute_ticks_hippo()
void tools::sg::axis::compute_ticks_hippo |
( |
| ) |
|
|
inlineprotected |
Hippodraw tick modeling //////////////////////////////////////////////.
Definition at line 874 of file axis.
892 if((
mn<=0) || (
mx<=0) ) a_is_log =
false;
895 float magxxx,y,yr,startTick,tickSize;
900 unsigned int tick_num = 0;
901 std::vector<float> tick_values;
902 std::vector<std::string> tick_labels;
906 float NUM_FUZZ = 0.01f;
924 startTick =
fceil(
mn / tickSize) * tickSize;
926 if (
ffabs(magxxx) <= 3)
931 snpf(pstr,
sizeof(pstr),
"%%1.%df",(
int)max_of<float>((pmag-magxxx),0.0));
934 while (y <=
mx*(1.0+NUM_FUZZ)) {
938 snpf(tmp,
sizeof(tmp),pstr,yr*
fpow(10,magxxx-pmag));
940 {
float val = yr *
fpow(10.0,magxxx);
941 if((val>=
mn)&&(val<=
mx)) {
942 tick_values.push_back(val);
943 tick_labels.push_back(tmp);
949 if (
ffabs(magxxx) <= 3.0) magxxx = 0.0;
972 float magrng = maghigh - maglow;
983 magStep = magrng <= 7 ? 1.0F : 2.0F;
986 pmag = (nLogTicks == 3 && (
ffabs(maglow)>3 ||
ffabs(maghigh)>3)) ?
991 while ((y=logTicks[i]*
fpow(10,magxxx)) <
mx*(1+NUM_FUZZ)) {
996 if ((magxxx-pmag) > 4 || (magxxx-pmag) < -3) {
997 ::strcpy(pstr,
"%1.0e");
999 snpf(pstr,
sizeof(pstr),
1000 "%%1.%df",(
int)((magxxx-pmag)>0?0.:-(magxxx-pmag)));
1002 snpf(tmp,
sizeof(tmp),pstr,y*
fpow(10.0,-pmag));
1006 tick_values.push_back(val);
1007 tick_labels.push_back(tmp);
1024 float range =
mx -
mn;
1030 for(
unsigned int index=0;index<tick_num;index++) {
1031 float val = tick_values[index];
1032 float coord =
width * (val-
mn)/range;
1040 for(
size_t index=n;index<tick_num;index++)
labels.
add(
"");
◆ compute_ticks_HPLOT()
void tools::sg::axis::compute_ticks_HPLOT |
( |
std::ostream & |
a_out | ) |
|
|
inlineprotected |
HPLOT tick modeling //////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////.
Definition at line 1082 of file axis.
1099 if((
mn<=0) || (
mx<=0) ) a_is_log =
false;
1107 double xmax =
width;
1110 double gridlength = 0;
1112 if(a_is_log) chopt +=
"G";
1114 std::vector<float> linesGrid;
1115 std::vector<hplot::_text> texts;
1117 hplot::axis sbAxisHPLOT(a_out);
1133 sbAxisHPLOT.set_title(
"");
1134 sbAxisHPLOT.paint(xmin,ymin,xmax,ymax,
1136 chopt,gridlength,
false,
1144 float range =
mx -
mn;
1146 size_t tick_num = texts.size();
1152 if(::sscanf(texts[tick_num-1].fString.c_str(),
"x10^%d!",&pmag)==1) {
1161 for(
size_t index=0;index<tick_num;index++) {
1162 float coord = (float)texts[index].fX;
1172 for(
size_t index=n;index<tick_num;index++)
labels.
add(
"");
1176 for(
size_t index=0;index<tick_num;index++) {
1184 for(
size_t index=0;index<num;index++) {
1188 for(
size_t i=0;i<tick_num;i++) {
1189 if((
float)texts[i].fX==coord) {
◆ get_overlap()
float tools::sg::axis::get_overlap |
( |
std::ostream & |
a_out, |
|
|
bool & |
a_overlap |
|
) |
| |
|
inlineprotected |
Definition at line 800 of file axis.
802 std::vector<float> x_mins;
803 std::vector<float> x_maxs;
805 bbox_action _action(a_out);
808 (*it)->bbox(_action);
811 if(_action.box().get_size(dx,dy,dz)) {
820 float dx_overlap = 0;
821 {
size_t number = x_mins.size();
822 for(
size_t index=1;index<number;index++) {
823 float dx = x_mins[index]-x_maxs[index-1];
826 dx_overlap =
mx(dx_overlap,-dx);
◆ labels_style()
Definition at line 334 of file axis.
◆ line_style()
Definition at line 332 of file axis.
◆ mag_style()
Definition at line 336 of file axis.
◆ node_desc_fields()
virtual const desc_fields& tools::sg::axis::node_desc_fields |
( |
| ) |
const |
|
inlinevirtual |
Reimplemented from tools::sg::node.
Definition at line 73 of file axis.
75 static const desc_fields s_v(parent::node_desc_fields(),27,
◆ operator=()
axis& tools::sg::axis::operator= |
( |
const axis & |
a_from | ) |
|
|
inline |
Definition at line 291 of file axis.
292 parent::operator=(a_from);
294 width = a_from.width;
307 title = a_from.title;
◆ pick()
virtual void tools::sg::axis::pick |
( |
pick_action & |
a_action | ) |
|
|
inlinevirtual |
◆ render()
◆ reset_style()
void tools::sg::axis::reset_style |
( |
bool |
a_geom = false | ) |
|
|
inline |
Definition at line 612 of file axis.
655 float hData = YSIZ-YMGL-YMGU;
658 float to1 =
width/hData;
660 float vsiz = VSIZ * to1;
661 float yval = YVAL * to1;
662 float xtic = XTIC * to1;
663 float ylab = YLAB * to1;
664 float asiz = ASIZ * to1;
◆ reset_touched()
virtual void tools::sg::axis::reset_touched |
( |
| ) |
|
|
inlinevirtual |
◆ search()
Reimplemented from tools::sg::node.
Definition at line 179 of file axis.
184 parent::search(a_action);
185 if(a_action.done())
return;
◆ set_color()
void tools::sg::axis::set_color |
( |
const colorf & |
a_color | ) |
|
|
inline |
Definition at line 338 of file axis.
◆ set_encoding()
void tools::sg::axis::set_encoding |
( |
const std::string & |
a_value | ) |
|
|
inline |
Definition at line 794 of file axis.
◆ set_from_style()
bool tools::sg::axis::set_from_style |
( |
std::ostream & |
a_out, |
|
|
const style_t & |
a_style |
|
) |
| |
|
inline |
Definition at line 706 of file axis.
707 style_t::const_iterator it;
708 for(it=a_style.begin();it!=a_style.end();++it) {
709 const std::string& key = (*it).first;
710 const std::string& sv = (*it).second;
731 if(key==
"divisions") {
735 }
else if(key==
"modeling") {
737 }
else if(key==
"is_log") {
742 }
else if(key==
"tick_up") {
746 }
else if(key==
"tick_length") {
751 }
else if(key==
"title") {
753 }
else if(key==
"title_to_axis") {
757 }
else if(key==
"title_height") {
761 }
else if(key==
"title_hjust") {
767 }
else if(key==
"label_to_axis") {
771 }
else if(key==
"label_height") {
776 }
else if(key==
"labels_no_overlap_automated") {
780 }
else if(key==
"labels_gap") {
786 a_out <<
"axis::set_from_style :"
787 <<
" unknown key " << key <<
"."
◆ style_failed()
static void tools::sg::axis::style_failed |
( |
std::ostream & |
a_out, |
|
|
const std::string & |
a_key, |
|
|
const std::string & |
a_value |
|
) |
| |
|
inlinestaticprotected |
Definition at line 862 of file axis.
865 a_out <<
"axis::set_from_style :"
866 <<
" failed for key " << sout(a_key)
867 <<
" and value " << sout(a_value) <<
"."
◆ ticks_style()
Definition at line 333 of file axis.
◆ title_style()
Definition at line 335 of file axis.
◆ touched()
virtual bool tools::sg::axis::touched |
( |
| ) |
|
|
inlinevirtual |
Reimplemented from tools::sg::node.
Definition at line 107 of file axis.
108 if(parent::touched())
return true;
◆ update_sg()
void tools::sg::axis::update_sg |
( |
std::ostream & |
a_out | ) |
|
|
inline |
Definition at line 346 of file axis.
361 rgba* mat =
new rgba();
365 draw_style* ds =
new draw_style;
371 vertices* vtxs =
new vertices;
374 vtxs->add(
width,0,0);
389 vertices* vtxs =
new vertices;
396 for(
size_t index=0;index<num;index++) {
413 for(
unsigned int index=0;index<
tick_number;index++) {
422 rgba* mat =
new rgba();
426 draw_style* ds =
new draw_style;
446 rgba* mat =
new rgba();
454 draw_style* ds =
new draw_style;
467 vec3f Z;X.cross(Y,Z);
469 mat4f scale_rot(X.v0(),Y.v0(),Z.v0(),0,
470 X.v1(),Y.v1(),Z.v1(),0,
471 X.v2(),Y.v2(),Z.v2(),0,
473 scale_rot.mul_scale(text_size,text_size,1);
479 for(
unsigned int index=0;index<number;index++) {
482 if(index==(number-1))
continue;
491 separator*
sep =
new separator;
501 vec[0],vec[1],vec[2],
521 rgba* mat =
new rgba();
531 vec3f vec(
width*1.03f,0,0);
538 draw_style* ds =
new draw_style;
551 vec[0],vec[1],vec[2],
563 rgba* mat =
new rgba();
571 draw_style* ds =
new draw_style;
600 vec[0],vec[1],vec[2],
◆ write()
virtual bool tools::sg::axis::write |
( |
write_action & |
a_action | ) |
|
|
inlinevirtual |
◆ coords
mf<float> tools::sg::axis::coords |
Definition at line 52 of file axis.
◆ divisions
sf<unsigned int> tools::sg::axis::divisions |
Definition at line 37 of file axis.
◆ is_log
sf<bool> tools::sg::axis::is_log |
Definition at line 39 of file axis.
◆ label_height
sf<float> tools::sg::axis::label_height |
Definition at line 62 of file axis.
◆ label_to_axis
sf<float> tools::sg::axis::label_to_axis |
Definition at line 61 of file axis.
◆ labels
Definition at line 50 of file axis.
◆ labels_enforced
sf<bool> tools::sg::axis::labels_enforced |
Definition at line 42 of file axis.
◆ labels_gap
sf<float> tools::sg::axis::labels_gap |
Definition at line 65 of file axis.
◆ labels_no_overlap_automated
sf<bool> tools::sg::axis::labels_no_overlap_automated |
Definition at line 64 of file axis.
◆ m_group
group tools::sg::axis::m_group |
|
protected |
◆ m_labels_mtxs
std::vector<matrix*> tools::sg::axis::m_labels_mtxs |
|
protected |
◆ m_labels_sep
◆ m_labels_seps
std::vector<separator*> tools::sg::axis::m_labels_seps |
|
protected |
◆ m_labels_style
◆ m_labels_xs
std::vector<float> tools::sg::axis::m_labels_xs |
|
protected |
◆ m_line_sep
◆ m_line_style
◆ m_mag_sep
◆ m_mag_style
◆ m_sub_ticks
std::vector<float> tools::sg::axis::m_sub_ticks |
|
protected |
◆ m_ticks_sep
◆ m_ticks_style
◆ m_title_sep
◆ m_title_style
◆ m_ttf
◆ magnitude
sf<int> tools::sg::axis::magnitude |
Definition at line 54 of file axis.
◆ maximum_value
sf<float> tools::sg::axis::maximum_value |
Definition at line 36 of file axis.
◆ minimum_value
sf<float> tools::sg::axis::minimum_value |
Definition at line 35 of file axis.
◆ modeling
Definition at line 38 of file axis.
◆ sub_coords
mf<float> tools::sg::axis::sub_coords |
Definition at line 53 of file axis.
◆ tick_length
sf<float> tools::sg::axis::tick_length |
Definition at line 44 of file axis.
◆ tick_number
sf<unsigned int> tools::sg::axis::tick_number |
Definition at line 49 of file axis.
◆ tick_up
sf<bool> tools::sg::axis::tick_up |
Definition at line 43 of file axis.
◆ time_format
Definition at line 69 of file axis.
◆ time_labels
sf<bool> tools::sg::axis::time_labels |
Definition at line 68 of file axis.
◆ time_offset
sf<double> tools::sg::axis::time_offset |
Definition at line 70 of file axis.
◆ time_offset_is_GMT
sf<bool> tools::sg::axis::time_offset_is_GMT |
Definition at line 71 of file axis.
◆ title
Definition at line 56 of file axis.
◆ title_height
sf<float> tools::sg::axis::title_height |
Definition at line 58 of file axis.
◆ title_hjust
Definition at line 59 of file axis.
◆ title_to_axis
sf<float> tools::sg::axis::title_to_axis |
Definition at line 57 of file axis.
◆ values
mf<float> tools::sg::axis::values |
Definition at line 51 of file axis.
◆ width
sf<float> tools::sg::axis::width |
Definition at line 34 of file axis.
The documentation for this class was generated from the following file:
- /Users/barrand/private/dev/softinex/g4tools/g4tools/tools/sg/axis
sf_enum< sg::vjust > vjust
sf_enum< sg::font_modeling > font_modeling
sf_vec< colorf, float > color
sf_enum< sg::hjust > hjust
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
#define tools_vforcit(a__T, a__v, a__it)
#define TOOLS_ARG_FIELD_DESC(a__field)