summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-02-15 18:29:48 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-02-15 18:29:48 +0000
commit99fb2239028e72f8773bff39e43f7af33b4252d4 (patch)
tree23e96adea9f08b37f066559b28aac842cb230879 /src
parentupdate to trunk (diff)
downloadinkscape-99fb2239028e72f8773bff39e43f7af33b4252d4.tar.gz
inkscape-99fb2239028e72f8773bff39e43f7af33b4252d4.zip
first steps
(bzr r13645.1.9)
Diffstat (limited to 'src')
-rw-r--r--src/2geom/2geom.h2
-rw-r--r--src/2geom/CMakeLists.txt4
-rw-r--r--src/2geom/Makefile_insert1
-rw-r--r--src/2geom/pointwise.cpp15
-rw-r--r--src/2geom/pointwise.h24
-rw-r--r--src/2geom/satellite-enum.h19
-rw-r--r--src/2geom/satellite.h67
-rw-r--r--src/live_effects/CMakeLists.txt4
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp54
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h18
-rw-r--r--src/live_effects/parameter/Makefile_insert4
-rw-r--r--src/live_effects/parameter/array.cpp51
-rw-r--r--src/live_effects/parameter/array.h43
-rw-r--r--src/live_effects/parameter/pointwise.cpp104
-rw-r--r--src/live_effects/parameter/pointwise.h88
15 files changed, 173 insertions, 325 deletions
diff --git a/src/2geom/2geom.h b/src/2geom/2geom.h
index 000f3423d..1deef9e8c 100644
--- a/src/2geom/2geom.h
+++ b/src/2geom/2geom.h
@@ -59,6 +59,8 @@
#include <2geom/sbasis.h>
// others
+#include <2geom/pointwise.h>
+#include <2geom/satellite.h>
#include <2geom/math-utils.h>
#include <2geom/utils.h>
diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt
index eeaecaa39..b49b78e7e 100644
--- a/src/2geom/CMakeLists.txt
+++ b/src/2geom/CMakeLists.txt
@@ -26,11 +26,13 @@ set(2geom_SRC
pathvector.cpp
piecewise.cpp
point.cpp
+ pointwise.cpp
poly.cpp
quadtree.cpp
rect.cpp
# recursive-bezier-intersection.cpp
region.cpp
+ satellite.cpp
sbasis-2d.cpp
sbasis-geometric.cpp
sbasis-math.cpp
@@ -100,11 +102,13 @@ set(2geom_SRC
piecewise.h
point-ops.h
point.h
+ pointwise.h
poly.h
quadtree.h
ray.h
rect.h
region.h
+ satellite.h
sbasis-2d.h
sbasis-curve.h
sbasis-geometric.h
diff --git a/src/2geom/Makefile_insert b/src/2geom/Makefile_insert
index 2f23bc442..8872065fb 100644
--- a/src/2geom/Makefile_insert
+++ b/src/2geom/Makefile_insert
@@ -92,6 +92,7 @@
2geom/recursive-bezier-intersection.cpp \
2geom/region.cpp \
2geom/region.h \
+ 2geom/satellite.cpp \
2geom/satellite.h \
2geom/sbasis-2d.cpp \
2geom/sbasis-2d.h \
diff --git a/src/2geom/pointwise.cpp b/src/2geom/pointwise.cpp
index cd7f7914f..5cbccbca9 100644
--- a/src/2geom/pointwise.cpp
+++ b/src/2geom/pointwise.cpp
@@ -33,12 +33,19 @@
namespace Geom {
-std::vector<satellite>
-pointwise::findSatellites(int A) const
+Pointwise::Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<std::pair<int,Satellite> > satellites)
+ : _pwd2(pwd2), _satellites(satellites)
{
- std::vector<satelite> ret;
+};
+
+Pointwise::~Pointwise(){};
+
+std::vector<Satellite>
+Pointwise::findSatellites(int A) const
+{
+ std::vector<Satellite> ret;
for(unsigned i = 0; i < _satellites.size(); i++){
- if(_satellites[i].first() == A){
+ if(_satellites[i].first == A){
ret.push_back(_satellites[i].second);
}
}
diff --git a/src/2geom/pointwise.h b/src/2geom/pointwise.h
index c0974f54c..6e9c8840b 100644
--- a/src/2geom/pointwise.h
+++ b/src/2geom/pointwise.h
@@ -50,7 +50,6 @@
#include <2geom/sbasis-2d.h>
#include <2geom/piecewise.h>
#include <2geom/satellite.h>
-#include <2geom/affine.h>
namespace Geom {
/**
@@ -60,31 +59,28 @@ namespace Geom {
class Pointwise
{
public:
- Pointwise(){}
-
- Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<std::pair<int,satelite> > satellites)
- : _pwd2(pwd2), _satellites(satellites)
- {
- }
-
+ Pointwise(){};
+ Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<std::pair<int,Satellite> > satellites);
virtual ~Pointwise();
-
- std::vector<satelite> findSatellites(int A) const;
+ std::vector<Satellite> findSatellites(int A) const;
Pointwise recalculate_for_new_pwd2(Piecewise<D2<SBasis> > A);
Pointwise pwd2_reverse(int index);
Pointwise pwd2_append(int index);
Pointwise pwd2_prepend(int index);
Pointwise pwd2_add(int index);
Pointwise pwd2_del(int index);
- Pointwise satellite_add(int index,satelite sat);
- Pointwise satellite_del(int index,satelite sat);
+ Pointwise satellite_add(int index,Satellite sat);
+ Pointwise satellite_del(int index,Satellite sat);
private:
- std::vector<std::pair<int,satelite> > _satellites;
Piecewise<D2<SBasis> > _pwd2;
+ std::vector<std::pair<int,Satellite> > _satellites;
+
};
-#endif //SEEN_GEOM_PW_SB_H
+} // end namespace Geom
+
+#endif //SEEN_GEOM_POINTWISE_H
/*
Local Variables:
mode:c++
diff --git a/src/2geom/satellite-enum.h b/src/2geom/satellite-enum.h
index a71306bc9..474e98547 100644
--- a/src/2geom/satellite-enum.h
+++ b/src/2geom/satellite-enum.h
@@ -10,6 +10,8 @@
*/
#include "util/enums.h"
+/*#include <boost/bimap.hpp>
+*/
namespace Geom {
@@ -18,11 +20,20 @@ enum SatelliteType {
INVERSE_FILLET,
CHAMFER,
INVERSE_CHAMFER,
- INVALID_SATELLITE // This must be last (I made it such that it is not needed anymore I think..., Don't trust on it being last. - johan)
+ INVALID_SATELLITE // This must be last)
};
-std::map<gchar const *value, SatelliteType> SatelliteTypeMap = boost::map_list_of("FILLET", FILLET)("INVERSE_FILLET", INVERSE_FILLET)("CHAMFER",CHAMFER)("INVERSE_CHAMFER",INVERSE_CHAMFER)("INVALID_SATELLITE",INVALID_SATELLITE);
-extern const Util::EnumData<SatelliteType> SATELLITETypeData[]; /// defined in satelite.cpp
-extern const Util::EnumDataConverter<SateliteType> SATELLITETypeConverter; /// defined in sattelite.cpp
+
+/* TODO maybe is best do next by bimap
+ typedef boost::bimap< Geom::SatelliteType,gchar const *> map_type ;
+
+ map_type SatelliteTypeBimap;
+
+ SatelliteTypeBimap.insert( map_type::value_type(FILLET, "FILLET"));
+ SatelliteTypeBimap.insert( map_type::value_type(INVERSE_FILLET, "INVERSE_FILLET"));
+ SatelliteTypeBimap.insert( map_type::value_type(CHAMFER, "CHAMFER")) );
+ SatelliteTypeBimap.insert( map_type::value_type(INVERSE_CHAMFER, "INVERSE_CHAMFER"));
+ SatelliteTypeBimap.insert( map_type::value_type(INVALID_SATELLITE, "INVALID_SATELLITE"));
+*/
} //namespace Geom
diff --git a/src/2geom/satellite.h b/src/2geom/satellite.h
index a18b08f27..8623ff1b0 100644
--- a/src/2geom/satellite.h
+++ b/src/2geom/satellite.h
@@ -34,39 +34,31 @@
#define LIB2GEOM_SEEN_SATELLITE_H
#include <2geom/satellite-enum.h>
+#include <2geom/d2.h>
+#include <map>
+#include <boost/assign.hpp>
namespace Geom {
-const Util::EnumData<SatelliteType> SATELLITETypeData[] = {
- // {constant defined in satellite-enum.h, N_("name of satellite_type"), "name of your satellite type on SVG"}
-/* 0.92 */
- {FILLET, N_("Fillet"), "fillet"},
- {INVERSE_FILLET, N_("Inverse Fillet"), "inverse_fillet"},
- {CHAMFER, N_("Chamfer"), "chamfer"},
- {INVERSE_CHAMFER, N_("Inverse Chamfer"), "inverse_chamfer"},
- {INTERPOLATE_POINTS, N_("Interpolate points"), "interpolate_points"},
-};
-const Util::EnumDataConverter<SatelliteType> SATELLITETypeConverter(SATELLITETypeData, sizeof(SATELLITETypeData)/sizeof(*SATELLITETypeData));
-
-
class Satellite
{
public:
- Satellite()
- {}
- virtual ~Sattelite();
+ Satellite();
+ Satellite(SatelliteType satellitetype, bool isTime, bool active, bool hasMirror, bool hidden, double size, double time);
- Satellite(SatelliteType satellitetype, bool isTime, bool active, bool mirror, bool after, bool hidden, double size, double time)
- : _satellitetype(satellitetype), _time(time), _active(active), _mirror(mirror), _after(after), _hidden(hidden), _size(size), _time(time)
- {
- }
+ virtual ~Satellite();
void setSatelliteType(SatelliteType A)
{
_satellitetype = A;
}
+ void setIsTime(bool A)
+ {
+ _isTime = A;
+ }
+
void setActive(bool A)
{
_active = A;
@@ -74,7 +66,7 @@ class Satellite
void setHasMirror(bool A)
{
- _mirror = A;
+ _hasMirror = A;
}
void setHidden(bool A)
@@ -84,19 +76,17 @@ class Satellite
void setTime(double A)
{
- _isTime = true;
_time = A;
}
void setSize(double A)
{
- _isTime = false;
_size = A;
}
SatelliteType satellitetype() const
{
- return _ts;
+ return _satellitetype;
}
bool isTime() const
@@ -111,7 +101,7 @@ class Satellite
bool hasMirror() const
{
- return _mirror;
+ return _hasMirror;
}
bool hidden() const
@@ -129,36 +119,19 @@ class Satellite
return _time;
}
- double time(D2<SBasis> curve) const
+ double time(Geom::D2<Geom::SBasis> curve) const
{
//todo make the process
return _time;
}
- void setPosition(Geom::Point p, D2<SBasis> curve){
- _time = Geom::nearestPoint(p, curve);
- if(!_isTime){
- if (curve.degreesOfFreedom() != 2) {
- Piecewise<D2<SBasis> > u;
- u.push_cut(0);
- u.push(curve, 1);
- u = portion(u, 0, _time);
- _size = length(u, 0.001) * -1;
- } else {
- lenghtPart = length(last_pwd2[index], EPSILON);
- _size = (time * lenghtPart) * -1;
- }
- }
- }
+ void setPosition(Geom::Point p, Geom::D2<Geom::SBasis> curve);
- Geom::Point getPosition(D2<SBasis> curve){
- return curve.pointAt(_time);
- }
+ Geom::Point getPosition(Geom::D2<Geom::SBasis> curve);
- bool isDegenerate() const
- {
- return _size = 0 && _time = 0;
- }
+ static const std::map<SatelliteType,gchar const *> SatelliteTypeToGcharMap;
+
+ static const std::map<gchar const *,SatelliteType> GcharMapToSatelliteType;
private:
SatelliteType _satellitetype;
diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt
index e171e99e3..6b004e1df 100644
--- a/src/live_effects/CMakeLists.txt
+++ b/src/live_effects/CMakeLists.txt
@@ -63,7 +63,7 @@ set(live_effects_SRC
parameter/path-reference.cpp
parameter/point.cpp
parameter/powerstrokepointarray.cpp
- parameter/pointwise.cpp
+ parameter/satellitepairarray.cpp
parameter/random.cpp
parameter/text.cpp
paramter/transformedpoint.cpp
@@ -140,7 +140,7 @@ set(live_effects_SRC
parameter/originalpatharray.h
parameter/point.h
parameter/powerstrokepointarray.h
- parameter/pointwise.h
+ parameter/satellitepairarray.h
parameter/random.h
parameter/text.h
parameter/togglebutton.h
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index f4eb4f46e..884e51ffd 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -14,20 +14,28 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include "live_effects/parameter/pointwise.h"
+#include "live_effects/lpe-fillet-chamfer.h"
+#include <sp-shape.h>
+#include <2geom/pointwise.h>
+#include <2geom/satellite.h>
+#include <2geom/satellite-enum.h>
+#include "helper/geom-nodetype.h"
+#include "helper/geom.h"
+#include "display/curve.h"
+#include <vector>
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
-using namespace Geom;
+
namespace Inkscape {
namespace LivePathEffect {
LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- pointwise_values(_("Fillet point"), _("Fillet point"), "pointwise_values", &wr, this)
+ satellitepairarrayparam_values(_("Fillet point"), _("Fillet point"), "satellitepairarrayparam_values", &wr, this)
{
- registerParameter(&pointwise_values);
+ registerParameter(&satellitepairarrayparam_values);
}
LPEFilletChamfer::~LPEFilletChamfer() {}
@@ -35,12 +43,17 @@ LPEFilletChamfer::~LPEFilletChamfer() {}
void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
{
- SPShape * shape = dynamic_cast<SPshape *>(lpeItem);
+ SPLPEItem * splpeitem = const_cast<SPLPEItem *>(lpeItem);
+ SPShape * shape = dynamic_cast<SPShape *>(splpeitem);
if (shape) {
- std::vector<std::pair<int,GeomSatellite> pointwise;
- PathVector const &original_pathv = pathv_to_linear_and_cubic_beziers(shape->gerCurve->get_pathvector());
- //Piecewise<D2<SBasis> > pwd2_in = paths_to_pw(original_pathv);
- for (PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) {
+ Geom::PathVector const &original_pathv = pathv_to_linear_and_cubic_beziers(shape->getCurve()->get_pathvector());
+ std::vector<std::pair<int,Geom::Satellite> > satellites;
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_in = paths_to_pw(original_pathv);
+ pwd2_in = remove_short_cuts(pwd2_in, .01);
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > der = derivative(pwd2_in);
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > n = rot90(unitVector(der));
+ satellitepairarrayparam_values.set_pwd2(pwd2_in, n);
+ for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) {
if (path_it->empty())
continue;
@@ -61,16 +74,15 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
}
int counter = 0;
while (curve_it1 != curve_endit) {
- Geom::Saltellite sat(FILLET, true, true, false, false, false, 0, 0.2);
- std::pair<std::size_t, std::size_t> positions = pointwise_values.get_positions(counter, original_pathv);
+ Geom::Satellite satellite(Geom::FILLET, true, true, false, false, 0.0, 0.2);
Geom::NodeType nodetype;
- if (positions.second == 0) {
- nodetype = NODE_NONE;
- } else {
+ if(counter!=0){
nodetype = get_nodetype((*path_it)[counter - 1], *curve_it1);
+ } else {
+ nodetype = Geom::NODE_NONE;
}
- if (nodetype == NODE_CUSP) {
- pointwise.push_back(std::pair<counter,sat>);
+ if (nodetype == Geom::NODE_CUSP) {
+ satellites.push_back(std::make_pair(counter, satellite));
}
++curve_it1;
if (curve_it2 != curve_endit) {
@@ -79,7 +91,7 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
counter++;
}
}
- pointwise_values.param_set_and_write_new_value(pointwise);
+ satellitepairarrayparam_values.param_set_and_write_new_value(satellites);
} else {
g_warning("LPE Fillet/Chamfer can only be applied to shapes (not groups).");
SPLPEItem * item = const_cast<SPLPEItem*>(lpeItem);
@@ -87,6 +99,14 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
}
}
+void
+LPEFilletChamfer::adjustForNewPath(std::vector<Geom::Path> const &path_in)
+{
+ if (!path_in.empty()) {
+ //fillet_chamfer_values.recalculate_controlpoints_for_new_pwd2(pathv_to_linear_and_cubic_beziers(path_in)[0].toPwSb());
+ }
+}
+
}; //namespace LivePathEffect
}; /* namespace Inkscape */
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index f4462d154..08000c0a5 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -15,19 +15,8 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#if defined(GLIBMM_DISABLE_DEPRECATED) && defined(HAVE_GLIBMM_THREADS_H)
-# include <glibmm/threads.h>
-#endif
-
-#include "live_effects/parameter/enum.h"
-#include "live_effects/parameter/bool.h"
-#include "live_effects/parameter/unit.h"
-
-#include "live_effects/parameter/pointwise.h"
+#include "2geom/pointwise.h"
+#include "live_effects/parameter/satellitepairarray.h"
#include "live_effects/effect.h"
namespace Inkscape {
@@ -40,8 +29,9 @@ public:
virtual ~LPEFilletChamfer();
virtual void doOnApply(SPLPEItem const *lpeItem);
+ virtual void adjustForNewPath(std::vector<Geom::Path> const &path_in);
- PointwiseArrayParam pointwise_values;
+ SatellitePairArrayParam satellitepairarrayparam_values;
private:
diff --git a/src/live_effects/parameter/Makefile_insert b/src/live_effects/parameter/Makefile_insert
index d78b1e22f..33c6b0673 100644
--- a/src/live_effects/parameter/Makefile_insert
+++ b/src/live_effects/parameter/Makefile_insert
@@ -26,8 +26,8 @@ ink_common_sources += \
live_effects/parameter/powerstrokepointarray.h \
live_effects/parameter/filletchamferpointarray.cpp \
live_effects/parameter/filletchamferpointarray.h \
- live_effects/parameter/pointwise.cpp \
- live_effects/parameter/pointwise.h \
+ live_effects/parameter/satellitepairarray.cpp \
+ live_effects/parameter/satellitepairarray.h \
live_effects/parameter/text.cpp \
live_effects/parameter/text.h \
live_effects/parameter/transformedpoint.cpp \
diff --git a/src/live_effects/parameter/array.cpp b/src/live_effects/parameter/array.cpp
index bd2bf1870..d17f28c4f 100644
--- a/src/live_effects/parameter/array.cpp
+++ b/src/live_effects/parameter/array.cpp
@@ -6,8 +6,7 @@
#include "live_effects/parameter/array.h"
-#include "svg/svg.h"
-#include "svg/stringstream.h"
+#include "helper-fns.h"
#include <2geom/coord.h>
#include <2geom/point.h>
@@ -48,37 +47,47 @@ ArrayParam<Geom::Point>::readsvg(const gchar * str)
}
return Geom::Point(Geom::infinity(),Geom::infinity());
}
-void
-sp_svg_satellite_read_d(gchar const *str, satellite *sat){
- gchar ** strarray = g_strsplit(str, "*", 0);
- if(strarray.size() != 6){
+//TODO: move maybe to svg-lenght.cpp
+unsigned int
+sp_svg_satellite_read_d(gchar const *str, Geom::Satellite *sat){
+ if (!str) {
+ return 0;
+ }
+ gchar ** strarray = g_strsplit(str, " * ", 0);
+ if(strarray[6] && !strarray[7]){
+ std::map< gchar const *, Geom::SatelliteType> gts = sat->GcharMapToSatelliteType;
+ sat->setSatelliteType(gts[strarray[0]]);
+ sat->setIsTime(helperfns_read_bool(strarray[1], true));
+ sat->setActive(helperfns_read_bool(strarray[2], true));
+ sat->setHasMirror(helperfns_read_bool(strarray[3], false));
+ sat->setHidden(helperfns_read_bool(strarray[4], false));
+ double time,size;
+ sp_svg_number_read_d(strarray[5], &time);
+ sp_svg_number_read_d(strarray[6], &size);
+ sat->setTime(time);
+ sat->setSize(size);
g_strfreev (strarray);
- return NULL;
+ return 1;
}
- sat->setSatelliteType(SatelliteTypeMap[strarray[0]]);
- sat->setActive(helperfns_read_bool(strarray[1], true));
- sat->sethasMirror(helperfns_read_bool(strarray[2], false));
- sat->setHidden(helperfns_read_bool(strarray[3], false));
- sat->setHidden(helperfns_read_bool(strarray[3], false));
- sat->setTime(sp_svg_number_read_d(strarray[4], 0.0));
- sat->setSize(sp_svg_number_read_d(strarray[5], 0.0));
g_strfreev (strarray);
+ return 0;
}
template <>
-std::pair<int, satellite>
-ArrayParam<Geom::Point>::readsvg(const gchar * str)
+std::pair<int, Geom::Satellite>
+ArrayParam<std::pair<int, Geom::Satellite> >::readsvg(const gchar * str)
{
gchar ** strarray = g_strsplit(str, ",", 2);
- int index;
- Geom::satellite sat = NULL;
- unsigned int success = sp_svg_number_read_d(strarray[0], &index);
+ double index;
+ std::pair<int, Geom::Satellite> result;
+ unsigned int success = (int)sp_svg_number_read_d(strarray[0], &index);
+ Geom::Satellite sat;
success += sp_svg_satellite_read_d(strarray[1], &sat);
g_strfreev (strarray);
if (success == 2) {
- return std::pair<index, sat>;
+ return std::make_pair(index, sat);
}
- return std::pair<Geom::infinity(),NULL>;
+ return std::make_pair((int)Geom::infinity(),sat);
}
} /* namespace LivePathEffect */
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h
index b93c7a617..9f26ed3e6 100644
--- a/src/live_effects/parameter/array.h
+++ b/src/live_effects/parameter/array.h
@@ -15,6 +15,9 @@
#include "live_effects/parameter/parameter.h"
+#include <2geom/satellite.h>
+#include <2geom/satellite-enum.h>
+#include <2geom/pointwise.h>
#include "svg/svg.h"
#include "svg/stringstream.h"
@@ -93,16 +96,40 @@ protected:
// separate items with pipe symbol
str << " | ";
}
- std::pair<int,Geom::satellite> pointwiseElement = dynamic_cast<std::pair<int,Geom::satellite> ><(_vector[i]);
- if(pointwiseElement){
- str << vector[i].first;
- str << " , ";
- str << vector[i].second;
- } else {
- str << vector[i];
- }
+ writesvgData(str,vector[i]);
}
}
+
+ void writesvgData(SVGOStringStream &str, float const &nVector) const {
+ str << nVector;
+ }
+
+ void writesvgData(SVGOStringStream &str, double const &nVector) const {
+ str << nVector;
+ }
+
+ void writesvgData(SVGOStringStream &str, Geom::Point const &nVector) const {
+ str << nVector;
+ }
+
+ void writesvgData(SVGOStringStream &str, std::pair<int, Geom::Satellite> const &nVector) const {
+ str << nVector.first;
+ str << " , ";
+ std::map<Geom::SatelliteType, gchar const *> stg = nVector.second.SatelliteTypeToGcharMap;
+ str << stg[nVector.second.satellitetype()];
+ str << " * ";
+ str << nVector.second.isTime();
+ str << " * ";
+ str << nVector.second.active();
+ str << " * ";
+ str << nVector.second.hasMirror();
+ str << " * ";
+ str << nVector.second.hidden();
+ str << " * ";
+ str << nVector.second.size();
+ str << " * ";
+ str <<nVector.second.time();
+ }
StorageType readsvg(const gchar * str);
diff --git a/src/live_effects/parameter/pointwise.cpp b/src/live_effects/parameter/pointwise.cpp
deleted file mode 100644
index ec83eb6c7..000000000
--- a/src/live_effects/parameter/pointwise.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) Jabiertxo Arraiza Cenoz <jabier.arraiza@marker.es>
- * Special thanks to Johan Engelen for the base of the effect -powerstroke-
- * Also to ScislaC for point me to the idea
- * Also su_v for his construvtive feedback and time
- * and finaly to Liam P. White for his big help on coding, that save me a lot of
- * hours
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "knotholder.h"
-
-// TODO due to internal breakage in glibmm headers,
-// this has to be included last.
-#include <glibmm/i18n.h>
-
-
-using namespace Geom;
-
-namespace Inkscape {
-
-namespace LivePathEffect {
-
-PointwiseParam::PointwiseParam(
- const Glib::ustring &label, const Glib::ustring &tip,
- const Glib::ustring &key, Inkscape::UI::Widget::Registry *wr,
- Effect *effect)
- : ArrayParam<Pointwise>(label, tip, key, wr, effect, 0)
-{
- knot_shape = SP_KNOT_SHAPE_DIAMOND;
- knot_mode = SP_KNOT_MODE_XOR;
- knot_color = 0x00ff0000;
-}
-
-PointwiseParam::~PointwiseParam() {}
-
-Gtk::Widget *PointwiseParam::param_newWidget()
-{
- return NULL;
-}
-
-void PointwiseParam::set_oncanvas_looks(SPKnotShapeType shape,
- SPKnotModeType mode,
- guint32 color)
-{
- knot_shape = shape;
- knot_mode = mode;
- knot_color = color;
-}
-
-PointwiseParamKnotHolderEntity::
-PointwiseParamKnotHolderEntity(
- PointwiseParam *p)
- : _pparam(p) {}
-
-void PointwiseParamKnotHolderEntity::knot_set(Point const &p,
- Point const &/*origin*/,
- guint state)
-{
- Geom::Point const s = snap_knot_position(p, state);
- _pparam->_vector.at(_index).second.setPosition(s,_pparam->_pointwise.pwd2[_pparam->_vector.at(_index).first]);
- sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
-}
-
-Point PointwiseParamKnotHolderEntity::knot_get() const
-{
- Geom::Point const canvas_point = _pparam->_vector.at(_index).second.getPosition(_pparam->_pointwise.pwd2[_pparam->_vector.at(_index).first]);
- _pparam->updateCanvasIndicators();
- return canvas_point;
-}
-
-
-void PointwiseParam::addKnotHolderEntities(KnotHolder *knotholder,
- SPDesktop *desktop,
- SPItem *item)
-{
- for (unsigned int i = 0; i < _pointwise.satellites.size(); ++i) {
- const gchar *tip;
- tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toggle type, "
- "<b>Shift+Click</b> open dialog, "
- "<b>Ctrl+Alt+Click</b> reset");
- PointwiseParamKnotHolderEntity *e =
- new PointwiseParamKnotHolderEntity(this, i);
- e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _(tip),
- knot_shape, knot_mode, knot_color);
- knotholder->add(e);
- }
- updateCanvasIndicators();
-}
-
-} /* 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 :
diff --git a/src/live_effects/parameter/pointwise.h b/src/live_effects/parameter/pointwise.h
deleted file mode 100644
index 59f1b4ff4..000000000
--- a/src/live_effects/parameter/pointwise.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef INKSCAPE_LIVEPATHEFFECT_POINTWISE_H
-#define INKSCAPE_LIVEPATHEFFECT_POINTWISE_H
-
-/*
- * Inkscape::LivePathEffectParameters
- * Copyright (C) Jabiertxo Arraiza Cenoz <jabier.arraiza@marker.es>
- * Special thanks to Johan Engelen for the base of the effect -powerstroke-
- * Also to ScislaC for point me to the idea
- * Also su_v for his construvtive feedback and time
- * To Nathan Hurst for his review and help on refactor
- * and finaly to Liam P. White for his big help on coding, that save me a lot of
- * hours
- *
- *
- * This parameter act as bridge from pointwise class to serialize it as a LPE
- * parameter
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include <glib.h>
-#include "knot-holder-entity.h"
-
-namespace Inkscape {
-
-namespace LivePathEffect {
-
-class PointwiseParamKnotHolderEntity;
-
-class PointwiseParam : public ArrayParam<Geom::Pointwise> {
-public:
- PointwiseParam(const Glib::ustring &label,
- const Glib::ustring &tip,
- const Glib::ustring &key,
- Inkscape::UI::Widget::Registry *wr,
- Effect *effect);
- virtual ~PointwiseParam();
-
- virtual Gtk::Widget * param_newWidget() {
- return NULL;
- }
-
- void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode,
- guint32 color);
- virtual bool providesKnotHolderEntities() const {
- return true;
- }
- friend class PointwiseParamKnotHolderEntity;
-
-protected:
-
- StorageType readsvg(const gchar * str);
-
-private:
- PointwiseParam(const PointwiseParam &);
- PointwiseParam &operator=(const PointwiseParam &);
-
- SPKnotShapeType knot_shape;
- SPKnotModeType knot_mode;
- guint32 knot_color;
-};
-
-class PointwiseParamKnotHolderEntity : public KnotHolderEntity {
-public:
- PointwiseParamKnotHolderEntity(PointwiseParam *p,
- unsigned int index);
- virtual ~PointwiseParamKnotHolderEntity() {}
-
- virtual void knot_set(Geom::Point const &p, Geom::Point const &origin,
- guint state);
- virtual Geom::Point knot_get() const;
-
- /*Checks whether the index falls within the size of the parameter's vector*/
- bool valid_index(unsigned int index) const {
- return (_pparam->_vector.size() > index);
- }
- ;
-
-private:
- PointwiseParam *_pparam;
- unsigned int _index;
-};
-
-} //namespace LivePathEffect
-
-} //namespace Inkscape
-
-#endif