From: yu.dongliang <18588496441@163.com> Date: Tue, 7 Nov 2023 06:23:20 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=1e7fb3e7b70cd6262289ec9e6bab2c6daecf22db;p=ses.git tmp --- diff --git a/ses_layout.c b/ses_layout.c index 4d40f49..9574cea 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -1492,7 +1492,7 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ } } - cairo_set_line_width(cr, 2); + cairo_set_line_width(cr, 2.5); for (i = 0; i < b->n_functions; i++) { f = b->functions[i]; @@ -1720,7 +1720,7 @@ int ses_layout_board(ScfEboard* b) return ret; } -// ses_steps_analyse(f, 5, 1); + ses_steps_analyse(f, 5, 1); x = f->x; y = f->y; diff --git a/ses_step_simplify.c b/ses_step_simplify.c index dbab7d1..732fca0 100644 --- a/ses_step_simplify.c +++ b/ses_step_simplify.c @@ -35,76 +35,91 @@ static int _simplify_draw(ScfEfunction* f, uint32_t bx, uint32_t by, uint32_t bw cairo_set_line_width(cr, 2); - if (SCF_EDA_PIN_POS & el->flags) { + if (SCF_EDA_PIN_POS & el->flags) cairo_set_source_rgb(cr, 1, 0, 0); - cairo_set_line_width(cr, 4); - } else if (SCF_EDA_PIN_NEG & el->flags) { + else if (SCF_EDA_PIN_NEG & el->flags) cairo_set_source_rgb(cr, 0, 0, 1); - cairo_set_line_width(cr, 4); - } else if (SCF_EDA_PIN_OUT & el->flags) { + else if (SCF_EDA_PIN_OUT & el->flags) cairo_set_source_rgb(cr, 1, 0, 1); - cairo_set_line_width(cr, 4); - } else if (el->v == B->pins[SCF_EDA_Battery_POS]->v) { - cairo_set_source_rgb(cr, 0.9, 0, 0); - cairo_set_line_width(cr, 2.5); + else if (el->v == B->pins[SCF_EDA_Battery_POS]->v) + cairo_set_source_rgb(cr, 0.8, 0, 0); - } else if (el->v == B->pins[SCF_EDA_Battery_NEG]->v) { - cairo_set_source_rgb(cr, 0, 0, 0.9); - cairo_set_line_width(cr, 2.5); + else if (el->v == B->pins[SCF_EDA_Battery_NEG]->v) + cairo_set_source_rgb(cr, 0, 0, 0.8); - } else if (SCF_EDA_PIN_IN & el->flags) + else if (SCF_EDA_PIN_IN & el->flags) cairo_set_source_rgb(cr, 0, 1, 0); - else if (SCF_EDA_PIN_CF & el->flags) { + else if (SCF_EDA_PIN_CF & el->flags) cairo_set_source_rgb(cr, 1, 0.1, 0.8); - cairo_set_line_width(cr, 2.5); - } else + else cairo_set_source_rgb(cr, 1, 0.5, 0.1); + uint8_t text[64]; + + cairo_select_font_face(cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); + cairo_set_font_size (cr, 28); + + ScfLine* prev = NULL; + for (k = 0; k < el->n_lines; k++) { l = el->lines[k]; - cairo_move_to(cr, l->x0, l->y0); - cairo_line_to(cr, l->x1, l->y1); - } + if (l->x0 > l->x1) + continue; - cairo_select_font_face(cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size (cr, 24); + if (!prev) { + snprintf(text, sizeof(text) - 1, "%ld", el->id); - uint8_t text[64]; - snprintf(text, sizeof(text) - 1, "%ld", el->id); + cairo_move_to (cr, l->x0 - 30, l->y0 + 5); + cairo_show_text(cr, text); + cairo_stroke(cr); - cairo_move_to (cr, l->x0 - 20, l->y0 + 5); - cairo_show_text(cr, text); - cairo_stroke(cr); + if (el->v < SCF_EDA_V_MIN) + snprintf(text, sizeof(text) - 1, "%lg", B->pins[SCF_EDA_Battery_NEG]->v); + else if (el->v > SCF_EDA_V_MAX) + snprintf(text, sizeof(text) - 1, "%lg", B->pins[SCF_EDA_Battery_POS]->v); - if (el->v < SCF_EDA_V_MIN) - snprintf(text, sizeof(text) - 1, "%lg", B->pins[SCF_EDA_Battery_NEG]->v); - else if (el->v > SCF_EDA_V_MAX) - snprintf(text, sizeof(text) - 1, "%lg", B->pins[SCF_EDA_Battery_POS]->v); + else if (el->v > 1e-3 || el->v < -1e-3) + snprintf(text, sizeof(text) - 1, "%lgv", (int)(el->v * 1000) / 1000.0); - else if (el->v > 1e-3 || el->v < -1e-3) - snprintf(text, sizeof(text) - 1, "%lgv", (int)(el->v * 1000) / 1000.0); + else if (el->v > 1e-6 || el->v < -1e-6) + snprintf(text, sizeof(text) - 1, "%lgmV", (int)(el->v * 1000000) / 1000.0); + else + snprintf(text, sizeof(text) - 1, "%lguV", (int)(el->v * 1000000) / 1000000.0); - else if (el->v > 1e-6 || el->v < -1e-6) - snprintf(text, sizeof(text) - 1, "%lgmV", (int)(el->v * 1000000) / 1000.0); - else - snprintf(text, sizeof(text) - 1, "%lguV", (int)(el->v * 1000000) / 1000000.0); + cairo_set_font_size(cr, 20); - cairo_set_font_size(cr, 20); + cairo_move_to (cr, l->x0 - 24, l->y0 + 24); + cairo_show_text(cr, text); + cairo_stroke(cr); + } - cairo_move_to (cr, l->x0 - 24, l->y0 + 24); - cairo_show_text(cr, text); - cairo_stroke(cr); + cairo_set_line_width(cr, 4); + cairo_move_to(cr, l->x0, l->y0); + cairo_line_to(cr, l->x1, l->y1); + cairo_stroke(cr); + + if (prev) { + if (!(el->flags & SCF_EDA_PIN_BORDER)) + cairo_set_line_width(cr, 1); + + cairo_move_to(cr, prev->x0, prev->y0); + cairo_line_to(cr, l->x0, l->y0); + cairo_stroke(cr); + } + + prev = l; + } } for (j = 0; j < f->n_components; j++) { c = f->components[j]; - cairo_set_line_width(cr, 2); + cairo_set_line_width(cr, 2.5); uint8_t text[64]; snprintf(text, sizeof(text) - 1, "%ld", c->id);