libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout
include
osmscout
util
ScreenBox.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_UTIL_SCREENBOX_H
2
#define OSMSCOUT_UTIL_SCREENBOX_H
3
4
/*
5
This source is part of the libosmscout library
6
Copyright (C) 2022 Tim Teulings
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#include <
osmscout/lib/CoreImportExport.h
>
24
25
#include <
osmscout/Pixel.h
>
26
27
namespace
osmscout
{
28
37
class
OSMSCOUT_API
ScreenBox
CLASS_FINAL
38
{
39
private
:
40
Vertex2D minCoord=Vertex2D(0.0,0.0);
41
Vertex2D maxCoord=Vertex2D(0.0,0.0);
42
43
public
:
44
static
const
ScreenBox
EMPTY
;
48
ScreenBox
() =
default
;
49
53
ScreenBox
(
const
ScreenBox
& other) =
default
;
54
58
ScreenBox
(
ScreenBox
&& other) =
default
;
59
64
ScreenBox
(
const
Vertex2D
& coordA,
65
const
Vertex2D
& coordB);
66
70
ScreenBox
&
operator=
(
const
ScreenBox
& other) =
default
;
71
75
ScreenBox
&
operator=
(
ScreenBox
&& other) =
default
;
76
80
bool
operator==
(
const
ScreenBox
& other)
const
;
81
82
[[nodiscard]]
double
GetMinX
()
const
83
{
84
return
minCoord.GetX();
85
}
86
87
[[nodiscard]]
double
GetMinY
()
const
88
{
89
return
minCoord.GetY();
90
}
91
92
[[nodiscard]]
double
GetMaxX
()
const
93
{
94
return
maxCoord.GetX();
95
}
96
97
[[nodiscard]]
double
GetMaxY
()
const
98
{
99
return
maxCoord.GetY();
100
}
101
105
[[nodiscard]]
double
GetWidth
()
const
106
{
107
return
maxCoord.GetX()-minCoord.GetX();
108
}
109
113
[[nodiscard]]
double
GetHeight
()
const
114
{
115
return
maxCoord.GetY()-minCoord.GetY();
116
}
117
123
[[nodiscard]]
double
GetSize
()
const
124
{
125
return
GetWidth
()*
GetHeight
();
126
}
127
133
[[nodiscard]]
bool
IsEmpty
()
const
134
{
135
return
GetSize
()==0.0;
136
}
137
142
[[nodiscard]]
Vertex2D
GetCenter
()
const
143
{
144
return
{(minCoord.GetX()+maxCoord.GetX())/2,
145
(minCoord.GetY()+maxCoord.GetY())/2};
146
}
147
148
[[nodiscard]]
bool
Intersects
(
const
ScreenBox
& other)
const
;
149
[[nodiscard]]
bool
Intersects
(
const
ScreenBox
& other,
150
bool
openInterval)
const
;
151
164
[[nodiscard]]
ScreenBox
Resize
(
double
offset)
const
;
165
[[nodiscard]]
ScreenBox
Merge
(
const
ScreenBox
& other)
const
;
166
};
167
}
168
169
#endif
CoreImportExport.h
OSMSCOUT_API
#define OSMSCOUT_API
Definition
CoreImportExport.h:45
Pixel.h
osmscout::CLASS_FINAL
Definition
Area.h:88
osmscout::CLASS_FINAL::GetWidth
double GetWidth() const
Definition
ScreenBox.h:105
osmscout::CLASS_FINAL::ScreenBox
ScreenBox()=default
osmscout::CLASS_FINAL::GetHeight
double GetHeight() const
Definition
ScreenBox.h:113
osmscout::CLASS_FINAL::Merge
ScreenBox Merge(const ScreenBox &other) const
osmscout::CLASS_FINAL::Intersects
bool Intersects(const ScreenBox &other) const
osmscout::CLASS_FINAL::GetCenter
Vertex2D GetCenter() const
Definition
ScreenBox.h:142
osmscout::CLASS_FINAL::ScreenBox
ScreenBox(ScreenBox &&other)=default
osmscout::CLASS_FINAL::GetMaxY
double GetMaxY() const
Definition
ScreenBox.h:97
osmscout::CLASS_FINAL::ScreenBox
ScreenBox(const ScreenBox &other)=default
osmscout::CLASS_FINAL::Vertex2D
Vertex2D()=default
osmscout::CLASS_FINAL::operator==
bool operator==(const ScreenBox &other) const
osmscout::CLASS_FINAL::Resize
ScreenBox Resize(double offset) const
osmscout::CLASS_FINAL::operator=
ScreenBox & operator=(ScreenBox &&other)=default
osmscout::CLASS_FINAL::EMPTY
static const ScreenBox EMPTY
Definition
ScreenBox.h:44
osmscout::CLASS_FINAL::IsEmpty
bool IsEmpty() const
Definition
ScreenBox.h:133
osmscout::CLASS_FINAL::operator=
ScreenBox & operator=(const ScreenBox &other)=default
osmscout::CLASS_FINAL::Intersects
bool Intersects(const ScreenBox &other, bool openInterval) const
osmscout::CLASS_FINAL::GetMaxX
double GetMaxX() const
Definition
ScreenBox.h:92
osmscout::CLASS_FINAL::ScreenBox
ScreenBox(const Vertex2D &coordA, const Vertex2D &coordB)
osmscout::CLASS_FINAL::GetMinX
double GetMinX() const
Definition
ScreenBox.h:82
osmscout::CLASS_FINAL::GetSize
double GetSize() const
Definition
ScreenBox.h:123
osmscout::CLASS_FINAL::GetMinY
double GetMinY() const
Definition
ScreenBox.h:87
osmscout
Definition
Area.h:39
Generated by
1.17.0