1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #ifndef INCLUDED_BASEGFX_POLYGON_B3DPOLYPOLYGON_HXX 21 #define INCLUDED_BASEGFX_POLYGON_B3DPOLYPOLYGON_HXX 22 23 #include <sal/types.h> 24 #include <o3tl/cow_wrapper.hxx> 25 #include <basegfx/basegfxdllapi.h> 26 27 class ImplB3DPolyPolygon; 28 29 namespace basegfx 30 { 31 class B3DPolygon; 32 class B3DHomMatrix; 33 class B2DHomMatrix; 34 } 35 36 namespace basegfx 37 { 38 class BASEGFX_DLLPUBLIC B3DPolyPolygon 39 { 40 public: 41 typedef o3tl::cow_wrapper< ImplB3DPolyPolygon, o3tl::ThreadSafeRefCountingPolicy > ImplType; 42 43 private: 44 ImplType mpPolyPolygon; 45 46 public: 47 B3DPolyPolygon(); 48 B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon); 49 B3DPolyPolygon(B3DPolyPolygon&& rPolygon); 50 explicit B3DPolyPolygon(const B3DPolygon& rPolygon); 51 ~B3DPolyPolygon(); 52 53 // assignment operator 54 B3DPolyPolygon& operator=(const B3DPolyPolygon& rPolyPolygon); 55 B3DPolyPolygon& operator=(B3DPolyPolygon&& rPolyPolygon); 56 57 // compare operators 58 bool operator==(const B3DPolyPolygon& rPolyPolygon) const; 59 bool operator!=(const B3DPolyPolygon& rPolyPolygon) const; 60 61 // polygon interface 62 sal_uInt32 count() const; 63 64 // B3DPolygon interface 65 B3DPolygon const & getB3DPolygon(sal_uInt32 nIndex) const; 66 void setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon); 67 68 // BColor interface 69 bool areBColorsUsed() const; 70 void clearBColors(); 71 72 // Normals interface 73 void transformNormals(const B3DHomMatrix& rMatrix); 74 bool areNormalsUsed() const; 75 void clearNormals(); 76 77 // TextureCoordinate interface 78 void transformTextureCoordinates(const B2DHomMatrix& rMatrix); 79 bool areTextureCoordinatesUsed() const; 80 void clearTextureCoordinates(); 81 82 // append single polygon 83 void append(const B3DPolygon& rPolygon, sal_uInt32 nCount = 1); 84 85 // append multiple polygons 86 void append(const B3DPolyPolygon& rPolyPolygon); 87 88 // remove 89 void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1); 90 91 // reset to empty state 92 void clear(); 93 94 // flip polygon direction 95 void flip(); 96 97 // test if tools::PolyPolygon has double points 98 bool hasDoublePoints() const; 99 100 // remove double points, at the begin/end and follow-ups, too 101 void removeDoublePoints(); 102 103 // apply transformation given in matrix form to the polygon 104 void transform(const basegfx::B3DHomMatrix& rMatrix); 105 106 // polygon iterators (same iterator validity conditions as for vector) 107 const B3DPolygon* begin() const; 108 const B3DPolygon* end() const; 109 B3DPolygon* begin(); 110 B3DPolygon* end(); 111 }; 112 } // end of namespace basegfx 113 114 #endif // INCLUDED_BASEGFX_POLYGON_B3DPOLYPOLYGON_HXX 115 116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 117