xref: /aoo41x/main/basegfx/test/testtools.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _BASEGFX_TESTTOOLS_HXX
29 #define _BASEGFX_TESTTOOLS_HXX
30 
31 #include <basegfx/point/b2dpoint.hxx>
32 
33 #include <vector>
34 #include <iostream>
35 
36 
37 namespace basegfx
38 {
39     class B2DCubicBezier;
40     class B2DPolygon;
41     class B2DPolyPolygon;
42     class B2DRange;
43 
44     namespace testtools
45     {
46         class Plotter
47         {
48         public:
49             /** Create a plotter for the given output stream
50 
51 				This class can be used to generate gnuplot scripts for
52 				a number of basegfx graphics primitives, useful for
53 				debugging, regression-testing and comparing basegfx.
54              */
55             Plotter( ::std::ostream& rOutputStream );
56 
57             /** Delete the plotter
58 
59 				This implicitely flushes all potential pending writes
60 				to the output stream
61              */
62             ~Plotter();
63 
64             /** Plot a 2d polygon into the current graph
65              */
66             void plot( const B2DPolygon& rPoly );
67 
68             /** Plot a 2d polyPolygon into the current graph
69              */
70             void plot( const B2DPolyPolygon& rPolyPoly );
71 
72             /** Plot a 2d point into the current graph
73              */
74             void plot( const B2DPoint& rPoint );
75 
76             /** Plot a 2d rectangle into the current graph
77              */
78             void plot( const B2DRange& rRect );
79 
80             /** Plot a 2d line into the current graph
81              */
82             void plot( const B2DPoint& rStartPoint, const B2DPoint& rEndPoint );
83 
84             /** Plot a 2d cubic bezier curve into the current graph
85              */
86             void plot( const B2DCubicBezier& rCurve );
87 
88         private:
89             void writeSeparator();
90 
91             ::std::ostream& 			mrOutputStream;
92             ::std::vector< B2DPoint > 	maPoints;
93             bool						mbFirstElement;
94         };
95     }
96 }
97 
98 #endif /* _BASEGFX_TESTTOOLS_HXX */
99