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