File: QuantitativeParallelAxis.h

package info (click to toggle)
tulip 4.8.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,264 kB
  • ctags: 64,517
  • sloc: cpp: 600,444; ansic: 36,311; makefile: 22,136; python: 1,304; sh: 946; yacc: 522; xml: 337; pascal: 157; php: 66; lex: 55
file content (168 lines) | stat: -rw-r--r-- 4,760 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/**
 *
 * This file is part of Tulip (www.tulip-software.org)
 *
 * Authors: David Auber and the Tulip development Team
 * from LaBRI, University of Bordeaux
 *
 * Tulip is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * Tulip is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 */

#ifndef QUANTITATIVE_PARALLEL_AXIS
#define QUANTITATIVE_PARALLEL_AXIS

#ifndef DOXYGEN_NOTFOR_DEVEL

#include "ParallelAxis.h"

#include <tulip/GlQuantitativeAxis.h>

const unsigned int DEFAULT_NB_AXIS_GRAD = 20;

namespace tlp {

class ParallelCoordinatesGraphProxy;

enum BoxPlotValue {BOTTOM_OUTLIER = 0, FIRST_QUARTILE = 1, MEDIAN = 2, THIRD_QUARTILE = 3,
                   TOP_OUTLIER = 4, NO_VALUE = 5
                  };

// Class which allows to render a quantitative axis
// Associated datatypes can be real or integer
class QuantitativeParallelAxis : public ParallelAxis {

public :

  QuantitativeParallelAxis(const Coord &baseCoord, const float height, const float axisAreaWidth, ParallelCoordinatesGraphProxy *graphProxy,
                           const std::string &graphPropertyName, const bool ascendingOrder = true, const Color &axisColor = Color(0,0,0),
                           const float rotationAngle = 0, const GlAxis::CaptionLabelPosition captionPosition = GlAxis::BELOW);

  void setNbAxisGrad(const unsigned int nbAxisGrad) {
    this->nbAxisGrad = nbAxisGrad;
  }
  unsigned int getNbAxisGrad() const {
    return nbAxisGrad;
  }

  Coord getPointCoordOnAxisForData(const unsigned int dataIdx);

  void translate(const Coord &c);
  void redraw();

  void showConfigDialog();

  std::string getAxisDataTypeName() const;

  void setLog10Scale(const bool log10Scale) {
    this->log10Scale = log10Scale;
  }
  bool hasLog10Scale() const {
    return log10Scale;
  }

  double getAssociatedPropertyMinValue();
  double getAssociatedPropertyMaxValue();

  void setAxisMinMaxValues(const double min, const double max) {
    axisMinValue = min ;
    axisMaxValue = max;
  }

  inline double getAxisMinValue() const {
    return glQuantitativeAxis->getAxisMinValue();
  }
  inline double getAxisMaxValue() const {
    return glQuantitativeAxis->getAxisMaxValue();
  }

  double getValueForAxisCoord(const Coord &axisCoord);
  Coord getAxisCoordForValue(double value);

  std::string getTopSliderTextValue();
  std::string getBottomSliderTextValue();

  const std::set<unsigned int> &getDataInSlidersRange() ;
  void updateSlidersWithDataSubset(const std::set<unsigned int> &dataSubset);

  void setBoxPlotHighlightBounds(BoxPlotValue lowBound, BoxPlotValue highBound) {
    boxPlotLowBound = lowBound ;
    boxPlotHighBound = highBound;
  }
  const std::set<unsigned int> &getDataBetweenBoxPlotBounds();

  bool hasAscendingOrder() const {
    return glQuantitativeAxis->hasAscendingOrder();
  }
  void setAscendingOrder(const bool ascendingOrder);

  // Axis BoxPlot methods
  Coord getBottomOutlierCoord() const {
    return boxPlotValuesCoord[BOTTOM_OUTLIER];
  }
  Coord getFirstQuartileCoord() const {
    return boxPlotValuesCoord[FIRST_QUARTILE];
  }
  Coord getMedianCoord() const {
    return boxPlotValuesCoord[MEDIAN];
  }
  Coord getThirdQuartileCoord() const {
    return boxPlotValuesCoord[THIRD_QUARTILE];
  }
  Coord getTopOutlierCoord() const {
    return boxPlotValuesCoord[TOP_OUTLIER];
  }
  std::string getBottomOutlierStringValue() const {
    return boxPlotStringValues[BOTTOM_OUTLIER];
  }
  std::string getFirstQuartileStringValue() const {
    return boxPlotStringValues[FIRST_QUARTILE];
  }
  std::string getMedianStringValue() const {
    return boxPlotStringValues[MEDIAN];
  }
  std::string getThirdQuartileStringValue() const {
    return boxPlotStringValues[THIRD_QUARTILE];
  }
  std::string getTopOutlierStringValue() const {
    return boxPlotStringValues[TOP_OUTLIER];
  }

private:

  const std::set<unsigned int> &getDataInRange(float yLowBound, float yHighBound) ;

  void computeBoxPlotCoords();

  void showAxisConfigDialog();

  void setAxisLabels();

  GlQuantitativeAxis *glQuantitativeAxis;

  unsigned int nbAxisGrad;
  double axisMinValue, axisMaxValue;

  ParallelCoordinatesGraphProxy *graphProxy;
  bool log10Scale;

  std::vector<Coord> boxPlotValuesCoord;
  std::vector<std::string> boxPlotStringValues;
  BoxPlotValue boxPlotLowBound, boxPlotHighBound;
  bool integerScale;

};

}

#endif // DOXYGEN_NOTFOR_DEVEL

#endif