LibreOffice Module basegfx (master) 1
b2drange.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{
34 class B2IRange;
35 class B2DHomMatrix;
36
53 class SAL_WARN_UNUSED B2DRange : public Range2D<double, DoubleTraits>
54 {
55 public:
57 : Range2D()
58 {}
59
61 explicit B2DRange(const Tuple2D<ValueType>& rTuple)
62 : Range2D(rTuple)
63 {
64 }
65
68 const Tuple2D<ValueType>& rTuple2)
69 : Range2D(rTuple1, rTuple2)
70 {
71 }
72
74 : Range2D(x1, y1, x2, y2)
75 {}
76
77 BASEGFX_DLLPUBLIC explicit B2DRange(const B2IRange& rRange);
78
81 {
82 return B2DPoint(
83 maRangeX.getMinimum(),
84 maRangeY.getMinimum()
85 );
86 }
87
90 {
91 return B2DPoint(
92 maRangeX.getMaximum(),
93 maRangeY.getMaximum()
94 );
95 }
96
99 {
100 return B2DVector(
101 maRangeX.getRange(),
102 maRangeY.getRange()
103 );
104 }
105
108 {
109 return B2DPoint(
110 maRangeX.getCenter(),
111 maRangeY.getCenter()
112 );
113 }
114
116 BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix& rMatrix);
117
125 BASEGFX_DLLPUBLIC B2DRange& operator*=( const ::basegfx::B2DHomMatrix& rMat );
126
128 BASEGFX_DLLPUBLIC static const B2DRange& getUnitB2DRange();
129 };
130
133 B2DRange operator*( const B2DHomMatrix& rMat, const B2DRange& rB2DRange );
134
140
161 std::vector<B2DRange>& o_rResult,
162 const B2DRange& rFirst,
163 const B2DRange& rSecond);
164
166 template<typename charT, typename traits>
167 inline std::basic_ostream<charT, traits>& operator<<(
168 std::basic_ostream<charT, traits>& stream, const B2DRange& range)
169 {
170 return stream << range.getWidth() << "x" << range.getHeight() << "@" << range.getMinimum();
171 }
172
173} // end of namespace basegfx
174
175/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BASEGFX_DLLPUBLIC
Definition: basegfxdllapi.h:35
Base Point class with two double values.
Definition: b2dpoint.hxx:42
A two-dimensional interval over doubles.
Definition: b2drange.hxx:54
B2DPoint getMaximum() const
get upper bound of the set. returns arbitrary values for empty sets.
Definition: b2drange.hxx:89
B2DRange(const Tuple2D< ValueType > &rTuple1, const Tuple2D< ValueType > &rTuple2)
Create proper interval between the two given points.
Definition: b2drange.hxx:67
B2DRange(const Tuple2D< ValueType > &rTuple)
Create degenerate interval consisting of a single point.
Definition: b2drange.hxx:61
B2DVector getRange() const
return difference between upper and lower point. returns (0,0) for empty sets.
Definition: b2drange.hxx:98
B2DPoint getCenter() const
return center point of set. returns (0,0) for empty sets.
Definition: b2drange.hxx:107
B2DRange(ValueType x1, ValueType y1, ValueType x2, ValueType y2)
Definition: b2drange.hxx:73
B2DPoint getMinimum() const
get lower bound of the set. returns arbitrary values for empty sets.
Definition: b2drange.hxx:80
Base Point class with two double values.
Definition: b2dvector.hxx:40
A two-dimensional interval over integers.
Definition: b2irange.hxx:53
TYPE getWidth() const
return difference between upper and lower X value. returns 0 for empty sets.
Definition: Range2D.hxx:106
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
B2IRange fround(const B2DRange &rRange)
Round double to nearest integer for 2D range.
Definition: b2drange.cxx:64
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
B2DPoint operator*(const ::basegfx::B2DHomMatrix &rMat, const B2DPoint &rPoint)
Definition: b2dpoint.cxx:43
ValueType
#define SAL_WARN_UNUSED
SmFace & operator*=(SmFace &rFace, const Fraction &rFrac)