Commit d847a6b7 authored by Thibault Soucarre's avatar Thibault Soucarre

change position calculation in browse_entities

parent 55bc0034
......@@ -228,7 +228,7 @@ public:
trace_to_render_y(_containers[i].y),// * _y_state_scale*(_render_height-_ruler_height)/Info::Container::y_max) - _y_state_translate + _ruler_y + _ruler_height,
_z_container,
_containers[i].w * (Info::Render::width/Info::Container::x_max)*_x_scale_container_state,
_containers[i].h * _y_state_scale*(Info::Render::height-_ruler_height)/Info::Container::y_max);
_containers[i].h * _y_state_scale*(Info::Render::height-_ruler_height)/Info::Container::y_max);
}
// std::cout << __FILE__ << " ~ " << __LINE__ << " " << Info::Container::y_max << " " << Info::Container::y_min << std::endl;
......
......@@ -332,15 +332,17 @@ public:
_entity_containers.push_back(container);
}
// Store the position to draw links
_container_positions[container] = y/(_container_height + _container_v_space) /*+ 7 * _container_v_space*/;//position; // First line after children
_container_sizes[container] = h/(_container_height + _container_v_space);//size; // First line after children
// Use one line for each variable
if (container->get_variable_number() > 0) {
_variable_containers.push_back(container);
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
......@@ -379,7 +381,6 @@ public:
template<class T>
inline void browse_entities(T* draw_object, double zoom, Interval* interval, std::vector<const Container *> *set_container) {
//////////////////////////////////////////////////////////
std::cout << "browse entities" << std::endl;
const Container *container;
StateChange::Tree *state_tree;
Event::Tree *event_tree;
......@@ -388,7 +389,7 @@ public:
const std::map<VariableType *, Variable *> *variable_map;
Variable *var;
const std::list<std::pair<Date, Double> > *variable_values;
int position;
Element_pos position;
const Color *color;
std::map<std::string, Value *>::const_iterator field;
Element_pos lvl_zoom;
......@@ -408,7 +409,7 @@ public:
if(is_in_set(*c,set_container)){
container = *c;
position = (int)_container_positions[container] + _container_sizes[container] - 1;
position = _container_positions[container] + _container_sizes[container] - (_container_height + _container_v_space);
state_tree = container->get_states();
event_tree = container->get_events();
......@@ -511,7 +512,7 @@ public:
if(is_in_set(*c,set_container)){
container = *c;
position = (int)_container_positions[container] + _container_sizes[container];
position = _container_positions[container] + _container_sizes[container];
// Browse variables
variable_map = container->get_variables();
......@@ -563,7 +564,7 @@ public:
*/
template<class T>
inline void draw_variable_value(T *draw_object, double time, double value, int position) {
Element_pos y = (position+1)*(_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;
draw_object->draw_counter(time, y);
}
......@@ -587,8 +588,8 @@ public:
double srcsize = _container_sizes[link->get_source()];
double dstsize = _container_sizes[link->get_destination()];
Element_pos y1 = (srcpos + 0.5 * srcsize)*(_container_height+_container_v_space);
Element_pos y2 = (dstpos + 0.5 * dstsize)*(_container_height+_container_v_space);
Element_pos y1 = (srcpos + 0.5 * srcsize);//*(_container_height+_container_v_space);
Element_pos y2 = (dstpos + 0.5 * dstsize);//*(_container_height+_container_v_space);
if (color != NULL)
draw_object->draw_arrow(starttime, endtime, y1, y2, color->get_red(), color->get_green(), color->get_blue());
......
......@@ -67,9 +67,9 @@ template <typename E> class BinaryTree;
template<class D, class E>
class DrawTree {
private:
D *_draw_object;
int _position;
double _min_size;
D * _draw_object;
Element_pos _position;
double _min_size;
Element_pos _container_height;
Element_pos _container_v_space;
......@@ -81,7 +81,7 @@ public:
/*!
*\brief Default constructor
*/
DrawTree(D *draw_object, int position, double min_size,
DrawTree(D *draw_object, Element_pos position, double min_size,
Element_pos container_height, Element_pos container_v_space,
Element_pos state_height, Element_pos state_v_space):
_draw_object(draw_object), _position(position), _min_size(min_size),
......@@ -120,7 +120,7 @@ public:
* \param b Blue value of the state color
*/
inline void draw_state(double starttime, double endtime, double r, double g, double b) {
Element_pos y = _position*(_container_height+_container_v_space) + _container_v_space/2;
Element_pos y = _position + _container_v_space/2;
_draw_object->draw_state(starttime, endtime, y, _state_height, r, g, b);
}
......@@ -133,7 +133,7 @@ public:
* \param b The blue component of the color
*/
inline void draw_event(double time, double r, double g, double b) {
Element_pos y = _position*(_container_height+_container_v_space) + _container_v_space/2;
Element_pos y = _position + _container_v_space/2;
_draw_object->draw_event(time, y, _state_height, r, g, b);
}
......
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