Index: trunk/src/plugins/io_eeschema/read_netclass.c =================================================================== --- trunk/src/plugins/io_eeschema/read_netclass.c (revision 11326) +++ trunk/src/plugins/io_eeschema/read_netclass.c (revision 11327) @@ -33,45 +33,94 @@ float height_norm; /* height in normal vector direction, in alien units */ float width_norm; /* width in normal vector direction, in alien units */ int (*render_decor)(read_ctx_t* const ctx, csch_cgrp_t* const dst, - struct netclass_decor* const decor, const float xf, const float yf, + struct netclass_decor* const decor, const float x, const float y, const int rot, const char* const stroke); }; static int netclass_decor_render__round(read_ctx_t* const ctx, csch_cgrp_t* const dst, struct netclass_decor* const decor, - const float xf, const float yf, const int rot, const char* const stroke) + const float x, const float y, const int rot, const char* const stroke) { - TODO("TODO"); + if(!csch_alien_mkcircle(&ctx->alien, dst, x, y, decor->height_norm*0.5, + stroke, NULL)) + { + return -1; + } + return 0; } static int netclass_decor_render__dot(read_ctx_t* const ctx, csch_cgrp_t* const dst, struct netclass_decor* const decor, - const float xf, const float yf, const int rot, const char* const stroke) + const float x, const float y, const int rot, const char* const stroke) { - TODO("TODO"); + if(!csch_alien_mkcircle(&ctx->alien, dst, x, y, decor->height_norm*0.5, + stroke, stroke)) + { + return -1; + } + return 0; } static int netclass_decor_render__rectangle(read_ctx_t* const ctx, csch_cgrp_t* const dst, struct netclass_decor* const decor, - const float xf, const float yf, const int rot, const char* const stroke) + const float x, const float y, const int rot, const char* const stroke) { - TODO("TODO"); + float dx; + float dy; + + if(rot==0 || rot==180) + { + dx = decor->width_norm * 0.5; + dy = decor->height_norm * 0.5; + } + else + { + dx = decor->height_norm * 0.5; + dy = decor->width_norm * 0.5; + } + + if(!csch_alien_mkrect(&ctx->alien, dst, x-dx, y-dy, x+dx, y+dy, stroke, + NULL)) + { + return -1; + } + return 0; } static int netclass_decor_render__diamond(read_ctx_t* const ctx, csch_cgrp_t* const dst, struct netclass_decor* const decor, - const float xf, const float yf, const int rot, const char* const stroke) + const float x, const float y, const int rot, const char* const stroke) { - TODO("TODO"); + float dx; + float dy; + + csch_chdr_t* poly = csch_alien_mkpoly(&ctx->alien, dst, stroke, NULL); + + if(rot==0 || rot==180) + { + dx = decor->width_norm * 0.5; + dy = decor->height_norm * 0.5; + } + else + { + dx = decor->height_norm * 0.5; + dy = decor->width_norm * 0.5; + } + + csch_alien_append_poly_line(&ctx->alien, poly, x-dx, y, x, y+dy); + csch_alien_append_poly_line(&ctx->alien, poly, x-dx, y, x, y-dy); + csch_alien_append_poly_line(&ctx->alien, poly, x+dx, y, x, y+dy); + csch_alien_append_poly_line(&ctx->alien, poly, x+dx, y, x, y-dy); + return 0; } static const struct netclass_decor eeschema_netclass_decors[] = { - { "round", 1.27, 1.27, netclass_decor_render__round }, + { "round", 1.016, 1.016, netclass_decor_render__round }, { "dot", 0.8636, 0.8636, netclass_decor_render__dot }, { "rectangle", 0.8128, 1.6256, netclass_decor_render__rectangle }, { "diamond", 1.016, 2.0066, netclass_decor_render__diamond }, Index: trunk/src/plugins/io_eeschema/read_render.c =================================================================== --- trunk/src/plugins/io_eeschema/read_render.c (revision 11326) +++ trunk/src/plugins/io_eeschema/read_render.c (revision 11327) @@ -932,6 +932,8 @@ float xe = x0; /* line end X */ float ye = y0; /* line end Y */ + float delta; + if(!decor) { eechema_error(ctx, objroot, "unknown netclass_flag shape: '%s'", @@ -939,26 +941,28 @@ return -1; } + delta = decor->height_norm * 0.5; + switch(rot) { case 0: y -= length; - ye = y + decor->height_norm; + ye = y + delta; break; case 180: y += length; - ye = y - decor->height_norm; + ye = y - delta; break; case 90: x -= length; - xe = x + decor->height_norm; + xe = x + delta; break; case 270: x += length; - xe = x - decor->height_norm; + xe = x - delta; break; }