lpe-copy_rotate.cpp revision 16fb3a233e680e2cc0452528e102f84887b8015f
/** \file
* LPE <copy_rotate> implementation
*/
/*
* Authors:
* Maximilian Albert <maximilian.albert@gmail.com>
* Johan Engelen <j.b.c.engelen@alumnus.utwente.nl>
*
* Copyright (C) Authors 2007-2012
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "live_effects/lpe-copy_rotate.h"
#include "knot-holder-entity.h"
#include "knotholder.h"
namespace Inkscape {
namespace LivePathEffect {
namespace CR {
class KnotHolderEntityStartingAngle : public LPEKnotHolderEntity {
public:
};
class KnotHolderEntityRotationAngle : public LPEKnotHolderEntity {
public:
};
class KnotHolderEntityOrigin : public LPEKnotHolderEntity {
public:
};
} // namespace CR
origin(_("Origin"), _("Origin of the rotation"), "origin", &wr, this, "Adjust the origin of the rotation"),
rotation_angle(_("Rotation angle:"), _("Angle between two successive copies"), "rotation_angle", &wr, this, 30.0),
num_copies(_("Number of copies:"), _("Number of copies of the original path"), "num_copies", &wr, this, 5),
copiesTo360(_("360º Copies"), _("No rotation angle, fixed to 360º"), "copiesTo360", &wr, this, true),
dist_angle_handle(100.0)
{
show_orig_path = true;
_provides_knotholder_entities = true;
// register all your parameters here, so Inkscape knows which parameters this effect has:
num_copies.param_make_integer(true);
}
{
}
void
{
using namespace Geom;
origin.param_setValue(A);
dist_angle_handle = L2(B - A);
dir = unit_vector(B - A);
}
void
{
using namespace Geom;
if(copiesTo360 ){
}
dir = unit_vector(B - A);
// 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)
if(copiesTo360 ){
}
}
{
using namespace Geom;
if(num_copies == 1){
return pwd2_in;
}
for (int i = 0; i < num_copies; ++i) {
}
return output;
}
void
LPECopyRotate::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec)
{
using namespace Geom;
hp.appendNew<Geom::LineSegment>(origin + dir * Rotate(-deg_to_rad(rotation_angle+starting_angle)) * dist_angle_handle);
}
void LPECopyRotate::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
{
_("Adjust the starting angle"));
knotholder->add(e);
}
{
_("Adjust the rotation angle"));
knotholder->add(e);
}
}
void
{
};
namespace CR {
using namespace Geom;
void
KnotHolderEntityStartingAngle::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
// 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)
if (state & GDK_SHIFT_MASK) {
} else {
}
// FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating.
}
void
KnotHolderEntityRotationAngle::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
// 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 - lpe->origin)) - lpe->starting_angle);
if (state & GDK_SHIFT_MASK) {
} else {
}
// FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating.
}
KnotHolderEntityStartingAngle::knot_get() const
{
}
KnotHolderEntityRotationAngle::knot_get() const
{
}
} // namespace CR
/* ######################## */
} //namespace LivePathEffect
} /* namespace Inkscape */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :