Commit e7434a41 authored by Thibault Soucarre's avatar Thibault Soucarre

add counters

parent 338e0166
...@@ -199,6 +199,16 @@ void Render_alternate::paintGL(){ ...@@ -199,6 +199,16 @@ void Render_alternate::paintGL(){
glUniformMatrix4fv(glGetUniformLocation(_shader.getProgramID(), "projection"), 1, GL_FALSE, glm::value_ptr(_projection)); glUniformMatrix4fv(glGetUniformLocation(_shader.getProgramID(), "projection"), 1, GL_FALSE, glm::value_ptr(_projection));
glDrawArrays(GL_QUADS, 0, _states.getNbVertex()); glDrawArrays(GL_QUADS, 0, _states.getNbVertex());
_states.unlock(); _states.unlock();
//_modelview = tmp;
/*drawing counters*/
_counters.lock();
//_modelview = glm::translate(_modelview, glm::vec3(0.0, _ruler_y + _ruler_height - _y_state_translate, _z_container));
//_modelview = glm::scale(_modelview, glm::vec3(_x_scale_container_state/0.20, _y_state_scale, 1.0));
//glUniformMatrix4fv(glGetUniformLocation(_shader.getProgramID(), "modelview"), 1, GL_FALSE, glm::value_ptr(_modelview));
//glUniformMatrix4fv(glGetUniformLocation(_shader.getProgramID(), "projection"), 1, GL_FALSE, glm::value_ptr(_projection));
glDrawArrays(GL_LINES, 0, _counters.getNbVertex());
_counters.unlock();
_modelview = tmp; _modelview = tmp;
/*drawing links*/ /*drawing links*/
......
...@@ -287,7 +287,7 @@ public: ...@@ -287,7 +287,7 @@ public:
i++) i++)
// Use the fact that if a container is selected, then it implies that all his ancestors are // Use the fact that if a container is selected, then it implies that all his ancestors are
if(is_in_set(*i,container)) if(is_in_set(*i,container))
y += browse_container(draw_object, *i, 0., y, _container_width, 0., container); y += browse_container(draw_object, *i, 0., y, _container_width, 0., container)+_container_v_space;
} }
}/* end browse_container_tree */ }/* end browse_container_tree */
...@@ -315,6 +315,7 @@ public: ...@@ -315,6 +315,7 @@ public:
i++) { i++) {
h += browse_container(draw_object, (*i), x + _container_width + _container_h_space, y + h, _container_width, 0., set_container) + _container_v_space; h += browse_container(draw_object, (*i), x + _container_width + _container_h_space, y + h, _container_width, 0., set_container) + _container_v_space;
} }
// h -= _container_v_space; // h -= _container_v_space;
/*if(is_in_set(*i,set_container)) /*if(is_in_set(*i,set_container))
size += browse_container(draw_object, (*i), position+size, depth+1,set_container);*/ size += browse_container(draw_object, (*i), position+size, depth+1,set_container);*/
...@@ -333,18 +334,16 @@ public: ...@@ -333,18 +334,16 @@ public:
} }
// Store the position to draw links
_container_positions[container] = y;
_container_sizes[container] = h;
// Use one line for each variable // Use one line for each variable
if (container->get_variable_number() > 0) { if (container->get_variable_number() > 0) {
_variable_containers.push_back(container); _variable_containers.push_back(container);
h += (_container_height + _container_v_space) * container->get_variable_number(); h += (_container_height + _container_v_space) * container->get_variable_number();
} }
// Store the position to draw links
_container_positions[container] = y;
_container_sizes[container] = h;
h -= _container_v_space;
if (h < _container_height) // Minimum size if (h < _container_height) // Minimum size
h = _container_height; h = _container_height;
...@@ -352,6 +351,8 @@ public: ...@@ -352,6 +351,8 @@ public:
if (!container->get_links()->empty()) if (!container->get_links()->empty())
_link_containers.push_back(container); _link_containers.push_back(container);
h -= _container_v_space;
// Draw this container // Draw this container
draw_container(draw_object, x, y, w, h, container->get_name().to_string()); draw_container(draw_object, x, y, w, h, container->get_name().to_string());
...@@ -529,8 +530,8 @@ public: ...@@ -529,8 +530,8 @@ public:
double first_value = 0.; double first_value = 0.;
double second_value = 0.; double second_value = 0.;
draw_object->draw_text_value((long int)var,0.0, (position+1)*(_container_height+_container_v_space) - _container_v_space/2 - //draw_object->draw_text_value((long int)var,0.0, (position+1)*(_container_height+_container_v_space) - _container_v_space/2 - 0.5*_container_height);
0.5*_container_height); draw_object->draw_text_value((long int)var, 0.0, position + 0.5 * _container_height + _container_v_space/2);
_var_positions[var]=position; _var_positions[var]=position;
draw_variable_value(draw_object, 0.0, 0.0, position); draw_variable_value(draw_object, 0.0, 0.0, position);
for (std::list<std::pair<Date, Double> >::const_iterator value = variable_values->begin(); for (std::list<std::pair<Date, Double> >::const_iterator value = variable_values->begin();
...@@ -546,7 +547,7 @@ public: ...@@ -546,7 +547,7 @@ public:
} }
} }
draw_variable_value(draw_object, 0.0, 0.0, position); draw_variable_value(draw_object, 0.0, 0.0, position);
position++; // One line was used position += _container_height + _container_v_space; // One line was used
}/* end for */ }/* end for */
} }
}//end for }//end for
...@@ -563,8 +564,8 @@ public: ...@@ -563,8 +564,8 @@ public:
* \param position Line where the variable is drawn * \param position Line where the variable is drawn
*/ */
template<class T> template<class T>
inline void draw_variable_value(T *draw_object, double time, double value, int position) { inline void draw_variable_value(T *draw_object, double time, double value, Element_pos position) {
Element_pos y = position + (_container_height+_container_v_space) - _container_v_space/2 - Element_pos y = position + (_container_height+_container_v_space) -_container_v_space/2 -
value*_container_height; value*_container_height;
draw_object->draw_counter(time, y); draw_object->draw_counter(time, y);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment