1 #define INKSCAPE_LPEGROUPBBOX_CPP
3 /*
4 * Copyright (C) Steren Giannini 2008 <steren.giannini@gmail.com>
5 *
6 * Released under GNU GPL, read the file 'COPYING' for more information
7 */
9 #include "live_effects/lpegroupbbox.h"
10 #include "sp-shape.h"
11 #include "sp-item.h"
12 #include "sp-path.h"
13 #include "sp-item-group.h"
14 #include "display/curve.h"
15 #include <libnr/n-art-bpath.h>
16 #include <libnr/nr-matrix-fns.h>
17 #include "live_effects/n-art-bpath-2geom.h"
18 #include "svg/svg.h"
19 #include "ui/widget/scalar.h"
21 #include <2geom/sbasis.h>
22 #include <2geom/sbasis-geometric.h>
23 #include <2geom/bezier-to-sbasis.h>
24 #include <2geom/sbasis-to-bezier.h>
25 #include <2geom/d2.h>
26 #include <2geom/piecewise.h>
28 #include <algorithm>
30 using std::vector;
32 namespace Inkscape {
33 namespace LivePathEffect {
35 void
36 LivePathEffect_group_bbox::recursive_original_bbox(SPGroup *group, Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2, std::vector<Geom::Path> & temppath)
37 {
38 std::vector<Geom::Path> tempsubpath;
39 GSList const *item_list = sp_item_group_item_list(group);
41 for ( GSList const *iter = item_list; iter; iter = iter->next )
42 {
43 SPObject *subitem = static_cast<SPObject *>(iter->data);
44 if (SP_IS_PATH(subitem))
45 {
46 //if there is not an original-d, just take the d
47 if(SP_OBJECT_REPR(subitem)->attribute("inkscape:original-d") != NULL)
48 tempsubpath = SVGD_to_2GeomPath(SP_OBJECT_REPR(subitem)->attribute("inkscape:original-d"));
49 else
50 tempsubpath = SVGD_to_2GeomPath(SP_OBJECT_REPR(subitem)->attribute("d"));
52 temppath.insert(temppath.end(), tempsubpath.begin(), tempsubpath.end());
53 }else
54 if (SP_IS_GROUP(subitem))
55 {
56 recursive_original_bbox(SP_GROUP(subitem), pwd2, temppath);
57 }
59 }
60 }
63 } // namespace LivePathEffect
64 } /* namespace Inkscape */
66 /*
67 Local Variables:
68 mode:c++
69 c-file-style:"stroustrup"
70 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
71 indent-tabs-mode:nil
72 fill-column:99
73 End:
74 */
75 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :