mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 19:20:45 +00:00
Vertical Text fix
This commit is contained in:
parent
89d51c16fe
commit
afb8065ca3
@ -152,9 +152,9 @@ void gBarChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
GetTextExtent(str, textX, textY);
|
GetTextExtent(str, textX, textY);
|
||||||
float j=t1+((t2/2.0)+(textY/2.0)+5);
|
float j=t1+((t2/2.0)+(textY/2.0)+5);
|
||||||
if (m_orientation==Qt::Vertical) {
|
if (m_orientation==Qt::Vertical) {
|
||||||
DrawText(w,str,start_px-textX-8,scry-j);
|
DrawText(str,start_px-textX-8,scry-j);
|
||||||
} else {
|
} else {
|
||||||
DrawText(w,str,j,scry-(start_py-3-(textX/2)),90);
|
DrawText(str,j,scry-(start_py-3-(textX/2)),90);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,10 @@ void gCandleStick::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
if (t2>x+5) {
|
if (t2>x+5) {
|
||||||
int j=t1+((t2/2.0)-(x/2.0));
|
int j=t1+((t2/2.0)-(x/2.0));
|
||||||
if (m_orientation==Qt::Vertical) {
|
if (m_orientation==Qt::Vertical) {
|
||||||
DrawText(w,str,start_px+barwidth+2+y,scry-j,270.0);
|
DrawText(str,start_px+barwidth+2+y,scry-j,270.0);
|
||||||
} else {
|
} else {
|
||||||
w.renderText(j,float(scry)-(float(start_py)+(barwidth/2.0)-(y/2.0)),str);
|
//w.renderText(j,float(scry)-(float(start_py)+(barwidth/2.0)-(y/2.0)),str);
|
||||||
//DrawText(w,str,j,scry-(start_py+(barwidth/2.0)-(y/2.0)));
|
DrawText(str,j,float(scry)-(float(start_py)+(barwidth/2.0)-(y/2.0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // for (int i
|
} // for (int i
|
||||||
|
@ -119,9 +119,7 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
// Draw text label
|
// Draw text label
|
||||||
float x,y;
|
float x,y;
|
||||||
GetTextExtent(label,x,y);
|
GetTextExtent(label,x,y);
|
||||||
DrawText(w,label,start_px-x-10,(scry-line_top)-(line_h/2)+(y/2)); //(line_top-((line_h/2)-(y/2))+4));
|
DrawText(label,start_px-x-10,(scry-line_top)-(line_h/2)+(y/2));
|
||||||
//glColor3ub(0,0,0);
|
|
||||||
//w.renderText(start_px-x-10,scry-(line_top+(line_h/2)-(y/2)+3),label);
|
|
||||||
float x1,x2;
|
float x1,x2;
|
||||||
|
|
||||||
QColor & col=color[0];
|
QColor & col=color[0];
|
||||||
|
@ -73,7 +73,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
//TextMarkup...
|
//TextMarkup...
|
||||||
GetTextExtent(msg,x,y,bigfont);
|
GetTextExtent(msg,x,y,bigfont);
|
||||||
//w.renderText(start_px+(width/2.0)-(x/2.0),start_py+(height/2.0)-(y/2.0),msg,*bigfont);
|
//w.renderText(start_px+(width/2.0)-(x/2.0),start_py+(height/2.0)-(y/2.0),msg,*bigfont);
|
||||||
DrawText(w,msg,start_px+(width/2.0)-(x/2.0),scry-w.GetBottomMargin()-height/2.0+y/2.0,0,Qt::gray,bigfont);//-(y/2.0)
|
DrawText(msg,start_px+(width/2.0)-(x/2.0),scry-w.GetBottomMargin()-height/2.0+y/2.0,0,Qt::gray,bigfont);//-(y/2.0)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ void gLineOverlayBar::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
vertarray[vertcnt++]=bottom;
|
vertarray[vertcnt++]=bottom;
|
||||||
if (xx<(1800.0/86400.0)) {
|
if (xx<(1800.0/86400.0)) {
|
||||||
GetTextExtent(label,x,y);
|
GetTextExtent(label,x,y);
|
||||||
DrawText(w,label,x1-(x/2),scry-(start_py+height-30+y));
|
DrawText(label,x1-(x/2),scry-(start_py+height-30+y));
|
||||||
//w.renderText(x1-(x/2),scry-(start_py+height-30+y),label);
|
//w.renderText(x1-(x/2),scry-(start_py+height-30+y),label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ void gTitle::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
GetTextExtent(m_title,width,height);
|
GetTextExtent(m_title,width,height);
|
||||||
int xp=(height/2)+20;
|
int xp=(height/2)+20;
|
||||||
//if (m_alignment==wxALIGN_RIGHT) xp=scrx-4-height;
|
//if (m_alignment==wxALIGN_RIGHT) xp=scrx-4-height;
|
||||||
DrawText(w,m_title,xp,scry-(w.GetBottomMargin()+((scry-w.GetBottomMargin())/2.0)),90.0,m_color,&m_font);
|
DrawText(m_title,xp,scry-(w.GetBottomMargin()+((scry-w.GetBottomMargin())/2.0)),90.0,m_color,&m_font);
|
||||||
|
|
||||||
//DrawText(w,m_title,150,-40,45.0); //20+xp,scry-(w.GetBottomMargin()+((scry-w.GetBottomMargin())/2.0)+(height/2)),90.0,m_color,&m_font);
|
//DrawText(w,m_title,150,-40,45.0); //20+xp,scry-(w.GetBottomMargin()+((scry-w.GetBottomMargin())/2.0)+(height/2)),90.0,m_color,&m_font);
|
||||||
|
|
||||||
|
@ -165,10 +165,10 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
GetTextExtent(fd,x,y);
|
GetTextExtent(fd,x,y);
|
||||||
//glColor3ub(0,0,0);
|
//glColor3ub(0,0,0);
|
||||||
if (!show_time) {
|
if (!show_time) {
|
||||||
DrawText(w,fd, px+y, scry-(py-(x/2)-8), 90.0);
|
DrawText(fd, px+y, scry-(py-(x/2)-8), 90.0);
|
||||||
//w.renderText(px-(y/2)+2, scry-(py-(x/2)-20), 90.0,fd);
|
//w.renderText(px-(y/2)+2, scry-(py-(x/2)-20), 90.0,fd);
|
||||||
} else {
|
} else {
|
||||||
DrawText(w,fd, px-(x/2), scry-(py-8-y));
|
DrawText(fd, px-(x/2), scry-(py-8-y));
|
||||||
//w.renderText(px-(x/2), scry-(py-(y/2)-20), fd);
|
//w.renderText(px-(x/2), scry-(py-(y/2)-20), fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry)
|
|||||||
GetTextExtent(fd,x,y);
|
GetTextExtent(fd,x,y);
|
||||||
if (x>labelW) labelW=x;
|
if (x>labelW) labelW=x;
|
||||||
h=start_py+ty;
|
h=start_py+ty;
|
||||||
DrawText(w,fd,start_px-12-x,scry-(h-(y/2.0)),0); //
|
DrawText(fd,start_px-12-x,scry-(h-(y/2.0)),0);
|
||||||
//glColor3ub(0,0,0);
|
//glColor3ub(0,0,0);
|
||||||
//w.renderText(start_px-15-x, scry-(h - (y / 2)),fd);
|
//w.renderText(start_px-15-x, scry-(h - (y / 2)),fd);
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ inline void RDrawText(QPainter & painter, QString text, int x, int y, float ang
|
|||||||
painter.translate(floor(x),floor(y));
|
painter.translate(floor(x),floor(y));
|
||||||
painter.rotate(-90);
|
painter.rotate(-90);
|
||||||
painter.drawText(floor(-w/2.0),floor(-h/2.0),text);
|
painter.drawText(floor(-w/2.0),floor(-h/2.0),text);
|
||||||
|
painter.rotate(+90);
|
||||||
painter.translate(floor(-x),floor(-y));
|
painter.translate(floor(-x),floor(-y));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -124,11 +125,13 @@ void DrawTextQueue(gGraphWindow & wid)
|
|||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
// I bet this slows things down craploads.. should probably skip the vector and use a preallocated textbuffer array.
|
// I bet this slows things down craploads.. should probably skip the vector and use a preallocated textbuffer array.
|
||||||
void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QColor color,QFont *font)
|
void DrawText(QString text, int x, int y, float angle, QColor color,QFont *font)
|
||||||
{
|
{
|
||||||
TextBuffer *b=new TextBuffer(text,x,y,angle,color,font);
|
TextBuffer *b=new TextBuffer(text,x,y,angle,color,font);
|
||||||
if (!angle) TextQue.push_back(b);
|
if (angle==90)
|
||||||
else TextQueRot.push_back(b);
|
TextQueRot.push_back(b);
|
||||||
|
else
|
||||||
|
TextQue.push_back(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ extern GLshort *vertex_array[num_vert_arrays];
|
|||||||
|
|
||||||
class gGraphWindow;
|
class gGraphWindow;
|
||||||
void GetTextExtent(QString text, float & width, float & height, QFont *font=defaultfont);
|
void GetTextExtent(QString text, float & width, float & height, QFont *font=defaultfont);
|
||||||
void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle=0, QColor color=QColor("black"),QFont *font=defaultfont);
|
void DrawText(QString text, int x, int y, float angle=0, QColor color=QColor("black"),QFont *font=defaultfont);
|
||||||
void DrawTextQueue(gGraphWindow & wid);
|
void DrawTextQueue(gGraphWindow & wid);
|
||||||
|
|
||||||
void LinedRoundedRectangle(int x,int y,int w,int h,int radius,int lw,QColor color);
|
void LinedRoundedRectangle(int x,int y,int w,int h,int radius,int lw,QColor color);
|
||||||
|
Loading…
Reference in New Issue
Block a user