Minor conflicts based on my cleanup of Tomaz' earlier commits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-05 09:50:11 -07:00
commit 1238fde17c

View file

@ -42,6 +42,7 @@ typedef enum {
CEILING_SHALLOW, CEILING_DEEP, CALC_CEILING_SHALLOW, CALC_CEILING_DEEP CEILING_SHALLOW, CEILING_DEEP, CALC_CEILING_SHALLOW, CALC_CEILING_DEEP
} color_indice_t; } color_indice_t;
#define COLOR(x, y, z) QVector<QColor>() << x << y << z; #define COLOR(x, y, z) QVector<QColor>() << x << y << z;
/* profile_color[color indice] = COLOR(screen color, b/w printer color, color printer}} printer & screen colours could be different */ /* profile_color[color indice] = COLOR(screen color, b/w printer color, color printer}} printer & screen colours could be different */
QMap<color_indice_t, QVector<QColor> > profile_color; QMap<color_indice_t, QVector<QColor> > profile_color;
@ -95,6 +96,7 @@ void fill_profile_color()
profile_color[CEILING_DEEP] = COLOR(RED1_MED_TRANS, BLACK1_HIGH_TRANS, RED1_MED_TRANS); profile_color[CEILING_DEEP] = COLOR(RED1_MED_TRANS, BLACK1_HIGH_TRANS, RED1_MED_TRANS);
profile_color[CALC_CEILING_SHALLOW] = COLOR(FUNGREEN1_HIGH_TRANS, BLACK1_HIGH_TRANS, FUNGREEN1_HIGH_TRANS); profile_color[CALC_CEILING_SHALLOW] = COLOR(FUNGREEN1_HIGH_TRANS, BLACK1_HIGH_TRANS, FUNGREEN1_HIGH_TRANS);
profile_color[CALC_CEILING_DEEP] = COLOR(APPLE1_HIGH_TRANS, BLACK1_HIGH_TRANS, APPLE1_HIGH_TRANS); profile_color[CALC_CEILING_DEEP] = COLOR(APPLE1_HIGH_TRANS, BLACK1_HIGH_TRANS, APPLE1_HIGH_TRANS);
} }
#undef COLOR #undef COLOR
@ -102,7 +104,7 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
{ {
setScene(new QGraphicsScene()); setScene(new QGraphicsScene());
setBackgroundBrush(QColor("#F3F3E6")); setBackgroundBrush(QColor("#F3F3E6"));
scene()->setSceneRect(0,0,100,100); scene()->setSceneRect(0,0,1000,1000);
fill_profile_color(); fill_profile_color();
} }
@ -348,8 +350,10 @@ void ProfileGraphicsView::plot_depth_profile(struct graphics_context *gc, struct
entry = pi->entry; entry = pi->entry;
QGraphicsPolygonItem *neatFill = new QGraphicsPolygonItem();
QPolygonF p; QPolygonF p;
QLinearGradient pat(0.0,0.0,0.0,scene()->height());
QGraphicsPolygonItem *neatFill = NULL;
for (i = 0; i < pi->nr; i++, entry++) for (i = 0; i < pi->nr; i++, entry++)
p.append( QPointF( SCALE(gc, entry->sec, entry->depth) )); p.append( QPointF( SCALE(gc, entry->sec, entry->depth) ));
@ -364,79 +368,90 @@ void ProfileGraphicsView::plot_depth_profile(struct graphics_context *gc, struct
p.append( QPointF( SCALE(gc, entry->sec, entry->depth) )); p.append( QPointF( SCALE(gc, entry->sec, entry->depth) ));
} }
} }
neatFill->setPolygon(p);
QLinearGradient pat(0.0,0.0,0.0,p.boundingRect().height());
pat.setColorAt(1, profile_color[DEPTH_BOTTOM].first()); pat.setColorAt(1, profile_color[DEPTH_BOTTOM].first());
pat.setColorAt(0, profile_color[DEPTH_TOP].first()); pat.setColorAt(0, profile_color[DEPTH_TOP].first());
neatFill = new QGraphicsPolygonItem();
neatFill->setPolygon(p);
neatFill->setBrush(QBrush(pat)); neatFill->setBrush(QBrush(pat));
neatFill->setPen(QPen());
scene()->addItem(neatFill); scene()->addItem(neatFill);
#if 0
/* if the user wants the deco ceiling more visible, do that here (this /* if the user wants the deco ceiling more visible, do that here (this
* basically draws over the background that we had allowed to shine * basically draws over the background that we had allowed to shine
* through so far) */ * through so far) */
if (prefs.profile_red_ceiling) { // TODO: port the prefs.profile_red_ceiling to QSettings
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0 * plot_scale); //if (prefs.profile_red_ceiling) {
pattern_add_color_stop_rgba (gc, pat, 0, CEILING_SHALLOW); p.clear();
pattern_add_color_stop_rgba (gc, pat, 1, CEILING_DEEP); pat.setColorAt(0, profile_color[CEILING_SHALLOW].first());
cairo_set_source(gc->cr, pat); pat.setColorAt(1, profile_color[CEILING_DEEP].first());
cairo_pattern_destroy(pat);
entry = pi->entry; entry = pi->entry;
move_to(gc, 0, 0);
for (i = 0; i < pi->nr; i++, entry++) { for (i = 0; i < pi->nr; i++, entry++) {
if (entry->ndl == 0 && entry->stopdepth) { if (entry->ndl == 0 && entry->stopdepth) {
if (entry->ndl == 0 && entry->stopdepth < entry->depth) { if (entry->ndl == 0 && entry->stopdepth < entry->depth) {
line_to(gc, entry->sec, entry->stopdepth); p.append( QPointF( SCALE(gc, entry->sec, entry->stopdepth) ));
} else { } else {
line_to(gc, entry->sec, entry->depth); p.append( QPointF( SCALE(gc, entry->sec, entry->depth) ));
} }
} else { } else {
line_to(gc, entry->sec, 0); p.append( QPointF( SCALE(gc, entry->sec, 0) ));
} }
} }
cairo_close_path(gc->cr);
cairo_fill(gc->cr); neatFill = new QGraphicsPolygonItem();
} neatFill->setBrush(QBrush(pat));
neatFill->setPolygon(p);
neatFill->setPen(QPen());
scene()->addItem(neatFill);
//}
/* finally, plot the calculated ceiling over all this */ /* finally, plot the calculated ceiling over all this */
if (prefs.profile_calc_ceiling) { // TODO: Port the profile_calc_ceiling to QSettings
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0 * plot_scale); // if (prefs.profile_calc_ceiling) {
pattern_add_color_stop_rgba (gc, pat, 0, CALC_CEILING_SHALLOW); pat.setColorAt(0, profile_color[CALC_CEILING_SHALLOW].first());
pattern_add_color_stop_rgba (gc, pat, 1, CALC_CEILING_DEEP); pat.setColorAt(1, profile_color[CALC_CEILING_DEEP].first());
cairo_set_source(gc->cr, pat);
cairo_pattern_destroy(pat);
entry = pi->entry; entry = pi->entry;
move_to(gc, 0, 0); p.clear();
p.append( QPointF(0,0));
for (i = 0; i < pi->nr; i++, entry++) { for (i = 0; i < pi->nr; i++, entry++) {
if (entry->ceiling) if (entry->ceiling)
line_to(gc, entry->sec, entry->ceiling); p.append( QPointF( SCALE(gc, entry->sec, entry->ceiling) ));
else else
line_to(gc, entry->sec, 0); p.append( QPointF( SCALE(gc, entry->sec, 0) ));
}
line_to(gc, (entry-1)->sec, 0); /* make sure we end at 0 */
cairo_close_path(gc->cr);
cairo_fill(gc->cr);
} }
p.append( QPointF( SCALE(gc, (entry-1)->sec, 0) ));
neatFill = new QGraphicsPolygonItem();
neatFill->setPolygon(p);
neatFill->setPen(QPen());
scene()->addItem(neatFill);
//}
/* next show where we have been bad and crossed the dc's ceiling */ /* next show where we have been bad and crossed the dc's ceiling */
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0 * plot_scale); pat.setColorAt(0, profile_color[CEILING_SHALLOW].first());
pattern_add_color_stop_rgba (gc, pat, 0, CEILING_SHALLOW); pat.setColorAt(1, profile_color[CEILING_DEEP].first());
pattern_add_color_stop_rgba (gc, pat, 1, CEILING_DEEP);
cairo_set_source(gc->cr, pat);
cairo_pattern_destroy(pat);
entry = pi->entry; entry = pi->entry;
move_to(gc, 0, 0); p.clear();
p.append( QPointF(0,0));
for (i = 0; i < pi->nr; i++, entry++) for (i = 0; i < pi->nr; i++, entry++)
line_to(gc, entry->sec, entry->depth); p.append( QPointF( SCALE(gc, entry->sec, entry->depth) ));
for (i = pi->nr - 1; i >= 0; i--, entry--) { for (i = pi->nr - 1; i >= 0; i--, entry--) {
if (entry->ndl == 0 && entry->stopdepth > entry->depth) { if (entry->ndl == 0 && entry->stopdepth > entry->depth) {
line_to(gc, entry->sec, entry->stopdepth); p.append( QPointF( SCALE(gc, entry->sec, entry->stopdepth) ));
} else { } else {
line_to(gc, entry->sec, entry->depth); p.append( QPointF( SCALE(gc, entry->sec, entry->depth) ));
} }
} }
cairo_close_path(gc->cr);
cairo_fill(gc->cr); neatFill = new QGraphicsPolygonItem();
neatFill->setPolygon(p);
neatFill->setPen(QPen());
neatFill->setBrush(QBrush(pat));
scene()->addItem(neatFill);
/* Now do it again for the velocity colors */ /* Now do it again for the velocity colors */
entry = pi->entry; entry = pi->entry;
@ -447,12 +462,10 @@ void ProfileGraphicsView::plot_depth_profile(struct graphics_context *gc, struct
* representing the vertical velocity, so we need to * representing the vertical velocity, so we need to
* chop this into short segments */ * chop this into short segments */
depth = entry->depth; depth = entry->depth;
set_source_rgba(gc, VELOCITY_COLORS_START_IDX + entry->velocity); QGraphicsLineItem *colorLine = new QGraphicsLineItem( SCALE(gc, entry[-1].sec, entry[-1].depth), SCALE(gc, sec, depth));
move_to(gc, entry[-1].sec, entry[-1].depth); colorLine->setPen(QPen(QBrush(profile_color[ (color_indice_t) (VELOCITY_COLORS_START_IDX + entry->velocity)].first()), 2 ));
line_to(gc, sec, depth); scene()->addItem(colorLine);
cairo_stroke(cr);
} }
#endif
} }