Bladeren bron

Changes to the source files

Jose Ortiz 9 jaren geleden
bovenliggende
commit
4d4df27b96
3 gewijzigde bestanden met toevoegingen van 4 en 60 verwijderingen
  1. 0
    9
      main.cpp
  2. 3
    24
      xyplotwindow.cpp
  3. 1
    27
      xyplotwindow.h

+ 0
- 9
main.cpp Bestand weergeven

17
     double increment = 0.01;
17
     double increment = 0.01;
18
     
18
     
19
     // Plot of a segment
19
     // Plot of a segment
20
-    // Grafica de un segmento
21
     
20
     
22
     for (double t = 0; t < 2*M_PI; t = t + increment) {
21
     for (double t = 0; t < 2*M_PI; t = t + increment) {
23
         
22
         
25
         y = t;
24
         y = t;
26
         
25
         
27
         // add x and y as a point in the graph
26
         // add x and y as a point in the graph
28
-        // anade x y y como un punto en la grafica
29
         wLine.AddPointToGraph(x,y);
27
         wLine.AddPointToGraph(x,y);
30
     }
28
     }
31
     
29
     
32
     // After all the points have been added, plot and show the graph
30
     // After all the points have been added, plot and show the graph
33
-    // Despues que todos los puntos han sido anadidos, grafica y demuestra la grafica
34
     wLine.Plot();
31
     wLine.Plot();
35
     wLine.show();
32
     wLine.show();
36
     
33
     
37
     
34
     
38
     
35
     
39
     // Plot of a circle
36
     // Plot of a circle
40
-    // Grafica de un circulo
41
     
37
     
42
     
38
     
43
     // YOUR CODE FOR THE CIRCLE HERE
39
     // YOUR CODE FOR THE CIRCLE HERE
44
-    // TU CODIGO PARA EL CIRCULO VA AQUI
45
     
40
     
46
     
41
     
47
     // Plot of a heart
42
     // Plot of a heart
48
-    // Grafica de un corazon
49
     
43
     
50
     
44
     
51
     // YOUR CODE FOR THE HEART HERE
45
     // YOUR CODE FOR THE HEART HERE
52
-    // TU CODIGO PARA EL CORAZON VA AQUI
53
     
46
     
54
     
47
     
55
     // Plot of a butterfly
48
     // Plot of a butterfly
56
-    // Grafica de una mariposa
57
     
49
     
58
     
50
     
59
     // YOUR CODE FOR THE BUTTERFLY HERE
51
     // YOUR CODE FOR THE BUTTERFLY HERE
60
-    // TU CODIGO PARA LA MARIPOSA VA AQUI
61
     
52
     
62
     return a.exec();
53
     return a.exec();
63
 }
54
 }

+ 3
- 24
xyplotwindow.cpp Bestand weergeven

3
 #include "qcustomplot.h"
3
 #include "qcustomplot.h"
4
 #include <cmath>
4
 #include <cmath>
5
 
5
 
6
-/// \fn XYPlotWindow::XYPlotWindow(QWidget *parent)
7
-/// \~English
8
-/// \brief Constructor
9
-/// \~Spanish
10
-/// \brief Constructor
11
 XYPlotWindow::XYPlotWindow(QWidget *parent) :
6
 XYPlotWindow::XYPlotWindow(QWidget *parent) :
12
     QMainWindow(parent),
7
     QMainWindow(parent),
13
     ui(new Ui::XYPlotWindow)
8
     ui(new Ui::XYPlotWindow)
16
 }
11
 }
17
 
12
 
18
 
13
 
