correction de bugs et amelioration du placement des connecteurs

option -c
This commit is contained in:
Christophe Alexandre 2002-08-26 14:04:50 +00:00
parent 2c0047ea19
commit a22ecd9738
1 changed files with 74 additions and 55 deletions

View File

@ -1048,7 +1048,8 @@ PPlacement::GenerateConsPlacement()
//creation d'un placement aleatoire des connecteurs.
unsigned faces[4];
double aspectRatio = GetWidth() / GetHeight();
unsigned nbConsNorthSouth = (unsigned)((_cons.size() / 2) * aspectRatio);
double repartition = aspectRatio + 1.0;
unsigned nbConsNorthSouth = (unsigned)( aspectRatio * _cons.size() / repartition);
unsigned nbConsEastWest = _cons.size() - nbConsNorthSouth;
//faces north est sud ouest
@ -1069,6 +1070,8 @@ PPlacement::GenerateConsPlacement()
int spaceLeft = 0;
//placement au nord.
if (faces[0])
{
interval = (maxx - minx) / faces[0];
spaceLeft = (maxx - minx) % faces[0];
pos = minx + interval / 2;
@ -1080,8 +1083,11 @@ PPlacement::GenerateConsPlacement()
(*cit++)->SetPos(PPos(pos , maxy));
pos += interval;
}
}
//placement a l'est.
if (faces[1])
{
interval = (maxy - miny) / faces[1];
spaceLeft = (maxx - minx) % faces[1];
pos = miny + interval / 2;
@ -1093,8 +1099,11 @@ PPlacement::GenerateConsPlacement()
(*cit++)->SetPos(PPos(maxx , pos));
pos += interval;
}
}
//placement au sud.
if (faces[2])
{
interval = (maxx - minx) / faces[2];
spaceLeft = (maxx - minx) % faces[2];
pos = minx + interval / 2;
@ -1106,8 +1115,11 @@ PPlacement::GenerateConsPlacement()
(*cit++)->SetPos(PPos(pos , miny));
pos += interval;
}
}
//placement a l'ouest.
if (faces[3])
{
interval = (maxy - miny) / faces[3];
spaceLeft = (maxx - minx) % faces[3];
pos = miny + interval / 2;
@ -1119,6 +1131,7 @@ PPlacement::GenerateConsPlacement()
(*cit++)->SetPos(PPos(minx , pos));
pos += interval;
}
}
}
// ======================================================================
@ -1150,6 +1163,8 @@ PPlacement::GenerateRingConsPlacement()
int spaceLeft = 0;
//placement au nord.
if (faces[0])
{
interval = (maxx - minx) / faces[0];
spaceLeft = (maxx - minx) % faces[0];
pos = minx + interval / 2;
@ -1161,8 +1176,11 @@ PPlacement::GenerateRingConsPlacement()
(*cit++)->SetPos(PPos(pos , maxy));
pos += interval;
}
}
//placement au sud.
if (faces[1])
{
interval = (maxx - minx) / faces[1];
spaceLeft = (maxx - minx) % faces[1];
pos = minx + interval / 2;
@ -1174,6 +1192,7 @@ PPlacement::GenerateRingConsPlacement()
(*cit++)->SetPos(PPos(pos , miny));
pos += interval;
}
}
}
// ======================================================================