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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
/////variables pour boucles/////
int x=0;
int y=0;
int i=1;
int a=0;
int j=0;
int k=0;
////////////////////////////
int nbr_comp=0;
int max=0;
int min=0;
int testabs=0;
int testangle=0;
int valeur_trouvee=0;
int nblignes=fen_carac->Table_asp1->Rows->Count;
float distance=0;
float precip=0;
float precipT=0;
const double PI=3.141592;
for(y=1;y<=(fen_dim->piste_long);y++)
{
for(x=1;x<=(fen_dim->piste_larg);x++)
{
//Test angle
testabs = abs((y-(fen_position->pos_long_asp1))/(x-(fen_position->pos_larg_asp1)));
testangle = abs(Math::Tan((((fen_position->angle1)/2)*PI)/180));
while(testabs<testangle)
{
distance = Math::Sqrt(Math::Pow((x-(fen_position->pos_larg_asp1)),2.0)+(Math::Pow((y-(fen_position->pos_long_asp1)),2.0)));
distance = Math::Round(distance,1);
distance = distance*10;
//min & max de la colonne distance
for (a=0;a<nblignes;a++)//Pour chaque ligne
{
//Selection de la ligne
DataRow* myRow1 = fen_carac->Table_asp1->get_Rows()->get_Item(k);
//selection de la colonne
String* valeur_distance = myRow1->get_Item(0)->ToString();
//Conversion de valeur_cellule en int pour traitement math
nbr_comp = Convert::ToInt32(valeur_distance);
k++;
if (nbr_comp<min)
{
min=nbr_comp;
}
if(nbr_comp>max)
{
max=nbr_comp;
}
}
//recup valeur precipitation
while(distance!=valeur_trouvee)
{
for (a=0;a<nblignes;a++)//Pour chaque ligne
{
//Selection de la ligne
DataRow* myRow2 = fen_carac->Table_asp1->get_Rows()->get_Item(j);
//selection de la colonne
String* valeur_distance2 = myRow2->get_Item(0)->ToString();
//Conversion de valeur_temp en int pour traitement math
valeur_trouvee = Convert::ToInt32(valeur_distance2);
j++;
}
}
j--;
DataRow* myRow3 = fen_carac->Table_asp1->get_Rows()->get_Item(j);
//selection de la colonne
String* precip_temp = myRow3->get_Item(1)->ToString();
//Conversion de valeur_cellule en int pour traitement math
precip = Convert::ToSingle(precip_temp);
//Addition de precip pour chaque asperseurs
precipT = precipT + precip;
i++;
}
MessageBox::Show(Convert::ToString(precipT));
}
}
} |
Partager