# HG changeset patch # User Rik # Date 1398304110 25200 # Node ID e42843ceff485448438faa44ca900944dc6896ef # Parent 652d9ed6f88d75847faf9e3ea022d0c07e121a59 Fix axes bounding box not obeying 'layer' property. * gl-render.cc (draw_axes_boxes): Check layer2Dtop to decide which Z-value to place axis at. In 2-D plot, don't draw box lines at second Z-value which overlaps original axis and is always on top. * graphics.cc (update_axes_layout): Set property is2D based on whether view() elevation is 90 degrees. * graphics.in.h (axes::properties): New is2D bool property. * graphics.in.h (axes::properties::get_is2D): New getter function. diff -r 652d9ed6f88d -r e42843ceff48 libinterp/corefcn/gl-render.cc --- a/libinterp/corefcn/gl-render.cc Wed Apr 23 11:01:30 2014 -0700 +++ b/libinterp/corefcn/gl-render.cc Wed Apr 23 18:48:30 2014 -0700 @@ -873,6 +873,8 @@ opengl_renderer::draw_axes_boxes (const axes::properties& props) { bool xySym = props.get_xySym (); + bool layer2Dtop = props.get_layer2Dtop (); + bool is2d = props.get_is2D (); double xPlane = props.get_xPlane (); double yPlane = props.get_yPlane (); double zPlane = props.get_zPlane (); @@ -899,6 +901,10 @@ // X box set_color (props.get_xcolor_rgb ()); + + if (layer2Dtop) + std::swap (zpTick, zpTickN); + glVertex3d (xPlaneN, ypTick, zpTick); glVertex3d (xPlane, ypTick, zpTick); @@ -906,10 +912,13 @@ { glVertex3d (xPlaneN, ypTickN, zpTick); glVertex3d (xPlane, ypTickN, zpTick); - glVertex3d (xPlaneN, ypTickN, zpTickN); - glVertex3d (xPlane, ypTickN, zpTickN); - glVertex3d (xPlaneN, ypTick, zpTickN); - glVertex3d (xPlane, ypTick, zpTickN); + if (! is2d) + { + glVertex3d (xPlaneN, ypTickN, zpTickN); + glVertex3d (xPlane, ypTickN, zpTickN); + glVertex3d (xPlaneN, ypTick, zpTickN); + glVertex3d (xPlane, ypTick, zpTickN); + } } // Y box @@ -921,10 +930,14 @@ { glVertex3d (xpTickN, yPlaneN, zpTick); glVertex3d (xpTickN, yPlane, zpTick); - glVertex3d (xpTickN, yPlaneN, zpTickN); - glVertex3d (xpTickN, yPlane, zpTickN); - glVertex3d (xpTick, yPlaneN, zpTickN); - glVertex3d (xpTick, yPlane, zpTickN); + + if (! is2d) + { + glVertex3d (xpTickN, yPlaneN, zpTickN); + glVertex3d (xpTickN, yPlane, zpTickN); + glVertex3d (xpTick, yPlaneN, zpTickN); + glVertex3d (xpTick, yPlane, zpTickN); + } } // Z box diff -r 652d9ed6f88d -r e42843ceff48 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Wed Apr 23 11:01:30 2014 -0700 +++ b/libinterp/corefcn/graphics.cc Wed Apr 23 18:48:30 2014 -0700 @@ -5199,6 +5199,7 @@ Matrix viewmat = get_view ().matrix_value (); nearhoriz = std::abs (viewmat(1)) <= 5; + is2D = viewmat(1) == 90; update_ticklength (); } diff -r 652d9ed6f88d -r e42843ceff48 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Wed Apr 23 11:01:30 2014 -0700 +++ b/libinterp/corefcn/graphics.in.h Wed Apr 23 18:48:30 2014 -0700 @@ -3666,6 +3666,7 @@ bool get_x2Dtop (void) const { return x2Dtop; } bool get_y2Dright (void) const { return y2Dright; } bool get_layer2Dtop (void) const { return layer2Dtop; } + bool get_is2D (void) const { return is2D; } bool get_xySym (void) const { return xySym; } bool get_xyzSym (void) const { return xyzSym; } bool get_zSign (void) const { return zSign; } @@ -3704,7 +3705,7 @@ double fx, fy, fz; double xticklen, yticklen, zticklen; double xtickoffset, ytickoffset, ztickoffset; - bool x2Dtop, y2Dright, layer2Dtop; + bool x2Dtop, y2Dright, layer2Dtop, is2D; bool xySym, xyzSym, zSign, nearhoriz; #if HAVE_FREETYPE