diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-08-18 00:47:13 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-08-18 00:47:13 +0000 |
| commit | 890556d030ed1c2877f15709807ce5e9178fe793 (patch) | |
| tree | 320fd56a67afc55dcb98ce129b2c509fd46adf26 /src/live_effects | |
| parent | Some debugging messages (diff) | |
| download | inkscape-890556d030ed1c2877f15709807ce5e9178fe793.tar.gz inkscape-890556d030ed1c2877f15709807ce5e9178fe793.zip | |
Toggle button in geometry toolbar to set limiting bounding box for LPELineSegment
(bzr r6685)
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/lpe-line_segment.cpp | 20 | ||||
| -rw-r--r-- | src/live_effects/lpe-line_segment.h | 2 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/live_effects/lpe-line_segment.cpp b/src/live_effects/lpe-line_segment.cpp index 7c1cb9f3e..fee3607e1 100644 --- a/src/live_effects/lpe-line_segment.cpp +++ b/src/live_effects/lpe-line_segment.cpp @@ -14,6 +14,7 @@ */ #include "live_effects/lpe-line_segment.h" +#include "lpe-tool-context.h" #include <2geom/pathvector.h> #include <2geom/geom.h> @@ -46,26 +47,19 @@ LPELineSegment::~LPELineSegment() void LPELineSegment::doBeforeEffect (SPLPEItem *lpeitem) { - SPDocument *document = SP_OBJECT_DOCUMENT(lpeitem); - w = sp_document_width(document); - h = sp_document_height(document); - + lpetool_get_limiting_bbox_corners(SP_OBJECT_DOCUMENT(lpeitem), bboxA, bboxB); } std::vector<Geom::Path> LPELineSegment::doEffect_path (std::vector<Geom::Path> const & path_in) { + using namespace Geom; std::vector<Geom::Path> output; - A = Geom::initialPoint(path_in); - B = Geom::finalPoint(path_in); + A = initialPoint(path_in); + B = finalPoint(path_in); - Geom::Point E(0,0); - Geom::Point F(0,h); - Geom::Point G(w,h); - Geom::Point H(w,0); - - std::vector<Geom::Point> intersections = Geom::rect_line_intersect(E, G, A, B); + std::vector<Point> intersections = rect_line_intersect(bboxA, bboxB, A, B); if (intersections.size() < 2) { g_print ("Possible error - no intersection with limiting bounding box.\n"); @@ -81,7 +75,7 @@ LPELineSegment::doEffect_path (std::vector<Geom::Path> const & path_in) } Geom::Path path(A); - path.appendNew<Geom::LineSegment>(B); + path.appendNew<LineSegment>(B); output.push_back(path); diff --git a/src/live_effects/lpe-line_segment.h b/src/live_effects/lpe-line_segment.h index a64eea4cb..ed57d17fe 100644 --- a/src/live_effects/lpe-line_segment.h +++ b/src/live_effects/lpe-line_segment.h @@ -41,7 +41,7 @@ public: private: Geom::Point A, B; // intersections of the line segment with the limiting bounding box - Geom::Coord w, h; // document width and height + Geom::Point bboxA, bboxB; // upper left and lower right corner of limiting bounding box LPELineSegment(const LPELineSegment&); LPELineSegment& operator=(const LPELineSegment&); |
