xref: /haiku/headers/libs/agg/agg_vcgen_markers_term.h (revision 5412911f7f8ca41340b0f5cb928ed9726322ab44)
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.2
3 // Copyright (C) 2002-2004 Maxim Shemanarev (http://www.antigrain.com)
4 //
5 // Permission to copy, use, modify, sell and distribute this software
6 // is granted provided this copyright notice appears in all copies.
7 // This software is provided "as is" without express or implied
8 // warranty, and with no claim as to its suitability for any purpose.
9 //
10 //----------------------------------------------------------------------------
11 // Contact: mcseem@antigrain.com
12 //          mcseemagg@yahoo.com
13 //          http://www.antigrain.com
14 //----------------------------------------------------------------------------
15 
16 #ifndef AGG_VCGEN_MARKERS_TERM_INCLUDED
17 #define AGG_VCGEN_MARKERS_TERM_INCLUDED
18 
19 #include "agg_basics.h"
20 #include "agg_vertex_sequence.h"
21 #include "agg_vertex_iterator.h"
22 
23 namespace agg
24 {
25 
26     //======================================================vcgen_markers_term
27     //
28     // See Implemantation agg_vcgen_markers_term.cpp
29     // Terminal markers generator (arrowhead/arrowtail)
30     //
31     //------------------------------------------------------------------------
32     class vcgen_markers_term
33     {
34     public:
35         vcgen_markers_term() : m_curr_id(0), m_curr_idx(0) {}
36 
37         // Vertex Generator Interface
38         void remove_all();
39         void add_vertex(double x, double y, unsigned cmd);
40 
41         // Vertex Source Interface
42         void rewind(unsigned id);
43         unsigned vertex(double* x, double* y);
44 
45         typedef vcgen_markers_term source_type;
46         typedef vertex_iterator<source_type> iterator;
47         iterator begin(unsigned id) { return iterator(*this, id); }
48         iterator end() { return iterator(path_cmd_stop); }
49 
50     private:
51         vcgen_markers_term(const vcgen_markers_term&);
52         const vcgen_markers_term& operator = (const vcgen_markers_term&);
53 
54         struct coord_type
55         {
56             double x, y;
57 
58             coord_type() {}
59             coord_type(double x_, double y_) : x(x_), y(y_) {}
60         };
61 
62         typedef pod_deque<coord_type, 6> coord_storage;
63 
64         coord_storage m_markers;
65         unsigned      m_curr_id;
66         unsigned      m_curr_idx;
67     };
68 
69 
70 }
71 
72 #endif
73