summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-04-02 23:46:44 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-04-02 23:46:44 +0000
commit323fc5ae45fd8374de4561d0771f6b9d5cd3e87a (patch)
treeb79bfbdf24df455572eed37aa5afc27b8dac4b1e /src
parentadd move knots when move nodes pointed by su_v (diff)
downloadinkscape-323fc5ae45fd8374de4561d0771f6b9d5cd3e87a.tar.gz
inkscape-323fc5ae45fd8374de4561d0771f6b9d5cd3e87a.zip
Adding suport for duplicate nodes
Allow degenrate curves Show helper path whith original path (bzr r13645.1.70)
Diffstat (limited to 'src')
-rw-r--r--src/helper/geom-pointwise.cpp14
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp28
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h3
3 files changed, 27 insertions, 18 deletions
diff --git a/src/helper/geom-pointwise.cpp b/src/helper/geom-pointwise.cpp
index cfe93311c..261d2bff4 100644
--- a/src/helper/geom-pointwise.cpp
+++ b/src/helper/geom-pointwise.cpp
@@ -123,28 +123,26 @@ void Pointwise::pwd2Append(Piecewise<D2<SBasis> > A)
size_t new_subpath_index = _path_info.subPathIndex(i);
_path_info.setPwd2(_pwd2);
bool subpath_is_changed = false;
+ bool not_exist = ;
if (_pwd2.size() <= i - counter) {
subpath_is_changed = false;
} else {
subpath_is_changed = new_subpath_index != _path_info.subPathIndex(i - counter);
}
- if (!reorder && first == i - counter &&
- !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001) &&
- !subpath_is_changed) {
+ if (!reorder && first == i - counter && !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001) && !subpath_is_changed) {
//Send the modified subpath to back
subpathToBack(_path_info.subPathIndex(first));
reorder = true;
i--;
continue;
}
- if (!reversed && first == i - counter &&
- !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001) &&
- !subpath_is_changed) {
+ if (!reversed && first == i - counter && !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001) && !subpath_is_changed) {
subpathReverse(first, last);
reversed = true;
}
- if (_pwd2.size() <= i - counter ||
- !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001)) {
+ if (_pwd2.size() <= i - counter || !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001) ||
+ /*this condition for duplicate node Shift+d*/(i > 0 && are_near(A[i - 1].at0(), A[i].at0(), 0.001) &&
+ !are_near(_pwd2[i - counter].at0(), _pwd2[i - counter - 1].at0(), 0.001))){
counter++;
bool active = true;
bool hidden = false;
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index ac412e120..f7fd6f64b 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -129,12 +129,6 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
int counter = 0;
size_t steps = chamfer_steps;
while (curve_it1 != curve_endit) {
- if ((*curve_it1).isDegenerate() || (*curve_it1).isDegenerate()) {
- g_warning("LPE Fillet not handle degenerate curves.");
- SPLPEItem *item = const_cast<SPLPEItem *>(lpeItem);
- item->removeCurrentPathEffect(false);
- return;
- }
bool active = true;
bool hidden = false;
if (counter == 0) {
@@ -380,6 +374,9 @@ void LPEFilletChamfer::updateSatelliteType(Geom::SatelliteType satellitetype)
void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
{
+ if(!_hp.empty()){
+ _hp.clear();
+ }
SPLPEItem *splpeitem = const_cast<SPLPEItem *>(lpeItem);
SPShape *shape = dynamic_cast<SPShape *>(splpeitem);
if (shape) {
@@ -469,6 +466,12 @@ LPEFilletChamfer::adjustForNewPath(std::vector<Geom::Path> const &path_in)
}
}
+void
+LPEFilletChamfer::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec)
+{
+ hp_vec.push_back(_hp);
+}
+
std::vector<Geom::Path>
LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
{
@@ -483,6 +486,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
if (path_it->empty()) {
continue;
}
+ _hp.push_back(*path_it);
Geom::Path tmp_path;
Geom::Path::const_iterator curve_it1 = path_it->begin();
Geom::Path::const_iterator curve_it2 = ++(path_it->begin());
@@ -511,9 +515,15 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
double time0 = 0;
std::vector<Geom::Satellite> sats = pointwise->getSatellites();
while (curve_it1 != curve_endit) {
- if ((*curve_it1).isDegenerate() || (*curve_it1).isDegenerate()) {
- g_warning("LPE Fillet not handle degenerate curves.");
- return path_in;
+ if ((*curve_it1).isDegenerate() || (curve_it2 != curve_endit && (*curve_it2).isDegenerate())) {
+ ++curve_it1;
+ if (curve_it2 != curve_endit) {
+ ++curve_it2;
+ }
+ counter++;
+ counter_curves++;
+ time0 = 0.0;
+ continue;
}
Satellite satellite;
Curve *curve_it2_fixed = path_it->begin()->duplicate();
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index dc2199609..e3ea41ba8 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -42,7 +42,7 @@ public:
virtual void doOnApply(SPLPEItem const *lpeItem);
virtual void adjustForNewPath(std::vector<Geom::Path> const &path_in);
virtual Gtk::Widget *newWidget();
-
+ void addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec);
void updateSatelliteType(Geom::SatelliteType satellitetype);
void updateChamferSteps();
void updateAmount();
@@ -69,6 +69,7 @@ private:
Geom::Pointwise *pointwise;
double segment_size;
+ Geom::PathVector _hp;
LPEFilletChamfer(const LPEFilletChamfer &);
LPEFilletChamfer &operator=(const LPEFilletChamfer &);