150 ctx->translate(-
buf.rect.left(), -
buf.rect.top());
153 ctx->set_line_width(1);
157 cairo_set_operator(ctx->cobj(), CAIRO_OPERATOR_DIFFERENCE);
162 ctx->translate(aligned_origin.
x(), aligned_origin.
y());
178 double const position = aligned_origin.
x();
179 ctx->move_to(position,
buf.rect.top() + 0.5);
180 ctx->line_to(position,
buf.rect.bottom() - 0.5);
183 double position = aligned_origin.
y();
184 ctx->move_to(
buf.rect.left() + 0.5, position);
185 ctx->line_to(
buf.rect.right() - 0.5, position);
191 std::vector<Geom::Point> intersections;
192 for (
unsigned i = 0; i < 4; ++i) {
197 intersections.push_back(line.
pointAt(oc->ta));
201 std::cerr <<
"CanvasItemGuideLine::render: Error: Infinite intersections." << std::endl;
205 if (intersections.size() == 2) {
206 double const x0 = intersections[0].x();
207 double const x1 = intersections[1].x();
208 double const y0 = intersections[0].y();
209 double const y1 = intersections[1].y();
210 ctx->move_to(x0, y0);
211 ctx->line_to(x1, y1);
282 return 0.5 *
static_cast<double>(
width);
Affine withoutTranslation() const
Infinite line on a plane.
static Line from_origin_and_vector(Point const &o, Point const &v)
Create a line from origin and unit vector.
Point pointAt(Coord t) const
Two-dimensional point that doubles as a vector.
IntPoint floor() const
Round coordinates downwards.
constexpr Coord y() const noexcept
constexpr Coord x() const noexcept
Axis aligned, non-empty rectangle.
void set_shape(CanvasItemCtrlShape shape)
double radius() const
Return the radius of the handle dot.
CanvasItemGuideHandle(CanvasItemGroup *group, Geom::Point const &pos, CanvasItemGuideLine *line)
Create a handle ("dot") along a guide line.
CanvasItemPtr< CanvasItemGuideHandle > _origin_ctrl
bool contains(Geom::Point const &p, double tolerance=0) override
Returns true if point p (in canvas units) is within tolerance (canvas units) distance of guideLine (o...
CanvasItemGuideHandle * dot() const
Returns the pointer to the origin control (the "dot")
void set_origin(Geom::Point const &origin)
Sets origin of guide line (place where handle is located).
CanvasItemGuideLine(CanvasItemGroup *group, Glib::ustring label, Geom::Point const &origin, Geom::Point const &normal)
Create a control guide line.
static constexpr double LABEL_SEP
void set_visible(bool visible) override
void set_stroke(uint32_t color) override
static constexpr uint32_t CONTROL_LOCKED_COLOR
void set_inverted(bool inverted)
Sets the inverted nature of the line.
void set_label(Glib::ustring &&label)
void set_normal(Geom::Point const &normal)
Sets orientation of guide line.
double closest_distance_to(Geom::Point const &p)
Returns distance between point in canvas units and nearest point on guideLine.
void set_locked(bool locked)
void _update(bool propagate) override
Update and redraw control guideLine.
void _render(Inkscape::CanvasItemBuffer &buf) const override
Render guideLine to screen via Cairo.
virtual void set_visible(bool visible)
Geom::Affine const & affine() const
virtual void set_stroke(uint32_t rgba)
UI::Widget::Canvas * get_canvas() const
bool is_yaxisdown() const
constexpr double SP_RGBA32_G_F(uint32_t v)
constexpr double SP_RGBA32_R_F(uint32_t v)
constexpr double SP_RGBA32_A_F(uint32_t v)
constexpr double SP_RGBA32_B_F(uint32_t v)
Editable view implementation.
constexpr Coord infinity()
Get a value representing infinity.
Angle distance(Angle const &a, Angle const &b)
std::optional< Crossing > OptCrossing
OptCrossing intersection(Ray const &r1, Line const &l2)
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
D2< T > rot90(D2< T > const &a)
Helper class to stream background task notifications as a series of messages.
@ CANVAS_ITEM_CTRL_SHAPE_CROSS
@ CANVAS_ITEM_CTRL_SHAPE_CIRCLE
@ CANVAS_ITEM_CTRL_TYPE_GUIDE_HANDLE
Class used when rendering canvas items.