Code

Use is_straight_curve() instead of three separate dynamic casts
[inkscape.git] / src / display / curve.h
1 #ifndef SEEN_DISPLAY_CURVE_H
2 #define SEEN_DISPLAY_CURVE_H
4 /** \file
5  * Wrapper around a Geom::PathVector objects.
6  *
7  * Author:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *
10  * Copyright (C) 2000 Lauris Kaplinski
11  * Copyright (C) 2000-2001 Ximian, Inc.
12  * Copyright (C) 2002 Lauris Kaplinski
13  * Copyright (C) 2008 Johan Engelen
14  *
15  * Released under GNU GPL
16  */
18 #include <glib/gtypes.h>
19 #include <glib/gslist.h>
21 #include <2geom/forward.h>
23 class SPCurve {
24 public:
25     /* Constructors */
26     explicit SPCurve();
27     explicit SPCurve(Geom::PathVector const& pathv);
28     static SPCurve * new_from_rect(Geom::Rect const &rect);
30     virtual ~SPCurve();
32     void set_pathvector(Geom::PathVector const & new_pathv);
33     Geom::PathVector const & get_pathvector() const;
35     SPCurve * ref();
36     SPCurve * unref();
38     SPCurve * copy() const;
40     guint get_segment_count() const;
41     guint nodes_in_path() const;
43     bool is_empty() const;
44     bool is_closed() const;
45     Geom::Curve const * last_segment() const;
46     Geom::Path const * last_path() const;
47     Geom::Curve const * first_segment() const;
48     Geom::Path const * first_path() const;
49     Geom::Point first_point() const;
50     Geom::Point last_point() const;
51     Geom::Point second_point() const;
52     Geom::Point penultimate_point() const;
54     void reset();
56     void moveto(Geom::Point const &p);
57     void moveto(gdouble x, gdouble y);
58     void lineto(Geom::Point const &p);
59     void lineto(gdouble x, gdouble y);
60     void curveto(Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2);
61     void curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
62     void closepath();
63     void closepath_current();
64     void backspace();
66     void transform(Geom::Matrix const &m);
67     void stretch_endpoints(Geom::Point const &, Geom::Point const &);
68     void move_endpoints(Geom::Point const &, Geom::Point const &);
69     void last_point_additive_move(Geom::Point const & p);
71     void append(SPCurve const *curve2, bool use_lineto);
72     SPCurve * append_continuous(SPCurve const *c1, gdouble tolerance);
73     SPCurve * create_reverse() const;
75     GSList * split() const;
76     static SPCurve * concat(GSList const *list);
78 protected:
79     gint _refcount;
81     Geom::PathVector _pathv;
83 private:
84     // Don't implement these:
85     SPCurve(const SPCurve&);
86     SPCurve& operator=(const SPCurve&);
87 };
89 #endif /* !SEEN_DISPLAY_CURVE_H */
91 /*
92   Local Variables:
93   mode:c++
94   c-file-style:"stroustrup"
95   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
96   indent-tabs-mode:nil
97   fill-column:99
98   End:
99 */
100 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :