lpe-bspline.cpp revision 57b10de804a8bae2c91decce6f686c083e494915
/*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtkmm.h>
#if WITH_GLIBMM_2_32
#endif
#include <glib.h>
#include "helper/geom-curves.h"
#include "live_effects/lpe-bspline.h"
#include "live_effects/lpeobject.h"
#include "live_effects/parameter/parameter.h"
#include "ui/tools/node-tool.h"
#include "ui/tool/control-point-selection.h"
#include "ui/tool/selectable-control-point.h"
#include "selection.h"
#include "sp-path.h"
#include "style.h"
#include "document-private.h"
#include "document.h"
#include "document-undo.h"
#include "desktop-handles.h"
#include "verbs.h"
#include "sp-lpe-item.h"
#include "display/sp-canvas.h"
#include <typeinfo>
#include <vector>
// For handling un-continuous paths:
#include "message-stack.h"
#include "inkscape.h"
#include "desktop.h"
using Inkscape::DocumentUndo;
namespace Inkscape {
namespace LivePathEffect {
const double handleCubicGap = 0.01;
steps(_("Steps whith CTRL:"), _("Change number of steps whith CTRL pressed"), "steps", &wr, this, 2),
onlySelected(_("Change only selected nodes"), _("Change only selected nodes"), "onlySelected", &wr, this, false),
{
}
LPEBSpline::~LPEBSpline() {}
{
if (!SP_IS_SHAPE(item)) {
g_warning("LPE BSpline can only be applied to shapes (not groups).");
} else {
// Path effect definition
}
}
{
return;
}
continue;
}
}
while (curve_it1 != curve_endit) {
if (cubic) {
} else {
}
} else {
}
} else {
}
delete in;
if ( curve_it2 != curve_endit ) {
if (cubic) {
} else {
}
} else {
}
delete out;
}
if (cubic) {
} else {
}
delete start;
if (cubic) {
} else {
}
delete end;
lineHelper->reset();
delete lineHelper;
} else if ( curve_it2 == curve_endit) {
} else {
lineHelper->reset();
delete lineHelper;
previousNode = node;
if((cubic && are_near((*cubic)[0],(*cubic)[1])) || (cubic2 && are_near((*cubic2)[2],(*cubic2)[3]))) {
}
}
++curve_it1;
++curve_it2;
}
//y cerramos la curva
}
delete nCurve;
}
}
{
// use manage here, because after deletion of Effect object, others might
// still be pointing to this widget.
if ((*it)->widget_is_visible) {
defaultWeight->signal_clicked().connect(sigc::bind<Gtk::Widget *>(sigc::mem_fun(*this, &LPEBSpline::toDefaultWeight), widg));
makeCusp->signal_clicked().connect(sigc::bind<Gtk::Widget *>(sigc::mem_fun(*this, &LPEBSpline::toMakeCusp), widg));
}
Inkscape::UI::Widget::Scalar *widgRegistered = Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg));
if (widg) {
}
}
if (widg) {
if (tip) {
} else {
widg->set_has_tooltip(false);
}
}
}
++it;
}
return vbox;
}
{
changeWeight(0.3334);
}
{
changeWeight(0.0000);
}
void LPEBSpline::toWeight()
{
}
{
}
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_LPE, _("Modified the weight of a BSpline"));
}
{
using Geom::X;
using Geom::Y;
return true;
} else {
}
}
}
return false;
}
{
using Geom::X;
using Geom::Y;
if ((*i)->selected()) {
}
}
}
//bool hasNodesSelected = LPEBspline::hasNodesSelected();
return;
// Make copy of old path as it is changed during processing
//Recorremos todos los paths a los que queremos aplicar el efecto, hasta el
//penúltimo
//Si está vacío...
continue;
//Itreadores
//Creamos las lineas rectas que unen todos los puntos del trazado y donde se
//calcularán
//los puntos clave para los manejadores.
//Esto hace que la curva BSpline no pierda su condición aunque se trasladen
//dichos manejadores
// if the path is closed, maybe we have to stop a bit earlier because the
// closing line segment has zerolength.
// Geom::LineSegment.
// closingline.isDegenerate() did not work, because it only checks for
// *exact* zero length, which goes wrong for relative coordinates and
// rounding errors...
// the closing line segment has zero-length. So stop before that one!
}
}
//Si la curva está cerrada calculamos el punto donde
//en posible caso de que se cierre con una linea recta creando un nodo
//BSPline
//Recorremos todos los segmentos menos el último
while (curve_it1 != curve_endit) {
//previousPointAt3 = pointAt3;
//Calculamos los puntos que dividirían en tres segmentos iguales el path
//recto de entrada y de salida
if (!onlySelected) {
if (cubic) {
if (weightValue != 0.0000) {
pointAt1 =
}
} else {
}
if (weightValue != 0.0000) {
pointAt2 =
}
} else {
}
} else {
if (weightValue != 0.0000) {
pointAt1 =
}
if (weightValue != 0.0000) {
pointAt2 =
}
} else {
}
}
} else {
if (cubic) {
if (nodeIsSelected(pointAt0)) {
if (weightValue != 0.0000) {
pointAt1 =
}
} else {
}
} else {
}
if (nodeIsSelected(pointAt3)) {
if (weightValue != 0.0000) {
pointAt2 =
}
} else {
}
} else {
}
} else {
if (nodeIsSelected(pointAt0)) {
pointAt1 =
} else {
}
if (nodeIsSelected(pointAt3)) {
pointAt2 =
} else {
}
} else {
}
}
}
delete in;
//La curva BSpline se forma calculando el centro del segmanto de unión
//de el punto situado en las 2/3 partes de el segmento de entrada
//con el punto situado en la posición 1/3 del segmento de salida
//Estos dos puntos ademas estan posicionados en el lugas correspondiente
//de
//los manejadores de la curva
//aumentamos los valores para el siguiente paso en el bucle
++curve_it1;
++curve_it2;
}
} else {
}
//y cerramos la curva
}
delete nCurve;
}
}
}; //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 :