File indexing completed on 2025-01-05 03:58:56
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com> 0004 // 0005 0006 #include "GeoDataLatLonQuad.h" 0007 #include "GeoDataTypes.h" 0008 0009 namespace Marble { 0010 0011 class GeoDataLatLonQuadPrivate 0012 { 0013 public: 0014 GeoDataCoordinates m_bottomLeft; 0015 GeoDataCoordinates m_bottomRight; 0016 GeoDataCoordinates m_topRight; 0017 GeoDataCoordinates m_topLeft; 0018 0019 GeoDataLatLonQuadPrivate(); 0020 }; 0021 0022 GeoDataLatLonQuadPrivate::GeoDataLatLonQuadPrivate() : 0023 m_bottomLeft(),m_bottomRight(),m_topRight(),m_topLeft() 0024 { 0025 // nothing to do 0026 } 0027 0028 GeoDataLatLonQuad::GeoDataLatLonQuad() : GeoDataObject(), d( new GeoDataLatLonQuadPrivate ) 0029 { 0030 // nothing to do 0031 } 0032 0033 GeoDataLatLonQuad::GeoDataLatLonQuad( const Marble::GeoDataLatLonQuad &other ) : 0034 GeoDataObject( other ), d( new GeoDataLatLonQuadPrivate( *other.d ) ) 0035 { 0036 // nothing to do 0037 } 0038 0039 GeoDataLatLonQuad &GeoDataLatLonQuad::operator=( const GeoDataLatLonQuad &other ) 0040 { 0041 *d = *other.d; 0042 return *this; 0043 } 0044 0045 bool GeoDataLatLonQuad::operator==(const GeoDataLatLonQuad& other) const 0046 { 0047 return equals( other ) 0048 && d->m_bottomLeft == other.d->m_bottomLeft 0049 && d->m_bottomRight == other.d->m_bottomRight 0050 && d->m_topLeft == other.d->m_topLeft 0051 && d->m_topRight == other.d->m_topRight; 0052 } 0053 0054 bool GeoDataLatLonQuad::operator!=(const GeoDataLatLonQuad& other) const 0055 { 0056 return !this->operator==(other); 0057 } 0058 0059 GeoDataLatLonQuad::~GeoDataLatLonQuad() 0060 { 0061 delete d; 0062 } 0063 0064 const char *GeoDataLatLonQuad::nodeType() const 0065 { 0066 return GeoDataTypes::GeoDataLatLonQuadType; 0067 } 0068 0069 qreal GeoDataLatLonQuad::bottomLeftLatitude( GeoDataCoordinates::Unit unit ) const 0070 { 0071 return d->m_bottomLeft.latitude(unit); 0072 } 0073 0074 void GeoDataLatLonQuad::setBottomLeftLatitude( qreal latitude, GeoDataCoordinates::Unit unit ) 0075 { 0076 d->m_bottomLeft.setLatitude( latitude, unit ); 0077 } 0078 0079 qreal GeoDataLatLonQuad::bottomLeftLongitude( GeoDataCoordinates::Unit unit ) const 0080 { 0081 return d->m_bottomLeft.longitude( unit ); 0082 } 0083 0084 void GeoDataLatLonQuad::setBottomLeftLongitude( qreal longitude, GeoDataCoordinates::Unit unit ) 0085 { 0086 d->m_bottomLeft.setLongitude( longitude, unit ); 0087 } 0088 0089 qreal GeoDataLatLonQuad::bottomRightLatitude( GeoDataCoordinates::Unit unit ) const 0090 { 0091 return d->m_bottomRight.latitude( unit ); 0092 } 0093 0094 void GeoDataLatLonQuad::setBottomRightLatitude( qreal latitude, GeoDataCoordinates::Unit unit ) 0095 { 0096 d->m_bottomRight.setLatitude( latitude, unit ); 0097 } 0098 0099 qreal GeoDataLatLonQuad::bottomRightLongitude( GeoDataCoordinates::Unit unit ) const 0100 { 0101 return d->m_bottomRight.longitude( unit ); 0102 } 0103 0104 void GeoDataLatLonQuad::setBottomRightLongitude( qreal longitude, GeoDataCoordinates::Unit unit ) 0105 { 0106 d->m_bottomRight.setLongitude( longitude, unit ); 0107 } 0108 0109 qreal GeoDataLatLonQuad::topRightLatitude( GeoDataCoordinates::Unit unit ) const 0110 { 0111 return d->m_topRight.latitude( unit ); 0112 } 0113 0114 void GeoDataLatLonQuad::setTopRightLatitude( qreal latitude, GeoDataCoordinates::Unit unit ) 0115 { 0116 d->m_topRight.setLatitude( latitude, unit ); 0117 } 0118 0119 qreal GeoDataLatLonQuad::topRightLongitude( GeoDataCoordinates::Unit unit ) const 0120 { 0121 return d->m_topRight.longitude( unit ); 0122 } 0123 0124 void GeoDataLatLonQuad::setTopRightLongitude( qreal longitude, GeoDataCoordinates::Unit unit ) 0125 { 0126 d->m_topRight.setLongitude( longitude, unit ); 0127 } 0128 0129 qreal GeoDataLatLonQuad::topLeftLatitude( GeoDataCoordinates::Unit unit ) const 0130 { 0131 return d->m_topLeft.latitude( unit ); 0132 } 0133 0134 void GeoDataLatLonQuad::setTopLeftLatitude( qreal latitude, GeoDataCoordinates::Unit unit ) 0135 { 0136 d->m_topLeft.setLatitude( latitude, unit ); 0137 } 0138 0139 qreal GeoDataLatLonQuad::topLeftLongitude( GeoDataCoordinates::Unit unit ) const 0140 { 0141 return d->m_topLeft.longitude( unit ); 0142 } 0143 0144 void GeoDataLatLonQuad::setTopLeftLongitude( qreal longitude, GeoDataCoordinates::Unit unit ) 0145 { 0146 d->m_topLeft.setLongitude(longitude, unit ); 0147 } 0148 0149 0150 GeoDataCoordinates &GeoDataLatLonQuad::bottomLeft() const 0151 { 0152 return d->m_bottomLeft; 0153 } 0154 0155 void GeoDataLatLonQuad::setBottomLeft(const GeoDataCoordinates &coordinates) 0156 { 0157 d->m_bottomLeft = coordinates; 0158 } 0159 GeoDataCoordinates &GeoDataLatLonQuad::bottomRight() const 0160 { 0161 return d->m_bottomRight; 0162 } 0163 0164 void GeoDataLatLonQuad::setBottomRight(const GeoDataCoordinates &coordinates) 0165 { 0166 d->m_bottomRight = coordinates; 0167 } 0168 0169 GeoDataCoordinates &GeoDataLatLonQuad::topRight() const 0170 { 0171 return d->m_topRight; 0172 } 0173 0174 void GeoDataLatLonQuad::setTopRight(const GeoDataCoordinates &coordinates) 0175 { 0176 d->m_topRight = coordinates; 0177 } 0178 0179 GeoDataCoordinates &GeoDataLatLonQuad::topLeft() const 0180 { 0181 return d->m_topLeft; 0182 } 0183 0184 void GeoDataLatLonQuad::setTopLeft(const GeoDataCoordinates &coordinates) 0185 { 0186 d->m_topLeft = coordinates; 0187 } 0188 0189 bool GeoDataLatLonQuad::isValid() const 0190 { 0191 return d->m_bottomLeft.isValid() && d->m_bottomRight.isValid() 0192 && d->m_topLeft.isValid() && d->m_topRight.isValid(); 0193 } 0194 0195 }