LibreOffice Module basegfx (master) 1
b2irange.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <ostream>
23#include <vector>
24
31
32namespace basegfx
33{
52 class B2IRange : public Range2D<sal_Int32, Int32Traits>
53 {
54 public:
56 : Range2D()
57 {}
58
60 explicit B2IRange(const Tuple2D<ValueType>& rTuple)
61 : Range2D(rTuple)
62 {
63 }
64
67 const Tuple2D<ValueType>& rTuple2)
68 : Range2D(rTuple1, rTuple2)
69 {
70 }
71
73 : Range2D(x1, y1, x2, y2)
74 {}
75
78 {
79 return B2IPoint(
82 );
83 }
84
87 {
88 return B2IPoint(
91 );
92 }
93
96 {
97 return B2I64Tuple(
100 );
101 }
102 };
103
124 std::vector<B2IRange>& o_rResult,
125 const B2IRange& rFirst,
126 const B2IRange& rSecond);
127
129 template<typename charT, typename traits>
130 inline std::basic_ostream<charT, traits>& operator<<(
131 std::basic_ostream<charT, traits>& stream, const B2IRange& range)
132 {
133 if (range.isEmpty())
134 return stream << "EMPTY";
135 else
136 return stream << range.getWidth() << 'x' << range.getHeight() << "@" << range.getMinimum();
137 }
138
139} // end of namespace basegfx
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BASEGFX_DLLPUBLIC
Definition: basegfxdllapi.h:35
Base class for all Points/Vectors with two sal_Int64 values.
Definition: b2i64tuple.hxx:37
Base Point class with two sal_Int32 values.
Definition: b2ipoint.hxx:37
A two-dimensional interval over integers.
Definition: b2irange.hxx:53
B2IPoint getMinimum() const
get lower bound of the set. returns arbitrary values for empty sets.
Definition: b2irange.hxx:77
B2IPoint getMaximum() const
get upper bound of the set. returns arbitrary values for empty sets.
Definition: b2irange.hxx:86
B2IRange(ValueType x1, ValueType y1, ValueType x2, ValueType y2)
Definition: b2irange.hxx:72
B2I64Tuple getRange() const
return difference between upper and lower point. returns (0,0) for empty sets.
Definition: b2irange.hxx:95
B2IRange(const Tuple2D< ValueType > &rTuple1, const Tuple2D< ValueType > &rTuple2)
Create proper interval between the two given points.
Definition: b2irange.hxx:66
B2IRange(const Tuple2D< ValueType > &rTuple)
Create degenerate interval consisting of a single point.
Definition: b2irange.hxx:60
T getMaximum() const
Definition: basicrange.hxx:63
T getMinimum() const
Definition: basicrange.hxx:62
Traits::DifferenceType getRange() const
Definition: basicrange.hxx:276
TYPE getWidth() const
return difference between upper and lower X value. returns 0 for empty sets.
Definition: Range2D.hxx:106
basegfx::BasicRange< sal_Int32, Int32Traits > maRangeX
Definition: Range2D.hxx:31
basegfx::BasicRange< sal_Int32, Int32Traits > maRangeY
Definition: Range2D.hxx:32
bool isEmpty() const
Check if the interval set is empty.
Definition: Range2D.hxx:69
TYPE getHeight() const
return difference between upper and lower Y value. returns 0 for empty sets.
Definition: Range2D.hxx:109
Reference< XOutputStream > stream
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, BColor const &color)
Definition: bcolor.hxx:176
std::vector< B2IRange > & computeSetDifference(std::vector< B2IRange > &o_rResult, const B2IRange &rFirst, const B2IRange &rSecond)
Compute the set difference of the two given ranges.
Definition: b2xrange.cxx:100