Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/CircularLayout/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>org.gephi.layout.plugin</groupId>
<artifactId>circularlayout</artifactId>
<version>0.9.3</version>
<version>0.9.4</version>
<packaging>nbm</packaging>

<name>CircularLayout</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void initAlgo()
{
if (!n.isFixed())
{
tmpcirc += (n.size() * 2);
tmpcirc += (nodeSize(n) * 2);
}
}
tmpcirc = (tmpcirc * 1.2);
Expand Down Expand Up @@ -109,7 +109,7 @@ public void initAlgo()
{
if (this.isNodePlacementNoOverlap())
{
noderadius = (n.size());
noderadius = (nodeSize(n));
double noderadian = (theta * noderadius * 1.2);
nodeCoords = this.cartCoors(radius, 1, lasttheta + noderadian);
lasttheta += (noderadius * 2 * theta * 1.2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public void initAlgo()
{
if (index < this.secondarynodecount)
{
tmpsecondarycirc += (n.size() * 2);
tmpsecondarycirc += (nodeSize(n) * 2);
}
else
{
tmpprimarycirc += (n.size() * 2);
tmpprimarycirc += (nodeSize(n) * 2);
}
index++;
}
Expand Down Expand Up @@ -137,7 +137,7 @@ public void initAlgo()
if (index < this.secondarynodecount)
{
//Draw secondary circle
double noderadius = (n.size());
double noderadius = (nodeSize(n));
//This step is hackish... but it makes small numbers of nodes symetrical on both the secondary circles.
if (secondary_scale > 2)
{
Expand All @@ -153,7 +153,7 @@ public void initAlgo()
}
else
{
double noderadius = (n.size());
double noderadius = (nodeSize(n));
double noderadian = (primary_theta * noderadius * 1.2 * primary_scale);
if (index == this.secondarynodecount)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
*/
public abstract class LayoutHelper implements Layout
{
private static final double MIN_NODE_SIZE = 1.0;

private final LayoutBuilder layoutBuilder;
protected GraphModel graphModel;
private boolean converged;
Expand Down Expand Up @@ -284,6 +286,15 @@ public static Map getRotationMap()
return map;
}

/**
* The room a node takes on the circle. Nodes are spaced by their size, so a node without size (e.g. one that was
* ranked down to zero) would give a circle with no circumference and NaN positions.
*/
protected static double nodeSize(Node n)
{
return Math.max(n.size(), MIN_NODE_SIZE);
}

public float[] cartCoors(double radius, int whichInt, double theta)
{
float[] coOrds = new float[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ else if ("BOTTOM".equals(this.strKnockdown))
}
if (order == 0)
{
double noderadius = n.size();
double noderadius = nodeSize(n);
circ += noderadius * 2;
SparBaseList.add(n);
}
Expand Down Expand Up @@ -230,7 +230,7 @@ else if ("BOTTOM".equals(this.strKnockdown))
double[] ArraySparTheta = new double[(int)SparArrayCount];
for (Node n : SparBaseList)
{
double noderadius = (n.size());
double noderadius = (nodeSize(n));
double noderadian = (theta * noderadius * this.dScalingWidth);
ArraySparTheta[group] = lasttheta + noderadian;
ArraySparLength[group] = noderadius * this.dScalingWidth;
Expand All @@ -256,7 +256,7 @@ else if ("BOTTOM".equals(this.strKnockdown))
tmpsparlength = ArraySparLength[position.group];
tmpspartheta = ArraySparTheta[position.group];

double noderadius = (n.size());
double noderadius = (nodeSize(n));
if (this.boolSparSpiral)
{
nodeCoords = this.cartCoors(tmpsparlength + radius + (noderadius * this.dScalingWidth), 1, tmpspartheta + (position.order * (thetainc / SparNodeCount[position.group])));
Expand Down
Loading