xref: /aoo4110/main/basegfx/test/testtools.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _BASEGFX_TESTTOOLS_HXX
25 #define _BASEGFX_TESTTOOLS_HXX
26 
27 #include <basegfx/point/b2dpoint.hxx>
28 
29 #include <vector>
30 #include <iostream>
31 
32 
33 namespace basegfx
34 {
35     class B2DCubicBezier;
36     class B2DPolygon;
37     class B2DPolyPolygon;
38     class B2DRange;
39 
40     namespace testtools
41     {
42         class Plotter
43         {
44         public:
45             /** Create a plotter for the given output stream
46 
47 				This class can be used to generate gnuplot scripts for
48 				a number of basegfx graphics primitives, useful for
49 				debugging, regression-testing and comparing basegfx.
50              */
51             Plotter( ::std::ostream& rOutputStream );
52 
53             /** Delete the plotter
54 
55 				This implicitely flushes all potential pending writes
56 				to the output stream
57              */
58             ~Plotter();
59 
60             /** Plot a 2d polygon into the current graph
61              */
62             void plot( const B2DPolygon& rPoly );
63 
64             /** Plot a 2d polyPolygon into the current graph
65              */
66             void plot( const B2DPolyPolygon& rPolyPoly );
67 
68             /** Plot a 2d point into the current graph
69              */
70             void plot( const B2DPoint& rPoint );
71 
72             /** Plot a 2d rectangle into the current graph
73              */
74             void plot( const B2DRange& rRect );
75 
76             /** Plot a 2d line into the current graph
77              */
78             void plot( const B2DPoint& rStartPoint, const B2DPoint& rEndPoint );
79 
80             /** Plot a 2d cubic bezier curve into the current graph
81              */
82             void plot( const B2DCubicBezier& rCurve );
83 
84         private:
85             void writeSeparator();
86 
87             ::std::ostream& 			mrOutputStream;
88             ::std::vector< B2DPoint > 	maPoints;
89             bool						mbFirstElement;
90         };
91     }
92 }
93 
94 #endif /* _BASEGFX_TESTTOOLS_HXX */
95