mirror of https://github.com/KLayout/klayout.git
WIP: debugging of radius rulers
This commit is contained in:
parent
996f0d75e5
commit
1057c0f268
|
|
@ -452,14 +452,6 @@ public:
|
|||
out = (trans * p2 (obj)).x ();
|
||||
} else if (m_function == 'Q') {
|
||||
out = (trans * p2 (obj)).y ();
|
||||
} else if (m_function == 'R') {
|
||||
double r, a1, a2;
|
||||
db::DPoint c;
|
||||
if (obj.compute_interpolating_circle (r, c, a1, a2)) {
|
||||
out = tl::Variant (r);
|
||||
} else {
|
||||
out = tl::Variant ();
|
||||
}
|
||||
} else if (m_function == 'G') {
|
||||
double r, a1, a2;
|
||||
db::DPoint c;
|
||||
|
|
@ -528,7 +520,6 @@ Object::formatted (const std::string &fmt, const db::DFTrans &t, size_t index) c
|
|||
eval.define_function ("P", new AnnotationEvalFunction('P', &eval, index)); // p2.x
|
||||
eval.define_function ("Q", new AnnotationEvalFunction('Q', &eval, index)); // p2.y
|
||||
eval.define_function ("A", new AnnotationEvalFunction('A', &eval, index)); // area mm2
|
||||
eval.define_function ("R", new AnnotationEvalFunction('R', &eval, index)); // radius (if applicable)
|
||||
eval.define_function ("G", new AnnotationEvalFunction('G', &eval, index)); // angle (if applicable)
|
||||
return eval.interpolate (fmt);
|
||||
}
|
||||
|
|
@ -840,7 +831,7 @@ Object::compute_interpolating_circle (double &radius, db::DPoint ¢er, double
|
|||
|
||||
db::DVector n = m_points.back () - m_points.front ();
|
||||
db::DPoint m = m_points.front () + n * 0.5;
|
||||
n = db::DVector (n.y (), -n.x ()) * (1.0 / d);
|
||||
n = db::DVector (n.y (), -n.x ()) * (0.5 / d);
|
||||
|
||||
double nom = 0.0;
|
||||
double div = 0.0;
|
||||
|
|
@ -872,6 +863,7 @@ Object::compute_interpolating_circle (double &radius, db::DPoint ¢er, double
|
|||
|
||||
start_angle = a + da;
|
||||
stop_angle = start_angle + 2.0 * (M_PI - da);
|
||||
std::swap (start_angle, stop_angle); // @@@
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
|||
|
|
@ -80,8 +80,9 @@ static std::vector<ant::Template> make_standard_templates ()
|
|||
templates.push_back (ant::Template (tl::to_string (tr ("Angle")), "", "", "$(sprintf('%.5g',G))°", ant::Object::STY_line, ant::Object::OL_angle, true, lay::AC_Global, "_angle"));
|
||||
templates.back ().set_mode (ant::Template::RulerThreeClicks);
|
||||
|
||||
templates.push_back (ant::Template (tl::to_string (tr ("Radius")), "", "", "$R", ant::Object::STY_line, ant::Object::OL_radius, true, lay::AC_Global, "_radius"));
|
||||
templates.push_back (ant::Template (tl::to_string (tr ("Radius")), "", "", "R=$D", ant::Object::STY_arrow_end, ant::Object::OL_radius, true, lay::AC_Global, "_radius"));
|
||||
templates.back ().set_mode (ant::Template::RulerThreeClicks);
|
||||
templates.back ().set_main_position (ant::Object::POS_center);
|
||||
|
||||
templates.push_back (ant::Template (tl::to_string (tr ("Ellipse")), "W=$(abs(X))", "H=$(abs(Y))", "", ant::Object::STY_line, ant::Object::OL_ellipse, true, lay::AC_Global, std::string ()));
|
||||
|
||||
|
|
|
|||
|
|
@ -709,12 +709,19 @@ draw_ruler_radius (const ant::Object &ruler, const db::DCplxTrans &trans, bool s
|
|||
double a = 0.5 * (start_angle + stop_angle);
|
||||
db::DPoint rc = center + db::DVector (cos (a), sin (a)) * radius;
|
||||
|
||||
#if 0
|
||||
// draw a center marker
|
||||
ant::Object center_loc (center, center, 0, std::string (), ruler.fmt_x (), ruler.fmt_y (), ant::Object::STY_cross_start, ant::Object::OL_diag, false, lay::AC_Global);
|
||||
draw_ruler_segment (center_loc, 0, trans, sel, bitmap, renderer);
|
||||
#endif
|
||||
|
||||
// draw the radius ruler
|
||||
ant::Object radius (center, rc, 0, ruler.fmt (), std::string (), std::string (), ruler.style (), ruler.outline (), false, lay::AC_Global);
|
||||
ant::Object radius = ruler;
|
||||
radius.outline (ant::Object::OL_diag);
|
||||
ant::Object::point_list pts;
|
||||
pts.push_back (center);
|
||||
pts.push_back (rc);
|
||||
radius.set_points (pts);
|
||||
draw_ruler_segment (radius, 0, trans, sel, bitmap, renderer);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue