Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/canboat/BR24radar_pi
Browse files Browse the repository at this point in the history
  • Loading branch information
keesverruijt committed Aug 16, 2017
2 parents 0348440 + 7a2d384 commit ca0711a
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions src/RadarMarpa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,31 +529,26 @@ void RadarArpa::DrawContour(ArpaTarget* target) {
wxColor arpa = m_pi->m_settings.arpa_colour;
glColor4ub(arpa.Red(), arpa.Green(), arpa.Blue(), arpa.Alpha());
glLineWidth(3.0);
glBegin(GL_LINES);

glEnableClientState(GL_VERTEX_ARRAY);

double vertex_array[2 * MAX_CONTOUR_LENGTH + 1];
for (int i = 0; i < target->m_contour_length; i++) {
double xx;
double yy;
int angle = MOD_ROTATION2048(target->m_contour[i].angle - 512);
int radius = target->m_contour[i].r;
if (radius <= 0 || radius >= RETURNS_PER_LINE) {
LOG_INFO(wxT("BR24radar_pi: wrong values in DrawContour"));
return;
}
xx = polarLookup->x[angle][radius] * m_ri->m_range_meters / RETURNS_PER_LINE;
yy = polarLookup->y[angle][radius] * m_ri->m_range_meters / RETURNS_PER_LINE;
glVertex2f(xx, yy);
int ii = i + 1;
if (ii == target->m_contour_length) {
ii = 0; // start point again
}
if (radius <= 0 || radius >= RETURNS_PER_LINE) {
return;
}
angle = MOD_ROTATION2048(target->m_contour[ii].angle - 512);
radius = target->m_contour[ii].r;
xx = polarLookup->x[angle][radius] * m_ri->m_range_meters / RETURNS_PER_LINE;
yy = polarLookup->y[angle][radius] * m_ri->m_range_meters / RETURNS_PER_LINE;
glVertex2f(xx, yy);
vertex_array[2 * i] = polarLookup->x[angle][radius] * m_ri->m_range_meters / RETURNS_PER_LINE;
vertex_array[2 * i + 1] = polarLookup->y[angle][radius] * m_ri->m_range_meters / RETURNS_PER_LINE;
}

glVertexPointer(2, GL_DOUBLE, 0, vertex_array);
glDrawArrays(GL_LINE_STRIP, 0, target->m_contour_length);

glDisableClientState(GL_VERTEX_ARRAY); // disable vertex arrays

// following displays expected position with crosses that indicate the size of the search area
// for debugging only

Expand Down Expand Up @@ -583,7 +578,6 @@ void RadarArpa::DrawContour(ArpaTarget* target) {
}
#endif

glEnd();
}

void RadarArpa::DrawArpaTargets() {
Expand Down

0 comments on commit ca0711a

Please sign in to comment.