21 #ifndef Tulip_GLEDGE_H
22 #define Tulip_GLEDGE_H
24 #ifndef DOXYGEN_NOTFOR_DEVEL
26 #include <tulip/PropertyTypes.h>
27 #include <tulip/Size.h>
28 #include <tulip/GlEntity.h>
29 #include <tulip/Matrix.h>
30 #include <tulip/GlLabel.h>
31 #include <tulip/GlSceneVisitor.h>
36 class EdgeExtremityGlyph;
38 class GlGraphInputData;
44 class TLP_GL_SCOPE GlEdge final :
public GlEntity {
51 GlEdge(
unsigned int eId = UINT_MAX,
unsigned int ePos = UINT_MAX,
bool sel =
false)
52 : id(eId), pos(ePos), selectionDraw(sel) {}
57 void acceptVisitor(GlSceneVisitor *visitor)
override {
64 BoundingBox getBoundingBox(
const GlGraphInputData *data);
69 BoundingBox getBoundingBox(
const GlGraphInputData *data,
const edge e,
const node src,
70 const node tgt,
const Coord &srcCoord,
const Coord &tgtCoord,
71 const Size &srcSize,
const Size &tgtSize,
72 const LineType::RealType &bends);
77 void draw(
float lod,
const GlGraphInputData *data, Camera *camera);
83 void drawLabel(GlLabel &label, OcclusionTest *test,
const GlGraphInputData *data,
float lod,
84 Camera *camera =
nullptr);
89 size_t getVertices(
const GlGraphInputData *data,
const edge e,
const node src,
const node tgt,
90 Coord &srcCoord, Coord &tgtCoord, Size &srcSize, Size &tgtSize,
91 std::vector<Coord> &vertices,
float lengthRatio = 1);
96 void getColors(
const GlGraphInputData *data,
const node src,
const node tgt,
const Color &eColor,
97 Color &srcCol, Color &tgtCol,
const Coord *vertices,
unsigned int numberOfVertices,
98 std::vector<Color> &colors);
103 void getEdgeSize(
const GlGraphInputData *data, edge e,
const Size &srcSize,
const Size &tgtSize,
104 const float maxSrcSize,
const float maxTgtSize, Size &edgeSize);
109 void getEdgeAnchor(
const GlGraphInputData *data,
const node src,
const node tgt,
110 const LineType::RealType &bends,
const Coord &srcCoord,
const Coord &tgtCoord,
111 const Size &srcSize,
const Size &tgtSize, Coord &srcAnchor, Coord &tgtAnchor,
112 float lengthRatio = 1);
114 void setSelectionDraw(
bool selectDraw) {
115 selectionDraw = selectDraw;
119 unsigned int id, pos;
127 void drawEdge(
const Coord &srcNodePos,
const Coord &tgtNodePos,
const Coord &startPoint,
128 const Coord &endPoint,
const LineType::RealType &bends,
const Color &startColor,
129 const Color &endColor,
const Coord &lookDir,
bool colorInterpolate,
130 const Color &borderColor,
const Size &size,
int shape,
bool edge3D,
float lod,
131 const std::string &textureName,
const float outlineWidth);
136 BoundingBox eeGlyphBoundingBox(
const Coord &anchor,
const Coord &tgt,
float glyphNrm,
137 const Matrix<float, 4> &transformation,
138 const Matrix<float, 4> &size);
144 void getEdgeColor(
const GlGraphInputData *data,
const edge e,
const node src,
const node tgt,
145 bool selected, Color &srcCol, Color &tgtCol);
151 float getEdgeWidthLod(
const Coord &edgeCoord,
const Size &edgeSize, Camera *camera);
156 void displayArrowAndAdjustAnchor(
const GlGraphInputData *data,
const edge e,
const node src,
157 const Size &sizeRatio,
float edgeSize,
const Color &color,
158 float maxSize,
bool selected,
float selectionOutlineSize,
159 int tgtEdgeGlyph,
bool hasBends,
const Coord &anchor,
160 const Coord &tgtCoord,
const Coord &srcAnchor,
161 const Coord &tgtAnchor, Coord &lineAnchor,
162 EdgeExtremityGlyph *srcEdgeGlyph =
nullptr,
163 Camera *camera =
nullptr);