Skip to content

Commit 123c745

Browse files
authored
Merge pull request #183 from NREL/SAM_1616
Fix wxDVDMapPlot dithering issue for sub-hourly timesteps
2 parents 9092250 + 817db92 commit 123c745

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/dview/dvdmapctrl.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ class wxDVDMapPlot : public wxPLPlottable {
100100

101101
dc.Pen(*wxWHITE, 0, wxPLOutputDevice::NONE);
102102
dc.Brush(*wxRED, wxPLOutputDevice::HATCH);
103+
dc.Brush(m_colourMap->ColourForValue(m_data->At(0).y));
103104
dc.Rect(pos.x, pos.y, size.x + 1, size.y + 1);
104-
105+
105106
wxRealPoint wmin = map.GetWorldMinimum();
106107
wxRealPoint wmax = map.GetWorldMaximum();
107108
double xlen = wmax.x - wmin.x;
@@ -125,24 +126,22 @@ class wxDVDMapPlot : public wxPLPlottable {
125126
int worldXDay = int(m_data->At(i).x) / 24; //x-res does not change with higher res data.
126127

127128
double worldY = fmod(m_data->At(i).x, 24.0);
128-
worldY -= fmod(worldY,
129-
m_data->GetTimeStep()); // This makes sure the entire plot doesn't shift up for something like 1/2 hour data.
129+
worldY -= fmod(worldY, m_data->GetTimeStep()); // This makes sure the entire plot doesn't shift up for something like 1/2 hour data.
130130
if (worldY < wmin.y)
131131
continue;
132132
if (worldY >= wmax.y)
133133
continue;
134134
worldY -= wmin.y;
135135

136136
double x = pos.x + (worldXDay - wmin.x / 24) * dRectWidth;
137-
double y = pos.y + size.y - dRectHeight * (worldY / m_data->GetTimeStep() +
138-
1); //+1 is because we have top corner, not bottom.
137+
double y = pos.y + size.y - dRectHeight * (worldY / m_data->GetTimeStep() + 1); //+1 is because we have top corner, not bottom.
139138

140139
dc.Brush(m_colourMap->ColourForValue(m_data->At(i).y));
141140

142141
// increase rect dimensions by about 0.5 point to
143142
// make sure they render overlapped without white space
144143
// showing in between
145-
dc.Rect(x, y, ceil(dRectWidth + 0.5), ceil(dRectHeight + 0.5)); //+1s cover empty spaces between rects.
144+
dc.Rect(x, y, ceil(dRectWidth + 1.0 / m_data->GetTimeStep()), ceil(dRectHeight + 1.0 / m_data->GetTimeStep())); // +- 1/timesteps to cover empty spaces between rects.
146145
}
147146
}
148147

0 commit comments

Comments
 (0)