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
|
/**
*
* 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 SCATTERPLOTCORELCOEFFSELECTOR_H_
#define SCATTERPLOTCORELCOEFFSELECTOR_H_
#include <tulip/GlSimpleEntity.h>
#include <tulip/GlCircle.h>
#include <tulip/GLInteractor.h>
namespace tlp {
class ScatterPlotCorrelCoeffSelectorOptionsWidget;
class ScatterPlot2DView;
class GlEditableComplexPolygon : public GlSimpleEntity {
public :
GlEditableComplexPolygon(std::vector<Coord> polygonPoints, const Color &color);
void translate(const Coord &move);
void draw(float lod,Camera* camera);
BoundingBox getBoundingBox();
void getXML(std::string &) {}
void setWithXML(const std::string &, unsigned int &) {}
unsigned int getNumberOfVertex() const {
return polygonPoints.size();
}
bool pointInsidePolygon(const Coord &point);
Coord *getPolygonVertexUnderPointerIfAny(const Coord &pointerScreenCoord, Camera *camera);
std::pair<Coord, Coord> *getPolygonSegmentUnderPointerIfAny(const Coord &pointerSceneCoord);
void addPolygonVertex(std::pair<Coord, Coord> polygonSegment, const Coord &newVertex);
void removePolygonVertex(const Coord &vertex);
void movePolygonVertexToPoint(const Coord &polygonVertex, const Coord &targetPoint);
void setColor(const Color &color) {
this->color = color;
}
Color getColor() const {
return color;
}
void setSelected(const bool selected) {
this->selected = selected;
}
bool isSelected() const {
return selected;
}
const std::vector<Coord> & getPolygonVertices() const {
return polygonPoints;
}
private :
std::vector<Coord> polygonPoints;
Color color;
GlCircle basicCircle;
bool selected;
};
class ScatterPlotCorrelCoeffSelector : public GLInteractorComponent {
public :
ScatterPlotCorrelCoeffSelector(ScatterPlotCorrelCoeffSelectorOptionsWidget *optionsWidget);
ScatterPlotCorrelCoeffSelector(const ScatterPlotCorrelCoeffSelector &scatterPlotCorrelCoeffSelector);
~ScatterPlotCorrelCoeffSelector();
bool eventFilter(QObject *, QEvent *);
bool draw(GlMainWidget *glMainWidget);
bool compute(GlMainWidget *glMainWidget);
void viewChanged(View *view);
private :
void getPolygonAndPointUnderPointerIfAny(const Coord &pointerSceneCoord, Camera *camera);
void mapPolygonColorToCorrelCoeffOfData(GlEditableComplexPolygon *polygon, GlMainWidget *glWidget);
ScatterPlotCorrelCoeffSelectorOptionsWidget *optionsWidget;
ScatterPlot2DView *scatterView;
Coord currentPointerSceneCoords;
std::vector<Coord> polygonEdit;
std::vector<GlEditableComplexPolygon *> polygons;
GlCircle basicCircle;
GlEditableComplexPolygon *selectedPolygon;
Coord *selectedPolygonPoint;
bool dragStarted;
int x, y;
std::map<GlEditableComplexPolygon *, std::pair<std::vector<node>, double > > polygonsToNodesSubsetAndCorrelCoeff;
};
}
#endif /* SCATTERPLOTCORELCOEFFSELECTOR_H_ */
|