19
-/// \fn void XYPlotWindow::AddPointToGraph(double x, double y)
20
-/// \~English
21
-/// \brief Adds a coordinate (x,y) to the XX and YY vectors.
22
-/// \param x value of the coordinate (x,y) to be added to vector XX.
23
-/// \param y value of the coordinate (x,y) to be added to vector YY.
24
-/// \~Spanish
25
-/// \brief Anade una coordenada (x,y) a los vectores XX y YY.
26
-/// \param x valor de la coordenada (x,y) a ser anadido al vector XX.
27
-/// \param y valor de la coordenada (x,y) a ser anadido al vector YY.
14
+// Añade la x y y a sus respectivos vectores.
28
 void XYPlotWindow::AddPointToGraph(double x, double y) {
15
 void XYPlotWindow::AddPointToGraph(double x, double y) {
29
         XX.push_back(x);
16
         XX.push_back(x);
30
         YY.push_back(y);
17
         YY.push_back(y);
31
 }
18
 }
32
 
19
 
33
-/// \fn void XYPlotWindow::Plot()
34
-/// \~English
35
-/// \brief Plots the coordinates inserted in the vectors XX and YY.
36
-/// \~Spanish
37
-/// \brief Grafica las coordenadas insertadas en los vectores XX y YY.
20
+// Esta función invoca los métodos apropiados de customPlot para que
21
+// se grafiquen los puntos.
38
 void XYPlotWindow::Plot() {
22
 void XYPlotWindow::Plot() {
39
     ui->customPlot->xAxis->setLabel("x");
23
     ui->customPlot->xAxis->setLabel("x");
40
     ui->customPlot->yAxis->setLabel("y");
24
     ui->customPlot->yAxis->setLabel("y");
46
     myCurve->setData(XX,YY);
30
     myCurve->setData(XX,YY);
47
 }
31
 }
48
 
32
 
49
-/// \fn XYPlotWindow::~XYPlotWindow()
50
-/// \~English
51
-/// \brief Destructor
52
-/// \~Spanish
53
-/// \brief Destructor
54
 XYPlotWindow::~XYPlotWindow()
33
 XYPlotWindow::~XYPlotWindow()
55
 {
34
 {
56
     delete ui;
35
     delete ui;

+ 1
- 27
xyplotwindow.h Bestand weergeven

13
     Q_OBJECT
13
     Q_OBJECT
14
 
14
 
15
 public:
15
 public:
16
-    /// \fn XYPlotWindow::XYPlotWindow(QWidget *parent)
17
-    /// \~English
18
-    /// \brief Constructor
19
-    /// \~Spanish
20
-    /// \brief Constructor
21
     explicit XYPlotWindow(QWidget *parent = 0);
16
     explicit XYPlotWindow(QWidget *parent = 0);
22
-
23
-    /// \fn XYPlotWindow::~XYPlotWindow()
24
-    /// \~English
25
-    /// \brief Destructor
26
-    /// \~Spanish
27
-    /// \brief Destructor
17
+    //void setupgraph();
28
     ~XYPlotWindow();
18
     ~XYPlotWindow();
29
-
30
-    /// \fn void XYPlotWindow::AddPointToGraph(double x, double y)
31
-    /// \~English
32
-    /// \brief Adds a coordinate (x,y) to the XX and YY vectors.
33
-    /// \param x value of the coordinate (x,y) to be added to vector XX.
34
-    /// \param y value of the coordinate (x,y) to be added to vector YY.
35
-    /// \~Spanish
36
-    /// \brief Anade una coordenada (x,y) a los vectores XX y YY.
37
-    /// \param x valor de la coordenada (x,y) a ser anadido al vector XX.
38
-    /// \param y valor de la coordenada (x,y) a ser anadido al vector YY.
39
     void AddPointToGraph(double x, double y);
19
     void AddPointToGraph(double x, double y);
40
-
41
-    /// \fn void XYPlotWindow::Plot()
42
-    /// \~English
43
-    /// \brief Plots the coordinates inserted in the vectors XX and YY.
44
-    /// \~Spanish
45
-    /// \brief Grafica las coordenadas insertadas en los vectores XX y YY.
46
     void Plot();
20
     void Plot();
47
 
21
 
48
 
22