index d193b6d66591ae483d9e4915c7b9422dc6c5b7f5..dac34c5d485bad8057bae5966942e8e5f8b02463 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
{
SPCurve *curve = SP_SHAPE(lpeitem)->curve;
- A = curve->first_point();
- B = curve->last_point();
+ A = *(curve->first_point());
+ B = *(curve->last_point());
origin.param_setValue(A);
{
using namespace Geom;
+ // 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)
+ start_pos = origin + dir * Rotate(-deg_to_rad(starting_angle)) * dist_angle_handle;
+ rot_pos = origin + dir * Rotate(-deg_to_rad(starting_angle + rotation_angle)) * dist_angle_handle;
+
A = pwd2_in.firstValue();
B = pwd2_in.lastValue();
dir = unit_vector(B - A);
@@ -108,6 +113,20 @@ LPECopyRotate::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p
return output;
}
+void
+LPECopyRotate::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec)
+{
+ using namespace Geom;
+
+ Path path(start_pos);
+ path.appendNew<LineSegment>((Geom::Point) origin);
+ path.appendNew<LineSegment>(rot_pos);
+
+ PathVector pathv;
+ pathv.push_back(path);
+ hp_vec.push_back(pathv);
+}
+
namespace CR {
using namespace Geom;
}
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 {
@@ -145,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 {
@@ -164,26 +183,18 @@ 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);
- // 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)
- Point d = lpe->dir * Rotate(-deg_to_rad(lpe->starting_angle)) * lpe->dist_angle_handle;
-
- return snap_knot_position(lpe->origin + d);
+ return snap_knot_position(lpe->start_pos);
}
-NR::Point
+Geom::Point
KnotHolderEntityRotationAngle::knot_get()
{
LPECopyRotate* lpe = get_effect(item);
- // 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)
- Point d = lpe->dir * Rotate(-deg_to_rad(lpe->starting_angle + lpe->rotation_angle)) * lpe->dist_angle_handle;
-
- return snap_knot_position(lpe->origin + d);
+ return snap_knot_position(lpe->rot_pos);
}
} // namespace CR