summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 15e3dce)
raw | patch | inline | side by side (parent: 15e3dce)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 1 Aug 2008 19:15:16 +0000 (19:15 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 1 Aug 2008 19:15:16 +0000 (19:15 +0000) |
30 files changed:
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 6f63aa3ce54250c7ad1eef5cb23a78d7690711e4..522bfbdda510101dd2ef3a3ddd30917b08d01621 100644 (file)
--- 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,
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);
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 {
index 2bfac655e39904d5e76e5a80642a091173352592..49ca07ca7d511e0c73da32ab06a380bb4ddfa24f 100644 (file)
// 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
index b1fc7501cbcdbc47ca7313b3bbf4902c483df0ca..e2e014eff97162ff9b016c16e8e12a3a35bae381 100644 (file)
@@ -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);
}
index d40fd735aceeaab314d1fa2a4a6db5801d217c14..bd12cde886c695ec13ebed228b97096cffe6e09c 100644 (file)
#include "desktop.h"
#include "sp-namedview.h"
#include <2geom/matrix.h>
+#include <2geom/transforms.h>
int KnotHolderEntity::counter = 0;
{
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;
/* 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);
}
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;
index 432bf5501e407f576a26c9d10833ae0e77b11604..1f5ea8e2c98330a38e1a53848e45da5af4c91e1e 100644 (file)
--- a/src/knot-holder-entity.h
+++ b/src/knot-holder-entity.h
#include <glib/gtypes.h>
#include "knot.h"
-#include <libnr/nr-forward.h>
+#include <2geom/forward.h>
struct SPItem;
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);
/* 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;
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 6b838b3c9bd84e2db8ab9af6959ac01db72cfb4a..25d6d46381f8d83490a5d389ca9c55c6afe540c4 100644 (file)
--- a/src/knotholder.h
+++ b/src/knotholder.h
}
}
-
-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 ff9b5a4542f96fa05b9058e28d1e713d4c523c2b..57a25c74656bfd2294c745770fa72407a51fa0ce 100644 (file)
--- a/src/libnr/nr-point.h
+++ b/src/libnr/nr-point.h
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 8fdf936ed84dbd8fcceaff92196be28871b2ee9a..ee902d5fc08ba6e07b279f584937be637b82cfde 100644 (file)
--- a/src/line-snapper.cpp
+++ b/src/line-snapper.cpp
/* 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) {
index 179d46a52b6668ed16c1e22813d684830e0be997..111928d13922fc1a3e251a77ad62d73ade2c1c24 100644 (file)
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
}
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);
index 5fd33605b60fce105f604a15fd95ea614d408b43..bfb9a7b995d3d483a1bfe1fdff3a9304c576c5cb 100644 (file)
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
}
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);
index e6d49b0b234f3ff9699312cdf5b255f15ae58707..e169a3b8fbafdf32ad47647e2c30911bce4fe497 100644 (file)
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
}
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);
index f9aca2ada9ca493c47974471893a5eabdee1b9e8..35c6f0933a9b358f586c20220109b6b6aa9d93a7 100644 (file)
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
return static_cast<LPEPerpBisector *>(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<Inkscape::LivePathEffect::LPEPerpBisector *> (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);
}
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<Inkscape::LivePathEffect::LPEPerpBisector *> (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<Inkscape::LivePathEffect::LPEPerpBisector *> (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();
}
**/
-//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);
//}
/**
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);
index 9985542413953c11ab6c7b6bacbd6a21f7b7db68..ff487f235a33054f4ccb5466fa809e10960c0a64 100644 (file)
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
}
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);
index 5fc4ba6f2ffb3e9bc850fad8f7a6cf065b4772e3..c2ab7be514469910939adb02443bc5092e4a03ea 100644 (file)
{
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);
};
index 0d21b38e093e26e443e01e7b96beb78fa43dd2ed..ede13e2d45cb30203e22cef7ec1df42443b37576 100644 (file)
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
}
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);
index 1ec443a5f282f1a6094d8097f722e8a462baf939..e9cf050994ebec03c81d29d923adc241ac72acfc 100644 (file)
NR::Maybe<NR::Rect> 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];
}
index 0cb57993e6926358fc11cc3bb9bf00d16b89c36d..0c7a701f17dab033901ed3cdad89cd073c84aca2 100644 (file)
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:
};
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 434eff4f4e574818b9f93585265bfc69f5309170..34c149b4be9bcbaed9a835a793f27fd351776cab 100644 (file)
#include "sp-shape.h"
#include "knot.h"
#include "knotholder.h"
-#include "knot-holder-entity.h"
#include <glibmm/i18n.h>
#include <2geom/point.h>
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)
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 1d72b9b29d1ad27054e792c8c64854d99be3811f..3b513fe8815354593b4a91c39f4985e69a5f47e8 100644 (file)
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
/* 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);
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);
}
}
-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);
};
* -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;
}
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);
}
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);
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
}
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);
}
-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);
};
* [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);
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 a9f13c8aba288f2ea32074c7d6f78c417e11195c..80319e38c6e758fb91febb0d5436050529982743 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
Geom::Path cl;
std::vector<Geom::Path> clv;
- cl.start(p_min_on_cl.to_2geom());
- cl.appendNew<Geom::LineSegment>(p_max_on_cl.to_2geom());
+ cl.start(p_min_on_cl);
+ cl.appendNew<Geom::LineSegment>(p_max_on_cl);
clv.push_back(cl);
for (std::vector<NArtBpath*>::const_iterator k = _bpaths_to_snap_to->begin(); k != _bpaths_to_snap_to->end(); k++) {
index 11293092561ddd6f39d520402e2c754605fb5fdc..640ffa79f68de4f9b94639b53300407d5c50c1e1 100644 (file)
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 be7b0e8711109913342b1ff4cce57475da564035..11298bf25cac169272d92207cec36a87b6a6c043 100644 (file)
--- a/src/snapped-line.cpp
+++ b/src/snapped-line.cpp
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 aad26f050443749c0574d1d6422808248b72e737..561e0e62cb44a9e96aeff4779276ed27c1563b24 100644 (file)
--- 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:
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);
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)
index bcd16e3aa77167d75fe3977810ce35e005a236c5..f3e231ddc770a3750d3dbaba26ad82d808c4a687 100644 (file)
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<SPGuideConstraint>::iterator const ei(&item.constraints[i]);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 422ea1195c455023f9aae0959cb2a93bbb1be63b..691d471ca8e32e2a5ce65ee775e1db4893da1cbf 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
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 de4933821c3ed46f65e596b5da6950c24476cc92..8f4dead0ad84d715fdcd2aab986e86b4d6c0b826 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
* \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 08df8a1eac00ffb81f48647481cc25a2a4781747..1ccffd0fff06e07f2e015228ae74d62f7167a2fa 100644 (file)
--- a/src/sp-offset.h
+++ b/src/sp-offset.h
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 ad8ba38a93cac607d3c8f1c734405aae8c3e25c1..08d30b4f4be5a8db104f2c1c4ae2f6abe9ba8bee 100644 (file)
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
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 17dabed82f2b256dbae1675acb5ba78074e608a0..7d771c0d4695e1f20062fde860ce6ba8c87543e4 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
NR::Maybe<NR::Rect> 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);
index 27c991446b7239718462e3dabc3700416bbee22d..c6fb4395f88b47edb9468caeea931e0658d36484 100644 (file)
--- a/src/ui/widget/ruler.cpp
+++ b/src/ui/widget/ruler.cpp
_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 |
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);
}