void draw(OBJHANDLE hmetd,int r, int g, int b){
double lngmap,latmap;
EQU equpos;
GetEquPosByCoord(hmetd,equpos);
lngmap=equpos.lng*DEG;
latmap=equpos.lat*DEG;
if(oapiFindDialog(g_hInst,ID_MAP)){
HDC clientDC;
clientDC= GetDC(oapiFindDialog(g_hInst,ID_MAP));
//clientDC=GetDC(GetDlgItem(hDlg,IDC_STATMAP));
//HDC testDC;
//testDC=GetDC(GetDlgItem(hDlg, ID_MAP));
RECT rect;
Ellipse(clientDC,((lngmap/180*315+315)-5),(-1)*((latmap/90*158-158)-5),((lngmap/180*315+315)+5),(-1)*((latmap/90*158-158)+5));
rect.left=lngmap/180*315+315+6;
rect.right=lngmap/180*315+315+106;
rect.bottom=(-1)*(latmap/90*158-158-10);
rect.top=(-1)*(latmap/90*158-158+10);
double beta=asin(Getd(hmetd)/(GetAltH(hmetd)+rt));
POINT points[37],pointspiu[37],pointsmeno[37];
[B]double phi[37],lambda[37],theta[37];
double coslat=cos(abs(latmap)*RAD);
double sinlat=sin(abs(latmap)*RAD);
double coslong=cos(lngmap*RAD);
double sinlong=sin(lngmap*RAD);
double tanbeta=tan(beta);
double cosbeta=cos(beta);
double sinbeta=sin(beta);
for(int pts=0;pts<37;pts++){
theta[pts]=pts*10*RAD;
if(latmap>=0){
phi[pts]=asin(cosbeta*sinlat+sinbeta*coslat*cos(theta[pts]));
}else{
phi[pts]=(-1)*asin(cosbeta*sinlat+sinbeta*coslat*cos(theta[pts]));
}
lambda[pts]=atan2(tanbeta*sin(theta[pts]),coslat-tanbeta*cos(theta[pts])*sinlat);
points[pts].x=lambda[pts]*DEG*315/180+315+lngmap*315/180;
[/B]pointspiu[pts].x=points[pts].x+360*315/180;
pointsmeno[pts].x=points[pts].x-360*315/180;
[B]points[pts].y=(-1)*phi[pts]*DEG*158/90+158;[/B]
pointspiu[pts].y=points[pts].y;
pointsmeno[pts].y=points[pts].y;
}
HGDIOBJ hPen = NULL;
HGDIOBJ hPenOld;
hPen = CreatePen(PS_SOLID, 3, RGB(r, g, b));
hPenOld=SelectObject(clientDC, hPen);
Polyline(clientDC,points,37);
Polyline(clientDC,pointspiu,37);
Polyline(clientDC,pointsmeno,37);
DeleteObject(hPen);
char objname[50];
oapiGetObjectName(hmetd,objname,50);
DrawText(clientDC,objname,-1,&rect,DT_SINGLELINE);
ReleaseDC(hMap, clientDC);
}
return;
}