Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / basegfx / polygon / b3dpolygon.hxx
blob17ab965a8bb646a32f825e4a18ebf71e0650159a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_BASEGFX_POLYGON_B3DPOLYGON_HXX
21 #define INCLUDED_BASEGFX_POLYGON_B3DPOLYGON_HXX
23 #include <sal/types.h>
24 #include <o3tl/cow_wrapper.hxx>
25 #include <basegfx/basegfxdllapi.h>
28 // predeclarations
29 class ImplB3DPolygon;
31 namespace basegfx
33 class B3DPolygon;
34 class B3DPoint;
35 class B3DHomMatrix;
36 class B3DVector;
37 class B2DPoint;
38 class B2DHomMatrix;
39 class BColor;
40 } // end of namespace basegfx
44 namespace basegfx
46 class BASEGFX_DLLPUBLIC B3DPolygon
48 public:
49 typedef o3tl::cow_wrapper< ImplB3DPolygon > ImplType;
51 private:
52 // internal data.
53 ImplType mpPolygon;
55 public:
56 B3DPolygon();
57 B3DPolygon(const B3DPolygon& rPolygon);
58 ~B3DPolygon();
60 // assignment operator
61 B3DPolygon& operator=(const B3DPolygon& rPolygon);
63 // compare operators
64 bool operator==(const B3DPolygon& rPolygon) const;
65 bool operator!=(const B3DPolygon& rPolygon) const;
67 // member count
68 sal_uInt32 count() const;
70 // Coordinate interface
71 B3DPoint getB3DPoint(sal_uInt32 nIndex) const;
72 void setB3DPoint(sal_uInt32 nIndex, const B3DPoint& rValue);
74 // Coordinate append
75 void append(const B3DPoint& rPoint, sal_uInt32 nCount = 1);
77 // BColor interface
78 BColor getBColor(sal_uInt32 nIndex) const;
79 void setBColor(sal_uInt32 nIndex, const BColor& rValue);
80 bool areBColorsUsed() const;
81 void clearBColors();
83 // Normals interface
84 B3DVector getNormal() const; // plane normal
85 B3DVector getNormal(sal_uInt32 nIndex) const; // normal in each point
86 void setNormal(sal_uInt32 nIndex, const B3DVector& rValue);
87 void transformNormals(const B3DHomMatrix& rMatrix);
88 bool areNormalsUsed() const;
89 void clearNormals();
91 // TextureCoordinate interface
92 B2DPoint getTextureCoordinate(sal_uInt32 nIndex) const;
93 void setTextureCoordinate(sal_uInt32 nIndex, const B2DPoint& rValue);
94 void transformTextureCoordiantes(const B2DHomMatrix& rMatrix);
95 bool areTextureCoordinatesUsed() const;
96 void clearTextureCoordinates();
98 // append other 2D polygons
99 void append(const B3DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
101 // remove
102 void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
104 // clear all points
105 void clear();
107 // closed state
108 bool isClosed() const;
109 void setClosed(bool bNew);
111 // flip polygon direction
112 void flip();
114 // test if Polygon has double points
115 bool hasDoublePoints() const;
117 // remove double points, at the begin/end and follow-ups, too
118 void removeDoublePoints();
120 // apply transformation given in matrix form to the polygon
121 void transform(const B3DHomMatrix& rMatrix);
123 } // end of namespace basegfx
128 #endif // INCLUDED_BASEGFX_POLYGON_B3DPOLYGON_HXX
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */