本文整理汇总了C++中LKSurface::DrawLine方法的典型用法代码示例。如果您正苦于以下问题:C++ LKSurface::DrawLine方法的具体用法?C++ LKSurface::DrawLine怎么用?C++ LKSurface::DrawLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LKSurface
的用法示例。
在下文中一共展示了LKSurface::DrawLine方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawSelectionFrame
void DrawSelectionFrame(LKSurface& Surface, const RECT& rc)
{
Surface.SetBkMode(TRANSPARENT);
RECT rci = rc;
#define SHRINK 1
rci.left +=1;
rci.top -=1;
rci.right -=2;
rci.bottom -=2;
int iSize = NIBLSCALE(2);
LKColor col = RGB_BLACK;
Surface.DrawLine (PEN_SOLID, iSize, (POINT) {rci.left,rci.top} ,(POINT) {rci.left,rci.bottom} , col, rci);
Surface.DrawLine (PEN_SOLID, iSize, (POINT) {rci.left,rci.bottom} ,(POINT) {rci.right,rci.bottom}, col, rci);
Surface.DrawLine (PEN_SOLID, iSize, (POINT) {rci.right,rci.bottom} ,(POINT) {rci.right,rci.top} , col, rci);
Surface.DrawLine (PEN_SOLID, iSize, (POINT) {rci.right,rci.top} ,(POINT) {rci.left,rci.top} , col, rci);
col = RGB_YELLOW;
Surface.DrawDashLine(iSize,(POINT) {rci.left,rci.top} ,(POINT) {rci.left,rci.bottom} , col, rci);
Surface.DrawDashLine(iSize,(POINT) {rci.left,rci.bottom} ,(POINT) {rci.right,rci.bottom}, col, rci);
Surface.DrawDashLine(iSize,(POINT) {rci.right,rci.bottom},(POINT) {rci.right,rci.top} , col, rci);
Surface.DrawDashLine(iSize,(POINT) {rci.right,rci.top} ,(POINT) {rci.left,rci.top} , col, rci);
}
示例2: DrawHeadUpLine
void MapWindow::DrawHeadUpLine(LKSurface& Surface, const POINT& Orig, const RECT& rc, double fMin, double fMax ) {
const double tmp = fMax*zoom.ResScaleOverDistanceModify();
const double trackbearing = DisplayAircraftAngle+ (DerivedDrawInfo.Heading-DrawInfo.TrackBearing);
const POINT p2 = { Orig.x + (int)(tmp*fastsine(trackbearing)), Orig.y - (int)(tmp*fastcosine(trackbearing)) };
const LKColor rgbCol = BlackScreen?RGB_INVDRAW:RGB_BLACK;
// Reduce the rectangle for a better effect
const RECT ClipRect = {rc.left+NIBLSCALE(5), rc.top+NIBLSCALE(5), rc.right-NIBLSCALE(5), rc.bottom-NIBLSCALE(5) };
Surface.DrawLine(PEN_SOLID, NIBLSCALE(1), Orig, p2, rgbCol, ClipRect);
}
示例3: DrawFuturePos
void MapWindow::DrawFuturePos(LKSurface& Surface, const POINT& Orig, const RECT& rc, bool headUpLine) {
if(DrawInfo.Speed < 13.88) return; //Don't continue if ground speed < 50 Km/h
const double trackBearing = headUpLine ? DisplayAircraftAngle+(DerivedDrawInfo.Heading-DrawInfo.TrackBearing) : DrawInfo.TrackBearing;
const double dist2min=120*DrawInfo.Speed*zoom.ResScaleOverDistanceModify(); // 2 min
if(dist2min>=NIBLSCALE(3)) { //proceed only if the distance is not too small on the map
const double dist5min=300*DrawInfo.Speed*zoom.ResScaleOverDistanceModify(); // 5 min
const double dist10min=600*DrawInfo.Speed*zoom.ResScaleOverDistanceModify(); //10 min
// Reduce the rectangle for a better effect
const RECT ClipRect = (RECT){rc.left+NIBLSCALE(5), rc.top+NIBLSCALE(5), rc.right-NIBLSCALE(5), rc.bottom-NIBLSCALE(5) };
POINT p1,p2;
if( !MapWindow::mode.autoNorthUP() && !headUpLine && (DisplayOrientation==TRACKUP || DisplayOrientation==NORTHCIRCLE || DisplayOrientation==TARGETCIRCLE || DisplayOrientation==TARGETUP)) { //Track up map view
p1.x=Orig.x-NIBLSCALE(4);
p2.x=Orig.x+NIBLSCALE(4);
p1.y=p2.y=Orig.y-(int)round(dist2min);
Surface.DrawLine(PEN_SOLID,NIBLSCALE(1),p1,p2,BlackScreen?RGB_INVDRAW:RGB_BLACK,ClipRect);
p1.y=p2.y=Orig.y-(int)round(dist5min);
Surface.DrawLine(PEN_SOLID,NIBLSCALE(1),p1,p2,BlackScreen?RGB_INVDRAW:RGB_BLACK,ClipRect);
p1.y=p2.y=Orig.y-(int)round(dist10min);
Surface.DrawLine(PEN_SOLID,NIBLSCALE(1),p1,p2,BlackScreen?RGB_INVDRAW:RGB_BLACK,ClipRect);
} else { //North up map view
const double sin=fastsine(trackBearing);
const double cos=fastcosine(trackBearing);
double distXsin=dist2min*sin;
double distXcos=dist2min*cos;
const double tickXsin=NIBLSCALE(4)*sin;
const double tickXcos=NIBLSCALE(4)*cos;
p1.x=Orig.x+(int)round(distXsin-tickXcos);
p1.y=Orig.y-(int)round(distXcos+tickXsin);
p2.x=Orig.x+(int)round(distXsin+tickXcos);
p2.y=Orig.y-(int)round(distXcos-tickXsin);
Surface.DrawLine(PEN_SOLID,NIBLSCALE(1),p1,p2,BlackScreen?RGB_INVDRAW:RGB_BLACK,ClipRect);
distXsin=dist5min*sin;
distXcos=dist5min*cos;
p1.x=Orig.x+(int)round(distXsin-tickXcos);
p1.y=Orig.y-(int)round(distXcos+tickXsin);
p2.x=Orig.x+(int)round(distXsin+tickXcos);
p2.y=Orig.y-(int)round(distXcos-tickXsin);
Surface.DrawLine(PEN_SOLID,NIBLSCALE(1),p1,p2,BlackScreen?RGB_INVDRAW:RGB_BLACK,ClipRect);
distXsin=dist10min*sin;
distXcos=dist10min*cos;
p1.x=Orig.x+(int)round(distXsin-tickXcos);
p1.y=Orig.y-(int)round(distXcos+tickXsin);
p2.x=Orig.x+(int)round(distXsin+tickXcos);
p2.y=Orig.y-(int)round(distXcos-tickXsin);
Surface.DrawLine(PEN_SOLID,NIBLSCALE(1),p1,p2,BlackScreen?RGB_INVDRAW:RGB_BLACK,ClipRect);
}
}
}
示例4: DrawStartEndSector
void MapWindow::DrawStartEndSector(LKSurface& Surface, const RECT& rc,
const POINT &Start, const POINT &End, int Index,
int Type, double Radius) {
double tmp;
LKSurface::OldPen oldpen;
LKSurface::OldBrush oldbrush;
switch (Type) {
case 0: // CIRCLE
tmp = Radius * zoom.ResScaleOverDistanceModify();
oldpen = Surface.SelectObject(hpStartFinishThick);
oldbrush = Surface.SelectObject(LKBrush_Hollow);
Surface.Circle(WayPointList[Index].Screen.x,
WayPointList[Index].Screen.y, (int) tmp, rc, false, false);
Surface.SelectObject(LKPen_Red_N1);
Surface.Circle(WayPointList[Index].Screen.x,
WayPointList[Index].Screen.y, (int) tmp, rc, false, false);
Surface.SelectObject(oldpen);
Surface.SelectObject(oldbrush);
break;
case 1: // LINE
Surface.DrawLine(PEN_SOLID, NIBLSCALE(5), End, Start, taskcolor, rc);
Surface.DrawLine(PEN_SOLID, NIBLSCALE(1), End, Start, LKColor(255, 0, 0), rc);
break;
case 2: // SECTOR
Surface.DrawLine(PEN_SOLID, NIBLSCALE(5), WayPointList[Index].Screen,
Start, taskcolor, rc);
Surface.DrawLine(PEN_SOLID, NIBLSCALE(5), WayPointList[Index].Screen,
End, taskcolor, rc);
Surface.DrawLine(PEN_SOLID, NIBLSCALE(1), WayPointList[Index].Screen,
Start, LKColor(255, 0, 0), rc);
Surface.DrawLine(PEN_SOLID, NIBLSCALE(1), WayPointList[Index].Screen,
End, LKColor(255, 0, 0), rc);
break;
}
}
示例5: DrawAspNearest
//.........这里部分代码省略.........
break;
case LKEVENT_DOWN:
if (++SelectedRaw[curmapspace] >=AspNumraws) SelectedRaw[curmapspace]=0;
break;
case LKEVENT_UP:
if (--SelectedRaw[curmapspace] <0) SelectedRaw[curmapspace]=AspNumraws-1;
break;
case LKEVENT_PAGEUP:
LKevent=LKEVENT_NONE;
break;
case LKEVENT_PAGEDOWN:
LKevent=LKEVENT_NONE;
break;
case LKEVENT_NEWRUN:
for (i=0; i<MAXNEARAIRSPACES; i++) {
for (k=0; k<MAXAIRSPACENUMPAGES; k++) {
_stprintf(Buffer1[i][k], _T("----------------------------")); // max 30
Buffer1[i][k][s_maxnlname+7]='\0'; // some more dashes
_stprintf(Buffer2[i][k],_T("----"));
_stprintf(Buffer3[i][k],_T("----"));
_stprintf(Buffer4[i][k],_T("----"));
_stprintf(Buffer5[i][k],_T(" "));
}
}
break;
case LKEVENT_NEWPAGE:
break;
default:
LKevent=LKEVENT_NONE;
break;
}
if (INVERTCOLORS)
Surface.DrawLine(PEN_SOLID, NIBLSCALE(1), p1, p2, RGB_GREEN, rc);
else
Surface.DrawLine(PEN_SOLID, NIBLSCALE(1), p1, p2, RGB_DARKGREEN, rc);
Surface.SelectObject(LK8InfoNormalFont); // Heading line
short cursortbox=SortedMode[curmapspace];
if ( !ScreenLandscape ) { // portrait mode
Surface.FillRect(&s_sortBox[cursortbox], sortbrush);
_stprintf(Buffer,TEXT("%d.%d"),ModeIndex,CURTYPE+1);
Surface.SelectObject(LK8PanelMediumFont);
LKWriteText(Surface, Buffer, LEFTLIMITER, rc.top+TOPLIMITER , 0, WTMODE_NORMAL, WTALIGN_LEFT, RGB_LIGHTGREEN, false);
Surface.SelectObject(LK8InfoNormalFont);
_stprintf(Buffer,TEXT("%s %d/%d"), gettext(TEXT("[email protected]_")), curpage+1, AspNumpages); // ASP
if (cursortbox == 0)
LKWriteText(Surface, Buffer, Column0, HEADRAW-NIBLSCALE(1) , 0, WTMODE_NORMAL, WTALIGN_LEFT, RGB_BLACK, false);
else
LKWriteText(Surface, Buffer, Column0, HEADRAW-NIBLSCALE(1) , 0, WTMODE_NORMAL, WTALIGN_LEFT, RGB_LIGHTGREEN, false);
_tcscpy(Buffer,gettext(TEXT("[email protected]_"))); // Type
if (cursortbox==1)
LKWriteText(Surface, Buffer, Column2, HEADRAW , 0, WTMODE_NORMAL, WTALIGN_RIGHT, RGB_BLACK, false);
else
LKWriteText(Surface, Buffer, Column2, HEADRAW , 0, WTMODE_NORMAL, WTALIGN_RIGHT, RGB_WHITE, false);
_tcscpy(Buffer,gettext(TEXT("[email protected]_"))); // Dist
if (cursortbox==2)
LKWriteText(Surface, Buffer, Column3, HEADRAW , 0,WTMODE_NORMAL, WTALIGN_RIGHT, RGB_BLACK, false);
示例6: RenderFAISector
int RenderFAISector (LKSurface& Surface, const RECT& rc , double lat1, double lon1, double lat2, double lon2, int iOpposite , const LKColor& fillcolor)
{
POINT Pt1;
float fFAI_Percentage = FAI_NORMAL_PERCENTAGE;
double fDist_a, fDist_b, fDist_c, fAngle;
int i;
int iPolyPtr=0;
double lat_d,lon_d;
double alpha, fDistTri, cos_alpha=0;
POINT apSectorPolygon[MAX_FAI_SECTOR_PTS+1];
DistanceBearing(lat1, lon1, lat2, lon2, &fDist_c, &fAngle);
if(fabs(fDist_c) < 1000.0) /* distance too short for a FAI sector */
return -1;
double fDistMax = fDist_c/FAI_NORMAL_PERCENTAGE;
double fDistMin = fDist_c/(1.0-2.0*FAI28_45Threshold);
double fDelta_Dist = 2.0* fDist_c*fFAI_Percentage / (double)(FAI_SECTOR_STEPS-1);
double fA, fB;
double fMinLeg, fMaxLeg,fDiff=0;
double dir = -1.0;
BOOL bBigFAISector = false;
if(fDistMax > FAI28_45Threshold)
{
bBigFAISector = true;
fDistMax = fDist_c/FAI_BIG_PERCENTAGE;
}
if(fDistMin < FAI28_45Threshold)
{
fDistMin = fDist_c/(1.0-2.0*FAI_NORMAL_PERCENTAGE);
}
if (iOpposite >0)
{
dir = 1.0;
}
//#define HELP_LINES
#ifdef HELP_LINES
int x2,y2, style;
FindLatitudeLongitude(lat1, lon1, AngleLimit360 (fAngle), fDist_c/2, &lat_d, &lon_d);
x1 = (lon_d - lon_c)*fastcosine(lat_d);
y1 = (lat_d - lat_c);
FindLatitudeLongitude(lat_d, lon_d, AngleLimit360 (fAngle-90.0), fDist_c, &lat_d, &lon_d);
x2 = (lon_d - lon_c)*fastcosine(lat_d);
y2 = (lat_d - lat_c);
Surface.DrawLine(rc, x1, y1, x2, y2, style);
#endif
/********************************************************************
* right below threshold 1
********************************************************************/
fA = fDistMin;
if(fDistMax > FAI28_45Threshold)
fB = FAI28_45Threshold;
else
fB = fDistMax ;
if(fA<fB)
{
fDelta_Dist =(fB-fA)/ (double)(FAI_SECTOR_STEPS-1);
fDistTri = fA;
for(i =0 ;i < FAI_SECTOR_STEPS; i++)
{
fDist_a = FAI_NORMAL_PERCENTAGE * fDistTri;
fDist_b = fDistTri - fDist_a - fDist_c;
LKASSERT(fDist_c*fDist_b!=0);
cos_alpha = ( fDist_b*fDist_b + fDist_c*fDist_c - fDist_a*fDist_a )/(2.0*fDist_c*fDist_b);
alpha = acos(cos_alpha)*180/PI * dir;
FindLatitudeLongitude(lat1, lon1, AngleLimit360( fAngle + alpha ) , fDist_b, &lat_d, &lon_d);
MapWindow::LatLon2Screen(lon_d, lat_d, Pt1);
LKASSERT(iPolyPtr < MAX_FAI_SECTOR_PTS);
apSectorPolygon[iPolyPtr++] = Pt1;
fDistTri += fDelta_Dist;
}
}
/********************************************************************
* right threshold extender 2
********************************************************************/
if(fDistMin < FAI28_45Threshold)
if(bBigFAISector && (fDistMin < FAI28_45Threshold))
{
fMaxLeg = FAI28_45Threshold*FAI_BIG_MAX_PERCENTAGE;
fMinLeg = FAI28_45Threshold*FAI_BIG_PERCENTAGE;
fA = FAI28_45Threshold*FAI_NORMAL_PERCENTAGE;
fB = FAI28_45Threshold-fMaxLeg-fDist_c;
if(fB < fMinLeg)
//.........这里部分代码省略.........
示例7: iround
void MapWindow::DrawWindAtAircraft2(LKSurface& Surface, const POINT& Orig, const RECT& rc) {
int i;
POINT Start;
TCHAR sTmp[12];
static SIZE tsize = {0,0};
if (DerivedDrawInfo.WindSpeed<1) {
return; // JMW don't bother drawing it if not significant
}
if (tsize.cx == 0){
const auto oldFont = Surface.SelectObject(MapWindowBoldFont);
Surface.GetTextSize(TEXT("99"), 2, &tsize);
Surface.SelectObject(oldFont);
tsize.cx = tsize.cx/2;
}
int wmag = iround(4.0*DerivedDrawInfo.WindSpeed);
Start.y = Orig.y;
Start.x = Orig.x;
int kx = tsize.cx/ScreenScale/2;
POINT Arrow[7] = { {0,-20}, {-6,-26}, {0,-20},
{6,-26}, {0,-20},
{8+kx, -24},
{-8-kx, -24}};
for (i=1;i<4;i++)
Arrow[i].y -= wmag;
PolygonRotateShift(Arrow, 7, Start.x, Start.y,
DerivedDrawInfo.WindBearing-DisplayAngle);
//
// Draw Wind Arrow
//
POINT Tail[2] = {{0,-20}, {0,-26-min(20,wmag)*3}};
double angle = AngleLimit360(DerivedDrawInfo.WindBearing-DisplayAngle);
for(i=0; i<2; i++) {
if (ScreenScale>1) {
Tail[i].x *= ScreenScale;
Tail[i].y *= ScreenScale;
}
protateshift(Tail[i], angle, Start.x, Start.y);
}
// optionally draw dashed line for wind arrow
Surface.DrawLine(PEN_DASH, 1, Tail[0], Tail[1], LKColor(0,0,0), rc);
// Paint wind value only while circling
if ( (mode.Is(Mode::MODE_CIRCLING)) ) {
_stprintf(sTmp, _T("%d"), iround(DerivedDrawInfo.WindSpeed * SPEEDMODIFY));
TextInBoxMode_t TextInBoxMode = {0};
TextInBoxMode.AlligneCenter = true; // { 16 | 32 }; // JMW test {2 | 16};
TextInBoxMode.WhiteBorder = true;
if (Arrow[5].y>=Arrow[6].y) {
TextInBox(Surface, &rc, sTmp, Arrow[5].x-kx, Arrow[5].y, 0, &TextInBoxMode);
} else {
TextInBox(Surface, &rc, sTmp, Arrow[6].x-kx, Arrow[6].y, 0, &TextInBoxMode);
}
}
const auto hpOld = Surface.SelectObject(LKPen_Black_N2);
const auto hbOld = Surface.SelectObject(LKBrush_Grey);
Surface.Polygon(Arrow,5);
Surface.SelectObject(hbOld);
Surface.SelectObject(hpOld);
}