From d64a03f64534ef6e7e5337918cf4d4d644b27068 Mon Sep 17 00:00:00 2001 From: Matt Prilliman <54449384+mjprilliman@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:43:54 -0600 Subject: [PATCH 1/2] Change mask color for nan/inf values to light grey; draw layers starting with min rather than min+1 to not draw entire background as min --- src/plot/plcontourplot.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/plot/plcontourplot.cpp b/src/plot/plcontourplot.cpp index 0f2c15b5..94bb9104 100644 --- a/src/plot/plcontourplot.cpp +++ b/src/plot/plcontourplot.cpp @@ -143,9 +143,20 @@ void wxPLContourPlot::RebuildContours() { } } } else { - for (size_t k = 0; k < m_levels.size() - 1; k++) { - double zlow = m_levels[k]; - double zhigh = m_levels[k + 1]; + for (size_t k = 0; k < m_levels.size(); k++) { + double zlow = 0; + double zhigh = 0; + if (k == 0) { + zlow = m_levels[k] - (m_levels[1] - m_levels[0]); + zhigh = m_levels[k]; + } + else { + zlow = m_levels[k-1]; + zhigh = m_levels[k]; + } + + //double zlow = m_levels[k]; + //double zhigh = m_levels[k + 1]; std::vector list; qcg.create_filled_contour(zlow, zhigh, list); @@ -250,16 +261,17 @@ void wxPLContourPlot::Draw(wxPLOutputDevice &dc, const wxPLDeviceMapping &map) { dc.NoPen(); // background set to min // assume RebuildMask has been called - wxColor bgc(m_cmap->ColourForValue(m_zMin)); + //wxColor bgc(m_cmap->ColourForValue(m_zMin)); + wxColor bgc(*wxLIGHT_GREY); dc.Brush(bgc); wxRealPoint pos, size; map.GetDeviceExtents(&pos, &size); dc.Rect(pos.x, pos.y, size.x, size.y); // end background - // int ipoly = 0; for (size_t i = 0; i < m_cPolys.size(); i++) { double zmid = 0.5 * (m_cPolys[i].z + m_cPolys[i].zmax); + //double zmid = m_cPolys[i].z; wxColour color(m_cmap->ColourForValue(zmid)); dc.Pen(color, 2); dc.Brush(color); From f468a77349495ca434348fc4c0842cbc72edd3f1 Mon Sep 17 00:00:00 2001 From: Matt Prilliman <54449384+mjprilliman@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:16:12 -0600 Subject: [PATCH 2/2] Assign masking color to wxCONTOUR_BG, apply masking color to heat map tab nonfinite values --- include/wex/plot/plcolourmap.h | 2 ++ src/plot/plcolourmap.cpp | 2 +- src/plot/plcontourplot.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/wex/plot/plcolourmap.h b/include/wex/plot/plcolourmap.h index 19c6208e..577ab463 100644 --- a/include/wex/plot/plcolourmap.h +++ b/include/wex/plot/plcolourmap.h @@ -41,6 +41,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "wex/plot/plplot.h" +#define wxCONTOUR_BG wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) + class wxPLColourMap : public wxPLSideWidgetBase { public: wxPLColourMap(double min = 0, double max = 1); diff --git a/src/plot/plcolourmap.cpp b/src/plot/plcolourmap.cpp index aaca3044..85af32af 100644 --- a/src/plot/plcolourmap.cpp +++ b/src/plot/plcolourmap.cpp @@ -159,7 +159,7 @@ void wxPLColourMap::Render(wxPLOutputDevice &dc, const wxPLRealRect &geom) { } wxColour wxPLColourMap::ColourForValue(double val) { - if (m_colourList.size() == 0 || !(wxFinite(val))) return *wxBLACK; + if (m_colourList.size() == 0 || !(wxFinite(val))) return *wxCONTOUR_BG; int position = (int) (((double) m_colourList.size()) * ( diff --git a/src/plot/plcontourplot.cpp b/src/plot/plcontourplot.cpp index 94bb9104..7769ac00 100644 --- a/src/plot/plcontourplot.cpp +++ b/src/plot/plcontourplot.cpp @@ -262,7 +262,7 @@ void wxPLContourPlot::Draw(wxPLOutputDevice &dc, const wxPLDeviceMapping &map) { // background set to min // assume RebuildMask has been called //wxColor bgc(m_cmap->ColourForValue(m_zMin)); - wxColor bgc(*wxLIGHT_GREY); + wxColor bgc(*wxCONTOUR_BG); dc.Brush(bgc); wxRealPoint pos, size; map.GetDeviceExtents(&pos, &size);