1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_RANGE_B2DPOLYRANGE_HXX
21 #define INCLUDED_BASEGFX_RANGE_B2DPOLYRANGE_HXX
23 #include <o3tl/cow_wrapper.hxx>
25 #include <basegfx/vector/b2enums.hxx>
26 #include <basegfx/basegfxdllapi.h>
34 class ImplB2DPolyRange
;
36 /** Multiple ranges in one object.
38 This class combines multiple ranges in one object, providing a
39 total, enclosing range for it.
41 You can use this class e.g. when updating views containing
42 rectangular objects. Add each modified object to a
43 B2DMultiRange, then test each viewable object against
44 intersection with the multi range.
46 Similar in spirit to the poly-polygon vs. polygon relationship.
48 Note that comparable to polygons, a poly-range can also
49 contain 'holes' - this is encoded via polygon orientation at
50 the poly-polygon, and via explicit flags for the poly-range.
52 class BASEGFX_DLLPUBLIC B2DPolyRange
55 typedef std::tuple
<B2DRange
, B2VectorOrientation
> ElementType
;
60 /** Create a multi range with exactly one containing range
62 B2DPolyRange( const B2DPolyRange
& );
63 B2DPolyRange
& operator=( const B2DPolyRange
& );
65 bool operator==(const B2DPolyRange
&) const;
66 bool operator!=(const B2DPolyRange
&) const;
68 /// Number of included ranges
69 sal_uInt32
count() const;
71 ElementType
getElement(sal_uInt32 nIndex
) const;
73 // insert/append a single range
74 void appendElement(const B2DRange
& rRange
, B2VectorOrientation eOrient
, sal_uInt32 nCount
= 1);
78 /** Test whether given range overlaps one or more of the
79 included ranges. Does *not* use overall range, but checks
82 bool overlaps( const B2DRange
& rRange
) const;
84 /** Request a poly-polygon with solved cross-overs
86 B2DPolyPolygon
solveCrossovers() const;
88 void transform(const B2DHomMatrix
& rTranslate
);
91 o3tl::cow_wrapper
< ImplB2DPolyRange
> mpImpl
;
95 #endif // INCLUDED_BASEGFX_RANGE_B2DPOLYRANGE_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */