summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/helper/geom-pathvectorsatellites.cpp111
-rw-r--r--src/helper/geom-pathvectorsatellites.h11
-rw-r--r--src/helper/geom-satellite.cpp58
-rw-r--r--src/helper/geom-satellite.h13
-rw-r--r--src/live_effects/effect.cpp32
-rw-r--r--src/live_effects/effect.h5
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp354
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h34
-rw-r--r--src/live_effects/lpe-transform_2pts.cpp2
-rw-r--r--src/live_effects/parameter/array.cpp15
-rw-r--r--src/live_effects/parameter/array.h2
-rw-r--r--src/live_effects/parameter/satellitesarray.cpp51
-rw-r--r--src/live_effects/parameter/satellitesarray.h5
-rw-r--r--src/ui/tools/node-tool.cpp10
14 files changed, 362 insertions, 341 deletions
diff --git a/src/helper/geom-pathvectorsatellites.cpp b/src/helper/geom-pathvectorsatellites.cpp
index 625506b2f..c56887f53 100644
--- a/src/helper/geom-pathvectorsatellites.cpp
+++ b/src/helper/geom-pathvectorsatellites.cpp
@@ -1,6 +1,6 @@
/**
* \file
- * \brief PathVectorSatellites a class to manage a vector of satellites per piecewise node
+ * \brief PathVectorSatellites a class to manage satellites -per node extra data- in a pathvector
*/ /*
* Authors:
* Jabiertxof
@@ -60,6 +60,115 @@ std::pair<size_t, size_t> PathVectorSatellites::getIndexData(size_t index)
return std::make_pair(0,0);
}
+void PathVectorSatellites::setSelected(std::vector<size_t> selected)
+{
+ size_t counter = 0;
+ for (size_t i = 0; i < _satellites.size(); ++i) {
+ for (size_t j = 0; j < _satellites[i].size(); ++j) {
+ if(find (selected.begin(), selected.end(), counter) != selected.end()){
+ _satellites[i][j].setSelected(true);
+ } else {
+ _satellites[i][j].setSelected(false);
+ }
+ counter++;
+ }
+ }
+}
+
+void PathVectorSatellites::updateSteps(size_t steps, bool apply_no_radius, bool apply_with_radius, bool only_selected)
+{
+ for (size_t i = 0; i < _satellites.size(); ++i) {
+ for (size_t j = 0; j < _satellites[i].size(); ++j) {
+ if ((!apply_no_radius && _satellites[i][j].amount == 0) ||
+ (!apply_with_radius && _satellites[i][j].amount != 0))
+ {
+ continue;
+ }
+ if (only_selected) {
+ if (_satellites[i][j].selected) {
+ _satellites[i][j].steps = steps;
+ }
+ } else {
+ _satellites[i][j].steps = steps;
+ }
+ }
+ }
+}
+
+void PathVectorSatellites::updateAmount(double radius, bool apply_no_radius, bool apply_with_radius, bool only_selected,
+ bool use_knot_distance, bool flexible)
+{
+ double power = 0;
+ if (!flexible) {
+ power = radius;
+ } else {
+ power = radius / 100;
+ }
+ for (size_t i = 0; i < _satellites.size(); ++i) {
+ for (size_t j = 0; j < _satellites[i].size(); ++j) {
+ boost::optional<size_t> previous_index = boost::none;
+ if(j == 0 && _pathvector[i].closed()){
+ previous_index = _pathvector[i].size() - 1;
+ } else if(!_pathvector[i].closed() || j != 0) {
+ previous_index = j - 1;
+ }
+ if (!_pathvector[i].closed() && j == 0) {
+ _satellites[i][j].amount = 0;
+ continue;
+ }
+ if (_pathvector[i].size() == j) {
+ continue;
+ }
+ if ((!apply_no_radius && _satellites[i][j].amount == 0) ||
+ (!apply_with_radius && _satellites[i][j].amount != 0))
+ {
+ continue;
+ }
+
+ Geom::Point satellite_point = _pathvector[i].pointAt(j);
+ if (_satellites[i][j].selected || !only_selected) {
+ if (!use_knot_distance && !flexible) {
+ if(previous_index) {
+ _satellites[i][j].amount = _satellites[i][j].radToLen(power, _pathvector[i][*previous_index], _pathvector[i][j]);
+ } else {
+ _satellites[i][j].amount = 0.0;
+ }
+ } else {
+ _satellites[i][j].amount = power;
+ }
+ }
+ }
+ }
+}
+
+void PathVectorSatellites::updateSatelliteType(SatelliteType satellitetype, bool apply_no_radius, bool apply_with_radius,
+ bool only_selected)
+{
+ for (size_t i = 0; i < _satellites.size(); ++i) {
+ for (size_t j = 0; j < _satellites[i].size(); ++j) {
+ if ((!apply_no_radius && _satellites[i][j].amount == 0) ||
+ (!apply_with_radius && _satellites[i][j].amount != 0))
+ {
+ continue;
+ }
+ if (_pathvector[i].size() == j) {
+ if (!only_selected) {
+ _satellites[i][j].satellite_type = satellitetype;
+ }
+ continue;
+ }
+ if (only_selected) {
+ Geom::Point satellite_point = _pathvector[i].pointAt(j);
+ if (_satellites[i][j].selected) {
+ _satellites[i][j].satellite_type = satellitetype;
+ }
+ } else {
+ _satellites[i][j].satellite_type = satellitetype;
+ }
+ }
+ }
+}
+
void PathVectorSatellites::recalculateForNewPathVector(Geom::PathVector const pathv, Satellite const S)
{
Satellites satellites;
diff --git a/src/helper/geom-pathvectorsatellites.h b/src/helper/geom-pathvectorsatellites.h
index 483611db5..4a020f553 100644
--- a/src/helper/geom-pathvectorsatellites.h
+++ b/src/helper/geom-pathvectorsatellites.h
@@ -1,6 +1,6 @@
/**
* \file
- * \brief PathVectorSatellites a class to manage a vector of satellites per piecewise node
+ * \brief PathVectorSatellites a class to manage satellites -per node extra data- in a pathvector
*/ /*
* Authors:
* Jabiertxof
@@ -21,10 +21,8 @@
#include <2geom/path.h>
#include <2geom/pathvector.h>
-/**
- * @brief PathVectorSatellites a class to manage a vector of satellites per curve
- */
typedef std::vector<std::vector<Satellite> > Satellites;
+///@brief PathVectorSatellites a class to manage satellites in a pathvector
class PathVectorSatellites {
public:
Geom::PathVector getPathVector() const;
@@ -32,6 +30,11 @@ public:
Satellites getSatellites();
void setSatellites(Satellites satellites);
size_t getTotalSatellites();
+ void setSelected(std::vector<size_t> selected);
+ void updateSteps(size_t steps, bool apply_no_radius, bool apply_with_radius, bool only_selected);
+ void updateAmount(double radius, bool apply_no_radius, bool apply_with_radius, bool only_selected,
+ bool use_knot_distance, bool flexible);
+ void updateSatelliteType(SatelliteType satellitetype, bool apply_no_radius, bool apply_with_radius, bool only_selected);
std::pair<size_t, size_t> getIndexData(size_t index);
void recalculateForNewPathVector(Geom::PathVector const pathv, Satellite const S);
private:
diff --git a/src/helper/geom-satellite.cpp b/src/helper/geom-satellite.cpp
index 2672a571b..1242c9aaf 100644
--- a/src/helper/geom-satellite.cpp
+++ b/src/helper/geom-satellite.cpp
@@ -1,6 +1,6 @@
/**
* \file
- * \brief Satellite a per ?node/curve holder of data.
+ * \brief Satellite a per node holder of data.
*/ /*
* Authors:
* 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es>
@@ -23,15 +23,14 @@
#include <ctime>
#endif
-/**
- * @brief Satellite a per ?node/curve holder of data.
- */
+///@brief Satellite a per node holder of data.
Satellite::Satellite() {}
Satellite::Satellite(SatelliteType satellite_type)
: satellite_type(satellite_type),
is_time(false),
+ selected(false),
has_mirror(false),
hidden(true),
amount(0.0),
@@ -41,12 +40,8 @@ Satellite::Satellite(SatelliteType satellite_type)
Satellite::~Satellite() {}
-/**
- * Calculate the time in curve_in with a size of A
- * TODO: find a better place to it
- */
-
-
+///Calculate the time in curve_in with a size of A
+//TODO: find a better place to it
double timeAtArcLength(double const A, Geom::Curve const &curve_in)
{
if ( A == 0 || curve_in.isDegenerate()) {
@@ -69,10 +64,8 @@ double timeAtArcLength(double const A, Geom::Curve const &curve_in)
return t;
}
-/**
- * Calculate the size in curve_in with a point at A
- * TODO: find a better place to it
- */
+///Calculate the size in curve_in with a point at A
+//TODO: find a better place to it
double arcLengthAt(double const A, Geom::Curve const &curve_in)
{
if ( A == 0 || curve_in.isDegenerate()) {
@@ -91,9 +84,7 @@ double arcLengthAt(double const A, Geom::Curve const &curve_in)
return s;
}
-/**
- * Convert a arc radius of a fillet/chamfer to his satellite length -point position where fillet/chamfer knot be on original curve
- */
+///Convert a arc radius of a fillet/chamfer to his satellite length -point position where fillet/chamfer knot be on original curve
double Satellite::radToLen(
double const A, Geom::Curve const &curve_in,
Geom::Curve const &curve_out) const
@@ -122,9 +113,7 @@ double Satellite::radToLen(
return len;
}
-/**
-* Convert a satelite length -point position where fillet/chamfer knot be on original curve- to a arc radius of fillet/chamfer
-*/
+///Convert a satelite length -point position where fillet/chamfer knot be on original curve- to a arc radius of fillet/chamfer
double Satellite::lenToRad(
double const A, Geom::Curve const &curve_in,
Geom::Curve const &curve_out,
@@ -158,9 +147,7 @@ double Satellite::lenToRad(
return 0;
}
-/**
- * Get the time position of the satellite in curve_in
- */
+///Get the time position of the satellite in curve_in
double Satellite::time(Geom::Curve const &curve_in, bool inverse) const
{
double t = amount;
@@ -175,9 +162,7 @@ double Satellite::time(Geom::Curve const &curve_in, bool inverse) const
return t;
}
-/**.
- * Get the time from a length A in other curve, a bolean inverse gived to reverse time
- */
+///Get the time from a length A in other curve, a bolean inverse gived to reverse time
double Satellite::time(double A, bool inverse,
Geom::Curve const &curve_in) const
{
@@ -195,9 +180,7 @@ double Satellite::time(double A, bool inverse,
return timeAtArcLength(A, curve_in);
}
-/**
- * Get the length of the satellite in curve_in
- */
+///Get the length of the satellite in curve_in
double Satellite::arcDistance(Geom::Curve const &curve_in) const
{
double s = amount;
@@ -207,18 +190,14 @@ double Satellite::arcDistance(Geom::Curve const &curve_in) const
return s;
}
-/**
- * Get the point position of the satellite
- */
+///Get the point position of the satellite
Geom::Point Satellite::getPosition(Geom::Curve const &curve_in, bool inverse) const
{
double t = time(curve_in, inverse);
return curve_in.pointAt(t);
}
-/**
- * Set the position of the satellite from a gived point P
- */
+///Set the position of the satellite from a gived point P
void Satellite::setPosition(Geom::Point const p, Geom::Curve const &curve_in, bool inverse)
{
Geom::Curve * curve = const_cast<Geom::Curve *>(&curve_in);
@@ -232,9 +211,8 @@ void Satellite::setPosition(Geom::Point const p, Geom::Curve const &curve_in, bo
amount = A;
}
-/**
- * Map a satellite type with gchar
- */
+
+///Map a satellite type with gchar
void Satellite::setSatelliteType(gchar const *A)
{
std::map<std::string, SatelliteType> gchar_map_to_satellite_type =
@@ -245,9 +223,7 @@ void Satellite::setSatelliteType(gchar const *A)
}
}
-/**
- * Map a gchar with satelliteType
- */
+///Map a gchar with satelliteType
gchar const *Satellite::getSatelliteTypeGchar() const
{
std::map<SatelliteType, gchar const *> satellite_type_to_gchar_map =
diff --git a/src/helper/geom-satellite.h b/src/helper/geom-satellite.h
index 6cf891ec5..a4d63d66e 100644
--- a/src/helper/geom-satellite.h
+++ b/src/helper/geom-satellite.h
@@ -1,6 +1,6 @@
/**
* \file
- * \brief Satellite a per ?node/curve holder of data.
+ * \brief Satellite a per node holder of data.
*/ /*
* Authors:
* 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es>
@@ -25,7 +25,7 @@ enum SatelliteType {
INVALID_SATELLITE // Invalid Satellite
};
/**
- * @brief Satellite a per ?node/curve holder of data.
+ * @brief Satellite a per node holder of data.
*/
class Satellite {
@@ -39,6 +39,10 @@ public:
{
is_time = set_is_time;
}
+ void setSelected(bool set_selected)
+ {
+ selected = set_selected;
+ }
void setHasMirror(bool set_has_mirror)
{
has_mirror = set_has_mirror;
@@ -75,9 +79,10 @@ public:
void setSatelliteType(gchar const *A);
gchar const *getSatelliteTypeGchar() const;
SatelliteType satellite_type;
- //The value stored could be a time value of the satellite in the curve ot a distance on the curve
+ //The value stored could be a time value of the satellite in the curve or a lenght of distance to the node from the satellite
//"is_time" tell is if is a time or lenght value
bool is_time;
+ bool selected;
bool has_mirror;
bool hidden;
//in "amount" we store the time or distance used in the satellite
@@ -85,7 +90,7 @@ public:
double angle;
size_t steps;
};
-//cache_limit never called as 1
+
double timeAtArcLength(double const A, Geom::Curve const &curve_in);
double arcLengthAt(double const A, Geom::Curve const &curve_in);
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 0a78b199e..f60d628f6 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -400,19 +400,39 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/)
}
void
-Effect::setSelectedNodePoints(std::vector<Geom::Point> sNP)
+Effect::setCurrentZoom(double cZ)
{
- selectedNodesPoints = sNP;
+ current_zoom = cZ;
}
void
-Effect::setCurrentZoom(double cZ)
+Effect::setSelectedNodePoints(std::vector<Geom::Point> selected_node_points)
{
- current_zoom = cZ;
+ selectedNodesPoints = selected_node_points;
}
+std::vector<size_t>
+Effect::getSelectedNodes()
+{
+ size_t counter = 0;
+ std::vector<size_t> result;
+ for (size_t i = 0; i < pathvector_before_effect.size(); i++) {
+ for (size_t j = 0; j < pathvector_before_effect[i].size_closed(); j++) {
+ if ((pathvector_before_effect[i].size_closed() == j-1 &&
+ isNodePointSelected( pathvector_before_effect[i][j].finalPoint())) ||
+ isNodePointSelected( pathvector_before_effect[i][j].initialPoint()))
+ {
+ result.push_back(counter);
+ }
+ counter++;
+ }
+ }
+ return result;
+}
+
+
bool
-Effect::isNodePointSelected(Geom::Point const &nodePoint) const
+Effect::isNodePointSelected(Geom::Point const &node_point) const
{
if (selectedNodesPoints.size() > 0) {
using Geom::X;
@@ -421,7 +441,7 @@ Effect::isNodePointSelected(Geom::Point const &nodePoint) const
i != selectedNodesPoints.end(); ++i) {
Geom::Point p = *i;
Geom::Affine transformCoordinate = sp_lpe_item->i2dt_affine();
- Geom::Point p2(nodePoint[X],nodePoint[Y]);
+ Geom::Point p2(node_point[X],node_point[Y]);
p2 *= transformCoordinate;
if (Geom::are_near(p, p2, 0.01)) {
return true;
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index 898e089b7..1f08a2bae 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -59,8 +59,9 @@ public:
void doOnApply_impl(SPLPEItem const* lpeitem);
void doBeforeEffect_impl(SPLPEItem const* lpeitem);
void setCurrentZoom(double cZ);
- void setSelectedNodePoints(std::vector<Geom::Point> sNP);
- bool isNodePointSelected(Geom::Point const &nodePoint) const;
+ void setSelectedNodePoints(std::vector<Geom::Point> selected_node_points);
+ std::vector<size_t> getSelectedNodes();
+ bool isNodePointSelected(Geom::Point const &node_point) const;
virtual void doOnApply (SPLPEItem const* lpeitem);
virtual void doBeforeEffect (SPLPEItem const* lpeitem);
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index 48e68d366..83baab1d1 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -22,67 +22,65 @@
namespace Inkscape {
namespace LivePathEffect {
-static const Util::EnumData<FilletMethod> FilletMethodData[FM_END] = {
- { FM_AUTO, N_("Auto"), "auto" }, { FM_ARC, N_("Force arc"), "arc" },
+static const Util::EnumData<Fillet_method> Fillet_methodData[] = {
+ { FM_AUTO, N_("Auto"), "auto" },
+ { FM_ARC, N_("Force arc"), "arc" },
{ FM_BEZIER, N_("Force bezier"), "bezier" }
};
-static const Util::EnumDataConverter<FilletMethod> FMConverter(FilletMethodData,
- FM_END);
+static const Util::EnumDataConverter<Fillet_method> FMConverter(Fillet_methodData, FM_END);
LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject)
: Effect(lpeobject),
- satellites_param(_("pair_array_param"), _("pair_array_param"),
- "satellites_param", &wr, this),
- method(_("Method:"), _("Methods to calculate the fillet or chamfer"),
- "method", FMConverter, &wr, this, FM_AUTO),
- radius(_("Radius (unit or %):"), _("Radius, in unit or %"), "radius", &wr,
+ _satellites_param("satellites_param", "satellites_param",
+ "_satellites_param", &wr, this),
+ _method(_("_method:"), _("_methods to calculate the fillet or chamfer"),
+ "_method", FMConverter, &wr, this, FM_AUTO),
+ _radius(_("_radius (unit or %):"), _("_radius, in unit or %"), "_radius", &wr,
this, 0.0),
- chamfer_steps(_("Chamfer steps:"), _("Chamfer steps"), "chamfer_steps",
+ _chamfer_steps(_("Chamfer steps:"), _("Chamfer steps"), "_chamfer_steps",
&wr, this, 1),
- flexible(_("Flexible radius size (%)"), _("Flexible radius size (%)"),
- "flexible", &wr, this, false),
- mirror_knots(_("Mirror Knots"), _("Mirror Knots"), "mirror_knots", &wr,
+ _flexible(_("_flexible _radius size (%)"), _("_flexible _radius size (%)"),
+ "_flexible", &wr, this, false),
+ _mirror_knots(_("Mirror Knots"), _("Mirror Knots"), "_mirror_knots", &wr,
this, true),
- only_selected(_("Change only selected nodes"),
- _("Change only selected nodes"), "only_selected", &wr, this,
+ _only_selected(_("Change only selected nodes"),
+ _("Change only selected nodes"), "_only_selected", &wr, this,
false),
- use_knot_distance(_("Use knots distance instead radius"),
- _("Use knots distance instead radius"),
- "use_knot_distance", &wr, this, false),
- hide_knots(_("Hide knots"), _("Hide knots"), "hide_knots", &wr, this,
+ _use_knot_distance(_("Use knots distance instead _radius"),
+ _("Use knots distance instead _radius"),
+ "_use_knot_distance", &wr, this, false),
+ _hide_knots(_("Hide knots"), _("Hide knots"), "_hide_knots", &wr, this,
false),
- apply_no_radius(_("Apply changes if radius = 0"), _("Apply changes if radius = 0"), "apply_no_radius", &wr, this, true),
- apply_with_radius(_("Apply changes if radius > 0"), _("Apply changes if radius > 0"), "apply_with_radius", &wr, this, true),
- helper_size(_("Helper size with direction:"),
- _("Helper size with direction"), "helper_size", &wr, this, 0),
- pathvector_satellites(NULL),
- degenerate_hide(false)
+ _apply_no_radius(_("Apply changes if _radius = 0"), _("Apply changes if _radius = 0"), "_apply_no_radius", &wr, this, true),
+ _apply_with_radius(_("Apply changes if _radius > 0"), _("Apply changes if _radius > 0"), "_apply_with_radius", &wr, this, true),
+ _helper_size(_("Helper path size with direction to node:"),
+ _("Helper path size with direction to node"), "_helper_size", &wr, this, 0),
+ _pathvector_satellites(NULL),
+ _degenerate_hide(false)
{
- registerParameter(&satellites_param);
- registerParameter(&method);
- registerParameter(&radius);
- registerParameter(&chamfer_steps);
- registerParameter(&helper_size);
- registerParameter(&flexible);
- registerParameter(&use_knot_distance);
- registerParameter(&mirror_knots);
- registerParameter(&apply_no_radius);
- registerParameter(&apply_with_radius);
- registerParameter(&only_selected);
- registerParameter(&hide_knots);
+ registerParameter(&_satellites_param);
+ registerParameter(&_method);
+ registerParameter(&_radius);
+ registerParameter(&_chamfer_steps);
+ registerParameter(&_helper_size);
+ registerParameter(&_flexible);
+ registerParameter(&_use_knot_distance);
+ registerParameter(&_mirror_knots);
+ registerParameter(&_apply_no_radius);
+ registerParameter(&_apply_with_radius);
+ registerParameter(&_only_selected);
+ registerParameter(&_hide_knots);
- radius.param_set_range(0.0, Geom::infinity());
- radius.param_set_increments(1, 1);
- radius.param_set_digits(4);
- radius.param_overwrite_widget(true);
- chamfer_steps.param_set_range(1, 999);
- chamfer_steps.param_set_increments(1, 1);
- chamfer_steps.param_set_digits(0);
- //chamfer_steps.param_overwrite_widget(true);
- helper_size.param_set_range(0, 999);
- helper_size.param_set_increments(5, 5);
- helper_size.param_set_digits(0);
- //helper_size.param_overwrite_widget(true);
+ _radius.param_set_range(0.0, Geom::infinity());
+ _radius.param_set_increments(1, 1);
+ _radius.param_set_digits(4);
+ _radius.param_overwrite_widget(true);
+ _chamfer_steps.param_set_range(1, 999);
+ _chamfer_steps.param_set_increments(1, 1);
+ _chamfer_steps.param_set_digits(0);
+ _helper_size.param_set_range(0, 999);
+ _helper_size.param_set_increments(5, 5);
+ _helper_size.param_set_digits(0);
}
void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
@@ -103,24 +101,24 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
// continue
//}
Satellite satellite(FILLET);
- satellite.setSteps(chamfer_steps);
+ satellite.setSteps(_chamfer_steps);
subpath_satellites.push_back(satellite);
}
- //we add the last satellite on open path because pathvector_satellites is related to nodes, not curves
+ //we add the last satellite on open path because _pathvector_satellites is related to nodes, not curves
//so maybe in the future we can need this last satellite in other effects
- //dont remove for this effect because pathvector_satellites class has methods when the path is modiffied
- //and we want one method for all uses
+ //dont remove for this effect because _pathvector_satellites class has _methods when the path is modiffied
+ //and we want one _method for all uses
if (!path_it->closed()) {
Satellite satellite(FILLET);
- satellite.setSteps(chamfer_steps);
+ satellite.setSteps(_chamfer_steps);
subpath_satellites.push_back(satellite);
}
satellites.push_back(subpath_satellites);
}
- pathvector_satellites = new PathVectorSatellites();
- pathvector_satellites->setPathVector(pathv);
- pathvector_satellites->setSatellites(satellites);
- satellites_param.setPathVectorSatellites(pathvector_satellites);
+ _pathvector_satellites = new PathVectorSatellites();
+ _pathvector_satellites->setPathVector(pathv);
+ _pathvector_satellites->setSatellites(satellites);
+ _satellites_param.setPathVectorSatellites(_pathvector_satellites);
} else {
g_warning("LPE Fillet/Chamfer can only be applied to shapes (not groups).");
SPLPEItem *item = const_cast<SPLPEItem *>(lpeItem);
@@ -142,7 +140,7 @@ Gtk::Widget *LPEFilletChamfer::newWidget()
if ((*it)->widget_is_visible) {
Parameter *param = *it;
Gtk::Widget *widg = param->param_newWidget();
- if (param->param_key == "radius") {
+ if (param->param_key == "_radius") {
Inkscape::UI::Widget::Scalar *widg_registered =
Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg));
widg_registered->signal_value_changed().connect(
@@ -154,7 +152,7 @@ Gtk::Widget *LPEFilletChamfer::newWidget()
Gtk::Entry *entry_widget = dynamic_cast<Gtk::Entry *>(childList[1]);
entry_widget->set_width_chars(6);
}
- } else if (param->param_key == "chamfer_steps") {
+ } else if (param->param_key == "_chamfer_steps") {
Inkscape::UI::Widget::Scalar *widg_registered =
Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg));
widg_registered->signal_value_changed().connect(
@@ -166,12 +164,12 @@ Gtk::Widget *LPEFilletChamfer::newWidget()
Gtk::Entry *entry_widget = dynamic_cast<Gtk::Entry *>(childList[1]);
entry_widget->set_width_chars(3);
}
- } else if (param->param_key == "helper_size") {
+ } else if (param->param_key == "_helper_size") {
Inkscape::UI::Widget::Scalar *widg_registered =
Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg));
widg_registered->signal_value_changed().connect(
sigc::mem_fun(*this, &LPEFilletChamfer::refreshKnots));
- } else if (param->param_key == "only_selected") {
+ } else if (param->param_key == "_only_selected") {
Gtk::manage(widg);
}
Glib::ustring *tip = param->param_getTooltip();
@@ -189,29 +187,25 @@ Gtk::Widget *LPEFilletChamfer::newWidget()
}
Gtk::HBox *fillet_container = Gtk::manage(new Gtk::HBox(true, 0));
- Gtk::Button *fillet =
- Gtk::manage(new Gtk::Button(Glib::ustring(_("Fillet"))));
+ Gtk::Button *fillet = Gtk::manage(new Gtk::Button(Glib::ustring(_("Fillet"))));
fillet->signal_clicked()
- .connect(sigc::mem_fun(*this, &LPEFilletChamfer::fillet));
+ .connect(sigc::bind<SatelliteType>(sigc::mem_fun(*this, &LPEFilletChamfer::updateSatelliteType),FILLET));
fillet_container->pack_start(*fillet, true, true, 2);
- Gtk::Button *inverse_fillet =
- Gtk::manage(new Gtk::Button(Glib::ustring(_("Inverse fillet"))));
+ Gtk::Button *inverse_fillet = Gtk::manage(new Gtk::Button(Glib::ustring(_("Inverse fillet"))));
inverse_fillet->signal_clicked()
- .connect(sigc::mem_fun(*this, &LPEFilletChamfer::inverseFillet));
+ .connect(sigc::bind<SatelliteType>(sigc::mem_fun(*this, &LPEFilletChamfer::updateSatelliteType),INVERSE_FILLET));
fillet_container->pack_start(*inverse_fillet, true, true, 2);
Gtk::HBox *chamfer_container = Gtk::manage(new Gtk::HBox(true, 0));
- Gtk::Button *chamfer =
- Gtk::manage(new Gtk::Button(Glib::ustring(_("Chamfer"))));
+ Gtk::Button *chamfer = Gtk::manage(new Gtk::Button(Glib::ustring(_("Chamfer"))));
chamfer->signal_clicked()
- .connect(sigc::mem_fun(*this, &LPEFilletChamfer::chamfer));
+ .connect(sigc::bind<SatelliteType>(sigc::mem_fun(*this, &LPEFilletChamfer::updateSatelliteType),CHAMFER));
chamfer_container->pack_start(*chamfer, true, true, 2);
- Gtk::Button *inverse_chamfer =
- Gtk::manage(new Gtk::Button(Glib::ustring(_("Inverse chamfer"))));
+ Gtk::Button *inverse_chamfer = Gtk::manage(new Gtk::Button(Glib::ustring(_("Inverse chamfer"))));
inverse_chamfer->signal_clicked()
- .connect(sigc::mem_fun(*this, &LPEFilletChamfer::inverseChamfer));
+ .connect(sigc::bind<SatelliteType>(sigc::mem_fun(*this, &LPEFilletChamfer::updateSatelliteType),INVERSE_CHAMFER));
chamfer_container->pack_start(*inverse_chamfer, true, true, 2);
vbox->pack_start(*fillet_container, true, true, 2);
@@ -220,136 +214,30 @@ Gtk::Widget *LPEFilletChamfer::newWidget()
return vbox;
}
-void LPEFilletChamfer::fillet()
-{
- updateSatelliteType(FILLET);
-}
-
-void LPEFilletChamfer::inverseFillet()
-{
- updateSatelliteType(INVERSE_FILLET);
-}
-
-void LPEFilletChamfer::chamfer()
-{
- updateSatelliteType(CHAMFER);
-}
-
-void LPEFilletChamfer::inverseChamfer()
-{
- updateSatelliteType(INVERSE_CHAMFER);
-}
-
void LPEFilletChamfer::refreshKnots()
{
- if (satellites_param.knoth) {
- satellites_param.knoth->update_knots();
+ if (_satellites_param._knoth) {
+ _satellites_param._knoth->update_knots();
}
}
void LPEFilletChamfer::updateAmount()
{
- double power = 0;
- if (!flexible) {
- power = radius;
- } else {
- power = radius / 100;
- }
- Satellites satellites = pathvector_satellites->getSatellites();
- Geom::PathVector pathv = pathvector_satellites->getPathVector();
- for (size_t i = 0; i < satellites.size(); ++i) {
- for (size_t j = 0; j < satellites[i].size(); ++j) {
- boost::optional<size_t> previous_index = boost::none;
- if(j == 0 && pathv[i].closed()){
- previous_index = pathv[i].size() - 1;
- } else if(!pathv[i].closed() || j != 0) {
- previous_index = j - 1;
- }
- if (!pathv[i].closed() && j == 0) {
- satellites[i][j].amount = 0;
- continue;
- }
- if (pathv[i].size() == j) {
- continue;
- }
- if ((!apply_no_radius && satellites[i][j].amount == 0) ||
- (!apply_with_radius && satellites[i][j].amount != 0))
- {
- continue;
- }
-
- Geom::Point satellite_point = pathv[i].pointAt(j);
- if (isNodePointSelected(satellite_point) || !only_selected) {
- if (!use_knot_distance && !flexible) {
- if(previous_index) {
- satellites[i][j].amount = satellites[i][j].radToLen(power, pathv[i][*previous_index], pathv[i][j]);
- } else {
- satellites[i][j].amount = 0.0;
- }
- } else {
- satellites[i][j].amount = power;
- }
- }
- }
- }
- pathvector_satellites->setSatellites(satellites);
- satellites_param.setPathVectorSatellites(pathvector_satellites);
+ _pathvector_satellites->updateAmount(_radius, _apply_no_radius, _apply_with_radius, _only_selected,
+ _use_knot_distance, _flexible);
+ _satellites_param.setPathVectorSatellites(_pathvector_satellites);
}
void LPEFilletChamfer::updateChamferSteps()
{
- Satellites satellites = pathvector_satellites->getSatellites();
- Geom::PathVector pathv = pathvector_satellites->getPathVector();
- for (size_t i = 0; i < satellites.size(); ++i) {
- for (size_t j = 0; j < satellites[i].size(); ++j) {
- if ((!apply_no_radius && satellites[i][j].amount == 0) ||
- (!apply_with_radius && satellites[i][j].amount != 0))
- {
- continue;
- }
- if (only_selected) {
- Geom::Point satellite_point = pathv[i].pointAt(j);
- if (isNodePointSelected(satellite_point)) {
- satellites[i][j].steps = chamfer_steps;
- }
- } else {
- satellites[i][j].steps = chamfer_steps;
- }
- }
- }
- pathvector_satellites->setSatellites(satellites);
- satellites_param.setPathVectorSatellites(pathvector_satellites);
+ _pathvector_satellites->updateSteps(_chamfer_steps, _apply_no_radius, _apply_with_radius, _only_selected);
+ _satellites_param.setPathVectorSatellites(_pathvector_satellites);
}
void LPEFilletChamfer::updateSatelliteType(SatelliteType satellitetype)
{
- Satellites satellites = pathvector_satellites->getSatellites();
- Geom::PathVector pathv = pathvector_satellites->getPathVector();
- for (size_t i = 0; i < satellites.size(); ++i) {
- for (size_t j = 0; j < satellites[i].size(); ++j) {
- if ((!apply_no_radius && satellites[i][j].amount == 0) ||
- (!apply_with_radius && satellites[i][j].amount != 0))
- {
- continue;
- }
- if (pathv[i].size() == j) {
- if (!only_selected) {
- satellites[i][j].satellite_type = satellitetype;
- }
- continue;
- }
- if (only_selected) {
- Geom::Point satellite_point = pathv[i].pointAt(j);
- if (isNodePointSelected(satellite_point)) {
- satellites[i][j].satellite_type = satellitetype;
- }
- } else {
- satellites[i][j].satellite_type = satellitetype;
- }
- }
- }
- pathvector_satellites->setSatellites(satellites);
- satellites_param.setPathVectorSatellites(pathvector_satellites);
+ _pathvector_satellites->updateSatelliteType(satellitetype, _apply_no_radius, _apply_with_radius, _only_selected);
+ _satellites_param.setPathVectorSatellites(_pathvector_satellites);
}
void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
@@ -363,45 +251,46 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
c = path->get_original_curve();
}
//fillet chamfer specific calls
- satellites_param.setUseDistance(use_knot_distance);
+ _satellites_param.setUseDistance(_use_knot_distance);
//mandatory call
- satellites_param.setEffectType(effectType());
+ _satellites_param.setEffectType(effectType());
Geom::PathVector const pathv = pathv_to_linear_and_cubic_beziers(c->get_pathvector());
//if are diferent sizes call to poinwise recalculate
//TODO: Update the satellite data in paths modified, Goal 0.93
- if (pathvector_satellites) {
+ if (_pathvector_satellites) {
size_t number_nodes = pathv.nodes().size();
- size_t satellites_counter = pathvector_satellites->getTotalSatellites();
+ size_t satellites_counter = _pathvector_satellites->getTotalSatellites();
if (number_nodes != satellites_counter) {
Satellite satellite(FILLET);
- satellite.setIsTime(flexible);
- satellite.setHasMirror(mirror_knots);
- satellite.setHidden(hide_knots);
- pathvector_satellites->recalculateForNewPathVector(pathv, satellite);
- satellites_param.setPathVectorSatellites(pathvector_satellites);
+ satellite.setIsTime(_flexible);
+ satellite.setHasMirror(_mirror_knots);
+ satellite.setHidden(_hide_knots);
+ _pathvector_satellites->recalculateForNewPathVector(pathv, satellite);
+ _pathvector_satellites->setSelected(getSelectedNodes());
+ _satellites_param.setPathVectorSatellites(_pathvector_satellites);
refreshKnots();
return;
}
}
- Satellites satellites = satellites_param.data();
+ Satellites satellites = _satellites_param.data();
if(satellites.empty()) {
doOnApply(lpeItem);
- satellites = satellites_param.data();
+ satellites = _satellites_param.data();
}
- if (degenerate_hide) {
- satellites_param.setGlobalKnotHide(true);
+ if (_degenerate_hide) {
+ _satellites_param.setGlobalKnotHide(true);
} else {
- satellites_param.setGlobalKnotHide(false);
+ _satellites_param.setGlobalKnotHide(false);
}
- if (hide_knots) {
- satellites_param.setHelperSize(0);
+ if (_hide_knots) {
+ _satellites_param.setHelperSize(0);
} else {
- satellites_param.setHelperSize(helper_size);
+ _satellites_param.setHelperSize(_helper_size);
}
for (size_t i = 0; i < satellites.size(); ++i) {
for (size_t j = 0; j < satellites[i].size(); ++j) {
- if (satellites[i][j].is_time != flexible) {
- satellites[i][j].is_time = flexible;
+ if (satellites[i][j].is_time != _flexible) {
+ satellites[i][j].is_time = _flexible;
double amount = satellites[i][j].amount;
if (pathv[i].size() == j){
continue;
@@ -415,16 +304,17 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
satellites[i][j].amount = size;
}
}
- if (satellites[i][j].has_mirror != mirror_knots) {
- satellites[i][j].has_mirror = mirror_knots;
+ if (satellites[i][j].has_mirror != _mirror_knots) {
+ satellites[i][j].has_mirror = _mirror_knots;
}
- satellites[i][j].hidden = hide_knots;
+ satellites[i][j].hidden = _hide_knots;
}
}
- pathvector_satellites = new PathVectorSatellites();
- pathvector_satellites->setPathVector(pathv);
- pathvector_satellites->setSatellites(satellites);
- satellites_param.setPathVectorSatellites(pathvector_satellites);
+ _pathvector_satellites = new PathVectorSatellites();
+ _pathvector_satellites->setPathVector(pathv);
+ _pathvector_satellites->setSatellites(satellites);
+ _pathvector_satellites->setSelected(getSelectedNodes());
+ _satellites_param.setPathVectorSatellites(_pathvector_satellites);
refreshKnots();
} else {
g_warning("LPE Fillet can only be applied to shapes (not groups).");
@@ -444,7 +334,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
Geom::PathVector path_out;
size_t path = 0;
const double K = (4.0 / 3.0) * (sqrt(2.0) - 1.0);
- degenerate_hide = false;
+ _degenerate_hide = false;
Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers(path_in);
for (Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) {
if (path_it->empty()) {
@@ -460,7 +350,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
}
double time0 = 0;
size_t curve = 0;
- Satellites satellites = pathvector_satellites->getSatellites();
+ Satellites satellites = _pathvector_satellites->getSatellites();
for (Geom::Path::const_iterator curve_it1 = path_it->begin(); curve_it1 != path_it->end(); ++curve_it1) {
size_t next_index = curve + 1;
if (curve == pathv[path].size() - 1 && pathv[path].closed()) {
@@ -476,7 +366,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
}
Satellite satellite = satellites[path][next_index];
if (Geom::are_near((*curve_it1).initialPoint(),(*curve_it1).finalPoint())) {
- degenerate_hide = true;
+ _degenerate_hide = true;
g_warning("Knots hidded if consecutive nodes has the same position.");
return path_in;
}
@@ -563,10 +453,10 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
Geom::Line const x_line(Geom::Point(0, 0), Geom::Point(1, 0));
Geom::Line const angled_line(start_arc_point, end_arc_point);
double arc_angle = Geom::angle_between(x_line, angled_line);
- double radius = Geom::distance(start_arc_point,
+ double _radius = Geom::distance(start_arc_point,
middle_point(start_arc_point, end_arc_point)) /
sin(angle / 2.0);
- Geom::Coord rx = radius;
+ Geom::Coord rx = _radius;
Geom::Coord ry = rx;
if (times[1] != 1) {
if (times[1] != times[0] || (times[1] == 1 && times[0] == 1)) {
@@ -583,8 +473,8 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
Geom::Path path_chamfer;
path_chamfer.start(tmp_path.finalPoint());
if ((is_straight_curve(*curve_it1) &&
- is_straight_curve(curve_it2) && method != FM_BEZIER) ||
- method == FM_ARC) {
+ is_straight_curve(curve_it2) && _method != FM_BEZIER) ||
+ _method == FM_ARC) {
ccw_toggle = ccw_toggle ? 0 : 1;
path_chamfer.appendNew<Geom::EllipticalArc>(rx, ry, arc_angle, 0,
ccw_toggle, end_arc_point);
@@ -592,9 +482,9 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
path_chamfer.appendNew<Geom::CubicBezier>(handle_1, handle_2,
end_arc_point);
}
- double chamfer_stepsTime = 1.0 / steps;
+ double _chamfer_stepsTime = 1.0 / steps;
for (size_t i = 1; i < steps; i++) {
- Geom::Point chamfer_step = path_chamfer.pointAt(chamfer_stepsTime * i);
+ Geom::Point chamfer_step = path_chamfer.pointAt(_chamfer_stepsTime * i);
tmp_path.appendNew<Geom::LineSegment>(chamfer_step);
}
tmp_path.appendNew<Geom::LineSegment>(end_arc_point);
@@ -602,25 +492,25 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
Geom::Path path_chamfer;
path_chamfer.start(tmp_path.finalPoint());
if ((is_straight_curve(*curve_it1) &&
- is_straight_curve(curve_it2) && method != FM_BEZIER) ||
- method == FM_ARC) {
+ is_straight_curve(curve_it2) && _method != FM_BEZIER) ||
+ _method == FM_ARC) {
path_chamfer.appendNew<Geom::EllipticalArc>(rx, ry, arc_angle, 0,
ccw_toggle, end_arc_point);
} else {
path_chamfer.appendNew<Geom::CubicBezier>(
inverse_handle_1, inverse_handle_2, end_arc_point);
}
- double chamfer_stepsTime = 1.0 / steps;
+ double _chamfer_stepsTime = 1.0 / steps;
for (size_t i = 1; i < steps; i++) {
Geom::Point chamfer_step =
- path_chamfer.pointAt(chamfer_stepsTime * i);
+ path_chamfer.pointAt(_chamfer_stepsTime * i);
tmp_path.appendNew<Geom::LineSegment>(chamfer_step);
}
tmp_path.appendNew<Geom::LineSegment>(end_arc_point);
} else if (type == INVERSE_FILLET) {
if ((is_straight_curve(*curve_it1) &&
- is_straight_curve(curve_it2) && method != FM_BEZIER) ||
- method == FM_ARC) {
+ is_straight_curve(curve_it2) && _method != FM_BEZIER) ||
+ _method == FM_ARC) {
tmp_path.appendNew<Geom::EllipticalArc>(rx, ry, arc_angle, 0, ccw_toggle,
end_arc_point);
} else {
@@ -629,8 +519,8 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
}
} else if (type == FILLET) {
if ((is_straight_curve(*curve_it1) &&
- is_straight_curve(curve_it2) && method != FM_BEZIER) ||
- method == FM_ARC) {
+ is_straight_curve(curve_it2) && _method != FM_BEZIER) ||
+ _method == FM_ARC) {
ccw_toggle = ccw_toggle ? 0 : 1;
tmp_path.appendNew<Geom::EllipticalArc>(rx, ry, arc_angle, 0, ccw_toggle,
end_arc_point);
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index 420403b70..bd0b74b51 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -20,7 +20,7 @@
namespace Inkscape {
namespace LivePathEffect {
-enum FilletMethod {
+enum Fillet_method {
FM_AUTO,
FM_ARC,
FM_BEZIER,
@@ -40,28 +40,24 @@ public:
void updateChamferSteps();
void updateAmount();
void refreshKnots();
- void chamfer();
- void inverseChamfer();
- void fillet();
- void inverseFillet();
- SatellitesArrayParam satellites_param;
+ SatellitesArrayParam _satellites_param;
private:
- EnumParam<FilletMethod> method;
- ScalarParam radius;
- ScalarParam chamfer_steps;
- BoolParam flexible;
- BoolParam mirror_knots;
- BoolParam only_selected;
- BoolParam use_knot_distance;
- BoolParam hide_knots;
- BoolParam apply_no_radius;
- BoolParam apply_with_radius;
- ScalarParam helper_size;
+ EnumParam<Fillet_method> _method;
+ ScalarParam _radius;
+ ScalarParam _chamfer_steps;
+ BoolParam _flexible;
+ BoolParam _mirror_knots;
+ BoolParam _only_selected;
+ BoolParam _use_knot_distance;
+ BoolParam _hide_knots;
+ BoolParam _apply_no_radius;
+ BoolParam _apply_with_radius;
+ ScalarParam _helper_size;
- bool degenerate_hide;
- PathVectorSatellites *pathvector_satellites;
+ bool _degenerate_hide;
+ PathVectorSatellites *_pathvector_satellites;
Geom::PathVector _hp;
LPEFilletChamfer(const LPEFilletChamfer &);
diff --git a/src/live_effects/lpe-transform_2pts.cpp b/src/live_effects/lpe-transform_2pts.cpp
index 1cd59b7fa..3c4ce0708 100644
--- a/src/live_effects/lpe-transform_2pts.cpp
+++ b/src/live_effects/lpe-transform_2pts.cpp
@@ -434,7 +434,7 @@ LPETransform2Pts::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<
}
if(!lock_angle && lock_lenght) {
char const * svgd;
- svgd = "m 7.07,7.07 c -3.9,3.91 -10.24,3.91 -14.14,0 -3.91,-3.9 -3.91,-10.24 0,-14.14 3.9,-3.91 10.24,-3.91 14.14,0 l -2.83,-4.24 -0.7,2.12";
+ svgd = "M 0,9.94 C -2.56,9.91 -5.17,8.98 -7.07,7.07 c -3.91,-3.9 -3.91,-10.24 0,-14.14 1.97,-1.97 4.51,-3.02 7.07,-3.04 2.56,0.02 5.1,1.07 7.07,3.04 3.91,3.9 3.91,10.24 0,14.14 C 5.17,8.98 2.56,9.91 0,9.94 Z";
PathVector pathv_turn = sp_svg_read_pathv(svgd);
pathv_turn *= Geom::Rotate(previous_angle);
pathv_turn *= Affine(r,0,0,r,0,0) * Translate(Geom::Point(end));
diff --git a/src/live_effects/parameter/array.cpp b/src/live_effects/parameter/array.cpp
index 4e3037904..28867def2 100644
--- a/src/live_effects/parameter/array.cpp
+++ b/src/live_effects/parameter/array.cpp
@@ -58,18 +58,19 @@ ArrayParam<std::vector<Satellite > >::readsvg(const gchar * str)
gchar ** strarray = g_strsplit(str, "@", 0);
gchar ** iter = strarray;
while (*iter != NULL) {
- gchar ** strsubarray = g_strsplit(*iter, ",", 7);
- if(*strsubarray[6]){
+ gchar ** strsubarray = g_strsplit(*iter, ",", 8);
+ if(*strsubarray[7]){//steps always > 0
Satellite *satellite = new Satellite();
satellite->setSatelliteType(g_strstrip(strsubarray[0]));
satellite->is_time = strncmp(strsubarray[1],"1",1) == 0;
- satellite->has_mirror = strncmp(strsubarray[2],"1",1) == 0;
- satellite->hidden = strncmp(strsubarray[3],"1",1) == 0;
+ satellite->selected = strncmp(strsubarray[2],"1",1) == 0;
+ satellite->has_mirror = strncmp(strsubarray[3],"1",1) == 0;
+ satellite->hidden = strncmp(strsubarray[4],"1",1) == 0;
double amount,angle;
float stepsTmp;
- sp_svg_number_read_d(strsubarray[4], &amount);
- sp_svg_number_read_d(strsubarray[5], &angle);
- sp_svg_number_read_f(g_strstrip(strsubarray[6]), &stepsTmp);
+ sp_svg_number_read_d(strsubarray[5], &amount);
+ sp_svg_number_read_d(strsubarray[6], &angle);
+ sp_svg_number_read_f(g_strstrip(strsubarray[7]), &stepsTmp);
unsigned int steps = (unsigned int)stepsTmp;
satellite->amount = amount;
satellite->angle = angle;
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h
index 9802abc2e..9204ede1f 100644
--- a/src/live_effects/parameter/array.h
+++ b/src/live_effects/parameter/array.h
@@ -120,6 +120,8 @@ protected:
str << ",";
str << vector_data[i].is_time;
str << ",";
+ str << vector_data[i].selected;
+ str << ",";
str << vector_data[i].has_mirror;
str << ",";
str << vector_data[i].hidden;
diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp
index 18e1bd4de..2f5cea7b5 100644
--- a/src/live_effects/parameter/satellitesarray.cpp
+++ b/src/live_effects/parameter/satellitesarray.cpp
@@ -26,7 +26,7 @@ SatellitesArrayParam::SatellitesArrayParam(const Glib::ustring &label,
const Glib::ustring &key,
Inkscape::UI::Widget::Registry *wr,
Effect *effect)
- : ArrayParam<std::vector<Satellite> >(label, tip, key, wr, effect, 0), knoth(NULL)
+ : ArrayParam<std::vector<Satellite> >(label, tip, key, wr, effect, 0), _knoth(NULL)
{
_knot_shape = SP_KNOT_SHAPE_DIAMOND;
_knot_mode = SP_KNOT_MODE_XOR;
@@ -180,6 +180,9 @@ void SatellitesArrayParam::updateCanvasIndicators(bool mirror)
}
}
}
+ if(!_knot_reset_helper.empty()){
+ _hp.insert(_hp.end(), _knot_reset_helper.begin(), _knot_reset_helper.end() );
+ }
if (mirror) {
updateCanvasIndicators(false);
}
@@ -230,24 +233,21 @@ void SatellitesArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
using namespace Geom;
//If is for filletChamfer effect...
if (_effectType == FILLET_CHAMFER) {
-// if(!pathv[i].closed() && (j == 0 || j == _vector[i].size() -1)) {
-// continue;
-// }
const gchar *tip;
if (type == CHAMFER) {
- tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else if (type == INVERSE_CHAMFER) {
- tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else if (type == INVERSE_FILLET) {
- tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else {
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
}
@@ -267,7 +267,7 @@ void SatellitesArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
SPDesktop *desktop,
SPItem *item)
{
- knoth = knotholder;
+ _knoth = knotholder;
addKnotHolderEntities(knotholder, desktop, item, true);
}
@@ -316,6 +316,14 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p,
Geom::Point normal = pathv[path_index][curve_index].pointAt(normal_time);
double distance_mirror = Geom::distance(mirror,s);
double distance_normal = Geom::distance(normal,s);
+ //this avoid toggle when fillet are near node
+// if (is_mirror && Geom::are_near(mirror, pathv[path_index][curve_index].initialPoint())) {
+// distance_mirror = 0.0;
+// distance_normal = 1.0;
+// } else if (!is_mirror && Geom::are_near(normal, pathv[path_index][curve_index].initialPoint())){
+// distance_mirror = 1.0;
+// distance_normal = 0.0;
+// }
if (distance_mirror <= distance_normal) {
double time_start = 0;
Satellites satellites = _pparam->_last_pathvector_satellites->getSatellites();
@@ -332,6 +340,15 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p,
} else {
satellite.setPosition(s, pathv[path_index][curve_index]);
}
+ _pparam->_knot_reset_helper.clear();
+ if (satellite.amount == 0){
+ char const *svgd;
+ svgd = "M -5.39,8.78 -9.13,5.29 -10.38,10.28 Z M -7.22,7.07 -3.43,3.37 m -1.95,-12.16 -3.74,3.5 -1.26,-5 z "
+ "m -1.83,1.71 3.78,3.7 M 5.24,8.78 8.98,5.29 10.24,10.28 Z "
+ "M 7.07,7.07 3.29,3.37 M 5.24,-8.78 l 3.74,3.5 1.26,-5 z M 7.07,-7.07 3.29,-3.37";
+ _pparam->_knot_reset_helper = sp_svg_read_pathv(svgd);
+ _pparam->_knot_reset_helper *= Geom::Affine(_pparam->_helper_size * 0.1,0,0,_pparam->_helper_size * 0.1,0,0) * Geom::Translate(Geom::Point(normal));
+ }
_pparam->_vector[path_index][curve_index] = satellite;
SPLPEItem *splpeitem = dynamic_cast<SPLPEItem *>(item);
if (splpeitem) {
@@ -446,21 +463,21 @@ void FilletChamferKnotHolderEntity::knot_click(guint state)
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
const gchar *tip;
if (type == CHAMFER) {
- tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ "<b>Ctrl+Alt+Click</b> resets");
} else if (type == INVERSE_CHAMFER) {
- tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ "<b>Ctrl+Alt+Click</b> resets");
} else if (type == INVERSE_FILLET) {
- tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ "<b>Ctrl+Alt+Click</b> resets");
} else {
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggle type, "
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggles type, "
"<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
+ "<b>Ctrl+Alt+Click</b> resets");
}
this->knot->tip = g_strdup(tip);
this->knot->show();
diff --git a/src/live_effects/parameter/satellitesarray.h b/src/live_effects/parameter/satellitesarray.h
index 30b1db6c1..64bc934c8 100644
--- a/src/live_effects/parameter/satellitesarray.h
+++ b/src/live_effects/parameter/satellitesarray.h
@@ -64,7 +64,7 @@ public:
friend class LPEFilletChamfer;
protected:
- KnotHolder *knoth;
+ KnotHolder *_knoth;
private:
SatellitesArrayParam(const SatellitesArrayParam &);
@@ -74,6 +74,7 @@ private:
SPKnotModeType _knot_mode;
guint32 _knot_color;
Geom::PathVector _hp;
+ Geom::PathVector _knot_reset_helper;
int _helper_size;
bool _use_distance;
bool _global_knot_hide;
@@ -87,7 +88,7 @@ public:
FilletChamferKnotHolderEntity(SatellitesArrayParam *p, size_t index);
virtual ~FilletChamferKnotHolderEntity()
{
- _pparam->knoth = NULL;
+ _pparam->_knoth = NULL;
}
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin,
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index 23aaf6bb1..60d4c807f 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -292,15 +292,15 @@ void NodeTool::update_helperpath () {
if (SP_IS_LPE_ITEM(selection->singleItem())) {
Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE();
if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) {
- Inkscape::UI::ControlPointSelection::Set &selectionNodes = _selected_nodes->allPoints();
- std::vector<Geom::Point> selectedNodesPositions;
- for (Inkscape::UI::ControlPointSelection::Set::iterator i = selectionNodes.begin(); i != selectionNodes.end(); ++i) {
+ Inkscape::UI::ControlPointSelection::Set &selection_nodes = _selected_nodes->allPoints();
+ std::vector<Geom::Point> selected_nodes_positions;
+ for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection_nodes.begin(); i != selection_nodes.end(); ++i) {
if ((*i)->selected()) {
Inkscape::UI::Node *n = dynamic_cast<Inkscape::UI::Node *>(*i);
- selectedNodesPositions.push_back(n->position());
+ selected_nodes_positions.push_back(n->position());
}
}
- lpe->setSelectedNodePoints(selectedNodesPositions);
+ lpe->setSelectedNodePoints(selected_nodes_positions);
lpe->setCurrentZoom(this->desktop->current_zoom());
SPCurve *c = new SPCurve();
SPCurve *cc = new SPCurve();