1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
// déclaration
typedef struct PAQUET_MAT
{
long Xmin,Ymin,Xmax,Ymax;
TMatricule *mat[100]; // un tableau de pointeurs
TMatricule *blocmat;
bool Pack();
PAQUET_MAT();
~PAQUET_MAT();
}TabPaquetMat;
typedef TabPaquetMat* ptrPaquetMat;
struct TabRADIC //table des radicaux
{
char Rad[7];
AnsiString NomPlan;
UINT premier, dernier, nombre;
UINT Nombre(); // doit être appelé en cas de besoin si modif
// renvoie le nombre de composants tq exist=true;
// mais nombre est TOUJOURS le nombre réel de matricules
TList *TabMatric;
TabRADIC *suiv; // Le radical suivant
TabRADIC();
};
for (TabRADIC *tr=tr_prem; tr; tr=tr->suiv)
{
// on cherche un point proche de x, y
if (tr->TabMatric)
{
for (int ir=0; ir<tr->TabMatric->Count; ir++) // ir est un compteur
{
ptrPaquetMat pm= (ptrPaquetMat)tr->TabMatric->Items[ir];
if (!pm) continue;
if (x > pm->Xmin-TolX && x < pm->Xmax+TolX && y > pm->Ymin-TolY && y < pm->Ymax+TolY)
{
for (int ic=0; ic < 100; ic++)
{
TMatricule *Mat=pm->mat[ic];
if (Mat && Mat->TestType(PH))
{
if ((pt=(Point3D*)Mat->Objet()) != NULL )
{
if ( labs(pt->ValX()-x) < TolX && labs(pt->ValY()-y) < TolY )
return pt;
}
}
}
}
}
}
} |
Partager