diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-03-28 19:40:38 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-03-28 19:40:38 +0000 |
| commit | fec0b349b78851c2f7d8f30b44b057eafe2bc1ac (patch) | |
| tree | 6d02deb897be95b9e9b6a85123bca37255187386 | |
| parent | Add two files that were forgotten in last commit (diff) | |
| download | inkscape-fec0b349b78851c2f7d8f30b44b057eafe2bc1ac.tar.gz inkscape-fec0b349b78851c2f7d8f30b44b057eafe2bc1ac.zip | |
and two more files that were missed in lpe-group commit
(bzr r5221)
| -rw-r--r-- | src/live_effects/lpegroupbbox.cpp | 75 | ||||
| -rw-r--r-- | src/live_effects/lpegroupbbox.h | 41 |
2 files changed, 116 insertions, 0 deletions
diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp new file mode 100644 index 000000000..1468e5dde --- /dev/null +++ b/src/live_effects/lpegroupbbox.cpp @@ -0,0 +1,75 @@ +#define INKSCAPE_LPEGROUPBBOX_CPP + +/* + * Copyright (C) Steren Giannini 2008 <steren.giannini@gmail.com> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "live_effects/lpegroupbbox.h" +#include "sp-shape.h" +#include "sp-item.h" +#include "sp-path.h" +#include "sp-item-group.h" +#include "display/curve.h" +#include <libnr/n-art-bpath.h> +#include <libnr/nr-matrix-fns.h> +#include "live_effects/n-art-bpath-2geom.h" +#include "svg/svg.h" +#include "ui/widget/scalar.h" + +#include <2geom/sbasis.h> +#include <2geom/sbasis-geometric.h> +#include <2geom/bezier-to-sbasis.h> +#include <2geom/sbasis-to-bezier.h> +#include <2geom/d2.h> +#include <2geom/piecewise.h> + +#include <algorithm> + +using std::vector; + +namespace Inkscape { +namespace LivePathEffect { + +void +LivePathEffect_group_bbox::recursive_original_bbox(SPGroup *group, Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2, std::vector<Geom::Path> & temppath) +{ + std::vector<Geom::Path> tempsubpath; + GSList const *item_list = sp_item_group_item_list(group); + + for ( GSList const *iter = item_list; iter; iter = iter->next ) + { + SPObject *subitem = static_cast<SPObject *>(iter->data); + if (SP_IS_PATH(subitem)) + { + //if there is not an original-d, just take the d + if(SP_OBJECT_REPR(subitem)->attribute("inkscape:original-d") != NULL) + tempsubpath = SVGD_to_2GeomPath(SP_OBJECT_REPR(subitem)->attribute("inkscape:original-d")); + else + tempsubpath = SVGD_to_2GeomPath(SP_OBJECT_REPR(subitem)->attribute("d")); + + temppath.insert(temppath.end(), tempsubpath.begin(), tempsubpath.end()); + }else + if (SP_IS_GROUP(subitem)) + { + recursive_original_bbox(SP_GROUP(subitem), pwd2, temppath); + } + + } +} + + +} // 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/lpegroupbbox.h b/src/live_effects/lpegroupbbox.h new file mode 100644 index 000000000..cc56ed9a7 --- /dev/null +++ b/src/live_effects/lpegroupbbox.h @@ -0,0 +1,41 @@ +#ifndef INKSCAPE_LPEGROUPBBOX_H +#define INKSCAPE_LPEGROUPBBOXP_H + +/* + * Inkscape::LivePathEffect_group_bbox + * + * Copyright (C) Steren Giannini 2008 <steren.giannini@gmail.com> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ +#include "live_effects/effect.h" +#include "live_effects/parameter/path.h" +#include "live_effects/parameter/enum.h" +#include "live_effects/parameter/bool.h" + +#include <2geom/sbasis.h> +#include <2geom/sbasis-geometric.h> +#include <2geom/bezier-to-sbasis.h> +#include <2geom/sbasis-to-bezier.h> +#include <2geom/d2.h> +#include <2geom/piecewise.h> + +namespace Inkscape { +namespace LivePathEffect { + +class LivePathEffect_group_bbox { +protected: +//if we need information concerning the group Bounding box and coordinates of each subshapes. + Geom::Interval boundingbox_X; + Geom::Interval boundingbox_Y; + +//Here is a recursive function to get the bbox of a group + void +recursive_original_bbox(SPGroup *group, Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2, std::vector<Geom::Path> & temppath); + +}; + +}; //namespace LivePathEffect +}; //namespace Inkscape + +#endif |
