|
|||
|
Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").
linksdecay & ruin got that wrong appropriate tech fun social media stuff Like asecular.com (nobody does!) Like my brownhouse: |
handtruck in the snow Sunday, December 30 2007
function DrawRelationship(x1, y1, x2, y2, relname,
location, width1, width2, disp1, disp2, linecolor)
{
var zindex=12;
var strokewidth=1;
var leftoffset=10;
var downoffset=-1;
var out="";
var x, y, yx;
offset1=leftoffset+ 1 * disp1;
offset2=leftoffset + 1 * disp2;
voffset1=downoffset+ 1 * disp1;
voffset2=downoffset+ 1 * disp2;
var w=parseInt(Math.abs(x1-x2));
var container = document.getElementById(location);
var bwlSkipExtra1=false;
var bwlSkipExtra2=false;
var bwlSkipExtra1e=false;
var bwlSkipExtra2e=false;
var absxdif=Math.abs(x1-x2) + disp1 + disp2;
var offsetsum=offset1 + offset2;
y1=y1-voffset1;
y2=y2-voffset2;
var widthofeasternmost=width1;
if(x2<x1)
{
widthofeasternmost=width2;
//allows me to make an ideal transition from
//north/south to east/west mode
}
var h=parseInt(Math.abs(y1-y2));
if(absxdif< (widthofeasternmost + offsetsum+3))
//subject and foreign tables have a north/south
//or south/north relationship
{
x1=x1-offset1;
x2=x2-offset2;
x=ReturnSmaller(x1, x2);
y=ReturnSmaller(y1, y2);
yx=y2;
if(x==x2)
{
yx=y1;
}
DrawDivLine(yx, x, zindex, strokewidth, absxdif,
linecolor, container, relname + " x");
bwlSkipExtra2e=true;
bwlSkipExtra1e=true;
}
else if (x2<x1) //subject table is west of foreign table
{
x1=x1-offset1;
x2=x2+(width2+offset2);
bwlSkipExtra2=true;
bwlSkipExtra1e=true;
w=w-(width2+offset1+offset2);
yx= ReturnLarger(y2, y1);
y=y2;
x=x2;
if(y2==yx)
{
x=x1;
y=y1;
}
DrawDivLine(yx, x2, zindex, strokewidth, w,
linecolor, container, relname + " x");
}
else if (x1<x2) //subject table is east of foreign table
{
x2=x2-offset2;
x1=x1+(width1+offset1);
bwlSkipExtra1=true;
bwlSkipExtra2e=true;
w=w-(width1+offset1+offset2);
y=ReturnSmaller(y2, y1);
x=x1;
DrawDivLine(y2, x1, zindex, strokewidth, w,
linecolor, container, relname + " x");
}
if(h!=0)
//draw the vertical component of the relationship
{
DrawDivLine(y, x, zindex, h, strokewidth,
linecolor, container, relname + " y");
}
if(!bwlSkipExtra1)
{//the short horizontal line
//coming to subject table from the west
DrawDivLine(y1, x1, zindex, strokewidth, offset1,
linecolor, container, relname + " x1");
}
if(!bwlSkipExtra2)
{ //the short horizontal line coming to
//foreign table from the west
DrawDivLine(y2, x2, zindex, strokewidth, offset2,
linecolor, container, relname + " x2");
}
if(!bwlSkipExtra1e)
{//the short horizontal line coming to
//subject table from the east
DrawDivLine(y1, x1-offset1, zindex, strokewidth, offset1, linecolor,
container, relname + " x1");
}
if(!bwlSkipExtra2e)
{//the short horizontal line coming to
//foreign table from the east
DrawDivLine(y2, x2-offset2, zindex, strokewidth, offset2,
linecolor, container, relname + " x2");
}
}
For linking purposes this article's URL is: previous | next |
||