diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 050ed85752fcb63e2754164d4561f6e3829e813e..6779cd6a4668bfbc1e2458a93b1658d1876e6407 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,7 +81,7 @@ SET(VITE_HDRS trace/Trace.hpp # Render headers render/render.hpp - render/Render_area.hpp + render/Hook_event.hpp render/Render_opengl_dl.hpp render/Render_opengl.hpp render/render_svg.hpp @@ -90,12 +90,12 @@ SET(VITE_HDRS render/render_stats_svg.hpp #render/vbo.hpp # Interface headers - interface/help.hpp interface/resource.hpp interface/parsing_thread.hpp - interface/interface.hpp - interface/interface_console.hpp - interface/interface_graphic.hpp + interface/Interface.hpp + interface/Interface_graphic.hpp + # Core header + core/Core.hpp # Parser headers parser/Definition.hpp parser/Line.hpp @@ -152,7 +152,7 @@ SET(VITE_SRCS trace/Container.cpp trace/Trace.cpp # Render code files - render/Render_area.cpp + render/Hook_event.cpp render/Render_opengl.cpp render/render_svg.cpp render/render_stats_opengl.cpp @@ -170,10 +170,10 @@ SET(VITE_SRCS statistics/Statistic.cpp statistics/Stats_window.cpp # Interface code files - interface/help.cpp interface/parsing_thread.cpp - interface/interface_graphic.cpp - interface/interface_console.cpp + interface/Interface_graphic.cpp + # Core code files + core/Core.cpp # Main main.cpp ) diff --git a/src/core/Core.cpp b/src/core/Core.cpp index c4de7bd84fd9e9edc0827587bb50bc936cb309b5..28e80a03085b32fe15c5dd8ac6216005859faed3 100644 --- a/src/core/Core.cpp +++ b/src/core/Core.cpp @@ -73,24 +73,24 @@ #include "trace/EntityValue.hpp" #include "trace/EntityTypes.hpp" #include "trace/Entitys.hpp" -// #include "trace/tree/Interval.hpp" +//#include "trace/tree/Interval.hpp" #include "trace/Trace.hpp" #include "trace/DrawTree.hpp" #include "trace/DrawTrace.hpp" +#include "trace/Container.hpp" /* -- */ #include "parser/File.hpp" #include "parser/Parser.hpp" #include "parser/ParserPaje.hpp" #ifdef WITH_OTF -# include <otf.h> -# include "parser/ParserOTF.hpp" +#include <otf.h> +#include "parser/ParserOTF.hpp" #endif //WITH_OTF #include "parser/ParserVite.hpp" /* -- */ #include "statistics/Stats_window.hpp" /* -- */ #include "interface/resource.hpp" -//#include "interface/interface.hpp" #include "interface/Interface_graphic.hpp" #include "core/Core.hpp" #include "interface/parsing_thread.hpp" @@ -134,7 +134,7 @@ using namespace std; **********************************/ Core::Core(int argc, char ** argv){ - + bool useGUI;/* if window interface can be displayed */ QString current_path; @@ -302,7 +302,7 @@ bool Core::draw_trace(const string & filename, const int format){ } } - parser.reinit_cursor(); + // parser.reinit_cursor(); Error::print_numbers(); Error::flush("log.txt"); diff --git a/src/interface/Interface_graphic.hpp b/src/interface/Interface_graphic.hpp index fdd3b65f7d2380c220279ba9410b045ff151f23e..a127b22b4003c408f441bb3789b0afcf6b26fbe8 100644 --- a/src/interface/Interface_graphic.hpp +++ b/src/interface/Interface_graphic.hpp @@ -58,8 +58,6 @@ class Svg; #include "../ui_main_window.h"/* the main window graphical interface */ /* Global informations */ -#include "common/info.hpp" - #include "Interface.hpp" /*! diff --git a/src/main.cpp b/src/main.cpp index ea1fa37f134c1a7117d6a6531bd30c142021f7cb..4d6628cbb9a5a2bfc71f33db287f8a4cab86dfe1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -70,9 +70,9 @@ #include "render/Render_opengl.hpp" -#include "interface/interface.hpp" -#include "interface/interface_graphic.hpp" -#include "interface/interface_console.hpp" +#include "interface/Interface.hpp" +#include "interface/Interface_graphic.hpp" +#include "core/Core.hpp" /*! diff --git a/src/plugin/Command_window.cpp b/src/plugin/Command_window.cpp index dfceaa1960883d40618a211ea56a9fa548c1d279..c44a3b94338f5e352c2c1d163139d8eb3b0100b5 100644 --- a/src/plugin/Command_window.cpp +++ b/src/plugin/Command_window.cpp @@ -1,9 +1,71 @@ -#include "../interface/Interface_graphic.hpp" - +/* +** This file is part of the ViTE project. +** +** This software is governed by the CeCILL-A license under French law +** and abiding by the rules of distribution of free software. You can +** use, modify and/or redistribute the software under the terms of the +** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following +** URL: "http://www.cecill.info". +** +** As a counterpart to the access to the source code and rights to copy, +** modify and redistribute granted by the license, users are provided +** only with a limited warranty and the software's author, the holder of +** the economic rights, and the successive licensors have only limited +** liability. +** +** In this respect, the user's attention is drawn to the risks associated +** with loading, using, modifying and/or developing or reproducing the +** software by the user in light of its specific status of free software, +** that may mean that it is complicated to manipulate, and that also +** therefore means that it is reserved for developers and experienced +** professionals having in-depth computer knowledge. Users are therefore +** encouraged to load and test the software's suitability as regards +** their requirements in conditions enabling the security of their +** systems and/or data to be ensured and, more generally, to use and +** operate it in the same conditions as regards security. +** +** The fact that you are presently reading this means that you have had +** knowledge of the CeCILL-A license and that you accept its terms. +** +** +** ViTE developpers are (for version 0.* to 1.0): +** +** - COULOMB Kevin +** - FAVERGE Mathieu +** - JAZEIX Johnny +** - LAGRASSE Olivier +** - MARCOUEILLE Jule +** - NOISETTE Pascal +** - REDONDY Arthur +** - VUCHENER Clément +** +*/ +/*! + * \file command_window.cpp + */ + +#include <vector> +#include <stack> +#include <QTreeWidgetItem> +#include <QProcess> +/* -- */ +#include "interface/Interface_graphic.hpp" +/* -- */ +#include "../core/Core.hpp" +/* -- */ +#include "trace/values/Values.hpp" +#include "trace/tree/Interval.hpp" +#include "trace/tree/Node.hpp" +#include "trace/tree/BinaryTree.hpp" +#include "trace/EntityValue.hpp" +#include "trace/EntityTypes.hpp" +#include "trace/Entitys.hpp" +// #include "trace/tree/Interval.hpp" +#include "trace/Trace.hpp" +/* -- */ #include "Command_window.hpp" - using namespace std; Command_window::Command_window( QWidget *parent, Interface_graphic * i) : QMainWindow(parent){ setupUi(this); diff --git a/src/plugin/Command_window.hpp b/src/plugin/Command_window.hpp index 2aabf672af0e3d2e2d763586a3c82b871afcca63..6bd76aa6ad756166c77dc685222c55037669570b 100644 --- a/src/plugin/Command_window.hpp +++ b/src/plugin/Command_window.hpp @@ -1,3 +1,45 @@ +/* +** This file is part of the ViTE project. +** +** This software is governed by the CeCILL-A license under French law +** and abiding by the rules of distribution of free software. You can +** use, modify and/or redistribute the software under the terms of the +** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following +** URL: "http://www.cecill.info". +** +** As a counterpart to the access to the source code and rights to copy, +** modify and redistribute granted by the license, users are provided +** only with a limited warranty and the software's author, the holder of +** the economic rights, and the successive licensors have only limited +** liability. +** +** In this respect, the user's attention is drawn to the risks associated +** with loading, using, modifying and/or developing or reproducing the +** software by the user in light of its specific status of free software, +** that may mean that it is complicated to manipulate, and that also +** therefore means that it is reserved for developers and experienced +** professionals having in-depth computer knowledge. Users are therefore +** encouraged to load and test the software's suitability as regards +** their requirements in conditions enabling the security of their +** systems and/or data to be ensured and, more generally, to use and +** operate it in the same conditions as regards security. +** +** The fact that you are presently reading this means that you have had +** knowledge of the CeCILL-A license and that you accept its terms. +** +** +** ViTE developpers are (for version 0.* to 1.0): +** +** - COULOMB Kevin +** - FAVERGE Mathieu +** - JAZEIX Johnny +** - LAGRASSE Olivier +** - MARCOUEILLE Jule +** - NOISETTE Pascal +** - REDONDY Arthur +** - VUCHENER Clément +** +*/ /*! * \file command_window.hpp */ @@ -7,14 +49,18 @@ class Command_window; -#include "../ui_global_cmd.h" -#include "../core/Core.hpp" -#include "../trace/Trace.hpp" +#include "ui_global_cmd.h" /*! * \brief Class that is used to execute an exterior command on the trace */ +class Interface_graphic; +class Container; +class Trace; +class QTreeWidgetItem; +class QProcess; + class Command_window : public QMainWindow, protected Ui::Execution{ Q_OBJECT diff --git a/src/src.pro b/src/src.pro index 657cd70c78ea48ad0edc36019cd3891784350686..9fe5a86bc7ec4577522d754fbe0462665bb303d6 100644 --- a/src/src.pro +++ b/src/src.pro @@ -141,7 +141,7 @@ HEADERS += common/common.hpp \ statistics/DrawVDiagram.hpp \ statistics/DrawHDiagram.hpp \ statistics/DrawCounter.hpp \ -# plugin header +# Plugin header plugin/Command_window.hpp @@ -199,8 +199,13 @@ SOURCES += common/Message.cpp \ # interface/help.cpp \ interface/parsing_thread.cpp \ interface/interface_graphic.cpp \ -# Core file +# Core code file core/Core.cpp \ +# Plugin code file + plugin/Command_window.cpp \ +# Main code file main.cpp + + RESOURCES += interface/vite.qrc diff --git a/src/statistics/Stats_window.hpp b/src/statistics/Stats_window.hpp index 6f8176f3bfe6df1df6acf65886289160dd19a814..a85e4b2310c600e87652d137faf998aa2b873a14 100644 --- a/src/statistics/Stats_window.hpp +++ b/src/statistics/Stats_window.hpp @@ -54,7 +54,7 @@ class Render_stats_opengl; class Stats_window; -#include <QGLWidget> +//#include <QGLWidget> #include "ui_stats_viewer.h" diff --git a/src/trace/DrawTrace.hpp b/src/trace/DrawTrace.hpp index 0dfde97e65413a3a095f45eee2f5eecb64b9e713..f3ed81a50bd07d6f521da5776e3931ed2e7d9889 100644 --- a/src/trace/DrawTrace.hpp +++ b/src/trace/DrawTrace.hpp @@ -48,6 +48,15 @@ #ifndef DRAW_TRACE_HPP #define DRAW_TRACE_HPP +#include <string> + +//#include "resource.hpp" + +//#include "../render/render_opengl.hpp" +#include "common/Message.hpp" + +#include "DrawTree.hpp" + /* * Theses constants can not be put as static const float because it is a template and there binary representation is not normed by the C++ langage. */ @@ -197,7 +206,7 @@ public: if(container == NULL || container->empty()){ - container = new vector<const Container *>(); + container = new std::vector<const Container *>(); trace->set_interval_constrained(new Interval(0,trace->get_max_date())); trace->set_filter(0); @@ -214,7 +223,7 @@ public: //Adding the parent containers if not added yet else{ bool ended = false; - vector<const Container *> store; + std::vector<const Container *> store; store.clear(); while (!ended){ ended = true; @@ -426,27 +435,36 @@ public: // Browse variables variable_map = container->get_variables(); - for (std::map<VariableType *, Variable *>::const_iterator i = variable_map->begin(); - i != variable_map->end(); - i++) { - - var = (*i).second; - double min = var->get_min().get_value(); - double max = var->get_max().get_value(); - variable_values = var->get_values(); - - draw_variable_value(draw_object, 0.0, 0.0, position); - for (std::list<std::pair<Date, Double> >::const_iterator value = variable_values->begin(); - value != variable_values->end(); - value++) { - /* Call the object state drawing function */ - draw_variable_value(draw_object, (*value).first.get_value(), ((*value).second.get_value()-min)/(max-min), position); - } - draw_variable_value(draw_object, 0.0, 0.0, position); - position++; // One line was used - }/* end for */ - } - + for (std::map<VariableType *, Variable *>::const_iterator i = variable_map->begin(); + i != variable_map->end(); + i++) { + + var = (*i).second; + double min = var->get_min().get_value(); + double max = var->get_max().get_value(); + variable_values = var->get_values(); + + double first_value = 0.; + double second_value = 0.; + + draw_variable_value(draw_object, 0.0, 0.0, position); + for (std::list<std::pair<Date, Double> >::const_iterator value = variable_values->begin(); + value != variable_values->end(); + value++) { + + /* Call the object state drawing function. + We pass the first value if correspond to the beginning */ + first_value = (*value).first.get_value(); + second_value =((*value).second.get_value()-min)/(max-min) ; + if(!(first_value == 0. && second_value == 0.)) { + draw_variable_value(draw_object, first_value, second_value, position); + } + } + draw_variable_value(draw_object, 0.0, 0.0, position); + position++; // One line was used + }/* end for */ + } + }//end for draw_object->end_draw_counter(); } @@ -788,7 +806,7 @@ public: - void add( vector<const Container *>* container,std::stack<Container *> *containers){ + void add( std::vector<const Container *>* container,std::stack<Container *> *containers){ while (!containers->empty()) { diff --git a/src/trace/DrawTree.hpp b/src/trace/DrawTree.hpp index 0d6976b441417dd780ec84c470a7e34095213a62..efd594eb0d0386b3c15203f079f94de5c9d59253 100644 --- a/src/trace/DrawTree.hpp +++ b/src/trace/DrawTree.hpp @@ -47,6 +47,11 @@ #ifndef DRAWTREE_HPP #define DRAWTREE_HPP +/*#include "tree/BinaryTree.hpp" +#include "Event.hpp" + +#include <iostream> +*/ /*! * \class DrawTree * \brief Class called to draw a binary tree of type E using a D painting object @@ -55,6 +60,7 @@ class Interval; template <typename E> class Node; template <typename E> class BinaryTree; + template<class D, class E> class DrawTree { private: @@ -172,28 +178,67 @@ struct DrawNode<D, Event> { */ template<class D> struct DrawNode<D, StateChange> { + static void draw_node(DrawTree<D, StateChange> *draw, Node<StateChange> *node, bool& b, const Interval * interval) { + // Part to display the first state - static void draw_node(DrawTree<D, StateChange> *draw, Node<StateChange> *node) { - if (!node->get_element()->get_right_state()) - return; - std::map<std::string, Value *>::const_iterator field; - const State *state = node->get_element()->get_right_state(); - const std::map<std::string, Value *> *extra_fields; - const Color *color; - extra_fields = state->get_value()->get_extra_fields(); - // Search the color - if (state->get_value() && - !state->get_value()->get_extra_fields()->empty() && - ((field = state->get_value()->get_extra_fields()->find(std::string("Color"))) != extra_fields->end())) { - /* Call the object state drawing function with the state color */ - color = (const Color *)(*field).second; - draw->draw_state(state->get_start_time().get_value(), state->get_end_time().get_value(), - color->get_red(), color->get_green(), color->get_blue()); - } - else { - /* Call the object state drawing function with default color */ - draw->draw_state( state->get_start_time().get_value(), state->get_end_time().get_value(), 0.7, 0.7, 0.75); - } + if(!b){ + b = true; + // Node<StateChange> n = *node; + // n.get_element()->get_left_state()->set_left_state(interval->_left); + if(/*node & + node->get_element() &*/ + node->get_element()->get_left_state()){ + std::map<std::string, Value *>::const_iterator field; + const State *state = node->get_element()->get_left_state(); + const std::map<std::string, Value *> *extra_fields; + const Color *color; + extra_fields = state->get_value()->get_extra_fields(); + // Search the color + if (state->get_value() && + !state->get_value()->get_extra_fields()->empty() && + ((field = state->get_value()->get_extra_fields()->find(std::string("Color"))) != extra_fields->end())) { + /* Call the object state drawing function with the state color */ + color = (const Color *)(*field).second; + draw->draw_state(interval->_left.get_value(), state->get_end_time().get_value(), + color->get_red(), color->get_green(), color->get_blue()); + } + else { + /* Call the object state drawing function with default color */ + draw->draw_state( state->get_start_time().get_value(), state->get_end_time().get_value(), 0.7, 0.7, 0.75); + } + + } + } + + if (!node->get_element()->get_right_state()) + return; + std::map<std::string, Value *>::const_iterator field; + const State *state = node->get_element()->get_right_state(); + const std::map<std::string, Value *> *extra_fields; + const Color *color; + extra_fields = state->get_value()->get_extra_fields(); + + // Max is made to not display farther than the interval + double max; + if(state->get_end_time().get_value() > interval->_right.get_value()) + max = interval->_right.get_value(); + else + max = state->get_end_time().get_value(); + + + // Search the color + if (state->get_value() && + !state->get_value()->get_extra_fields()->empty() && + ((field = state->get_value()->get_extra_fields()->find(std::string("Color"))) != extra_fields->end())) { + /* Call the object state drawing function with the state color */ + color = (const Color *)(*field).second; + draw->draw_state(state->get_start_time().get_value(), max, + color->get_red(), color->get_green(), color->get_blue()); + } + else { + /* Call the object state drawing function with default color */ + draw->draw_state( state->get_start_time().get_value(), max, 0.7, 0.7, 0.75); + } } }; diff --git a/src/trace/Trace.cpp b/src/trace/Trace.cpp index ca007b8a48cdda937ee2f57628af015c2173c379..cd9f2bdab83896bc163eb7910201efa5ec2bbc82 100644 --- a/src/trace/Trace.cpp +++ b/src/trace/Trace.cpp @@ -426,3 +426,26 @@ Date Trace::get_max_date(){ return _max_date; } +void Trace::set_selected_container(std::vector<const Container *> * c) { + _selected_container = c; +} + +void Trace::set_interval_constrained(Interval * i) { + _interval_constrained = i; +} + +vector<const Container *>* Trace::get_selected_container() { + return _selected_container; +} + +Interval *Trace::get_interval_constrained() { + return _interval_constrained; +} + +void Trace::set_filter(double f) { + _filter = f; +} + +double Trace::get_filter() { + return _filter; +}