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
|
/**
*
* 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 PARALLELCOORDSAXISSLIDERS_H_
#define PARALLELCOORDSAXISSLIDERS_H_
#include <QCursor>
#include <QMouseEvent>
#include <string>
#include <tulip/GlRect.h>
#include <tulip/GlQuad.h>
#include <tulip/GlLabel.h>
#include <tulip/GlBoundingBoxSceneVisitor.h>
#include "ParallelCoordinatesDrawing.h"
#include "ParallelCoordsGlEntitiesSelector.h"
namespace tlp {
enum sliderType {TOP_SLIDER = 0, BOTTOM_SLIDER = 1};
class AxisSlider : public GlSimpleEntity {
public :
AxisSlider(const sliderType type, const Coord &sliderCoord, const float halfWidth, const float halfHeight, const Color &sliderColor, const Color &labelColor, const float rotationAngle = 0);
~AxisSlider();
void setSliderFillColor(const Color &color);
void setSliderOutlineColor(const Color &color);
void setSliderLabel(const std::string &label) {
sliderLabel->setText(label);
}
void setRotationAngle(const float rotationAngle) {
this->rotationAngle = rotationAngle;
}
void draw(float lod,Camera *camera);
BoundingBox getBoundingBox();
Coord getSliderCoord() const {
return sliderCoord;
}
void translate(const Coord &move);
void moveToCoord(const Coord &coord) {
translate(coord - sliderCoord);
}
sliderType getSliderType() const {
return type;
}
Color getColor() {
return arrowPolygon->getFillColor(0);
}
void getXML(std::string &) {}
void setWithXML(const std::string &, unsigned int &) {}
private :
sliderType type;
GlComposite *sliderComposite;
GlQuad *sliderQuad;
GlPolygon *sliderPolygon;
GlPolygon *arrowPolygon;
GlLabel *sliderLabel;
Coord sliderCoord;
float rotationAngle;
};
class ParallelCoordsAxisSliders : public GLInteractorComponent {
public :
ParallelCoordsAxisSliders();
~ParallelCoordsAxisSliders();
bool eventFilter(QObject *, QEvent *);
bool draw(GlMainWidget *glMainWidget);
bool compute(GlMainWidget *glMainWidget);
void viewChanged(View *view);
private :
void initOrUpdateSliders();
AxisSlider *getSliderUnderPointer(GlMainWidget *glWidget, ParallelAxis *axis, int x, int y);
void updateOtherAxisSliders();
void buildGlSliders(std::vector<ParallelAxis *> axis);
void deleteGlSliders();
void setSlidersColor(const Color &color);
void updateSlidersYBoundaries();
ParallelCoordinatesView *parallelView;
Graph *currentGraph;
std::map<ParallelAxis *, std::vector<AxisSlider *> > axisSlidersMap;
ParallelAxis *selectedAxis;
std::vector<ParallelAxis *> lastSelectedAxis;
AxisSlider *selectedSlider;
bool axisSliderDragStarted;
bool pointerBetweenSliders;
bool slidersRangeDragStarted;
int slidersRangeLength;
int xClick, yClick;
float lastAxisHeight;
unsigned int lastNbAxis;
ParallelCoordinatesDrawing::HighlightedEltsSetOp highlightedEltsSetOperation;
std::map<ParallelAxis *, std::pair<float, float> > slidersYBoundaries;
GlLayer *selectionLayer;
};
}
#endif /* PARALLELCOORDSAXISSLIDERS_H_ */
|