correction de bugs et amelioration du placement des connecteurs
option -c
This commit is contained in:
parent
2c0047ea19
commit
a22ecd9738
|
@ -1048,7 +1048,8 @@ PPlacement::GenerateConsPlacement()
|
||||||
//creation d'un placement aleatoire des connecteurs.
|
//creation d'un placement aleatoire des connecteurs.
|
||||||
unsigned faces[4];
|
unsigned faces[4];
|
||||||
double aspectRatio = GetWidth() / GetHeight();
|
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;
|
unsigned nbConsEastWest = _cons.size() - nbConsNorthSouth;
|
||||||
|
|
||||||
//faces north est sud ouest
|
//faces north est sud ouest
|
||||||
|
@ -1069,6 +1070,8 @@ PPlacement::GenerateConsPlacement()
|
||||||
int spaceLeft = 0;
|
int spaceLeft = 0;
|
||||||
|
|
||||||
//placement au nord.
|
//placement au nord.
|
||||||
|
if (faces[0])
|
||||||
|
{
|
||||||
interval = (maxx - minx) / faces[0];
|
interval = (maxx - minx) / faces[0];
|
||||||
spaceLeft = (maxx - minx) % faces[0];
|
spaceLeft = (maxx - minx) % faces[0];
|
||||||
pos = minx + interval / 2;
|
pos = minx + interval / 2;
|
||||||
|
@ -1080,8 +1083,11 @@ PPlacement::GenerateConsPlacement()
|
||||||
(*cit++)->SetPos(PPos(pos , maxy));
|
(*cit++)->SetPos(PPos(pos , maxy));
|
||||||
pos += interval;
|
pos += interval;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//placement a l'est.
|
//placement a l'est.
|
||||||
|
if (faces[1])
|
||||||
|
{
|
||||||
interval = (maxy - miny) / faces[1];
|
interval = (maxy - miny) / faces[1];
|
||||||
spaceLeft = (maxx - minx) % faces[1];
|
spaceLeft = (maxx - minx) % faces[1];
|
||||||
pos = miny + interval / 2;
|
pos = miny + interval / 2;
|
||||||
|
@ -1093,8 +1099,11 @@ PPlacement::GenerateConsPlacement()
|
||||||
(*cit++)->SetPos(PPos(maxx , pos));
|
(*cit++)->SetPos(PPos(maxx , pos));
|
||||||
pos += interval;
|
pos += interval;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//placement au sud.
|
//placement au sud.
|
||||||
|
if (faces[2])
|
||||||
|
{
|
||||||
interval = (maxx - minx) / faces[2];
|
interval = (maxx - minx) / faces[2];
|
||||||
spaceLeft = (maxx - minx) % faces[2];
|
spaceLeft = (maxx - minx) % faces[2];
|
||||||
pos = minx + interval / 2;
|
pos = minx + interval / 2;
|
||||||
|
@ -1106,8 +1115,11 @@ PPlacement::GenerateConsPlacement()
|
||||||
(*cit++)->SetPos(PPos(pos , miny));
|
(*cit++)->SetPos(PPos(pos , miny));
|
||||||
pos += interval;
|
pos += interval;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//placement a l'ouest.
|
//placement a l'ouest.
|
||||||
|
if (faces[3])
|
||||||
|
{
|
||||||
interval = (maxy - miny) / faces[3];
|
interval = (maxy - miny) / faces[3];
|
||||||
spaceLeft = (maxx - minx) % faces[3];
|
spaceLeft = (maxx - minx) % faces[3];
|
||||||
pos = miny + interval / 2;
|
pos = miny + interval / 2;
|
||||||
|
@ -1120,6 +1132,7 @@ PPlacement::GenerateConsPlacement()
|
||||||
pos += interval;
|
pos += interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
// void GenerateRingConsPlacement()
|
// void GenerateRingConsPlacement()
|
||||||
|
@ -1150,6 +1163,8 @@ PPlacement::GenerateRingConsPlacement()
|
||||||
int spaceLeft = 0;
|
int spaceLeft = 0;
|
||||||
|
|
||||||
//placement au nord.
|
//placement au nord.
|
||||||
|
if (faces[0])
|
||||||
|
{
|
||||||
interval = (maxx - minx) / faces[0];
|
interval = (maxx - minx) / faces[0];
|
||||||
spaceLeft = (maxx - minx) % faces[0];
|
spaceLeft = (maxx - minx) % faces[0];
|
||||||
pos = minx + interval / 2;
|
pos = minx + interval / 2;
|
||||||
|
@ -1161,8 +1176,11 @@ PPlacement::GenerateRingConsPlacement()
|
||||||
(*cit++)->SetPos(PPos(pos , maxy));
|
(*cit++)->SetPos(PPos(pos , maxy));
|
||||||
pos += interval;
|
pos += interval;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//placement au sud.
|
//placement au sud.
|
||||||
|
if (faces[1])
|
||||||
|
{
|
||||||
interval = (maxx - minx) / faces[1];
|
interval = (maxx - minx) / faces[1];
|
||||||
spaceLeft = (maxx - minx) % faces[1];
|
spaceLeft = (maxx - minx) % faces[1];
|
||||||
pos = minx + interval / 2;
|
pos = minx + interval / 2;
|
||||||
|
@ -1175,6 +1193,7 @@ PPlacement::GenerateRingConsPlacement()
|
||||||
pos += interval;
|
pos += interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
// void InitPlace(int NbRows)
|
// void InitPlace(int NbRows)
|
||||||
|
|
Loading…
Reference in New Issue