workaround segfault in compiler on macos-clang-intel
[LibreOffice.git] / include / basegfx / range / b2dpolyrange.hxx
blobff963e5b043cfc31b176bd7246446fc73b864b20
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 #pragma once
22 #include <o3tl/cow_wrapper.hxx>
23 #include <tuple>
24 #include <basegfx/vector/b2enums.hxx>
25 #include <basegfx/basegfxdllapi.h>
27 namespace basegfx
29 class B2DRange;
30 class B2DPolyPolygon;
31 class B2DHomMatrix;
32 class ImplB2DPolyRange;
34 /** Multiple ranges in one object.
36 This class combines multiple ranges in one object, providing a
37 total, enclosing range for it.
39 You can use this class e.g. when updating views containing
40 rectangular objects. Add each modified object to a
41 B2DMultiRange, then test each viewable object against
42 intersection with the multi range.
44 Similar in spirit to the poly-polygon vs. polygon relationship.
46 Note that comparable to polygons, a poly-range can also
47 contain 'holes' - this is encoded via polygon orientation at
48 the poly-polygon, and via explicit flags for the poly-range.
50 class BASEGFX_DLLPUBLIC B2DPolyRange
52 public:
53 typedef std::tuple<B2DRange, B2VectorOrientation> ElementType;
55 B2DPolyRange();
56 ~B2DPolyRange();
58 /** Create a multi range with exactly one containing range
60 B2DPolyRange( const B2DPolyRange& );
61 B2DPolyRange& operator=( const B2DPolyRange& );
63 bool operator==(const B2DPolyRange&) const;
65 /// Number of included ranges
66 sal_uInt32 count() const;
68 ElementType getElement(sal_uInt32 nIndex) const;
70 // insert/append a single range
71 void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient);
73 void clear();
75 /** Test whether given range overlaps one or more of the
76 included ranges. Does *not* use overall range, but checks
77 individually.
79 bool overlaps( const B2DRange& rRange ) const;
81 /** Request a poly-polygon with solved cross-overs
83 B2DPolyPolygon solveCrossovers() const;
85 void transform(const B2DHomMatrix& rTranslate);
87 private:
88 o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */