g4tools  5.4.0
Public Member Functions | List of all members
tools::sg::text_hershey_marker Class Reference
Inheritance diagram for tools::sg::text_hershey_marker:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::text_hershey_marker:
Collaboration graph
[legend]

Public Member Functions

virtual bool draw_in_frame_buffer () const
 
virtual void render (render_action &a_action)
 
virtual void pick (pick_action &a_action)
 
virtual void bbox (bbox_action &a_action)
 
 text_hershey_marker ()
 
virtual ~text_hershey_marker ()
 
 text_hershey_marker (const text_hershey_marker &a_from)
 
text_hershey_markeroperator= (const text_hershey_marker &a_from)
 
- Public Member Functions inherited from tools::sg::text_hershey
virtual const desc_fieldsnode_desc_fields () const
 
 text_hershey ()
 
virtual ~text_hershey ()
 
 text_hershey (const text_hershey &a_from)
 
text_hersheyoperator= (const text_hershey &a_from)
 
virtual void get_bounds (float a_height, float &a_mn_x, float &a_mn_y, float &a_mn_z, float &a_mx_x, float &a_mx_y, float &a_mx_z) const
 
virtual float ascent (float a_height) const
 
virtual float y_advance (float a_height) const
 
virtual float descent (float a_height) const
 
virtual bool truncate (const std::string &a_string, float a_height, float a_cut_width, std::string &a_out) const
 
- Public Member Functions inherited from tools::sg::base_text
 base_text ()
 
virtual ~base_text ()
 
- Public Member Functions inherited from tools::sg::node
virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const =0
 
virtual nodecopy () const =0
 
virtual unsigned int cls_version () const
 
virtual void search (search_action &a_action)
 
virtual void get_matrix (get_matrix_action &a_action)
 
virtual bool write (write_action &a_action)
 
virtual void event (event_action &)
 
virtual bool read (read_action &a_action)
 
virtual void is_visible (visible_action &)
 
virtual void protocol_one_fields (std::vector< field * > &a_fields) const
 
virtual bool touched ()
 
virtual void reset_touched ()
 
 node ()
 
virtual ~node ()
 
void touch ()
 
fieldfield_from_desc (const field_desc &a_desc) const
 
void dump_field_descs (std::ostream &a_out) const
 
fieldfind_field_by_name (const std::string &a_name) const
 
- Public Member Functions inherited from tools::sg::gstos
size_t num_gstos () const
 

Additional Inherited Members

- Static Public Member Functions inherited from tools::sg::text_hershey
static void get_bounds (float a_height, const std::string &a_encoding, font_type a_font, const std::vector< std::string > &a_ss, float &a_mn_x, float &a_mn_y, float &a_mn_z, float &a_mx_x, float &a_mx_y, float &a_mx_z)
 
static void get_bounds (float a_height, const std::string &a_encoding, font_type a_font, const std::string &a_s, float &a_mn_x, float &a_mn_y, float &a_mn_z, float &a_mx_x, float &a_mx_y, float &a_mx_z)
 
- Public Attributes inherited from tools::sg::text_hershey
sf_string encoding
 
sf_enum< font_typefont
 
- Public Attributes inherited from tools::sg::base_text
mf_string strings
 
sf< float > height
 
sf_enum< sg::hjusthjust
 
sf_enum< sg::vjustvjust
 
- Protected Types inherited from tools::sg::text_hershey
typedef std::vector< hcharsencoded
 
- Protected Member Functions inherited from tools::sg::text_hershey
virtual unsigned int create_gsto (std::ostream &, sg::render_manager &a_mgr)
 
void update_sg ()
 
void get_segments (std::vector< float > &a_segs) const
 
- Protected Member Functions inherited from tools::sg::base_text
 base_text (const base_text &a_from)
 
base_textoperator= (const base_text &a_from)
 
- Protected Member Functions inherited from tools::sg::node
 node (const node &)
 
nodeoperator= (const node &)
 
void add_field (field *a_field)
 
bool write_fields (write_action &a_action)
 
bool read_fields (read_action &a_action)
 
field_desc::offset_t field_offset (const field *a_field) const
 
fieldfind_field (const field_desc &a_rdesc) const
 
void check_fields (std::ostream &a_out) const
 
- Protected Member Functions inherited from tools::sg::gstos
 gstos ()
 
virtual ~gstos ()
 
 gstos (const gstos &)
 
gstosoperator= (const gstos &a_from)
 
unsigned int get_tex_id (std::ostream &a_out, render_manager &a_mgr, const img_byte &a_img, bool a_NEAREST)
 
unsigned int get_gsto_id (std::ostream &a_out, render_manager &a_mgr)
 
void clean_gstos ()
 
void clean_gstos (render_manager *a_mgr)
 
unsigned int _find (render_manager *a_mgr)
 
- Static Protected Member Functions inherited from tools::sg::text_hershey
static float _descent (float a_height)
 
static bool _truncate (const std::string &a_string, float a_height, font_type a_font, float a_cut_width, std::string &a_out)
 
static void get_char_bound (char a_char, font_type a_font, float a_scale, bool a_bar, float &a_mn_x, float &a_mn_y, float &a_mn_z, float &a_mx_x, float &a_mx_y, float &a_mx_z)
 
static void string_segs (bool aGEN_POINTS, const std::string &a_string, float a_height, const std::string &a_encoding, font_type a_font, float &aX, float &aY, std::vector< float > &a_segs, bool a_fill_segs)
 
static float char_segs (bool aGEN_POINTS, char a_char, font_type a_font, float a_scale, bool aBar, float aX, float aY, std::vector< float > &a_segs, bool a_fill_segs)
 
static void decode_plain (const std::string &a_s, sencoded &a_sed)
 
static void decode_PAW (const std::string &a_s, sencoded &a_sed)
 PAW encoding //////////////////////////////////////////////////////////. More...
 
- Protected Attributes inherited from tools::sg::text_hershey
std::vector< float > m_segs
 
size_t m_gsto_sz
 
- Protected Attributes inherited from tools::sg::gstos
std::vector< std::pair< unsigned int, render_manager * > > m_gstos
 

Detailed Description

Definition at line 12 of file text_hershey_marker.

Constructor & Destructor Documentation

◆ text_hershey_marker() [1/2]

tools::sg::text_hershey_marker::text_hershey_marker ( )
inline

Definition at line 86 of file text_hershey_marker.

87  :parent()
88  {
89  height = 10; //in pixels
90  }

◆ ~text_hershey_marker()

virtual tools::sg::text_hershey_marker::~text_hershey_marker ( )
inlinevirtual

Definition at line 91 of file text_hershey_marker.

91 {}

◆ text_hershey_marker() [2/2]

tools::sg::text_hershey_marker::text_hershey_marker ( const text_hershey_marker a_from)
inline

Definition at line 93 of file text_hershey_marker.

94  :parent(a_from)
95  {}

Member Function Documentation

◆ bbox()

virtual void tools::sg::text_hershey_marker::bbox ( bbox_action a_action)
inlinevirtual

Reimplemented from tools::sg::text_hershey.

Definition at line 82 of file text_hershey_marker.

82  {
83  a_action.add_one_point(0,0,0);
84  }

◆ draw_in_frame_buffer()

virtual bool tools::sg::text_hershey_marker::draw_in_frame_buffer ( ) const
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 15 of file text_hershey_marker.

15 {return true;}

◆ operator=()

text_hershey_marker& tools::sg::text_hershey_marker::operator= ( const text_hershey_marker a_from)
inline

Definition at line 96 of file text_hershey_marker.

96  {
97  parent::operator=(a_from);
98  return *this;
99  }

◆ pick()

virtual void tools::sg::text_hershey_marker::pick ( pick_action a_action)
inlinevirtual

Reimplemented from tools::sg::text_hershey.

Definition at line 53 of file text_hershey_marker.

53  {
54  float x,y,z;
55  a_action.projected_origin(x,y,z);
56 
57  const state& state = a_action.state();
58 
59  float sy = 2.0f*float(height.value())/float(state.m_wh); //in [-1,1]
60 
61  float old_height = height.value();
62  height.value_no_cmp(sy);
63 
64  std::vector<float> segs;
65  get_segments(segs);
66 
67  a_action.set_matrices_to_identity();
68 
69  {std::vector<float>::iterator it;
70  for(it=segs.begin();it!=segs.end();) {
71  *it += x;it++;
72  *it += y;it++;
73  }}
74 
75  a_action.add__lines_xy(*this,segs);
76 
77  a_action.set_matrices_from_state();
78 
79  height.value_no_cmp(old_height);
80  }

◆ render()

virtual void tools::sg::text_hershey_marker::render ( render_action a_action)
inlinevirtual

Reimplemented from tools::sg::text_hershey.

Definition at line 17 of file text_hershey_marker.

17  {
18  //Same logic as Inventor SoLightModel.model = BASE_COLOR.
19  a_action.set_lighting(false);
20  a_action.set_depth_test(false);
21 
22  float x,y,z;
23  a_action.projected_origin(x,y,z);
24 
25  const state& state = a_action.state();
26 
27  float sy = 2.0f*float(height.value())/float(state.m_wh); //in [-1,1]
28 
29  float old_height = height.value();
30  height.value_no_cmp(sy);
31 
32  std::vector<float> segs;
33  get_segments(segs); //must be after changing the height.
34 
35  a_action.load_matrices_to_identity();
36 
37  {std::vector<float>::iterator it;
38  for(it=segs.begin();it!=segs.end();) {
39  *it += x;it++; //Android don't like *it++.
40  *it += y;it++;
41  }}
42  a_action.draw_vertex_array_xy(gl::lines(),segs);
43 
44  a_action.load_matrices_from_state();
45 
46  height.value_no_cmp(old_height);
47 
48  a_action.set_depth_test(state.m_GL_DEPTH_TEST);
49  a_action.set_lighting(a_action.state().m_GL_LIGHTING);
50 
51  }

The documentation for this class was generated from the following file:
tools::sg::base_text::height
sf< float > height
Definition: base_text:30
tools::gl::lines
mode_t lines()
Definition: glprims:17
tools::sg::node::operator=
node & operator=(const node &)
Definition: node:124
tools::sg::bsf::value_no_cmp
void value_no_cmp(const T &a_value)
Definition: bsf:104
tools::sg::bsf::value
T & value()
Definition: bsf:98
tools::sg::text_hershey::get_segments
void get_segments(std::vector< float > &a_segs) const
Definition: text_hershey:290