diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-02-07 17:05:01 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-02-07 17:05:01 +0000 |
| commit | ab9fe994f320dfd929888e2f5d821b6968385694 (patch) | |
| tree | 94e9f46c125c7c1827491e1859bc59339ce7f143 /src | |
| parent | update to trunk (diff) | |
| download | inkscape-ab9fe994f320dfd929888e2f5d821b6968385694.tar.gz inkscape-ab9fe994f320dfd929888e2f5d821b6968385694.zip | |
refactor of pointwise base
(bzr r13645.1.6)
Diffstat (limited to 'src')
| -rw-r--r-- | src/2geom/pointwise.cpp | 22 | ||||
| -rw-r--r-- | src/2geom/pointwise.h | 19 | ||||
| -rw-r--r-- | src/2geom/satellite-enum.h | 40 | ||||
| -rw-r--r-- | src/2geom/satellite.h | 48 |
4 files changed, 93 insertions, 36 deletions
diff --git a/src/2geom/pointwise.cpp b/src/2geom/pointwise.cpp index 7a84593ba..ce3aa86f6 100644 --- a/src/2geom/pointwise.cpp +++ b/src/2geom/pointwise.cpp @@ -31,23 +31,17 @@ namespace Geom { -std::pair<int,satelite> +std::vector<satellite> pointwise::findSatellites(int A) const - { - std::pair<int,satelite> ret; - for(unsigned i = 0; i < _satellites.size(); i++){ - if(_satellites[i].first() == A){ - ret.push_back(std::pair<i,_satellites[i].second()>) - } - } - return ret; +{ + std::vector<satelite> ret; + for(unsigned i = 0; i < _satellites.size(); i++){ + if(_satellites[i].first() == A){ + ret.push_back(_satellites[i].second); } -double toTime(std::pair<int,satelite> A, double B){ - + } + return ret; } -double toSize(std::pair<int,satelite> A, double B) -Pointwise recalculate(Piecewise<D2<SBasis> > A) - } /* diff --git a/src/2geom/pointwise.h b/src/2geom/pointwise.h index 7573a0bdc..33289f4f0 100644 --- a/src/2geom/pointwise.h +++ b/src/2geom/pointwise.h @@ -59,18 +59,15 @@ class Pointwise virtual ~Pointwise(); - std::pair<int,satelite> findSatellites(int A) const; - - double toTime(std::pair<int,satelite> A, double B); - double toSize(std::pair<int,satelite> A, double B); - double len_to_rad(int index, double len); - double rad_to_len(int index, double rad); - std::vector<double> get_times(int index, bool last); - std::pair<std::size_t, std::size_t> get_positions(int index) - int last_index(int index); - double time_to_len(int index, double time); - double len_to_time(int index, double len); + std::vector<satelite> 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); private: std::vector<std::pair<int,satelite> > _satellites; diff --git a/src/2geom/satellite-enum.h b/src/2geom/satellite-enum.h new file mode 100644 index 000000000..3872cf718 --- /dev/null +++ b/src/2geom/satellite-enum.h @@ -0,0 +1,40 @@ +#ifndef LIB2GEOM_SEEN_SATELLITE_ENUM_H +#define LIB2GEOM_SEEN_SATELLITE_ENUM_H + +/* + * + * +* Copyright (C) Jabier Arraiza Cenoz <jabier.arraiza@marker.es> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "util/enums.h" + +namespace Geom { + +enum SatelliteType { + FILLET=0, + 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) +}; + +extern const Util::EnumData<SatelliteType> SATELLITETypeData[]; /// defined in satelite.cpp +extern const Util::EnumDataConverter<SateliteType> SATELLITETypeConverter; /// defined in sattelite.cpp + +} //namespace Geom + +#endif + +/* + 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/2geom/satellite.h b/src/2geom/satellite.h index 6be745de0..8e570db4c 100644 --- a/src/2geom/satellite.h +++ b/src/2geom/satellite.h @@ -33,8 +33,22 @@ #ifndef LIB2GEOM_SEEN_SATELLITE_H #define LIB2GEOM_SEEN_SATELLITE_H +#include <2geom/satellite-enum.h> + 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: @@ -43,14 +57,14 @@ class Satellite virtual ~Sattelite(); - Satellite(typeSatellite ts, bool isTime, bool active, bool after, bool hidden, double size, double time) - : _ts(ts), _time(time), _active(active), _after(after), _hidden(hidden), _size(size), _time(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) { } - void setTypeSatellite(typeSatellite A) + void setSatelliteType(SatelliteType A) { - _ts = A; + _satellitetype = A; } void setActive(bool A) @@ -58,9 +72,9 @@ class Satellite _active = A; } - void setAfter(bool A) + void setHasMirror(bool A) { - _after = A; + _mirror = A; } void setHidden(bool A) @@ -80,7 +94,7 @@ class Satellite _size = A; } - typeSatellite ts() const + SatelliteType satellitetype() const { return _ts; } @@ -95,9 +109,9 @@ class Satellite return _active; } - bool after() const + bool hasMirror() const { - return _after; + return _mirror; } bool hidden() const @@ -115,16 +129,28 @@ class Satellite return _time; } + double toTime(double A,D2<SBasis> curve) const + { + //todo make the process + return _time; + } + + double toSize(double A,D2<SBasis> curve) const + { + //todo make the process + return _size; + } + bool isDegenerate() const { return _size = 0 && _time = 0; } private: - typeSatellite _ts; + SatelliteType _satellitetype; bool _isTime; bool _active; - bool _after; + bool _hasMirror; bool _hidden; double _size; double _time; |
