}
if (!selected && vizModel.isHideNonSelectedEdges()) {
return;
}
if (selected && vizModel.isAutoSelectNeighbor()) {
ModelImpl m1 = (ModelImpl) obj.getSource().getModel();
ModelImpl m2 = (ModelImpl) obj.getTarget().getModel();
m1.mark = true;
m2.mark = true;
}
//Edge weight
GraphLimits limits = vizModel.getLimits();
float w;
if (obj.getEdge() instanceof MetaEdge) {
float weightRatio;
if (limits.getMinMetaWeight() == limits.getMaxMetaWeight()) {
weightRatio = WEIGHT_MINIMUM / limits.getMinMetaWeight();
} else {
weightRatio = Math.abs((WEIGHT_MAXIMUM - WEIGHT_MINIMUM) / (limits.getMaxMetaWeight() - limits.getMinMetaWeight()));
}
float edgeScale = vizModel.getEdgeScale() * vizModel.getMetaEdgeScale();
w = weight;
w = ((w - limits.getMinMetaWeight()) * weightRatio + WEIGHT_MINIMUM) * edgeScale;
} else {
float weightRatio;
if (limits.getMinWeight() == limits.getMaxWeight()) {
weightRatio = WEIGHT_MINIMUM / limits.getMinWeight();
} else {
weightRatio = Math.abs((WEIGHT_MAXIMUM - WEIGHT_MINIMUM) / (limits.getMaxWeight() - limits.getMinWeight()));
}
float edgeScale = vizModel.getEdgeScale();
w = weight;
w = ((w - limits.getMinWeight()) * weightRatio + WEIGHT_MINIMUM) * edgeScale;
}
//
float x1 = obj.getSource().x();
float x2 = obj.getTarget().x();
float y1 = obj.getSource().y();
float y2 = obj.getTarget().y();
float t1 = w;
float t2 = w;
float sideVectorX = y1 - y2;
float sideVectorY = x2 - x1;
float norm = (float) Math.sqrt(sideVectorX * sideVectorX + sideVectorY * sideVectorY);
sideVectorX /= norm;
sideVectorY /= norm;
float x1Thick = sideVectorX / 2f * t1;
float x2Thick = sideVectorX / 2f * t2;
float y1Thick = sideVectorY / 2f * t1;
float y2Thick = sideVectorY / 2f * t2;
if (!selected) {
float r;
float g;
float b;
float a;
r = obj.r();
if (r == -1f) {
if (vizModel.isEdgeHasUniColor()) {
float[] uni = vizModel.getEdgeUniColor();
r = uni[0];
g = uni[1];
b = uni[2];
a = uni[3];
} else {
NodeData source = obj.getSource();
r = 0.498f * source.r();
g = 0.498f * source.g();
b = 0.498f * source.b();
a = obj.alpha();
}
} else {
g = 0.498f * obj.g();
b = 0.498f * obj.b();
r *= 0.498f;
a = obj.alpha();
}
if (vizModel.getConfig().isLightenNonSelected()) {
float lightColorFactor = vizModel.getConfig().getLightenNonSelectedFactor();
a = a - (a - 0.01f) * lightColorFactor;
gl.glColor4f(r, g, b, a);
} else {
gl.glColor4f(r, g, b, a);
}
} else {
float r = 0f;
float g = 0f;
float b = 0f;
if (vizModel.isEdgeSelectionColor()) {
ModelImpl m1 = (ModelImpl) obj.getSource().getModel();
ModelImpl m2 = (ModelImpl) obj.getTarget().getModel();
if (m1.isSelected() && m2.isSelected()) {
float[] both = vizModel.getEdgeBothSelectionColor();
r = both[0];
g = both[1];
b = both[2];
} else if (m1.isSelected()) {
float[] out = vizModel.getEdgeOutSelectionColor();
r = out[0];
g = out[1];
b = out[2];
} else if (m2.isSelected()) {
float[] in = vizModel.getEdgeInSelectionColor();
r = in[0];
g = in[1];
b = in[2];
}