__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
//заполнение структур информацией о зданиях
mas_zd[0].xf = 50;//1-е здание
mas_zd[0].yf = 20;
mas_zd[0].xs = 90;
mas_zd[0].ys = 120;
mas_zd[1].xf = 240;//2-е здание
mas_zd[1].yf = 110;
mas_zd[1].xs = 380;
mas_zd[1].ys = 180;
mas_zd[2].xf = 20;//3-е здание
mas_zd[2].yf = 250;
mas_zd[2].xs = 80;
mas_zd[2].ys = 310;
mas_zd[3].xf = 190;//4-е здание
mas_zd[3].yf = 210;
mas_zd[3].xs = 230;
mas_zd[3].ys = 280;
int masx[16] = {70,50, 50, 90, 380, 240, 310, 380, 50, 20, 20, 80, 230, 190, 210, 230};
int masy[16] = {20,70, 120, 120, 110, 110, 180, 145, 250, 280, 310, 310, 210, 210, 280, 280};
int masz[16] = {3, 0, 6, 6, 3, 3, 3, 6, 3, 6, 0, 0, 6, 6, 3, 3};
//заполнение массива структур, описывающих рабочие станции
for(int i=0; i<16; i++)
{
mas_comp[i].x = masx[i];
mas_comp[i].y = masy[i];
mas_comp[i].z = masz[i];
mas_comp[i].nom = i+1;
}
}
//Прорисовка сети ---------------------------------------------------------------------------
void __fastcall TForm1::N4Click(TObject *Sender)
{
//************* очистка картинки ************
Form2->Image1->Canvas->Pen->Color = clWhite;
Form2->Image1->Canvas->Pen->Width = 400;
Form2->Image1->Canvas->MoveTo(0,0);
Form2->Image1->Canvas->LineTo(200,200);
//********************************************
Form2->Image1->Canvas->Pen->Color = clBlack;
Form2->Image1->Canvas->Pen->Width = 2;
//рисуем здания
for(int i=0; i<4; i++)
{
Form2->Image1->Canvas->Pen->Color = clBlack;
Form2->Image1->Canvas->MoveTo(mas_zd[i].xf,mas_zd[i].yf);
Form2->Image1->Canvas->LineTo(mas_zd[i].xf,mas_zd[i].ys);
Form2->Image1->Canvas->LineTo(mas_zd[i].xs,mas_zd[i].ys);
Form2->Image1->Canvas->LineTo(mas_zd[i].xs,mas_zd[i].yf);
Form2->Image1->Canvas->LineTo(mas_zd[i].xf,mas_zd[i].yf);
}
//*****************************
//рисуем подсказку
for(int i=0; i<6; i++)
for(int j=0; j<6; j++)
{
Form2->Image1->Canvas->Pixels[350+i][250+j] = clTeal;
Form2->Image1->Canvas->Pixels[350+i][270+j] = clLime;
Form2->Image1->Canvas->Pixels[350+i][290+j] = clSilver;
Form2->Image1->Canvas->Pixels[350+i][310+j] = clRed;
Form2->Image1->Canvas->Pixels[350+i][330+j] = clBlue;
}
Form2->Image1->Canvas->TextOutA(360,245,"1 этаж");
Form2->Image1->Canvas->TextOutA(360,265,"2 этаж");
Form2->Image1->Canvas->TextOutA(360,285,"3 этаж");
Form2->Image1->Canvas->TextOutA(360,305,"сервер");
Form2->Image1->Canvas->TextOutA(360,325,"хаб");
//рисуем компьютеры
for(int i=0; i<16; i++)
{
Form2->Image1->Canvas->TextOutA(mas_comp[i].x+5, mas_comp[i].y-3,IntToStr(mas_comp[i].nom));
for(int j=mas_comp[i].x-5; j<mas_comp[i].x+5; j++)
for(int k=mas_comp[i].y-5; k<mas_comp[i].y+5; k++)
{
if(mas_comp[i].z == 0)
Form2->Image1->Canvas->Pixels[j][k] = clTeal;
if(mas_comp[i].z == 3)
Form2->Image1->Canvas->Pixels[j][k] = clLime;
if(mas_comp[i].z == 6)
Form2->Image1->Canvas->Pixels[j][k] = clSilver;
}
}
//рисуем сервер
for(int j=245; j<255; j++)
for(int k=75; k<85; k++)
Form2->Image1->Canvas->Pixels[k][j] = clRed;
//*******************************
Form2->ShowModal();
}
//Выход из программы---------------------------------------------------------------------------
void __fastcall TForm1::N6Click(TObject *Sender)
{
Form1->Close();
}
//Рясчет параметров сети ---------------------------------------------------------------------------
void __fastcall TForm1::N8Click(TObject *Sender)
{
int L21, L23, L24,L;
int m21, m23, m24;
int cena_vit = 1.55;
int cena_opt = 27.05;
hub[2].x = 80;
hub[2].y = 250;
hub[2].z = 0;
m21 = m23 = m24 = 10000;
if(M_flag != 1)
{
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//оптимизация по оптоволокну
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.