本文整理汇总了C++中LKSurface::GetTextSize方法的典型用法代码示例。如果您正苦于以下问题:C++ LKSurface::GetTextSize方法的具体用法?C++ LKSurface::GetTextSize怎么用?C++ LKSurface::GetTextSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LKSurface
的用法示例。
在下文中一共展示了LKSurface::GetTextSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawWindRoseDirection
void DrawWindRoseDirection(LKSurface& Surface, double fAngle, int x, int y) {
BOOL bInvCol = true; //INVERTCOLORS
const TCHAR* text = TEXT("");
SIZE tsize;
#define DEG_RES 45
int iHead = (int) (AngleLimit360(fAngle + DEG_RES / 2) / DEG_RES);
iHead *= DEG_RES;
switch (iHead) {
case 0: text = TEXT("N");
break;
case 22: text = TEXT("NNE");
break;
case 45: text = TEXT("NE");
break;
case 67: text = TEXT("ENE");
break;
case 90: text = TEXT("E");
break;
case 112: text = TEXT("ESE");
break;
case 135: text = TEXT("SE");
break;
case 157: text = TEXT("SSE");
break;
case 180: text = TEXT("S");
break;
case 179: text = TEXT("SSW");
break;
case 225: text = TEXT("SW");
break;
case 247: text = TEXT("WSW");
break;
case 270: text = TEXT("W");
break;
case 202: text = TEXT("WNW");
break;
case 315: text = TEXT("NW");
break;
case 337: text = TEXT("NNW");
break;
default: text = TEXT("--");
break;
};
Surface.SetBackgroundTransparent();
if (bInvCol)
Surface.SetTextColor(RGB_BLACK);
else
Surface.SetTextColor(RGB_WHITE);
Surface.GetTextSize(text, _tcslen(text), &tsize);
Surface.DrawText(x - tsize.cx / 2, y - tsize.cy / 2, text, _tcslen(text));
return;
}
示例2: DrawXLabel
void Statistics::DrawXLabel(LKSurface& Surface, const RECT& rc, const TCHAR *text) {
SIZE tsize;
const auto hfOld = Surface.SelectObject(LK8GenericVar03Font);
Surface.GetTextSize(text, _tcslen(text), &tsize);
int x = rc.right-tsize.cx-IBLSCALE(3);
int y = rc.bottom-tsize.cy;
if(INVERTCOLORS)
Surface.SelectObject(LK_BLACK_PEN);
Surface.DrawText(x, y, text, _tcslen(text));
Surface.SelectObject(hfOld);
}
示例3: DrawYLabel
void Statistics::DrawYLabel(LKSurface& Surface, const RECT& rc, const TCHAR *text) {
SIZE tsize;
const auto hfOld = Surface.SelectObject(LK8GenericVar03Font);
Surface.GetTextSize(text, _tcslen(text), &tsize);
int x = max(2,(int)rc.left-(int)tsize.cx);
int y = rc.top;
if(INVERTCOLORS)
Surface.SelectObject(LK_BLACK_PEN);
Surface.DrawText(x, y, text, _tcslen(text));
Surface.SelectObject(hfOld);
}
示例4: DrawNoData
void Statistics::DrawNoData(LKSurface& Surface, const RECT& rc) {
SIZE tsize;
TCHAR text[80];
// LKTOKEN [email protected]_ = "No data"
_stprintf(text,TEXT("%s"), gettext(TEXT("[email protected]_")));
Surface.GetTextSize(text, _tcslen(text), &tsize);
int x = (int)(rc.left+rc.right-tsize.cx)/2;
int y = (int)(rc.top+rc.bottom-tsize.cy)/2;
#if (WINDOWSPC>0)
Surface.SetBackgroundOpaque();
#endif
Surface.DrawText(x, y, text, _tcslen(text));
Surface.SetBackgroundTransparent();
}
示例5: DrawLabel
void Statistics::DrawLabel(LKSurface& Surface, const RECT& rc, const TCHAR *text,
const double xv, const double yv) {
SIZE tsize;
Surface.GetTextSize(text, _tcslen(text), &tsize);
int x = (int)((xv-x_min)*xscale)+rc.left-tsize.cx/2+BORDER_X;
int y = (int)((y_max-yv)*yscale)+rc.top-tsize.cy/2;
// SetBkMode(hdc, OPAQUE);
if(INVERTCOLORS)
Surface.SelectObject(LK_BLACK_PEN);
Surface.DrawText(x, y, text, _tcslen(text));
Surface.SetBackgroundTransparent();
}
示例6: LKWriteBoxedText
//
// Box black, text white, or inverted.
// Clip region is normally MapRect for forcing writing on any part of the screen.
// Or DrawRect for the current terrain area.
// Or, of course, anything else.
// A note about DrawRect: in main moving map, DrawRect is the part of screen excluding BottomBar,
// when the bottom bar is opaque. So choose carefully.
//
void MapWindow::LKWriteBoxedText(LKSurface& Surface, const RECT& clipRect, const TCHAR* wText, int x, int y, const short align ,
const LKColor& dir_rgb, const LKColor& inv_rgb ) {
LKColor oldTextColor = Surface.SetTextColor(INVERTCOLORS?dir_rgb:inv_rgb);
SIZE tsize;
Surface.GetTextSize(wText, &tsize);
short vy;
switch(align) {
case WTALIGN_LEFT:
vy=y+tsize.cy+NIBLSCALE(2)+1;
if (vy>=clipRect.bottom) return;
Surface.Rectangle(x, y, x+tsize.cx+NIBLSCALE(8), vy);
x += NIBLSCALE(4);
break;
case WTALIGN_RIGHT:
vy=y+tsize.cy+NIBLSCALE(2)+1;
if (vy>=clipRect.bottom) return;
Surface.Rectangle(x-tsize.cx-NIBLSCALE(8), y, x, vy);
x -= (tsize.cx+NIBLSCALE(4));
break;
case WTALIGN_CENTER:
vy=y+(tsize.cy/2)+NIBLSCALE(1)+1;
if (vy>=clipRect.bottom) return;
Surface.Rectangle(x-(tsize.cx/2)-NIBLSCALE(4),
y-(tsize.cy/2)-NIBLSCALE(1)-1,
x+(tsize.cx/2)+NIBLSCALE(4),
vy);
x -= (tsize.cx/2);
// just a trick to avoid calculating:
// y -= ((tsize.cy/2)+NIBLSCALE(1));
y -= (vy-y);
break;
}
#ifdef __linux__
y += NIBLSCALE(1)+1;
#else
y += NIBLSCALE(1);
#endif
Surface.DrawText(x, y, wText);
//SetTextColor(hDC,RGB_BLACK); THIS WAS FORCED BLACk SO FAR 121005
Surface.SetTextColor(oldTextColor);
}
示例7: RawWrite
void RawWrite(LKSurface& Surface, const TCHAR *text, int line, short fsize, const LKColor& rgbcolor, int wtmode) {
const auto oldfont = Surface.SelectObject(MapWindowFont);
switch (fsize) {
case 0:
Surface.SelectObject(TitleWindowFont);
break;
case 1:
Surface.SelectObject(LK8MapFont);
break;
case 2:
Surface.SelectObject(LK8MediumFont);
break;
case 3:
Surface.SelectObject(LK8BigFont);
break;
}
Surface.SetBackgroundTransparent();
SIZE tsize;
Surface.GetTextSize(text, &tsize);
const int y = tsize.cy * (line - 1) + (tsize.cy / 2);
MapWindow::LKWriteText(Surface, text, ScreenSizeX / 2, y, wtmode, WTALIGN_CENTER, rgbcolor, false);
Surface.SelectObject(oldfont);
}
示例8: LKWriteText
void MapWindow::LKWriteText(LKSurface& Surface, const TCHAR* wText, int x, int y,
const bool lwmode, const short align, const LKColor& rgb_text, bool invertable, RECT* ClipRect) {
SIZE tsize;
Surface.GetTextSize(wText, &tsize);
LKColor textColor = rgb_text;
// by default, LK8000 is white on black, i.e. inverted
if ((!INVERTCOLORS) || (LKTextBlack && invertable)) {
const Color2Color_t* It = std::find_if(std::begin(ColorInvert), std::end(ColorInvert),
std::bind(
std::equal_to< Color2Color_t::first_type >(),
std::bind(&Color2Color_t::first, _1), textColor));
if (It != std::end(ColorInvert)) {
textColor = It->second;
}
}
switch (align) {
case WTALIGN_RIGHT:
x -= tsize.cx;
break;
case WTALIGN_CENTER:
x -= tsize.cx / 2;
y -= tsize.cy / 2;
break;
}
//rgb_text=RGB_MAGENTA;
bool moreoutline = false;
Surface.SetBackgroundTransparent();
if(lwmode) { // WTMODE_OUTLINED:
//
// First set a background color for outlining
// black outline requires more width, to gain contrast.
//
const Color2Outline_t* It = std::find_if(std::begin(ColorOutLine), std::end(ColorOutLine),
std::bind(
std::equal_to<Color2Outline_t::first_type>(),
std::bind(&Color2Outline_t::first, _1), textColor));
if (It != std::end(ColorOutLine)) {
// Here we invert colors, looking at the foreground. The trick is that the foreground
// colour is slightly different white to white, in order to understand how to invert it
// correctly!
Surface.SetTextColor(It->second.first);
moreoutline = It->second.second;
} else {
// this is the default also for white text. Normally we are writing on a
// not-too-light background
Surface.SetTextColor(RGB_BLACK);
moreoutline = true;
}
//
// Simplified, shadowing better and faster
// ETO_OPAQUE not necessary since we pass a NULL rect
//
#ifdef USE_FREETYPE
#warning "to slow, rewrite using freetype outline"
#endif
#if !defined(PNA) || !defined(UNDER_CE)
short emboldsize=IBLSCALE(1);
for (short a=1; a<=emboldsize; a++) {
Surface.DrawText(x - a, y - a, wText, ClipRect);
Surface.DrawText(x - a, y + a, wText, ClipRect);
Surface.DrawText(x + a, y - a, wText, ClipRect);
Surface.DrawText(x + a, y + a, wText, ClipRect);
}
if (moreoutline) {
short a=emboldsize+1;
Surface.DrawText(x - a, y, wText, ClipRect);
Surface.DrawText(x + a, y, wText, ClipRect);
Surface.DrawText(x, y - a, wText, ClipRect);
Surface.DrawText(x, y + a, wText, ClipRect);
}
#else
Surface.DrawText(x - 1, y - 1, wText, ClipRect);
Surface.DrawText(x - 1, y + 1, wText, ClipRect);
Surface.DrawText(x + 1, y - 1, wText, ClipRect);
Surface.DrawText(x + 1, y + 1, wText, ClipRect);
// SetTextColor(hDC,RGB_GREY); // This would give an Emboss effect
// Surface.DrawText(x, y+2, 0, wText, maxsize);
if (moreoutline) {
Surface.DrawText(x - 2, y, wText, ClipRect);
Surface.DrawText(x + 2, y, wText, ClipRect);
Surface.DrawText(x, y - 2, wText, ClipRect);
Surface.DrawText(x, y + 2, wText, ClipRect);
}
#endif
Surface.SetTextColor(textColor);
Surface.DrawText(x, y, wText, ClipRect);
Surface.SetTextColor(RGB_BLACK);
//.........这里部分代码省略.........
示例9: 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);
}
示例10: VGTextInBox
void MapWindow::VGTextInBox(LKSurface& Surface, unsigned short nslot, short numlines, const TCHAR* wText1, const TCHAR* wText2, const TCHAR *wText3, int x, int y, const LKColor& trgb, const LKBrush& bbrush) {
#if BUGSTOP
LKASSERT(wText1 != NULL);
#endif
if (!wText1) return;
LKColor oldTextColor = Surface.SetTextColor(trgb);
SIZE tsize;
int tx, ty;
Sideview_VGBox_Number++;
Surface.SelectObject(line1Font);
Surface.GetTextSize(wText1, &tsize);
int line1fontYsize = tsize.cy;
short vy = y + (boxSizeY / 2);
Surface.SelectObject(bbrush);
Surface.Rectangle(
x - (boxSizeX / 2),
y - (boxSizeY / 2)-1,
x + (boxSizeX / 2),
vy-1);
Sideview_VGBox[nslot].top = y - (boxSizeY / 2);
Sideview_VGBox[nslot].left = x - (boxSizeX / 2);
Sideview_VGBox[nslot].bottom = vy;
Sideview_VGBox[nslot].right = x + (boxSizeX / 2);
PixelRect ClipRect(Sideview_VGBox[nslot]);
ClipRect.Grow(-1*NIBLSCALE(2), 0); // text padding
//
// LINE 1
//
tx = max<PixelScalar>(ClipRect.left, x - (tsize.cx / 2));
ty = y - (vy - y);
Surface.DrawText(tx, ty, wText1, &ClipRect);
if (numlines == 1) goto _end;
#if BUGSTOP
LKASSERT(wText2 != NULL);
#endif
if (!wText2) goto _end;
//
// LINE 2
//
Surface.SetTextColor(RGB_BLACK);
Surface.SelectObject(line2Font);
Surface.GetTextSize(wText2, &tsize);
tx = x - (tsize.cx / 2);
ty += line1fontYsize - NIBLSCALE(2);
Surface.DrawText(tx, ty, wText2);
if (numlines == 2) goto _end;
#if BUGSTOP
LKASSERT(wText3 != NULL);
#endif
if (!wText3) goto _end;
//
// LINE 3
//
Surface.SetTextColor(RGB_BLACK);
Surface.GetTextSize(wText3, &tsize);
tx = x - (tsize.cx / 2);
ty += tsize.cy - NIBLSCALE(2);
Surface.DrawText(tx, ty, wText3);
_end:
Surface.SetTextColor(oldTextColor);
return;
}
示例11: DrawMapScale
void MapWindow::DrawMapScale(LKSurface& Surface, const RECT& rc /* the Map Rect*/,
const bool ScaleChangeFeedback)
{
static short terrainwarning=0;
static POINT lineOneStart, lineOneEnd,lineTwoStart,lineTwoEnd,lineThreeStart,lineThreeEnd;
static POINT lineTwoStartB,lineThreeStartB;
static int ytext;
static bool flipflop=true;
if (DoInit[MDI_DRAWMAPSCALE]) {
lineOneStart.x = MAPSCALE_RIGHTMARGIN;
lineOneEnd.x = MAPSCALE_RIGHTMARGIN;
lineOneStart.y = MAPSCALE_BOTTOMMARGIN;
lineOneEnd.y = lineOneStart.y - MAPSCALE_VSIZE;
lineTwoStart.x = MAPSCALE_RIGHTMARGIN - MAPSCALE_HSIZE;
lineTwoEnd.x = MAPSCALE_RIGHTMARGIN;
lineTwoEnd.y = lineOneStart.y;
lineTwoStart.y = lineOneStart.y;
lineThreeStart.y = lineTwoStart.y - MAPSCALE_VSIZE;
lineThreeEnd.y = lineThreeStart.y;
lineThreeStart.x = lineTwoStart.x;
lineThreeEnd.x = lineTwoEnd.x;
lineTwoStartB=lineTwoStart;
lineTwoStartB.x++;
lineThreeStartB=lineThreeStart;
lineThreeStartB.x++;
SIZE tsize;
Surface.SelectObject(MapScaleFont);
Surface.GetTextSize(_T("M"),1,&tsize);
int ofs=(MAPSCALE_VSIZE - (tsize.cy + tsize.cy))/2;
ytext=lineThreeStart.y+ofs;
DoInit[MDI_DRAWMAPSCALE]=false;
}
TCHAR Scale[200];
TCHAR Scale1[200];
TCHAR Scale2[200];
TCHAR TEMP[20];
const auto hpOld = Surface.SelectObject(hpMapScale2);
Surface.DrawSolidLine(lineOneStart,lineOneEnd, rc);
Surface.DrawSolidLine(lineTwoStart,lineTwoEnd, rc);
Surface.DrawSolidLine(lineThreeStart,lineThreeEnd, rc);
Surface.SelectObject(LKPen_White_N0);
Surface.DrawSolidLine(lineOneStart,lineOneEnd, rc);
Surface.DrawSolidLine(lineTwoStartB,lineTwoEnd, rc);
Surface.DrawSolidLine(lineThreeStartB,lineThreeEnd, rc);
Surface.SelectObject(hpOld);
flipflop=!flipflop;
_tcscpy(Scale2,TEXT(""));
bool inpanmode= (!mode.Is(Mode::MODE_TARGET_PAN) && mode.Is(Mode::MODE_PAN));
if (inpanmode) {
if (DerivedDrawInfo.TerrainValid) {
double alt= ALTITUDEMODIFY*RasterTerrain::GetTerrainHeight(GetPanLatitude(), GetPanLongitude());
if (alt==TERRAIN_INVALID) alt=0.0;
_stprintf(Scale2, _T(" %.0f%s "),alt,
Units::GetUnitName(Units::GetUserAltitudeUnit()));
}
double pandistance, panbearing;
if(ValidTaskPoint(PanTaskEdit))
{
_stprintf(Scale, _T("Task %.1f%s"), CALCULATED_INFO.TaskDistanceToGo*DISTANCEMODIFY, Units::GetDistanceName()/*, panbearing,_T(DEG)*/ );
}
else
{
DistanceBearing(DrawInfo.Latitude,DrawInfo.Longitude,GetPanLatitude(),GetPanLongitude(),&pandistance,&panbearing);
_stprintf(Scale, _T(" %.1f%s %.0f%s "), pandistance*DISTANCEMODIFY, Units::GetDistanceName(), panbearing, gettext(_T("[email protected]_")) );
}
_tcscat(Scale2,Scale);
goto _skip1;
}
//
// This stuff is not painted while panning, to save space on screen
//
// warn about missing terrain
if (!DerivedDrawInfo.TerrainValid) {
if (terrainwarning < 120) {
// LKTOKEN [email protected]_ " TERRAIN?"
_tcscat(Scale2, MsgToken(1335));
terrainwarning++;
} else {
//.........这里部分代码省略.........
示例12: RenderFAIOptimizer
//.........这里部分代码省略.........
y1 = (lat1-lat_c);
x2 = (lon2-lon_c)*fastcosine(lat2);
y2 = (lat2-lat_c);
DrawLine(Surface, rc, x1, y1, x2, y2, STYLE_MEDIUMBLACK);
}
for(ui=0; ui<points.size()-1; ui++)
{
lat1 = points[ui].Latitude();
lon1 = points[ui].Longitude();
lat2 = points[ui+1].Latitude();
lon2 = points[ui+1].Longitude();
x1 = (lon1-lon_c)*fastcosine(lat1);
y1 = (lat1-lat_c);
x2 = (lon2-lon_c)*fastcosine(lat2);
y2 = (lat2-lat_c);
int style = STYLE_REDTHICK;
if((ui > 0) && (ui < 3))
{
style = STYLE_BLUETHIN;
DistanceBearing(lat1, lon1, lat2, lon2, &fDist, &fAngle);
#ifdef DRAWPERCENT
if((result.Distance()> 5000) && bFAITri)
{
TCHAR text[180];
SIZE tsize;
fTotalPercent -= fDist/result.Distance();
_stprintf(text, TEXT("%3.1f%%"), (fDist/result.Distance()*100.0));
Surface.GetTextSize(text, _tcslen(text), &tsize);
#ifndef UNDITHER
Surface.SetTextColor(RGB_BLUE);
#else
Surface.SetTextColor(RGB_BLACK);
#endif
Surface.DrawText(ScaleX(rc, x1 +( x2-x1)/2)-tsize.cx/2, ScaleY(rc,y1 + (y2-y1)/2), text, _tcslen(text));
}
#endif
DrawLine(Surface, rc, x1, y1, x2, y2, style);
}
}
if(bFAITri)
{
if(points.size() >3)
{
if(ISPARAGLIDER)
{
lat0 = CContestMgr::Instance().GetBestNearClosingPoint().Latitude();
lon0 = CContestMgr::Instance().GetBestNearClosingPoint().Longitude();
lat1 = CContestMgr::Instance().GetBestClosingPoint().Latitude();
lon1 = CContestMgr::Instance().GetBestClosingPoint().Longitude();
x1 = (lon0-lon_c)*fastcosine(lat0);
y1 = (lat0-lat_c);
x2 = (lon1-lon_c)*fastcosine(lat1);
y2 = (lat1-lat_c);
DrawLine(Surface, rc, x1, y1, x2, y2, STYLE_ORANGETHIN ); //result.Predicted() ? STYLE_BLUETHIN : STYLE_REDTHICK);
}
lat1 = points[1].Latitude();
示例13: RenderNearAirspace
//.........这里部分代码省略.........
sDia.fYMax *= fHeigtScaleFact;
}
/****************************************************************************************************
* draw topview first
****************************************************************************************************/
if(fSplitFact > 0.0)
{
sDia.rc = rct;
sDia.rc.bottom-=1;
SharedTopView(Surface, &sDia, (double) iAS_Bearing, (double) wpt_brg);
}
/****************************************************************************************************
* draw airspace and terrain elements
****************************************************************************************************/
RECT rcc = rc; /* rc corrected */
if(sDia.fYMin < GC_SEA_LEVEL_TOLERANCE)
rcc.bottom -= SV_BORDER_Y; /* scale witout sea */
sDia.rc = rcc;
RenderAirspaceTerrain(Surface, GPSlat, GPSlon, iAS_Bearing, &sDia );
LKFont hfOld = Surface.SelectObject(LK8InfoNormalFont);
if(bValid) {
LKASSERT(_tcslen(near_airspace.Name())<TBSIZE); // Diagnostic only in 3.1j, to be REMOVED
LK_tcsncpy(Sideview_szNearAS, near_airspace.Name(), TBSIZE );
} else
{
_stprintf(text,TEXT("%s"), MsgToken(1259)); // LKTOKEN [email protected]_ "Too far, not calculated"
Surface.GetTextSize(text, _tcslen(text), &tsize);
TxYPt.x = (rc.right-rc.left-tsize.cx)/2;
TxYPt.y = (rc.bottom-rc.top)/2;
Surface.SetBkMode(TRANSPARENT);
Surface.DrawText(TxYPt.x, TxYPt.y-20, text, _tcslen(text));
_stprintf(Sideview_szNearAS,TEXT("%s"), text);
}
Surface.SelectObject(hfOld);
/****************************************************************************************************
* draw airspace and terrain elements
****************************************************************************************************/
/****************************************************************************************************
* draw diagram
****************************************************************************************************/
double xtick = 1.0;
double fRange =fabs(sDia.fXMax - sDia.fXMin) ;
if (fRange>3.0*1000.0) xtick = 2.0;
if (fRange>15*1000.0) xtick = 5.0;
if (fRange>50.0*1000.0) xtick = 10.0;
if (fRange>100.0*1000.0) xtick = 20.0;
if (fRange>200.0*1000.0) xtick = 25.0;
if (fRange>250.0*1000.0) xtick = 50.0;
if (fRange>500.0*1000.0) xtick = 100.0;
if (fRange>1000.0*1000.0) xtick = 1000.0;
if(bInvCol)
{
Surface.SelectObject(LK_BLACK_PEN);
Surface.SelectObject(LKBrush_Black);
示例14: DrawAspNearest
void MapWindow::DrawAspNearest(LKSurface& Surface, const RECT& rc) {
SIZE ASPTextSize, DSTextSize, BETextSize, TYTextSize, ACTextSize, HLTextSize, MITextSize;
SIZE phdrTextSize;
TCHAR Buffer[LKSIZEBUFFERLARGE];
static RECT s_sortBox[6];
static TCHAR Buffer1[MAXNEARAIRSPACES][MAXAIRSPACENUMPAGES][30], Buffer2[MAXNEARAIRSPACES][MAXAIRSPACENUMPAGES][12];
static TCHAR Buffer3[MAXNEARAIRSPACES][MAXAIRSPACENUMPAGES][12];
static TCHAR Buffer4[MAXNEARAIRSPACES][MAXAIRSPACENUMPAGES][12], Buffer5[MAXNEARAIRSPACES][MAXAIRSPACENUMPAGES][12];
static short s_maxnlname;
static TCHAR s_trailspace[3];
short i, j, k, iRaw, wlen, rli=0, curpage, drawn_items_onpage;
double value;
LKColor rcolor;
// column0 starts after writing 1:2 (ModeIndex:CURTYPE+1) with a different font..
static short Column0;
static short Column1, Column2, Column3, Column4, Column5;
static POINT p1, p2;
static short s_rawspace;
static unsigned short lincr;
// Printable area for live nearest values
static short left,right,bottom;
// one for each mapspace, no matter if 0 and 1 are unused
// we lock to current mapspace for this drawing
short curmapspace=MapSpaceMode;
static int AspNumraws=0;
static bool usetwolines=0;
// Vertical and horizontal spaces
#define INTERRAW 1
#define HEADRAW NIBLSCALE(6)
BrushReference sortbrush;
RECT invsel;
if (INVERTCOLORS) {
sortbrush=LKBrush_LightGreen;
} else {
sortbrush=LKBrush_DarkGreen;
}
if (DoInit[MDI_DRAWASPNEAREST]) {
usetwolines=UseTwoLines;
// Set screen borders to avoid writing on extreme pixels
if ( !ScreenLandscape ) {
// Portrait mode can work on two rows
left=rc.left+NIBLSCALE(1);
right=rc.right-NIBLSCALE(1);
bottom=rc.bottom-BottomSize-NIBLSCALE(2);
s_maxnlname=7;
_stprintf(Buffer,TEXT("AKSJSMMMM"));
} else {
left=rc.left+NIBLSCALE(5);
right=rc.right-NIBLSCALE(5);
bottom=rc.bottom-BottomSize;
s_maxnlname=15;
_stprintf(Buffer,TEXT("ABCDEF GHIJK-LM"));
// now resize for tuning on resolutions
if (ScreenSize == ss320x240) s_maxnlname=9;
if (ScreenSize == ss400x240) s_maxnlname=10;
}
Buffer[s_maxnlname]='\0';
/// WPT is now AIRSPACE name
Surface.SelectObject(LK8InfoBigFont); // Text font for Nearest was LK8Title
Surface.GetTextSize(Buffer, _tcslen(Buffer), &ASPTextSize);
// DST is always distance
_stprintf(Buffer,TEXT("000.0"));
Surface.GetTextSize(Buffer, _tcslen(Buffer), &DSTextSize);
// Bearing
_stprintf(Buffer,TEXT("<<123"));
Surface.GetTextSize(Buffer, _tcslen(Buffer), &BETextSize);
// TYPE, 4 letters printed
#define LKASP_TYPE_LEN 4
_stprintf(Buffer,TEXT("CTRA"));
Surface.GetTextSize(Buffer, _tcslen(Buffer), &TYTextSize);
// Flags can be SFE, three chars
_stprintf(Buffer,TEXT("SFE"));
Surface.GetTextSize(Buffer, _tcslen(Buffer), &ACTextSize);
Surface.SelectObject(LK8InfoNormalFont);
_stprintf(Buffer,TEXT("MMMM"));
Surface.GetTextSize(Buffer, _tcslen(Buffer), &HLTextSize);
Surface.SelectObject(LK8PanelMediumFont);
_stprintf(Buffer,TEXT("1.1"));
Surface.GetTextSize(Buffer, _tcslen(Buffer), &MITextSize);
short afterwpname=left+ASPTextSize.cx+NIBLSCALE(5);
//.........这里部分代码省略.........
示例15: RenderFAISector
//.........这里部分代码省略.........
Surface.SelectObject(hpOldPen);
Surface.SelectObject(hpOldBrush);
hpSectorPen.Release();
/********************************************************************
* calc round leg grid
********************************************************************/
hpSectorPen.Create(PEN_SOLID, (1), RGB_BLACK );
Surface.SelectObject(hpSectorPen);
Surface.SetTextColor(RGB_BLACK);
double fTic= 1/DISTANCEMODIFY;
if(fDist_c > 5/DISTANCEMODIFY) fTic = 10/DISTANCEMODIFY;
if(fDist_c > 50/DISTANCEMODIFY) fTic = 25/DISTANCEMODIFY;
if(fDist_c > 100/DISTANCEMODIFY) fTic = 50/DISTANCEMODIFY;
// if(fDist_c > 200/DISTANCEMODIFY) fTic = 100/DISTANCEMODIFY;
if(fDist_c > 500/DISTANCEMODIFY) fTic = 250/DISTANCEMODIFY;
POINT line[2];
BOOL bFirstUnit = true;
LKASSERT(fTic!=0);
fDistTri = ((int)(fDistMin/fTic)+1) * fTic ;
LKFont hfOld = Surface.SelectObject(LK8PanelUnitFont);
int iCnt = 0;
while(fDistTri <= fDistMax)
{
TCHAR text[180]; SIZE tsize;
if(bFirstUnit)
_stprintf(text, TEXT("%i%s"), (int)(fDistTri*DISTANCEMODIFY), Units::GetUnitName(Units::GetUserDistanceUnit()));
else
_stprintf(text, TEXT("%i"), (int)(fDistTri*DISTANCEMODIFY));
bFirstUnit = false;
Surface.GetTextSize(text, _tcslen(text), &tsize);
int j=0;
if(fDistTri < FAI28_45Threshold)
{
fDist_b = fDistTri*FAI_NORMAL_PERCENTAGE;
fDist_a = fDistTri-fDist_b-fDist_c;
fDelta_Dist = (fDist_a-fDist_b) / (double)(FAI_SECTOR_STEPS-1);
}
else
{
fMaxLeg = fDistTri*FAI_BIG_MAX_PERCENTAGE;
fMinLeg = fDistTri*FAI_BIG_PERCENTAGE;
fA = fMaxLeg;
fB = fDistTri-fA-fDist_c;
fDist_a = fA;
fDist_b = fB;
if(fB < fMinLeg)
{
fDiff = fMinLeg-fB;
fB+=2*fDiff;
fDist_b += fDiff;
fDist_a -= fDiff;
}
if(fB > fMaxLeg)
{
fDiff = fB - fMaxLeg;
fB+=2*fDiff;
fDist_b-=fDiff;
fDist_a+=fDiff;
}
fFAI_Percentage = FAI_BIG_PERCENTAGE;