From 1068f61dc6aa709df52b54b6f22bf84593457040 Mon Sep 17 00:00:00 2001 From: Tim Deagan Date: Fri, 26 Dec 2014 21:44:31 -0600 Subject: [PATCH 1/5] Add optional menu driven scaling tics to the large axes Tim Deagan 12/26/2014 While add-on rulers can be extremely useful, there are many times that a quick scaling marker would be handy. This feature generates tics every 10 units, driven off the log10 of the l variable defining axes length. As you zoom in or out, the tics automatically re-scale themselves. Every tenth tic is slightly larger. A menu item is added to the view menu to enable or disable the feature. I experimented with menu driven scaling (.01, .1, 1, 10, etc.), but using small increments when zoomed out brought the app to it's knees. Adding a visual indicator of the current scaling might be nice, but I'm nto sure where to put it (possibly below the small axes,) since it changes as zooming and would clutter the console. Changes to be committed: new file: images/scalemarkers.png modified: openscad.qrc modified: src/GLView.cc modified: src/GLView.h modified: src/MainWindow.h modified: src/MainWindow.ui modified: src/QGLView.h modified: src/mainwin.cc --- images/scalemarkers.png | Bin 0 -> 265 bytes openscad.qrc | 1 + src/GLView.cc | 67 +++++++++++++++++++++++++++++++++++++++- src/GLView.h | 2 ++ src/MainWindow.h | 3 +- src/MainWindow.ui | 16 ++++++++++ src/QGLView.h | 4 +++ src/mainwin.cc | 15 ++++++++- 8 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 images/scalemarkers.png diff --git a/images/scalemarkers.png b/images/scalemarkers.png new file mode 100644 index 0000000000000000000000000000000000000000..067b936638574f58dfdd186f9b664ffc8ba3ff09 GIT binary patch literal 265 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwQM~clzb&qdhBT#6Xr;B4q#NoG-eYp-R2)NB(=qdh9 zZ0~=|H+JnOICq`M+BCDtLnvd5>A^|`s|ObK^AloZPSzd}<$9-gyHW3O`GvoUQW;^) z@>Q1|HcM47=_|aj^jqPd6R!1e#sYq?qIr#mo3@KFY;Vpjm#z|eu&?Mk^LyF*>-W#e zxb1AzG~Y=lZHU20i;XGVot97JIi literal 0 HcmV?d00001 diff --git a/openscad.qrc b/openscad.qrc index f202c2d46e..aa090fe45c 100644 --- a/openscad.qrc +++ b/openscad.qrc @@ -59,5 +59,6 @@ images/perspective1white.png images/crosswhite.png icons/background.png + images/scalemarkers.png diff --git a/src/GLView.cc b/src/GLView.cc index d52b3c9bd8..9fd6c4696f 100644 --- a/src/GLView.cc +++ b/src/GLView.cc @@ -23,6 +23,7 @@ GLView::GLView() showfaces = true; showaxes = false; showcrosshairs = false; + showscale = false; renderer = NULL; colorscheme = &ColorMap::inst()->defaultColorScheme(); cam = Camera(); @@ -164,6 +165,8 @@ void GLView::paintGL() glTranslated(cam.object_trans.x(), cam.object_trans.y(), cam.object_trans.z()); // ...the axis lines need to follow the object translation. if (showaxes) GLView::showAxes(bgcontrast); + // mark the scale along the axis lines + if (showscale) GLView::showScalemarkers(bgcontrast); } glEnable(GL_LIGHTING); @@ -354,7 +357,6 @@ void GLView::initializeGL() glEnable(GL_LIGHT1); glEnable(GL_LIGHTING); glEnable(GL_NORMALIZE); - glEnable(GL_LINE_STIPPLE); glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); // The following line is reported to fix issue #71 @@ -468,6 +470,7 @@ void GLView::showAxes(const Color4f &col) glEnd(); glPushAttrib(GL_LINE_BIT); + glEnable(GL_LINE_STIPPLE); glLineStipple(3, 0xAAAA); glBegin(GL_LINES); glVertex3d(0, 0, 0); @@ -496,3 +499,65 @@ void GLView::showCrosshairs() glEnd(); } +void GLView::showScalemarkers(const Color4f &col) +{ + // Add scale tics on large axes + double l = cam.projection == Camera::PERSPECTIVE ? cam.viewer_distance : cam.height; + glLineWidth(this->getDPI()); + glColor3f(col[0], col[1], col[2]); + + int log_l = (int)log10(l); + double j = 10; + j = pow(j,log_l-1); + int size_div_sm = 60; // divisor for l to determine tic size + int size_div = size_div_sm; + int line_cnt = 0; + + for (double i=0;i + @@ -826,6 +827,21 @@ Ctrl+3 + + + true + + + + :/images/scalemarkers.png:/images/scalemarkers.png + + + Show Scale Markers + + + true diff --git a/src/QGLView.h b/src/QGLView.h index 21b6133d63..29147aab50 100644 --- a/src/QGLView.h +++ b/src/QGLView.h @@ -17,6 +17,7 @@ class QGLView : public QGLWidget, public GLView Q_PROPERTY(bool showAxes READ showAxes WRITE setShowAxes); Q_PROPERTY(bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs); Q_PROPERTY(bool orthoMode READ orthoMode WRITE setOrthoMode); + Q_PROPERTY(double showScaleProportional READ showScaleProportional WRITE setShowScaleProportional); public: QGLView(QWidget *parent = NULL); @@ -35,6 +36,9 @@ class QGLView : public QGLWidget, public GLView void setShowCrosshairs(bool enabled) { this->showcrosshairs = enabled; } bool orthoMode() const { return (this->cam.projection == Camera::ORTHOGONAL); } void setOrthoMode(bool enabled); + bool showScaleProportional() const { return this->showscale; } + void setShowScaleProportional(bool enabled) { this->showscale = enabled; } + std::string getRendererInfo() const; #if QT_VERSION >= 0x050100 float getDPI() { return this->devicePixelRatio(); } diff --git a/src/mainwin.cc b/src/mainwin.cc index 3e51f1f322..4eb3d61103 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -370,7 +370,8 @@ MainWindow::MainWindow(const QString &filename) connect(this->viewActionShowEdges, SIGNAL(triggered()), this, SLOT(viewModeShowEdges())); connect(this->viewActionShowAxes, SIGNAL(triggered()), this, SLOT(viewModeShowAxes())); connect(this->viewActionShowCrosshairs, SIGNAL(triggered()), this, SLOT(viewModeShowCrosshairs())); - connect(this->viewActionAnimate, SIGNAL(triggered()), this, SLOT(viewModeAnimate())); + connect(this->viewActionShowScaleProportional, SIGNAL(triggered()), this, SLOT(viewModeShowScaleProportional())); + connect(this->viewActionAnimate, SIGNAL(triggered()), this, SLOT(viewModeAnimate())); connect(this->viewActionTop, SIGNAL(triggered()), this, SLOT(viewAngleTop())); connect(this->viewActionBottom, SIGNAL(triggered()), this, SLOT(viewAngleBottom())); connect(this->viewActionLeft, SIGNAL(triggered()), this, SLOT(viewAngleLeft())); @@ -605,6 +606,10 @@ void MainWindow::loadViewSettings(){ viewActionShowCrosshairs->setChecked(true); viewModeShowCrosshairs(); } + if (settings.value("view/showScaleProportional").toBool()) { + viewActionShowScaleProportional->setChecked(true); + viewModeShowScaleProportional(); + } if (settings.value("view/orthogonalProjection").toBool()) { viewOrthogonal(); } else { @@ -2218,6 +2223,14 @@ void MainWindow::viewModeShowCrosshairs() this->qglview->updateGL(); } +void MainWindow::viewModeShowScaleProportional() +{ + QSettings settings; + settings.setValue("view/showScaleProportional",viewActionShowScaleProportional->isChecked()); + this->qglview->setShowScaleProportional(viewActionShowScaleProportional->isChecked()); + this->qglview->updateGL(); +} + void MainWindow::viewModeAnimate() { if (viewActionAnimate->isChecked()) { From 4823f26706817aba81378408509080304e11be44 Mon Sep 17 00:00:00 2001 From: Tim Deagan Date: Mon, 29 Dec 2014 14:55:15 -0600 Subject: [PATCH 2/5] Addition of function to generate scale maker numeric values on large axes. modified: src/GLView.cc The added function takes the length of the axis (l), the currrent position on the axis (i) and the size of the divisions between i and uses a variety of arrays to decode the characters of the position into GL_LINES, GL_LINE_STRIPs, GL_LINE_LOOPs as appropriate. The various orientations required by the axis are handled by abstracting the line vertex sequences into arrays (set per axis.) --- src/GLView.cc | 320 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 284 insertions(+), 36 deletions(-) diff --git a/src/GLView.cc b/src/GLView.cc index 9fd6c4696f..bbe8c566ee 100644 --- a/src/GLView.cc +++ b/src/GLView.cc @@ -506,58 +506,306 @@ void GLView::showScalemarkers(const Color4f &col) glLineWidth(this->getDPI()); glColor3f(col[0], col[1], col[2]); + // determine the log value to provide proportional tics int log_l = (int)log10(l); + + // j represents the increment for each minor tic double j = 10; - j = pow(j,log_l-1); - int size_div_sm = 60; // divisor for l to determine tic size + // deal with 0 log values + if (l < 1.5){ + j = pow(10,log_l-2); + } else { + j = pow(10,log_l-1); + } + + int size_div_sm = 60; // divisor for l to determine minor tic size int size_div = size_div_sm; int line_cnt = 0; - for (double i=0;i( &(std::ostringstream() << i) )->str(); + + // setup how far above the axis (or tic TBD) to draw the number + double dig_buf = (l/size_div_sm)/4; + // setup the size of the character box + double dig_w = (l/size_div_sm)/2; + double dig_h = (l/size_div_sm) + dig_buf; + // setup the distance between characters + double kern = dig_buf; + double dig_wk = (dig_w) + kern; + + // set up ordering for different axes + int ax[6][3] = { + {0,1,2}, + {1,0,2}, + {1,2,0}, + {0,1,2}, + {1,0,2}, + {1,2,0}}; + + // set up character vertex seqeunces for different axes + int or_2[6][6]={ + {0,1,3,2,4,5}, + {1,0,2,3,5,4}, + {1,0,2,3,5,4}, + {1,0,2,3,5,4}, + {0,1,3,2,4,5}, + {0,1,3,2,4,5}}; + + int or_3[6][7]={ + {0,1,3,2,3,5,4}, + {1,0,2,3,2,4,5}, + {1,0,2,3,2,4,5}, + {1,0,2,3,2,4,5}, + {0,1,3,2,3,5,4}, + {0,1,3,2,3,5,4}}; + + int or_4[6][5]={ + {0,2,3,1,5}, + {1,3,2,0,4}, + {1,3,2,0,4}, + {1,3,2,0,4}, + {0,2,3,1,5}, + {0,2,3,1,5}}; + + int or_5[6][6]={ + {1,0,2,3,5,4}, + {0,1,3,2,4,5}, + {0,1,3,2,4,5}, + {0,1,3,2,4,5}, + {1,0,2,3,5,4}, + {1,0,2,3,5,4}}; + + int or_6[6][6]={ + {1,0,4,3,5,2}, + {0,1,5,4,2,3}, + {0,1,5,4,2,3}, + {0,1,5,4,2,3}, + {1,0,4,3,5,2}, + {1,0,4,3,5,2}}; + + int or_7[6][3]={ + {0,1,4}, + {1,0,5}, + {1,0,5}, + {1,0,5}, + {0,1,4}, + {0,1,4}}; + + int or_9[6][5]={ + {5,1,0,2,3}, + {4,0,1,3,2}, + {4,0,1,3,2}, + {4,0,1,3,2}, + {5,1,0,2,3}, + {5,1,0,2,3}}; + + std::string stash_digit = digit; + + // walk through axes + for (int di=0;di<6;di++){ + + // setup negative axes + double polarity = 1; + if (di>2){ + polarity = -1; + digit = "-" + stash_digit; + } + + if (di>0 && di<4){ + std::reverse(digit.begin(),digit.end()); + } + + // walk through and render the characters of the string + for(std::string::size_type char_num = 0; char_num < digit.size(); ++char_num){ + + double dig_vrt[6][3] = { + {polarity*((i+((char_num)*dig_wk))-(dig_w/2)),dig_h,0}, + {polarity*((i+((char_num)*dig_wk))+(dig_w/2)),dig_h,0}, + {polarity*((i+((char_num)*dig_wk))-(dig_w/2)),dig_h/2+dig_buf,0}, + {polarity*((i+((char_num)*dig_wk))+(dig_w/2)),dig_h/2+dig_buf,0}, + {polarity*((i+((char_num)*dig_wk))-(dig_w/2)),dig_buf,0}, + {polarity*((i+((char_num)*dig_wk))+(dig_w/2)),dig_buf,0}}; + + switch(digit[char_num]){ + case '1': + glBegin(GL_LINES); + glVertex3d(dig_vrt[0][ax[di][0]],dig_vrt[0][ax[di][1]],dig_vrt[0][ax[di][2]]); //a + glVertex3d(dig_vrt[4][ax[di][0]],dig_vrt[4][ax[di][1]],dig_vrt[4][ax[di][2]]); //e + glEnd(); + break; + + case '2': + glBegin(GL_LINE_STRIP); + glVertex3d(dig_vrt[or_2[di][0]][ax[di][0]],dig_vrt[or_2[di][0]][ax[di][1]],dig_vrt[or_2[di][0]][ax[di][2]]); //a + glVertex3d(dig_vrt[or_2[di][1]][ax[di][0]],dig_vrt[or_2[di][1]][ax[di][1]],dig_vrt[or_2[di][1]][ax[di][2]]); //b + glVertex3d(dig_vrt[or_2[di][2]][ax[di][0]],dig_vrt[or_2[di][2]][ax[di][1]],dig_vrt[or_2[di][2]][ax[di][2]]); //d + glVertex3d(dig_vrt[or_2[di][3]][ax[di][0]],dig_vrt[or_2[di][3]][ax[di][1]],dig_vrt[or_2[di][3]][ax[di][2]]); //c + glVertex3d(dig_vrt[or_2[di][4]][ax[di][0]],dig_vrt[or_2[di][4]][ax[di][1]],dig_vrt[or_2[di][4]][ax[di][2]]); //e + glVertex3d(dig_vrt[or_2[di][5]][ax[di][0]],dig_vrt[or_2[di][5]][ax[di][1]],dig_vrt[or_2[di][5]][ax[di][2]]); //f + glEnd(); + break; + + case '3': + glBegin(GL_LINE_STRIP); + glVertex3d(dig_vrt[or_3[di][0]][ax[di][0]],dig_vrt[or_3[di][0]][ax[di][1]],dig_vrt[or_3[di][0]][ax[di][2]]); //a + glVertex3d(dig_vrt[or_3[di][1]][ax[di][0]],dig_vrt[or_3[di][1]][ax[di][1]],dig_vrt[or_3[di][1]][ax[di][2]]); //b + glVertex3d(dig_vrt[or_3[di][2]][ax[di][0]],dig_vrt[or_3[di][2]][ax[di][1]],dig_vrt[or_3[di][2]][ax[di][2]]); //d + glVertex3d(dig_vrt[or_3[di][3]][ax[di][0]],dig_vrt[or_3[di][3]][ax[di][1]],dig_vrt[or_3[di][3]][ax[di][2]]); //c + glVertex3d(dig_vrt[or_3[di][4]][ax[di][0]],dig_vrt[or_3[di][4]][ax[di][1]],dig_vrt[or_3[di][4]][ax[di][2]]); //d + glVertex3d(dig_vrt[or_3[di][5]][ax[di][0]],dig_vrt[or_3[di][5]][ax[di][1]],dig_vrt[or_3[di][5]][ax[di][2]]); //f + glVertex3d(dig_vrt[or_3[di][6]][ax[di][0]],dig_vrt[or_3[di][6]][ax[di][1]],dig_vrt[or_3[di][6]][ax[di][2]]); //e + glEnd(); + break; + + case '4': + glBegin(GL_LINE_STRIP); + glVertex3d(dig_vrt[or_4[di][0]][ax[di][0]],dig_vrt[or_4[di][0]][ax[di][1]],dig_vrt[or_4[di][0]][ax[di][2]]); //a + glVertex3d(dig_vrt[or_4[di][1]][ax[di][0]],dig_vrt[or_4[di][1]][ax[di][1]],dig_vrt[or_4[di][1]][ax[di][2]]); //c + glVertex3d(dig_vrt[or_4[di][2]][ax[di][0]],dig_vrt[or_4[di][2]][ax[di][1]],dig_vrt[or_4[di][2]][ax[di][2]]); //d + glVertex3d(dig_vrt[or_4[di][3]][ax[di][0]],dig_vrt[or_4[di][3]][ax[di][1]],dig_vrt[or_4[di][3]][ax[di][2]]); //b + glVertex3d(dig_vrt[or_4[di][4]][ax[di][0]],dig_vrt[or_4[di][4]][ax[di][1]],dig_vrt[or_4[di][4]][ax[di][2]]); //f + glEnd(); + break; + + case '5': + glBegin(GL_LINE_STRIP); + glVertex3d(dig_vrt[or_5[di][0]][ax[di][0]],dig_vrt[or_5[di][0]][ax[di][1]],dig_vrt[or_5[di][0]][ax[di][2]]); //b + glVertex3d(dig_vrt[or_5[di][1]][ax[di][0]],dig_vrt[or_5[di][1]][ax[di][1]],dig_vrt[or_5[di][1]][ax[di][2]]); //a + glVertex3d(dig_vrt[or_5[di][2]][ax[di][0]],dig_vrt[or_5[di][2]][ax[di][1]],dig_vrt[or_5[di][2]][ax[di][2]]); //c + glVertex3d(dig_vrt[or_5[di][3]][ax[di][0]],dig_vrt[or_5[di][3]][ax[di][1]],dig_vrt[or_5[di][3]][ax[di][2]]); //d + glVertex3d(dig_vrt[or_5[di][4]][ax[di][0]],dig_vrt[or_5[di][4]][ax[di][1]],dig_vrt[or_5[di][4]][ax[di][2]]); //f + glVertex3d(dig_vrt[or_5[di][5]][ax[di][0]],dig_vrt[or_5[di][5]][ax[di][1]],dig_vrt[or_5[di][5]][ax[di][2]]); //e + glEnd(); + break; + + case '6': + glBegin(GL_LINE_STRIP); + glVertex3d(dig_vrt[or_6[di][0]][ax[di][0]],dig_vrt[or_6[di][0]][ax[di][1]],dig_vrt[or_6[di][0]][ax[di][2]]); //b + glVertex3d(dig_vrt[or_6[di][1]][ax[di][0]],dig_vrt[or_6[di][1]][ax[di][1]],dig_vrt[or_6[di][1]][ax[di][2]]); //a + glVertex3d(dig_vrt[or_6[di][2]][ax[di][0]],dig_vrt[or_6[di][2]][ax[di][1]],dig_vrt[or_6[di][2]][ax[di][2]]); //e + glVertex3d(dig_vrt[or_6[di][3]][ax[di][0]],dig_vrt[or_6[di][3]][ax[di][1]],dig_vrt[or_6[di][3]][ax[di][2]]); //f + glVertex3d(dig_vrt[or_6[di][4]][ax[di][0]],dig_vrt[or_6[di][4]][ax[di][1]],dig_vrt[or_6[di][4]][ax[di][2]]); //d + glVertex3d(dig_vrt[or_6[di][5]][ax[di][0]],dig_vrt[or_6[di][5]][ax[di][1]],dig_vrt[or_6[di][5]][ax[di][2]]); //c + glEnd(); + break; + + case '7': + glBegin(GL_LINE_STRIP); + glVertex3d(dig_vrt[or_7[di][0]][ax[di][0]],dig_vrt[or_7[di][0]][ax[di][1]],dig_vrt[or_7[di][0]][ax[di][2]]); //a + glVertex3d(dig_vrt[or_7[di][1]][ax[di][0]],dig_vrt[or_7[di][1]][ax[di][1]],dig_vrt[or_7[di][1]][ax[di][2]]); //b + glVertex3d(dig_vrt[or_7[di][2]][ax[di][0]],dig_vrt[or_7[di][2]][ax[di][1]],dig_vrt[or_7[di][2]][ax[di][2]]); //e + glEnd(); + break; + + case '8': + glBegin(GL_LINE_STRIP); + glVertex3d(dig_vrt[2][ax[di][0]],dig_vrt[2][ax[di][1]],dig_vrt[2][ax[di][2]]); //c + glVertex3d(dig_vrt[3][ax[di][0]],dig_vrt[3][ax[di][1]],dig_vrt[3][ax[di][2]]); //d + glVertex3d(dig_vrt[1][ax[di][0]],dig_vrt[1][ax[di][1]],dig_vrt[1][ax[di][2]]); //b + glVertex3d(dig_vrt[0][ax[di][0]],dig_vrt[0][ax[di][1]],dig_vrt[0][ax[di][2]]); //a + glVertex3d(dig_vrt[4][ax[di][0]],dig_vrt[4][ax[di][1]],dig_vrt[4][ax[di][2]]); //e + glVertex3d(dig_vrt[5][ax[di][0]],dig_vrt[5][ax[di][1]],dig_vrt[5][ax[di][2]]); //f + glVertex3d(dig_vrt[3][ax[di][0]],dig_vrt[3][ax[di][1]],dig_vrt[3][ax[di][2]]); //d + glEnd(); + break; + + case '9': + glBegin(GL_LINE_STRIP); + glVertex3d(dig_vrt[or_9[di][0]][ax[di][0]],dig_vrt[or_9[di][0]][ax[di][1]],dig_vrt[or_9[di][0]][ax[di][2]]); //f + glVertex3d(dig_vrt[or_9[di][1]][ax[di][0]],dig_vrt[or_9[di][1]][ax[di][1]],dig_vrt[or_9[di][1]][ax[di][2]]); //b + glVertex3d(dig_vrt[or_9[di][2]][ax[di][0]],dig_vrt[or_9[di][2]][ax[di][1]],dig_vrt[or_9[di][2]][ax[di][2]]); //a + glVertex3d(dig_vrt[or_9[di][3]][ax[di][0]],dig_vrt[or_9[di][3]][ax[di][1]],dig_vrt[or_9[di][3]][ax[di][2]]); //c + glVertex3d(dig_vrt[or_9[di][4]][ax[di][0]],dig_vrt[or_9[di][4]][ax[di][1]],dig_vrt[or_9[di][4]][ax[di][2]]); //d + glEnd(); + break; + + case '0': + glBegin(GL_LINE_LOOP); + glVertex3d(dig_vrt[0][ax[di][0]],dig_vrt[0][ax[di][1]],dig_vrt[0][ax[di][2]]); //a + glVertex3d(dig_vrt[1][ax[di][0]],dig_vrt[1][ax[di][1]],dig_vrt[1][ax[di][2]]); //b + glVertex3d(dig_vrt[5][ax[di][0]],dig_vrt[5][ax[di][1]],dig_vrt[5][ax[di][2]]); //f + glVertex3d(dig_vrt[4][ax[di][0]],dig_vrt[4][ax[di][1]],dig_vrt[4][ax[di][2]]); //e + glEnd(); + break; + + case '-': + glBegin(GL_LINES); + glVertex3d(dig_vrt[2][ax[di][0]],dig_vrt[2][ax[di][1]],dig_vrt[2][ax[di][2]]); //c + glVertex3d(dig_vrt[3][ax[di][0]],dig_vrt[3][ax[di][1]],dig_vrt[3][ax[di][2]]); //d + glEnd(); + break; + + case '.': + glBegin(GL_LINES); + glVertex3d(dig_vrt[4][ax[di][0]],dig_vrt[4][ax[di][1]],dig_vrt[4][ax[di][2]]); //e + glVertex3d(dig_vrt[5][ax[di][0]],dig_vrt[5][ax[di][1]],dig_vrt[5][ax[di][2]]); //f + glEnd(); + break; + } + } + } +} + From 1826aa98f77cd9052c2c953f0fc08da3be679fbc Mon Sep 17 00:00:00 2001 From: Tim Deagan Date: Mon, 29 Dec 2014 15:00:37 -0600 Subject: [PATCH 3/5] Addition of header to support function to print scale marker position values on large axes. modified: src/GLView.h --- src/GLView.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GLView.h b/src/GLView.h index 9276aae841..c3f93f0351 100644 --- a/src/GLView.h +++ b/src/GLView.h @@ -78,4 +78,5 @@ class GLView void showAxes(const Color4f &col); void showSmallaxes(const Color4f &col); void showScalemarkers(const Color4f &col); + void decodeMarkerValue(double i, double l, int size_div_sm); }; From 7a71e59f2d3c9208480ce4ed03885136828839d9 Mon Sep 17 00:00:00 2001 From: Tim Deagan Date: Mon, 29 Dec 2014 21:23:46 -0600 Subject: [PATCH 4/5] Fix layout of number 6 character & add comments The layout of the array that drives the 6 char was wrong. Additional commenting added --- src/GLView.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/GLView.cc b/src/GLView.cc index bbe8c566ee..af0b7465d7 100644 --- a/src/GLView.cc +++ b/src/GLView.cc @@ -639,12 +639,12 @@ void GLView::decodeMarkerValue(double i, double l, int size_div_sm) {1,0,2,3,5,4}}; int or_6[6][6]={ - {1,0,4,3,5,2}, + {1,0,4,5,3,2}, {0,1,5,4,2,3}, {0,1,5,4,2,3}, {0,1,5,4,2,3}, - {1,0,4,3,5,2}, - {1,0,4,3,5,2}}; + {1,0,4,5,3,2}, + {1,0,4,5,3,2}}; int or_7[6][3]={ {0,1,4}, @@ -674,13 +674,14 @@ void GLView::decodeMarkerValue(double i, double l, int size_div_sm) digit = "-" + stash_digit; } + // fix the axes that need to run the opposite direction if (di>0 && di<4){ std::reverse(digit.begin(),digit.end()); } // walk through and render the characters of the string for(std::string::size_type char_num = 0; char_num < digit.size(); ++char_num){ - + // setup the vertices for the char rendering based on the axis and position double dig_vrt[6][3] = { {polarity*((i+((char_num)*dig_wk))-(dig_w/2)),dig_h,0}, {polarity*((i+((char_num)*dig_wk))+(dig_w/2)),dig_h,0}, @@ -689,6 +690,13 @@ void GLView::decodeMarkerValue(double i, double l, int size_div_sm) {polarity*((i+((char_num)*dig_wk))-(dig_w/2)),dig_buf,0}, {polarity*((i+((char_num)*dig_wk))+(dig_w/2)),dig_buf,0}}; + // convert the char into lines appropriate for the axis being used + // psuedo 7 segment vertices are: + // A--B + // | | + // C--D + // | | + // E--F switch(digit[char_num]){ case '1': glBegin(GL_LINES); From 358ba86fc8e383c2907c5c83658a0568435ebee0 Mon Sep 17 00:00:00 2001 From: Tim Deagan Date: Fri, 2 Jan 2015 01:32:37 -0600 Subject: [PATCH 5/5] Swap out spaces for tabs modified: src/GLView.h modified: src/MainWindow.h modified: src/QGLView.h modified: src/mainwin.cc QtCreator ignores the prefs and will only put in spaces instead of tabs. These are manual fixes in Notepad++ to try and keep the indents in the standard mode. --- src/GLView.h | 6 +++--- src/MainWindow.h | 4 ++-- src/QGLView.h | 7 +++---- src/mainwin.cc | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/GLView.h b/src/GLView.h index c3f93f0351..734139c645 100644 --- a/src/GLView.h +++ b/src/GLView.h @@ -62,7 +62,7 @@ class GLView bool showfaces; bool showedges; bool showcrosshairs; - bool showscale; + bool showscale; #ifdef ENABLE_OPENCSG GLint shaderinfo[11]; @@ -77,6 +77,6 @@ class GLView void showCrosshairs(); void showAxes(const Color4f &col); void showSmallaxes(const Color4f &col); - void showScalemarkers(const Color4f &col); - void decodeMarkerValue(double i, double l, int size_div_sm); + void showScalemarkers(const Color4f &col); + void decodeMarkerValue(double i, double l, int size_div_sm); }; diff --git a/src/MainWindow.h b/src/MainWindow.h index e4aa2304ea..32717d74a2 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -213,8 +213,8 @@ public slots: void viewModeShowEdges(); void viewModeShowAxes(); void viewModeShowCrosshairs(); - void viewModeShowScaleProportional(); - void viewModeAnimate(); + void viewModeShowScaleProportional(); + void viewModeAnimate(); void viewAngleTop(); void viewAngleBottom(); void viewAngleLeft(); diff --git a/src/QGLView.h b/src/QGLView.h index 29147aab50..3891ee51ed 100644 --- a/src/QGLView.h +++ b/src/QGLView.h @@ -17,7 +17,7 @@ class QGLView : public QGLWidget, public GLView Q_PROPERTY(bool showAxes READ showAxes WRITE setShowAxes); Q_PROPERTY(bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs); Q_PROPERTY(bool orthoMode READ orthoMode WRITE setOrthoMode); - Q_PROPERTY(double showScaleProportional READ showScaleProportional WRITE setShowScaleProportional); + Q_PROPERTY(double showScaleProportional READ showScaleProportional WRITE setShowScaleProportional); public: QGLView(QWidget *parent = NULL); @@ -36,9 +36,8 @@ class QGLView : public QGLWidget, public GLView void setShowCrosshairs(bool enabled) { this->showcrosshairs = enabled; } bool orthoMode() const { return (this->cam.projection == Camera::ORTHOGONAL); } void setOrthoMode(bool enabled); - bool showScaleProportional() const { return this->showscale; } - void setShowScaleProportional(bool enabled) { this->showscale = enabled; } - + bool showScaleProportional() const { return this->showscale; } + void setShowScaleProportional(bool enabled) { this->showscale = enabled; } std::string getRendererInfo() const; #if QT_VERSION >= 0x050100 float getDPI() { return this->devicePixelRatio(); } diff --git a/src/mainwin.cc b/src/mainwin.cc index 6a4d14b297..b00b375850 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -371,8 +371,8 @@ MainWindow::MainWindow(const QString &filename) connect(this->viewActionShowEdges, SIGNAL(triggered()), this, SLOT(viewModeShowEdges())); connect(this->viewActionShowAxes, SIGNAL(triggered()), this, SLOT(viewModeShowAxes())); connect(this->viewActionShowCrosshairs, SIGNAL(triggered()), this, SLOT(viewModeShowCrosshairs())); - connect(this->viewActionShowScaleProportional, SIGNAL(triggered()), this, SLOT(viewModeShowScaleProportional())); - connect(this->viewActionAnimate, SIGNAL(triggered()), this, SLOT(viewModeAnimate())); + connect(this->viewActionShowScaleProportional, SIGNAL(triggered()), this, SLOT(viewModeShowScaleProportional())); + connect(this->viewActionAnimate, SIGNAL(triggered()), this, SLOT(viewModeAnimate())); connect(this->viewActionTop, SIGNAL(triggered()), this, SLOT(viewAngleTop())); connect(this->viewActionBottom, SIGNAL(triggered()), this, SLOT(viewAngleBottom())); connect(this->viewActionLeft, SIGNAL(triggered()), this, SLOT(viewAngleLeft()));