From: johanengelen Date: Fri, 1 Aug 2008 19:15:16 +0000 (+0000) Subject: 2geomify a lot of NR::Points to Geom::Point X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5b20351508dc029f37f23fb7add6d0b43bf47f20;p=inkscape.git 2geomify a lot of NR::Points to Geom::Point --- diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index 6f63aa3ce..522bfbdda 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -129,7 +129,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge } } - guide = sp_guideline_new(desktop->guides, event_dt.to_2geom(), normal); + guide = sp_guideline_new(desktop->guides, event_dt, normal); sp_guideline_set_color(SP_GUIDELINE(guide), desktop->namedview->guidehicolor); gdk_pointer_grab(widget->window, FALSE, (GdkEventMask)(GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ), @@ -146,7 +146,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge m.setup(desktop); m.guideSnap(event_dt, normal); - sp_guideline_set_position(SP_GUIDELINE(guide), event_dt.to_2geom()); + sp_guideline_set_position(SP_GUIDELINE(guide), event_dt); desktop->set_coordinate_status(event_dt); desktop->setPosition (event_dt); } @@ -168,7 +168,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide"); sp_repr_set_point(repr, "orientation", normal); - sp_repr_set_point(repr, "position", event_dt.to_2geom()); + sp_repr_set_point(repr, "position", event_dt); SP_OBJECT_REPR(desktop->namedview)->appendChild(repr); Inkscape::GC::release(repr); sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, @@ -244,7 +244,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) m.setup(desktop); m.guideSnap(motion_dt, guide->normal_to_line); - sp_guide_moveto(*guide, motion_dt.to_2geom(), false); + sp_guide_moveto(*guide, motion_dt, false); moved = true; desktop->set_coordinate_status(motion_dt); desktop->setPosition (motion_dt); @@ -264,7 +264,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) m.guideSnap(event_dt, guide->normal_to_line); if (sp_canvas_world_pt_inside_window(item->canvas, event_w)) { - sp_guide_moveto(*guide, event_dt.to_2geom(), true); + sp_guide_moveto(*guide, event_dt, true); sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, _("Move guide")); } else { diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 2bfac655e..49ca07ca7 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -708,8 +708,8 @@ CanvasAxonomGridSnapper::_getSnapLines(NR::Point const &p) const // The vertical grid line is at the intersection of two angled grid lines. // Now go find that intersection! Geom::Point result; - Geom::IntersectorKind is = line_intersection(norm_x.to_2geom(), norm_x[NR::Y]*y_proj_along_x_max, - norm_z.to_2geom(), norm_z[NR::Y]*y_proj_along_z_max, + Geom::IntersectorKind is = line_intersection(norm_x, norm_x[NR::Y]*y_proj_along_x_max, + norm_z, norm_z[NR::Y]*y_proj_along_z_max, result); // Determine which half of the parallellogram to use diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index b1fc7501c..e2e014eff 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -200,7 +200,7 @@ static double sp_guideline_point(SPCanvasItem *item, NR::Point p, SPCanvasItem * *actual_item = item; Geom::Point vec(gl->normal_to_line[Geom::X], - gl->normal_to_line[Geom::Y]); - double distance = Geom::dot((p.to_2geom() - gl->point_on_line), vec); + double distance = Geom::dot((p - gl->point_on_line), vec); return MAX(fabs(distance)-1, 0); } diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp index d40fd735a..bd12cde88 100644 --- a/src/knot-holder-entity.cpp +++ b/src/knot-holder-entity.cpp @@ -27,6 +27,7 @@ #include "desktop.h" #include "sp-namedview.h" #include <2geom/matrix.h> +#include <2geom/transforms.h> int KnotHolderEntity::counter = 0; @@ -78,15 +79,15 @@ KnotHolderEntity::update_knot() { NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(item))); - NR::Point dp(knot_get() * i2d); + Geom::Point dp(knot_get() * i2d); _moved_connection.block(); sp_knot_set_position(knot, dp, SP_KNOT_STATE_NORMAL); _moved_connection.unblock(); } -NR::Point -KnotHolderEntity::snap_knot_position(NR::Point const &p) +Geom::Point +KnotHolderEntity::snap_knot_position(Geom::Point const &p) { NR::Matrix const i2d (from_2geom(sp_item_i2d_affine(item))); NR::Point s = p * i2d; @@ -99,30 +100,30 @@ KnotHolderEntity::snap_knot_position(NR::Point const &p) /* Pattern manipulation */ -static gdouble sp_pattern_extract_theta(SPPattern *pat, NR::Point scale) +static gdouble sp_pattern_extract_theta(SPPattern *pat, Geom::Point scale) { gdouble theta = asin(pat->patternTransform[1] / scale[NR::X]); if (pat->patternTransform[0] < 0) theta = M_PI - theta ; return theta; } -static NR::Point sp_pattern_extract_scale(SPPattern *pat) +static Geom::Point sp_pattern_extract_scale(SPPattern *pat) { Geom::Matrix transf = to_2geom(pat->patternTransform); - return NR::Point( transf.expansionX(), transf.expansionY() ); + return Geom::Point( transf.expansionX(), transf.expansionY() ); } -static NR::Point sp_pattern_extract_trans(SPPattern const *pat) +static Geom::Point sp_pattern_extract_trans(SPPattern const *pat) { - return NR::Point(pat->patternTransform[4], pat->patternTransform[5]); + return Geom::Point(pat->patternTransform[4], pat->patternTransform[5]); } void -PatternKnotHolderEntityXY::knot_set(NR::Point const &p, NR::Point const &origin, guint state) +PatternKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) { SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); - NR::Point p_snapped = snap_knot_position(p); + Geom::Point p_snapped = snap_knot_position(p); if ( state & GDK_CONTROL_MASK ) { if (fabs((p - origin)[NR::X]) > fabs((p - origin)[NR::Y])) { @@ -133,29 +134,29 @@ PatternKnotHolderEntityXY::knot_set(NR::Point const &p, NR::Point const &origin, } if (state) { - NR::Point const q = p_snapped - sp_pattern_extract_trans(pat); + Geom::Point const q = p_snapped - sp_pattern_extract_trans(pat); sp_item_adjust_pattern(item, NR::Matrix(NR::translate(q))); } item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -NR::Point +Geom::Point PatternKnotHolderEntityXY::knot_get() { SPPattern const *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); return sp_pattern_extract_trans(pat); } -NR::Point +Geom::Point PatternKnotHolderEntityAngle::knot_get() { SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); gdouble x = (pattern_width(pat)); gdouble y = 0; - NR::Point delta = NR::Point(x,y); - NR::Point scale = sp_pattern_extract_scale(pat); + Geom::Point delta = Geom::Point(x,y); + Geom::Point scale = sp_pattern_extract_scale(pat); gdouble theta = sp_pattern_extract_theta(pat, scale); delta = delta * NR::Matrix(NR::scale(scale))*NR::Matrix(NR::rotate(theta)); delta = delta + sp_pattern_extract_trans(pat); @@ -163,14 +164,14 @@ PatternKnotHolderEntityAngle::knot_get() } void -PatternKnotHolderEntityAngle::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +PatternKnotHolderEntityAngle::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { int const snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12); SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); // get the angle from pattern 0,0 to the cursor pos - NR::Point delta = p - sp_pattern_extract_trans(pat); + Geom::Point delta = p - sp_pattern_extract_trans(pat); gdouble theta = atan2(delta); if ( state & GDK_CONTROL_MASK ) { @@ -178,9 +179,9 @@ PatternKnotHolderEntityAngle::knot_set(NR::Point const &p, NR::Point const &/*or } // get the scale from the current transform so we can keep it. - NR::Point scl = sp_pattern_extract_scale(pat); + Geom::Point scl = sp_pattern_extract_scale(pat); NR::Matrix rot = NR::Matrix(NR::scale(scl)) * NR::Matrix(NR::rotate(theta)); - NR::Point const t = sp_pattern_extract_trans(pat); + Geom::Point const t = sp_pattern_extract_trans(pat); rot[4] = t[NR::X]; rot[5] = t[NR::Y]; sp_item_adjust_pattern(item, rot, true); @@ -188,26 +189,26 @@ PatternKnotHolderEntityAngle::knot_set(NR::Point const &p, NR::Point const &/*or } void -PatternKnotHolderEntityScale::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); - NR::Point p_snapped = snap_knot_position(p); + Geom::Point p_snapped = snap_knot_position(p); // get angle from current transform, (need get current scale first to calculate angle) - NR::Point oldscale = sp_pattern_extract_scale(pat); + Geom::Point oldscale = sp_pattern_extract_scale(pat); gdouble theta = sp_pattern_extract_theta(pat,oldscale); // Get the new scale from the position of the knotholder - NR::Point d = p_snapped - sp_pattern_extract_trans(pat); - d *= NR::Matrix(NR::rotate(-theta)); + Geom::Point d = p_snapped - sp_pattern_extract_trans(pat); + d *= Geom::Rotate(-theta); gdouble pat_x = pattern_width(pat); gdouble pat_y = pattern_height(pat); - NR::Point scl (d[NR::X] / pat_x, d[NR::Y] / pat_y); + Geom::Point scl (d[NR::X] / pat_x, d[NR::Y] / pat_y); NR::Matrix rot = NR::Matrix(NR::scale(scl)) * NR::Matrix(NR::rotate(theta)); - NR::Point const t = sp_pattern_extract_trans(pat); + Geom::Point const t = sp_pattern_extract_trans(pat); rot[4] = t[NR::X]; rot[5] = t[NR::Y]; sp_item_adjust_pattern(item, rot, true); @@ -215,14 +216,14 @@ PatternKnotHolderEntityScale::knot_set(NR::Point const &p, NR::Point const &/*or } -NR::Point +Geom::Point PatternKnotHolderEntityScale::knot_get() { SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); gdouble x = pattern_width(pat); gdouble y = pattern_height(pat); - NR::Point delta = NR::Point(x,y); + Geom::Point delta = Geom::Point(x,y); NR::Matrix a = pat->patternTransform; a[4] = 0; a[5] = 0; diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h index 432bf5501..1f5ea8e2c 100644 --- a/src/knot-holder-entity.h +++ b/src/knot-holder-entity.h @@ -19,7 +19,7 @@ #include #include "knot.h" -#include +#include <2geom/forward.h> struct SPItem; struct SPKnot; @@ -27,8 +27,8 @@ struct SPKnot; class SPDesktop; class KnotHolder; -typedef void (* SPKnotHolderSetFunc) (SPItem *item, NR::Point const &p, NR::Point const &origin, guint state); -typedef NR::Point (* SPKnotHolderGetFunc) (SPItem *item); +typedef void (* SPKnotHolderSetFunc) (SPItem *item, Geom::Point const &p, Geom::Point const &origin, guint state); +typedef Geom::Point (* SPKnotHolderGetFunc) (SPItem *item); /* fixme: Think how to make callbacks most sensitive (Lauris) */ typedef void (* SPKnotHolderReleasedFunc) (SPItem *item); @@ -49,14 +49,14 @@ public: /* the get/set/click handlers are virtual functions; each handler class for a knot should be derived from KnotHolderEntity and override these functions */ - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state) = 0; - virtual NR::Point knot_get() = 0; + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) = 0; + virtual Geom::Point knot_get() = 0; virtual void knot_click(guint /*state*/) {} void update_knot(); //private: - NR::Point snap_knot_position(NR::Point const &p); + Geom::Point snap_knot_position(Geom::Point const &p); SPKnot *knot; SPItem *item; @@ -88,20 +88,20 @@ class LPEKnotHolderEntity : public KnotHolderEntity { class PatternKnotHolderEntityXY : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class PatternKnotHolderEntityAngle : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class PatternKnotHolderEntityScale : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; #endif /* !SEEN_KNOT_HOLDER_ENTITY_H */ diff --git a/src/knotholder.h b/src/knotholder.h index 6b838b3c9..25d6d4638 100644 --- a/src/knotholder.h +++ b/src/knotholder.h @@ -31,12 +31,6 @@ class Node; } } - -typedef void (* SPKnotHolderSetFunc) (SPItem *item, NR::Point const &p, NR::Point const &origin, guint state); -typedef NR::Point (* SPKnotHolderGetFunc) (SPItem *item); -/* fixme: Think how to make callbacks most sensitive (Lauris) */ -typedef void (* SPKnotHolderReleasedFunc) (SPItem *item); - class KnotHolder { public: KnotHolder() {} // do nothing in the default constructor diff --git a/src/libnr/nr-point.h b/src/libnr/nr-point.h index ff9b5a454..57a25c746 100644 --- a/src/libnr/nr-point.h +++ b/src/libnr/nr-point.h @@ -126,10 +126,6 @@ public: friend inline std::ostream &operator<< (std::ostream &out_file, const NR::Point &in_pnt); - inline Geom::Point to_2geom() const { - return Geom::Point(_pt[X], _pt[Y]); - } - inline operator Geom::Point() const { return Geom::Point(_pt[X], _pt[Y]); } private: diff --git a/src/line-snapper.cpp b/src/line-snapper.cpp index 8fdf936ed..ee902d5fc 100644 --- a/src/line-snapper.cpp +++ b/src/line-snapper.cpp @@ -87,7 +87,7 @@ void Inkscape::LineSnapper::constrainedSnap(SnappedConstraints &sc, /* Try to intersect this line with the target line */ Geom::Point t_2geom(NR_HUGE, NR_HUGE); - Geom::IntersectorKind const k = Geom::line_intersection(n.to_2geom(), q0, i->first.to_2geom(), q1, t_2geom); + Geom::IntersectorKind const k = Geom::line_intersection(n, q0, i->first, q1, t_2geom); NR::Point t(t_2geom); if (k == Geom::intersects) { diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp index 179d46a52..111928d13 100644 --- a/src/live_effects/lpe-angle_bisector.cpp +++ b/src/live_effects/lpe-angle_bisector.cpp @@ -33,15 +33,15 @@ namespace AB { class KnotHolderEntityLeftEnd : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; class KnotHolderEntityRightEnd : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; } // namespace TtC @@ -102,39 +102,39 @@ get_effect(SPItem *item) } void -KnotHolderEntityLeftEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { LPEAngleBisector *lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); - double lambda = Geom::nearest_point(s.to_2geom(), lpe->ptA, lpe->dir); + double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir); lpe->length_left.param_set_value(-lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } void -KnotHolderEntityRightEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { LPEAngleBisector *lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); - double lambda = Geom::nearest_point(s.to_2geom(), lpe->ptA, lpe->dir); + double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir); lpe->length_right.param_set_value(lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } -NR::Point +Geom::Point KnotHolderEntityLeftEnd::knot_get() { LPEAngleBisector *lpe = get_effect(item); return lpe->ptA - lpe->dir * lpe->length_left; } -NR::Point +Geom::Point KnotHolderEntityRightEnd::knot_get() { LPEAngleBisector *lpe = get_effect(item); diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 5fd33605b..bfb9a7b99 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -29,15 +29,15 @@ namespace CR { class KnotHolderEntityStartingAngle : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; class KnotHolderEntityRotationAngle : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; } // namespace CR @@ -144,15 +144,15 @@ get_effect(SPItem *item) } void -KnotHolderEntityStartingAngle::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +KnotHolderEntityStartingAngle::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { LPECopyRotate* lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); // I first suspected the minus sign to be a bug in 2geom but it is // likely due to SVG's choice of coordinate system orientation (max) - lpe->starting_angle.param_set_value(rad_to_deg(-angle_between(lpe->dir, s.to_2geom() - lpe->origin))); + lpe->starting_angle.param_set_value(rad_to_deg(-angle_between(lpe->dir, s - lpe->origin))); if (state & GDK_SHIFT_MASK) { lpe->dist_angle_handle = L2(lpe->B - lpe->A); } else { @@ -164,15 +164,15 @@ KnotHolderEntityStartingAngle::knot_set(NR::Point const &p, NR::Point const &/*o } void -KnotHolderEntityRotationAngle::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +KnotHolderEntityRotationAngle::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { LPECopyRotate* lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); // I first suspected the minus sign to be a bug in 2geom but it is // likely due to SVG's choice of coordinate system orientation (max) - lpe->rotation_angle.param_set_value(rad_to_deg(-angle_between(lpe->dir, s.to_2geom() - lpe->origin)) - lpe->starting_angle); + lpe->rotation_angle.param_set_value(rad_to_deg(-angle_between(lpe->dir, s - lpe->origin)) - lpe->starting_angle); if (state & GDK_SHIFT_MASK) { lpe->dist_angle_handle = L2(lpe->B - lpe->A); } else { @@ -183,14 +183,14 @@ KnotHolderEntityRotationAngle::knot_set(NR::Point const &p, NR::Point const &/*o sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } -NR::Point +Geom::Point KnotHolderEntityStartingAngle::knot_get() { LPECopyRotate* lpe = get_effect(item); return snap_knot_position(lpe->start_pos); } -NR::Point +Geom::Point KnotHolderEntityRotationAngle::knot_get() { LPECopyRotate* lpe = get_effect(item); diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp index e6d49b0b2..e169a3b8f 100644 --- a/src/live_effects/lpe-parallel.cpp +++ b/src/live_effects/lpe-parallel.cpp @@ -27,15 +27,15 @@ namespace Pl { class KnotHolderEntityLeftEnd : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; class KnotHolderEntityRightEnd : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; } // namespace Pl @@ -108,43 +108,43 @@ get_effect(SPItem *item) } void -KnotHolderEntityLeftEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { using namespace Geom; LPEParallel *lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); - double lambda = L2(s - lpe->offset_pt) * sgn(dot(s.to_2geom() - lpe->offset_pt, lpe->dir)); + double lambda = L2(s - lpe->offset_pt) * sgn(dot(s - lpe->offset_pt, lpe->dir)); lpe->length_left.param_set_value(-lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } void -KnotHolderEntityRightEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { using namespace Geom; LPEParallel *lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); - double lambda = L2(s - lpe->offset_pt) * sgn(dot(s.to_2geom() - lpe->offset_pt, lpe->dir)); + double lambda = L2(s - lpe->offset_pt) * sgn(dot(s - lpe->offset_pt, lpe->dir)); lpe->length_right.param_set_value(lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } -NR::Point +Geom::Point KnotHolderEntityLeftEnd::knot_get() { LPEParallel *lpe = get_effect(item); return lpe->C; } -NR::Point +Geom::Point KnotHolderEntityRightEnd::knot_get() { LPEParallel *lpe = get_effect(item); diff --git a/src/live_effects/lpe-perp_bisector.cpp b/src/live_effects/lpe-perp_bisector.cpp index f9aca2ada..35c6f0933 100644 --- a/src/live_effects/lpe-perp_bisector.cpp +++ b/src/live_effects/lpe-perp_bisector.cpp @@ -27,19 +27,19 @@ namespace PB { class KnotHolderEntityEnd : public LPEKnotHolderEntity { public: - void bisector_end_set(NR::Point const &p, bool left = true); + void bisector_end_set(Geom::Point const &p, bool left = true); }; class KnotHolderEntityLeftEnd : public KnotHolderEntityEnd { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; class KnotHolderEntityRightEnd : public KnotHolderEntityEnd { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; // TODO: Make this more generic @@ -54,27 +54,27 @@ get_effect(SPItem *item) return static_cast(effect); } -NR::Point +Geom::Point KnotHolderEntityLeftEnd::knot_get() { Inkscape::LivePathEffect::LPEPerpBisector *lpe = get_effect(item); - return NR::Point(lpe->C); + return Geom::Point(lpe->C); } -NR::Point +Geom::Point KnotHolderEntityRightEnd::knot_get() { Inkscape::LivePathEffect::LPEPerpBisector *lpe = get_effect(item); - return NR::Point(lpe->D); + return Geom::Point(lpe->D); } void -KnotHolderEntityEnd::bisector_end_set(NR::Point const &p, bool left) { +KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, bool left) { Inkscape::LivePathEffect::LPEPerpBisector *lpe = dynamic_cast (sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item))); if (!lpe) return; - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); - double lambda = Geom::nearest_point(s.to_2geom(), lpe->M, lpe->perp_dir); + double lambda = Geom::nearest_point(s, lpe->M, lpe->perp_dir); if (left) { lpe->C = lpe->M + lpe->perp_dir * lambda; lpe->length_left.param_set_value(lambda); @@ -88,48 +88,48 @@ KnotHolderEntityEnd::bisector_end_set(NR::Point const &p, bool left) { } void -KnotHolderEntityLeftEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) { +KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { bisector_end_set(p); } void -KnotHolderEntityRightEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) { +KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { bisector_end_set(p, false); } /** -NR::Point path_start_get(SPItem *item) { +Geom::Point path_start_get(SPItem *item) { Inkscape::LivePathEffect::LPEPerpBisector *lpe = dynamic_cast (sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item))); if (lpe) - return NR::Point(lpe->A); + return Geom::Point(lpe->A); else - return NR::Point(0,0); + return Geom::Point(0,0); } -NR::Point path_end_get(SPItem *item) { +Geom::Point path_end_get(SPItem *item) { Inkscape::LivePathEffect::LPEPerpBisector *lpe = dynamic_cast (sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item))); if (lpe) - return NR::Point(lpe->B); + return Geom::Point(lpe->B); else - return NR::Point(0,0); + return Geom::Point(0,0); } void -path_set_start_end(SPItem *item, NR::Point const &p, bool start) { +path_set_start_end(SPItem *item, Geom::Point const &p, bool start) { SPCurve* curve = sp_path_get_curve_for_edit (SP_PATH(item)); // TODO: Should we use sp_shape_get_curve()? Geom::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(item))); Geom::Point A, B; if (start) { - A = p.to_2geom(); - B = (curve->last_point()).to_2geom(); + A = p; + B = curve->last_point(); } else { - A = (curve->first_point()).to_2geom(); - B = (p.to_2geom()); + A = curve->first_point(); + B = p; } SPCurve *c = new SPCurve(); @@ -140,11 +140,11 @@ path_set_start_end(SPItem *item, NR::Point const &p, bool start) { } **/ -//void path_start_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) { +//void path_start_set(SPItem *item, Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { // path_set_start_end(item, p); //} -//void path_end_set(SPItem *item, NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) { +//void path_end_set(SPItem *item, Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { // path_set_start_end(item, p, false); //} @@ -183,8 +183,8 @@ LPEPerpBisector::doOnApply (SPLPEItem */*lpeitem*/) /** SPCurve* curve = sp_path_get_curve_for_edit (SP_PATH(lpeitem)); // TODO: Should we use sp_shape_get_curve()? - Geom::Point A((curve->first_point()).to_2geom()); - Geom::Point B((curve->last_point()).to_2geom()); + Geom::Point A(curve->first_point()); + Geom::Point B(curve->last_point()); SPCurve *c = new SPCurve(); c->moveto(A); diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp index 998554241..ff487f235 100644 --- a/src/live_effects/lpe-perspective_path.cpp +++ b/src/live_effects/lpe-perspective_path.cpp @@ -40,8 +40,8 @@ namespace PP { class KnotHolderEntityOffset : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; } // namespace PP @@ -162,13 +162,13 @@ get_effect(SPItem *item) } void -KnotHolderEntityOffset::knot_set(NR::Point const &p, NR::Point const &origin, guint /*state*/) +KnotHolderEntityOffset::knot_set(Geom::Point const &p, Geom::Point const &origin, guint /*state*/) { using namespace Geom; LPEPerspectivePath* lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); lpe->offsetx.param_set_value((s - origin)[NR::X]); lpe->offsety.param_set_value(-(s - origin)[NR::Y]); // additional minus sign is due to coordinate system flipping @@ -177,7 +177,7 @@ KnotHolderEntityOffset::knot_set(NR::Point const &p, NR::Point const &origin, gu sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } -NR::Point +Geom::Point KnotHolderEntityOffset::knot_get() { LPEPerspectivePath* lpe = get_effect(item); diff --git a/src/live_effects/lpe-skeleton.cpp b/src/live_effects/lpe-skeleton.cpp index 5fc4ba6f2..c2ab7be51 100644 --- a/src/live_effects/lpe-skeleton.cpp +++ b/src/live_effects/lpe-skeleton.cpp @@ -91,8 +91,8 @@ class KnotHolderEntityMyHandle : public LPEKnotHolderEntity { public: // the set() and get() methods must be implemented, click() is optional - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); //virtual void knot_click(guint state); }; diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp index 0d21b38e0..ede13e2d4 100644 --- a/src/live_effects/lpe-tangent_to_curve.cpp +++ b/src/live_effects/lpe-tangent_to_curve.cpp @@ -32,22 +32,22 @@ namespace TtC { class KnotHolderEntityAttachPt : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; class KnotHolderEntityLeftEnd : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; class KnotHolderEntityRightEnd : public LPEKnotHolderEntity { public: - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); }; } // namespace TtC @@ -111,13 +111,13 @@ get_effect(SPItem *item) } void -KnotHolderEntityAttachPt::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { using namespace Geom; LPETangentToCurve* lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); // FIXME: There must be a better way of converting the path's SPCurve* to pwd2. SPCurve *curve = sp_path_get_curve_for_edit (SP_PATH(item)); @@ -127,7 +127,7 @@ KnotHolderEntityAttachPt::knot_set(NR::Point const &p, NR::Point const &/*origin pwd2.concat(pathv[i].toPwSb()); } - double t0 = nearest_point(s.to_2geom(), pwd2); + double t0 = nearest_point(s, pwd2); lpe->t_attach.param_set_value(t0); // FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating. @@ -135,46 +135,46 @@ KnotHolderEntityAttachPt::knot_set(NR::Point const &p, NR::Point const &/*origin } void -KnotHolderEntityLeftEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { LPETangentToCurve *lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); - double lambda = Geom::nearest_point(s.to_2geom(), lpe->ptA, lpe->derivA); + double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA); lpe->length_left.param_set_value(-lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } void -KnotHolderEntityRightEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { LPETangentToCurve *lpe = get_effect(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); - double lambda = Geom::nearest_point(s.to_2geom(), lpe->ptA, lpe->derivA); + double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA); lpe->length_right.param_set_value(lambda); sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } -NR::Point +Geom::Point KnotHolderEntityAttachPt::knot_get() { LPETangentToCurve* lpe = get_effect(item); return lpe->ptA; } -NR::Point +Geom::Point KnotHolderEntityLeftEnd::knot_get() { LPETangentToCurve *lpe = get_effect(item); return lpe->C; } -NR::Point +Geom::Point KnotHolderEntityRightEnd::knot_get() { LPETangentToCurve *lpe = get_effect(item); diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp index 1ec443a5f..e9cf05099 100644 --- a/src/live_effects/lpegroupbbox.cpp +++ b/src/live_effects/lpegroupbbox.cpp @@ -32,7 +32,7 @@ GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute) NR::Maybe itemBBox = item->getBounds(transform, SPItem::GEOMETRIC_BBOX); // NR to Geom glue - Geom::Rect geomBBox = Geom::Rect(itemBBox->min().to_2geom(), itemBBox->max().to_2geom()); + Geom::Rect geomBBox = Geom::Rect(itemBBox->min(), itemBBox->max()); boundingbox_X = geomBBox[Geom::X]; boundingbox_Y = geomBBox[Geom::Y]; } diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 0cb57993e..0c7a701f1 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -138,8 +138,8 @@ public: PointParamKnotHolderEntity(PointParam *p) { this->pparam = p; } virtual ~PointParamKnotHolderEntity() {} - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); - virtual NR::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); virtual void knot_click(guint state); private: @@ -147,14 +147,14 @@ private: }; void -PointParamKnotHolderEntity::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { - NR::Point const s = snap_knot_position(p); - pparam->param_setValue(s.to_2geom()); + Geom::Point const s = snap_knot_position(p); + pparam->param_setValue(s); sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); } -NR::Point +Geom::Point PointParamKnotHolderEntity::knot_get() { return *pparam; diff --git a/src/live_effects/parameter/pointparam-knotholder.cpp b/src/live_effects/parameter/pointparam-knotholder.cpp index 434eff4f4..34c149b4b 100644 --- a/src/live_effects/parameter/pointparam-knotholder.cpp +++ b/src/live_effects/parameter/pointparam-knotholder.cpp @@ -17,7 +17,6 @@ #include "sp-shape.h" #include "knot.h" #include "knotholder.h" -#include "knot-holder-entity.h" #include #include <2geom/point.h> @@ -30,7 +29,7 @@ class SPDesktop; namespace Inkscape { static void pointparam_knot_clicked_handler (SPKnot *knot, guint state, PointParamKnotHolder *kh); -static void pointparam_knot_moved_handler(SPKnot *knot, NR::Point const *p, guint state, PointParamKnotHolder *kh); +static void pointparam_knot_moved_handler(SPKnot *knot, Geom::Point const *p, guint state, PointParamKnotHolder *kh); static void pointparam_knot_ungrabbed_handler (SPKnot *knot, unsigned int state, PointParamKnotHolder *kh); PointParamKnotHolder::PointParamKnotHolder(SPDesktop *desktop, SPObject *lpeobject, const gchar * key, SPItem *item) @@ -61,17 +60,17 @@ PointParamKnotHolder::~PointParamKnotHolder() class KnotHolderEntityPointParam : public LPEKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; -NR::Point +Geom::Point KnotHolderEntityPointParam::knot_get() { - return NR::Point(0,0); + return Geom::Point(0,0); } void -KnotHolderEntityPointParam::knot_set(NR::Point const &/*p*/, NR::Point const &/*origin*/, guint /*state*/) { +KnotHolderEntityPointParam::knot_set(Geom::Point const &/*p*/, Geom::Point const &/*origin*/, guint /*state*/) { } void @@ -110,7 +109,7 @@ static void pointparam_knot_clicked_handler(SPKnot */*knot*/, guint /*state*/, P * \param p In desktop coordinates. * This function does not write to XML, but tries to write directly to the PointParam to quickly live update the effect */ -static void pointparam_knot_moved_handler(SPKnot */*knot*/, NR::Point const *p, guint /*state*/, PointParamKnotHolder *kh) +static void pointparam_knot_moved_handler(SPKnot */*knot*/, Geom::Point const *p, guint /*state*/, PointParamKnotHolder *kh) { Geom::Matrix const i2d(sp_item_i2d_affine(kh->getItem())); Geom::Point pos = (*p) * i2d.inverse(); diff --git a/src/object-edit.cpp b/src/object-edit.cpp index 1d72b9b29..3b513fe88 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -96,46 +96,46 @@ sp_item_knot_holder(SPItem *item, SPDesktop *desktop) /* handle for horizontal rounding radius */ class RectKnotHolderEntityRX : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual void knot_click(guint state); }; /* handle for vertical rounding radius */ class RectKnotHolderEntityRY : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual void knot_click(guint state); }; /* handle for width/height adjustment */ class RectKnotHolderEntityWH : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); protected: - void set_internal(NR::Point const &p, NR::Point const &origin, guint state); + void set_internal(Geom::Point const &p, Geom::Point const &origin, guint state); }; /* handle for x/y adjustment */ class RectKnotHolderEntityXY : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; -NR::Point +Geom::Point RectKnotHolderEntityRX::knot_get() { SPRect *rect = SP_RECT(item); - return NR::Point(rect->x.computed + rect->width.computed - rect->rx.computed, rect->y.computed); + return Geom::Point(rect->x.computed + rect->width.computed - rect->rx.computed, rect->y.computed); } void -RectKnotHolderEntityRX::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +RectKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { SPRect *rect = SP_RECT(item); @@ -175,16 +175,16 @@ RectKnotHolderEntityRX::knot_click(guint state) update_knot(); } -NR::Point +Geom::Point RectKnotHolderEntityRY::knot_get() { SPRect *rect = SP_RECT(item); - return NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->ry.computed); + return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->ry.computed); } void -RectKnotHolderEntityRY::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +RectKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { SPRect *rect = SP_RECT(item); @@ -245,19 +245,19 @@ static void sp_rect_clamp_radii(SPRect *rect) } } -NR::Point +Geom::Point RectKnotHolderEntityWH::knot_get() { SPRect *rect = SP_RECT(item); - return NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed); + return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed); } void -RectKnotHolderEntityWH::set_internal(NR::Point const &p, NR::Point const &origin, guint state) +RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &origin, guint state) { SPRect *rect = SP_RECT(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); if (state & GDK_CONTROL_MASK) { // original width/height when drag started @@ -310,22 +310,22 @@ RectKnotHolderEntityWH::set_internal(NR::Point const &p, NR::Point const &origin } void -RectKnotHolderEntityWH::knot_set(NR::Point const &p, NR::Point const &origin, guint state) +RectKnotHolderEntityWH::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) { set_internal(p, origin, state); update_knot(); } -NR::Point +Geom::Point RectKnotHolderEntityXY::knot_get() { SPRect *rect = SP_RECT(item); - return NR::Point(rect->x.computed, rect->y.computed); + return Geom::Point(rect->x.computed, rect->y.computed); } void -RectKnotHolderEntityXY::knot_set(NR::Point const &p, NR::Point const &origin, guint state) +RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) { SPRect *rect = SP_RECT(item); @@ -337,7 +337,7 @@ RectKnotHolderEntityXY::knot_set(NR::Point const &p, NR::Point const &origin, gu gdouble w_orig = opposite_x - origin[NR::X]; gdouble h_orig = opposite_y - origin[NR::Y]; - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); // mouse displacement since drag started gdouble minx = s[NR::X] - origin[NR::X]; @@ -432,23 +432,23 @@ RectKnotHolder::RectKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel class Box3DKnotHolderEntity : public KnotHolderEntity { public: - virtual NR::Point knot_get() = 0; - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state) = 0; + virtual Geom::Point knot_get() = 0; + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) = 0; - NR::Point knot_get_generic(SPItem *item, unsigned int knot_id); - void knot_set_generic(SPItem *item, unsigned int knot_id, NR::Point const &p, guint state); + Geom::Point knot_get_generic(SPItem *item, unsigned int knot_id); + void knot_set_generic(SPItem *item, unsigned int knot_id, Geom::Point const &p, guint state); }; -NR::Point +Geom::Point Box3DKnotHolderEntity::knot_get_generic(SPItem *item, unsigned int knot_id) { return box3d_get_corner_screen(SP_BOX3D(item), knot_id); } void -Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, NR::Point const &new_pos, guint state) +Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom::Point const &new_pos, guint state) { - NR::Point const s = snap_knot_position(new_pos); + Geom::Point const s = snap_knot_position(new_pos); g_assert(item != NULL); SPBox3D *box = SP_BOX3D(item); @@ -468,164 +468,164 @@ Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, NR:: class Box3DKnotHolderEntity0 : public Box3DKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class Box3DKnotHolderEntity1 : public Box3DKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class Box3DKnotHolderEntity2 : public Box3DKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class Box3DKnotHolderEntity3 : public Box3DKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class Box3DKnotHolderEntity4 : public Box3DKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class Box3DKnotHolderEntity5 : public Box3DKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class Box3DKnotHolderEntity6 : public Box3DKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class Box3DKnotHolderEntity7 : public Box3DKnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class Box3DKnotHolderEntityCenter : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; -NR::Point +Geom::Point Box3DKnotHolderEntity0::knot_get() { return knot_get_generic(item, 0); } -NR::Point +Geom::Point Box3DKnotHolderEntity1::knot_get() { return knot_get_generic(item, 1); } -NR::Point +Geom::Point Box3DKnotHolderEntity2::knot_get() { return knot_get_generic(item, 2); } -NR::Point +Geom::Point Box3DKnotHolderEntity3::knot_get() { return knot_get_generic(item, 3); } -NR::Point +Geom::Point Box3DKnotHolderEntity4::knot_get() { return knot_get_generic(item, 4); } -NR::Point +Geom::Point Box3DKnotHolderEntity5::knot_get() { return knot_get_generic(item, 5); } -NR::Point +Geom::Point Box3DKnotHolderEntity6::knot_get() { return knot_get_generic(item, 6); } -NR::Point +Geom::Point Box3DKnotHolderEntity7::knot_get() { return knot_get_generic(item, 7); } -NR::Point +Geom::Point Box3DKnotHolderEntityCenter::knot_get() { return box3d_get_center_screen(SP_BOX3D(item)); } void -Box3DKnotHolderEntity0::knot_set(NR::Point const &new_pos, NR::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity0::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) { knot_set_generic(item, 0, new_pos, state); } void -Box3DKnotHolderEntity1::knot_set(NR::Point const &new_pos, NR::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity1::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) { knot_set_generic(item, 1, new_pos, state); } void -Box3DKnotHolderEntity2::knot_set(NR::Point const &new_pos, NR::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity2::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) { knot_set_generic(item, 2, new_pos, state); } void -Box3DKnotHolderEntity3::knot_set(NR::Point const &new_pos, NR::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity3::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) { knot_set_generic(item, 3, new_pos, state); } void -Box3DKnotHolderEntity4::knot_set(NR::Point const &new_pos, NR::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity4::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) { knot_set_generic(item, 4, new_pos, state); } void -Box3DKnotHolderEntity5::knot_set(NR::Point const &new_pos, NR::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity5::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) { knot_set_generic(item, 5, new_pos, state); } void -Box3DKnotHolderEntity6::knot_set(NR::Point const &new_pos, NR::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity6::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) { knot_set_generic(item, 6, new_pos, state); } void -Box3DKnotHolderEntity7::knot_set(NR::Point const &new_pos, NR::Point const &/*origin*/, guint state) +Box3DKnotHolderEntity7::knot_set(Geom::Point const &new_pos, Geom::Point const &/*origin*/, guint state) { knot_set_generic(item, 7, new_pos, state); } void -Box3DKnotHolderEntityCenter::knot_set(NR::Point const &new_pos, NR::Point const &origin, guint state) +Box3DKnotHolderEntityCenter::knot_set(Geom::Point const &new_pos, Geom::Point const &origin, guint state) { - NR::Point const s = snap_knot_position(new_pos); + Geom::Point const s = snap_knot_position(new_pos); SPBox3D *box = SP_BOX3D(item); NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item))); @@ -695,28 +695,28 @@ Box3DKnotHolder::Box3DKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderR class ArcKnotHolderEntityStart : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; class ArcKnotHolderEntityEnd : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual void knot_click(guint state); }; class ArcKnotHolderEntityRX : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual void knot_click(guint state); }; class ArcKnotHolderEntityRY : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual void knot_click(guint state); }; @@ -727,7 +727,7 @@ public: * -1 : outside */ static gint -sp_genericellipse_side(SPGenericEllipse *ellipse, NR::Point const &p) +sp_genericellipse_side(SPGenericEllipse *ellipse, Geom::Point const &p) { gdouble dx = (p[NR::X] - ellipse->cx.computed) / ellipse->rx.computed; gdouble dy = (p[NR::Y] - ellipse->cy.computed) / ellipse->ry.computed; @@ -739,7 +739,7 @@ sp_genericellipse_side(SPGenericEllipse *ellipse, NR::Point const &p) } void -ArcKnotHolderEntityStart::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +ArcKnotHolderEntityStart::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { int snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12); @@ -748,7 +748,7 @@ ArcKnotHolderEntityStart::knot_set(NR::Point const &p, NR::Point const &/*origin ge->closed = (sp_genericellipse_side(ge, p) == -1) ? TRUE : FALSE; - NR::Point delta = p - NR::Point(ge->cx.computed, ge->cy.computed); + Geom::Point delta = p - Geom::Point(ge->cx.computed, ge->cy.computed); NR::scale sc(ge->rx.computed, ge->ry.computed); ge->start = atan2(delta * sc.inverse()); if ( ( state & GDK_CONTROL_MASK ) @@ -760,7 +760,7 @@ ArcKnotHolderEntityStart::knot_set(NR::Point const &p, NR::Point const &/*origin ((SPObject *)arc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -NR::Point +Geom::Point ArcKnotHolderEntityStart::knot_get() { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -770,7 +770,7 @@ ArcKnotHolderEntityStart::knot_get() } void -ArcKnotHolderEntityEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +ArcKnotHolderEntityEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { int snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12); @@ -779,7 +779,7 @@ ArcKnotHolderEntityEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/ ge->closed = (sp_genericellipse_side(ge, p) == -1) ? TRUE : FALSE; - NR::Point delta = p - NR::Point(ge->cx.computed, ge->cy.computed); + Geom::Point delta = p - Geom::Point(ge->cx.computed, ge->cy.computed); NR::scale sc(ge->rx.computed, ge->ry.computed); ge->end = atan2(delta * sc.inverse()); if ( ( state & GDK_CONTROL_MASK ) @@ -791,7 +791,7 @@ ArcKnotHolderEntityEnd::knot_set(NR::Point const &p, NR::Point const &/*origin*/ ((SPObject *)arc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -NR::Point +Geom::Point ArcKnotHolderEntityEnd::knot_get() { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); @@ -814,11 +814,11 @@ ArcKnotHolderEntityEnd::knot_click(guint state) void -ArcKnotHolderEntityRX::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +ArcKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); ge->rx.computed = fabs( ge->cx.computed - s[NR::X] ); @@ -829,12 +829,12 @@ ArcKnotHolderEntityRX::knot_set(NR::Point const &p, NR::Point const &/*origin*/, ((SPObject *)item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -NR::Point +Geom::Point ArcKnotHolderEntityRX::knot_get() { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); - return (NR::Point(ge->cx.computed, ge->cy.computed) - NR::Point(ge->rx.computed, 0)); + return (Geom::Point(ge->cx.computed, ge->cy.computed) - Geom::Point(ge->rx.computed, 0)); } void @@ -849,11 +849,11 @@ ArcKnotHolderEntityRX::knot_click(guint state) } void -ArcKnotHolderEntityRY::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +ArcKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); ge->ry.computed = fabs( ge->cy.computed - s[NR::Y] ); @@ -864,12 +864,12 @@ ArcKnotHolderEntityRY::knot_set(NR::Point const &p, NR::Point const &/*origin*/, ((SPObject *)item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -NR::Point +Geom::Point ArcKnotHolderEntityRY::knot_get() { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); - return (NR::Point(ge->cx.computed, ge->cy.computed) - NR::Point(0, ge->ry.computed)); + return (Geom::Point(ge->cx.computed, ge->cy.computed) - Geom::Point(0, ge->ry.computed)); } void @@ -916,26 +916,26 @@ ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRelea class StarKnotHolderEntity1 : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual void knot_click(guint state); }; class StarKnotHolderEntity2 : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual void knot_click(guint state); }; void -StarKnotHolderEntity1::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { SPStar *star = SP_STAR(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); - NR::Point d = s - star->center; + Geom::Point d = s - to_2geom(star->center); double arg1 = atan2(d); double darg1 = arg1 - star->arg[0]; @@ -955,14 +955,14 @@ StarKnotHolderEntity1::knot_set(NR::Point const &p, NR::Point const &/*origin*/, } void -StarKnotHolderEntity2::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { SPStar *star = SP_STAR(item); - NR::Point const s = snap_knot_position(p); + Geom::Point const s = snap_knot_position(p); if (star->flatsided == false) { - NR::Point d = s - star->center; + Geom::Point d = s - to_2geom(star->center); double arg1 = atan2(d); double darg1 = arg1 - star->arg[1]; @@ -983,7 +983,7 @@ StarKnotHolderEntity2::knot_set(NR::Point const &p, NR::Point const &/*origin*/, } } -NR::Point +Geom::Point StarKnotHolderEntity1::knot_get() { g_assert(item != NULL); @@ -994,7 +994,7 @@ StarKnotHolderEntity1::knot_get() } -NR::Point +Geom::Point StarKnotHolderEntity2::knot_get() { g_assert(item != NULL); @@ -1059,15 +1059,15 @@ StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel class SpiralKnotHolderEntityInner : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); virtual void knot_click(guint state); }; class SpiralKnotHolderEntityOuter : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; @@ -1078,7 +1078,7 @@ public: * [control] constrain inner arg to round per PI/4 */ void -SpiralKnotHolderEntityInner::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { int snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12); @@ -1120,7 +1120,7 @@ SpiralKnotHolderEntityInner::knot_set(NR::Point const &p, NR::Point const &/*ori * [control] constrain inner arg to round per PI/4 */ void -SpiralKnotHolderEntityOuter::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint state) +SpiralKnotHolderEntityOuter::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { int snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12); @@ -1192,7 +1192,7 @@ SpiralKnotHolderEntityOuter::knot_set(NR::Point const &p, NR::Point const &/*ori ((SPObject *)spiral)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -NR::Point +Geom::Point SpiralKnotHolderEntityInner::knot_get() { SPSpiral *spiral = SP_SPIRAL(item); @@ -1200,7 +1200,7 @@ SpiralKnotHolderEntityInner::knot_get() return sp_spiral_get_xy(spiral, spiral->t0); } -NR::Point +Geom::Point SpiralKnotHolderEntityOuter::knot_get() { SPSpiral *spiral = SP_SPIRAL(item); @@ -1243,12 +1243,12 @@ SpiralKnotHolder::SpiralKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolde class OffsetKnotHolderEntity : public KnotHolderEntity { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; void -OffsetKnotHolderEntity::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +OffsetKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) { SPOffset *offset = SP_OFFSET(item); @@ -1260,12 +1260,12 @@ OffsetKnotHolderEntity::knot_set(NR::Point const &p, NR::Point const &/*origin*/ } -NR::Point +Geom::Point OffsetKnotHolderEntity::knot_get() { SPOffset *offset = SP_OFFSET(item); - NR::Point np; + Geom::Point np; sp_offset_top_point(offset,&np); return np; } @@ -1286,20 +1286,20 @@ OffsetKnotHolder::OffsetKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolde // sense logically. class FlowtextKnotHolderEntity : public RectKnotHolderEntityWH { public: - virtual NR::Point knot_get(); - virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); }; -NR::Point +Geom::Point FlowtextKnotHolderEntity::knot_get() { SPRect *rect = SP_RECT(item); - return NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed); + return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed); } void -FlowtextKnotHolderEntity::knot_set(NR::Point const &p, NR::Point const &origin, guint state) +FlowtextKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) { set_internal(p, origin, state); } diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index a9f13c8ab..80319e38c 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -601,8 +601,8 @@ void Inkscape::ObjectSnapper::_snapPathsConstrained(SnappedConstraints &sc, Geom::Path cl; std::vector clv; - cl.start(p_min_on_cl.to_2geom()); - cl.appendNew(p_max_on_cl.to_2geom()); + cl.start(p_min_on_cl); + cl.appendNew(p_max_on_cl); clv.push_back(cl); for (std::vector::const_iterator k = _bpaths_to_snap_to->begin(); k != _bpaths_to_snap_to->end(); k++) { diff --git a/src/satisfied-guide-cns.cpp b/src/satisfied-guide-cns.cpp index 112930925..640ffa79f 100644 --- a/src/satisfied-guide-cns.cpp +++ b/src/satisfied-guide-cns.cpp @@ -13,7 +13,7 @@ void satisfied_guide_cns(SPDesktop const &desktop, for (GSList const *l = nv.guides; l != NULL; l = l->next) { SPGuide &g = *SP_GUIDE(l->data); for (unsigned int i = 0; i < snappoints.size(); ++i) { - if (approx_equal( sp_guide_distance_from_pt(&g, snappoints[i].to_2geom()), 0) ) { + if (approx_equal( sp_guide_distance_from_pt(&g, snappoints[i]), 0) ) { cns.push_back(SPGuideConstraint(&g, i)); } } diff --git a/src/snapped-line.cpp b/src/snapped-line.cpp index be7b0e871..11298bf25 100644 --- a/src/snapped-line.cpp +++ b/src/snapped-line.cpp @@ -47,8 +47,8 @@ Inkscape::SnappedLineSegment::~SnappedLineSegment() Inkscape::SnappedPoint Inkscape::SnappedLineSegment::intersect(SnappedLineSegment const &line) const { Geom::Point intersection_2geom(NR_HUGE, NR_HUGE); - Geom::IntersectorKind result = segment_intersect(_start_point_of_line.to_2geom(), _end_point_of_line.to_2geom(), - line._start_point_of_line.to_2geom(), line._end_point_of_line.to_2geom(), + Geom::IntersectorKind result = segment_intersect(_start_point_of_line, _end_point_of_line, + line._start_point_of_line, line._end_point_of_line, intersection_2geom); NR::Point intersection(intersection_2geom); @@ -115,8 +115,8 @@ Inkscape::SnappedPoint Inkscape::SnappedLine::intersect(SnappedLine const &line) // The point of intersection should be considered for snapping, but might be outside the snapping range Geom::Point intersection_2geom(NR_HUGE, NR_HUGE); - Geom::IntersectorKind result = Geom::line_intersection(getNormal().to_2geom(), getConstTerm(), - line.getNormal().to_2geom(), line.getConstTerm(), intersection_2geom); + Geom::IntersectorKind result = Geom::line_intersection(getNormal(), getConstTerm(), + line.getNormal(), line.getConstTerm(), intersection_2geom); NR::Point intersection(intersection_2geom); if (result == Geom::intersects) { diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index aad26f050..561e0e62c 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -206,7 +206,7 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) // default to vertical line for bad arguments guide->normal_to_line = component_vectors[NR::X]; } - sp_guide_set_normal(*guide, guide->normal_to_line.to_2geom(), false); + sp_guide_set_normal(*guide, guide->normal_to_line, false); } break; case SP_ATTR_POSITION: @@ -289,7 +289,7 @@ sp_guide_create_guides_around_page(SPDesktop *dt) { void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler) { - SPCanvasItem *item = sp_guideline_new(group, guide->point_on_line, guide->normal_to_line.to_2geom()); + SPCanvasItem *item = sp_guideline_new(group, guide->point_on_line, guide->normal_to_line); sp_guideline_set_color(SP_GUIDELINE(item), guide->color); g_signal_connect(G_OBJECT(item), "event", G_CALLBACK(handler), guide); @@ -334,7 +334,7 @@ void sp_guide_sensitize(SPGuide *guide, SPCanvas *canvas, gboolean sensitive) Geom::Point sp_guide_position_from_pt(SPGuide const *guide, NR::Point const &pt) { - return -(pt.to_2geom() - guide->point_on_line); + return -(pt - guide->point_on_line); } double sp_guide_distance_from_pt(SPGuide const *guide, Geom::Point const &pt) diff --git a/src/sp-item-rm-unsatisfied-cns.cpp b/src/sp-item-rm-unsatisfied-cns.cpp index bcd16e3aa..f3e231ddc 100644 --- a/src/sp-item-rm-unsatisfied-cns.cpp +++ b/src/sp-item-rm-unsatisfied-cns.cpp @@ -21,7 +21,7 @@ void sp_item_rm_unsatisfied_cns(SPItem &item) SPGuideConstraint const &cn = item.constraints[i]; int const snappoint_ix = cn.snappoint_ix; g_assert( snappoint_ix < int(snappoints.size()) ); - if (!approx_equal( sp_guide_distance_from_pt(cn.g, snappoints[snappoint_ix].to_2geom()), 0) ) { + if (!approx_equal( sp_guide_distance_from_pt(cn.g, snappoints[snappoint_ix]), 0) ) { remove_last(cn.g->attached_items, SPGuideAttachment(&item, cn.snappoint_ix)); g_assert( i < item.constraints.size() ); vector::iterator const ei(&item.constraints[i]); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 422ea1195..691d471ca 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -1722,10 +1722,10 @@ sp_item_convert_to_guides(SPItem *item) { NR::Point B(A[NR::X], C[NR::Y]); NR::Point D(C[NR::X], A[NR::Y]); - pts.push_back(std::make_pair(A.to_2geom(), B.to_2geom())); - pts.push_back(std::make_pair(B.to_2geom(), C.to_2geom())); - pts.push_back(std::make_pair(C.to_2geom(), D.to_2geom())); - pts.push_back(std::make_pair(D.to_2geom(), A.to_2geom())); + pts.push_back(std::make_pair(A, B)); + pts.push_back(std::make_pair(B, C)); + pts.push_back(std::make_pair(C, D)); + pts.push_back(std::make_pair(D, A)); sp_guide_pt_pairs_to_guides(dt, pts); } diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index de4933821..8f4dead0a 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -937,9 +937,9 @@ sp_offset_distance_to_original (SPOffset * offset, NR::Point px) * \return the topmost point on the offset. */ void -sp_offset_top_point (SPOffset * offset, NR::Point *px) +sp_offset_top_point (SPOffset * offset, Geom::Point *px) { - (*px) = NR::Point(0, 0); + (*px) = Geom::Point(0, 0); if (offset == NULL) return; diff --git a/src/sp-offset.h b/src/sp-offset.h index 08df8a1ea..1ccffd0ff 100644 --- a/src/sp-offset.h +++ b/src/sp-offset.h @@ -90,7 +90,7 @@ struct SPOffsetClass GType sp_offset_get_type (void); double sp_offset_distance_to_original (SPOffset * offset, NR::Point px); -void sp_offset_top_point (SPOffset * offset, NR::Point *px); +void sp_offset_top_point (SPOffset * offset, Geom::Point *px); SPItem *sp_offset_get_source (SPOffset *offset); diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index ad8ba38a9..08d30b4f4 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -586,10 +586,10 @@ sp_rect_convert_to_guides(SPItem *item) { NR::Point A3(NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d); NR::Point A4(NR::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d); - pts.push_back(std::make_pair(A1.to_2geom(), A2.to_2geom())); - pts.push_back(std::make_pair(A2.to_2geom(), A3.to_2geom())); - pts.push_back(std::make_pair(A3.to_2geom(), A4.to_2geom())); - pts.push_back(std::make_pair(A4.to_2geom(), A1.to_2geom())); + pts.push_back(std::make_pair(A1, A2)); + pts.push_back(std::make_pair(A2, A3)); + pts.push_back(std::make_pair(A3, A4)); + pts.push_back(std::make_pair(A4, A1)); sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts); } diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 17dabed82..7d771c0d4 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -569,8 +569,8 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) NR::Maybe size = selection->bounds(); if (size) { - sp_repr_set_point(_clipnode, "min", size->min().to_2geom()); - sp_repr_set_point(_clipnode, "max", size->max().to_2geom()); + sp_repr_set_point(_clipnode, "min", size->min()); + sp_repr_set_point(_clipnode, "max", size->max()); } g_slist_free(sorted_items); diff --git a/src/ui/widget/ruler.cpp b/src/ui/widget/ruler.cpp index 27c991446..c6fb4395f 100644 --- a/src/ui/widget/ruler.cpp +++ b/src/ui/widget/ruler.cpp @@ -105,7 +105,7 @@ Ruler::on_button_press_event(GdkEventButton *evb) _dragging = true; sp_repr_set_boolean(repr, "showguides", TRUE); sp_repr_set_boolean(repr, "inkscape:guide-bbox", TRUE); - _guide = sp_guideline_new(_dt->guides, event_dt.to_2geom(), _horiz_f ? Geom::Point(0.,1.) : Geom::Point(1.,0.)); + _guide = sp_guideline_new(_dt->guides, event_dt, _horiz_f ? Geom::Point(0.,1.) : Geom::Point(1.,0.)); sp_guideline_set_color(SP_GUIDELINE(_guide), _dt->namedview->guidehicolor); (void) get_window()->pointer_grab(false, Gdk::BUTTON_RELEASE_MASK | @@ -123,7 +123,7 @@ Ruler::on_motion_notify_event(GdkEventMotion *) NR::Point const &event_dt = get_event_dt(); if (_dragging) { - sp_guideline_set_position(SP_GUIDELINE(_guide), event_dt.to_2geom()); + sp_guideline_set_position(SP_GUIDELINE(_guide), event_dt); _dt->set_coordinate_status(event_dt); _dt->setPosition(event_dt); }