From: mathog <ma...@ca...> - 2012-09-06 23:29:30
|
On 04-Sep-2012 18:02, Krzysztof Kosiński wrote: > 2012/9/5 mathog <ma...@ca...>: >> Can livarot be used that way? > > Not without modifications. > > The relevant function is in splivarot.cpp, lines 115-602. You can try > to take everything after the input validation bits (they end around > line 239) and turn that into a new function that will take > pathvectors, then call this new function from the original. I tried that today and got it to the point where it would compile and create result of type "Path" (livarot Path, not Geom Path) containing the result. I can see this as std::cout << "result is: " << res->svg_dump_path() << std::endl; at that point shows a reasonable looking string for an SVG path for the test case: M 135.09375 531.25 L 135.09375 799.8125 C 135.09375 799.8125 148.51709 791.90059 169.90625 782.96875 L 169.90625 531.25 L 135.09375 531.25 z However there seems to be no method in livarot to convert livarot Path to Geom::Path. So I went looking for methods to convert that SVG text string to Geom::PathVector directly and came up empty. The best I have come up with so far (and this will not compile): Geom::PathVector outres; std::vector<Geom::Path> tpathv = Geom::parse_svg_path(res->svg_dump_path()); for (std::vector<Geom::Path>::const_iterator pit = tpathv.begin(); pit != tpathv.end(); ++pit){ outres.push_back(pit); } I thought Geom::PathVector was actually the same thing as std::vector<Geom::Path>>, but outres = tpathv; is not accepted (it doesn't know what to do with the "="). The last part above is also wrong and push_back causes: splivarot.cpp: In function ‘Geom::PathVector sp_pathvector_boolop(const PathVector&, const PathVector&, bool_op, fill_typ, fill_typ)’: splivarot.cpp:319:27: error: no matching function for call to ‘std::vector<Geom::Path>::push_back(std::vector<Geom::Path>::const_iterator&)’ splivarot.cpp:319:27: note: candidate is: /usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = Geom::Path, _Alloc = std::allocator<Geom::Path>, std::vector<_Tp, _Alloc>::value_type = Geom::Path] /usr/include/c++/4.6/bits/stl_vector.h:826:7: note: no known conversion for argument 1 from ‘std::vector<Geom::Path>::const_iterator {aka __gnu_cxx::__normal_iterator<const Geom::Path*, std::vector<Geom::Path> >}’ to ‘const value_type& {aka const Geom::Path&}’ So what is the proper syntax to get from tpathv to outres??? Thanks, David Mathog ma...@ca... Manager, Sequence Analysis Facility, Biology Division, Caltech |