File indexing completed on 2025-01-05 03:58:55
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2009 Patrick Spendrin <ps_ml@gmx.de> 0004 // 0005 0006 #ifndef MARBLE_GEODATAFEATUREPRIVATE_H 0007 #define MARBLE_GEODATAFEATUREPRIVATE_H 0008 0009 #include <QString> 0010 0011 #include "GeoDataExtendedData.h" 0012 #include "GeoDataAbstractView.h" 0013 #include "GeoDataFeature.h" 0014 #include "GeoDataRegion.h" 0015 #include "GeoDataTimeStamp.h" 0016 #include "GeoDataTimeSpan.h" 0017 #include "GeoDataTypes.h" 0018 #include "GeoDataStyle.h" 0019 #include "GeoDataSnippet.h" 0020 #include "GeoDataLookAt.h" 0021 #include "GeoDataCamera.h" 0022 0023 namespace Marble 0024 { 0025 0026 class GeoDataFeatureExtendedData 0027 { 0028 public: 0029 GeoDataSnippet m_snippet; // Snippet of the feature. 0030 QString m_description; // A longer textual description 0031 bool m_descriptionCDATA; // True if description should be considered CDATA 0032 QString m_address; // The address. Optional 0033 QString m_phoneNumber; // Phone Optional 0034 GeoDataAbstractView* m_abstractView; // AbstractView Optional 0035 GeoDataTimeSpan m_timeSpan; 0036 GeoDataTimeStamp m_timeStamp; 0037 GeoDataRegion m_region; 0038 0039 GeoDataFeatureExtendedData() : 0040 m_snippet(), 0041 m_description(), 0042 m_descriptionCDATA(false), 0043 m_address(), 0044 m_phoneNumber(), 0045 m_abstractView( nullptr ), 0046 m_timeSpan(), 0047 m_timeStamp(), 0048 m_region() 0049 { 0050 // nothing to do 0051 } 0052 0053 GeoDataFeatureExtendedData(const GeoDataFeatureExtendedData &other) : 0054 m_snippet( other.m_snippet ), 0055 m_description( other.m_description ), 0056 m_descriptionCDATA( other.m_descriptionCDATA), 0057 m_address( other.m_address ), 0058 m_phoneNumber( other.m_phoneNumber ), 0059 m_abstractView( other.m_abstractView ), 0060 m_timeSpan( other.m_timeSpan ), 0061 m_timeStamp( other.m_timeStamp ), 0062 m_region( other.m_region ) 0063 { 0064 // nothing to do 0065 } 0066 0067 GeoDataFeatureExtendedData& operator=(const GeoDataFeatureExtendedData &other) 0068 { 0069 m_snippet = other.m_snippet; 0070 m_description = other.m_description; 0071 m_descriptionCDATA = other.m_descriptionCDATA; 0072 m_address = other.m_address; 0073 m_phoneNumber = other.m_phoneNumber; 0074 m_abstractView = other.m_abstractView; 0075 m_timeSpan = other.m_timeSpan; 0076 m_timeStamp = other.m_timeStamp; 0077 m_region = other.m_region; 0078 return *this; 0079 } 0080 0081 bool operator==(const GeoDataFeatureExtendedData &other) const 0082 { 0083 if (m_snippet != other.m_snippet || 0084 m_description != other.m_description || 0085 m_descriptionCDATA != other.m_descriptionCDATA || 0086 m_address != other.m_address || 0087 m_phoneNumber != other.m_phoneNumber || 0088 m_timeSpan != other.m_timeSpan || 0089 m_timeStamp != other.m_timeStamp || 0090 m_region != other.m_region) { 0091 return false; 0092 } 0093 0094 if ( (!m_abstractView && other.m_abstractView) || 0095 (m_abstractView && !other.m_abstractView) ) { 0096 return false; 0097 } 0098 0099 if (m_abstractView && other.m_abstractView) { 0100 if (*m_abstractView != *other.m_abstractView) { 0101 return false; 0102 } 0103 } 0104 0105 return true; 0106 } 0107 0108 bool operator!=(const GeoDataFeatureExtendedData &other) const 0109 { 0110 return !(*this == other); 0111 } 0112 }; 0113 0114 class GeoDataFeaturePrivate 0115 { 0116 public: 0117 GeoDataFeaturePrivate() : 0118 m_name(), 0119 m_styleUrl(), 0120 m_popularity( 0 ), 0121 m_zoomLevel( 1 ), 0122 m_visible( true ), 0123 m_role(QLatin1String(" ")), 0124 m_style( nullptr ), 0125 m_styleMap( nullptr ), 0126 m_extendedData(), 0127 m_featureExtendedData(nullptr) 0128 { 0129 } 0130 0131 GeoDataFeaturePrivate( const GeoDataFeaturePrivate& other ) : 0132 m_name( other.m_name ), 0133 m_styleUrl( other.m_styleUrl ), 0134 m_popularity( other.m_popularity ), 0135 m_zoomLevel( other.m_zoomLevel ), 0136 m_visible( other.m_visible ), 0137 m_role( other.m_role ), 0138 m_style( other.m_style ), //FIXME: both style and stylemap need to be reworked internally!!!! 0139 m_styleMap( other.m_styleMap ), 0140 m_extendedData( other.m_extendedData ), 0141 m_featureExtendedData(nullptr) 0142 { 0143 if (other.m_featureExtendedData) { 0144 m_featureExtendedData = new GeoDataFeatureExtendedData(*other.m_featureExtendedData); 0145 } 0146 } 0147 0148 GeoDataFeaturePrivate& operator=( const GeoDataFeaturePrivate& other ) 0149 { 0150 m_name = other.m_name; 0151 m_styleUrl = other.m_styleUrl; 0152 m_popularity = other.m_popularity; 0153 m_zoomLevel = other.m_zoomLevel; 0154 m_visible = other.m_visible; 0155 m_role = other.m_role; 0156 m_style = other.m_style; 0157 m_styleMap = other.m_styleMap; 0158 m_extendedData = other.m_extendedData; 0159 delete m_featureExtendedData; 0160 m_featureExtendedData = nullptr; 0161 if (other.m_featureExtendedData) { 0162 m_featureExtendedData = new GeoDataFeatureExtendedData(*other.m_featureExtendedData); 0163 } 0164 return *this; 0165 } 0166 0167 virtual EnumFeatureId featureId() const 0168 { 0169 return InvalidFeatureId; 0170 } 0171 0172 virtual ~GeoDataFeaturePrivate() 0173 { 0174 delete m_featureExtendedData; 0175 } 0176 0177 GeoDataFeatureExtendedData & featureExtendedData() 0178 { 0179 if (!m_featureExtendedData) { 0180 m_featureExtendedData = new GeoDataFeatureExtendedData; 0181 } 0182 return *m_featureExtendedData; 0183 } 0184 const GeoDataFeatureExtendedData & featureExtendedData() const 0185 { 0186 if (!m_featureExtendedData) { 0187 m_featureExtendedData = new GeoDataFeatureExtendedData; 0188 } 0189 return *m_featureExtendedData; 0190 } 0191 0192 QString m_name; // Name of the feature. Is shown on screen 0193 QString m_styleUrl; // styleUrl Url#tag to a document wide style 0194 qint64 m_popularity; // Population/Area/Altitude depending on placemark(!) 0195 int m_zoomLevel; // Zoom Level of the feature 0196 0197 bool m_visible; // True if this feature should be shown. 0198 0199 QString m_role; 0200 0201 GeoDataStyle::Ptr m_style; 0202 const GeoDataStyleMap* m_styleMap; 0203 0204 GeoDataExtendedData m_extendedData; 0205 mutable GeoDataFeatureExtendedData* m_featureExtendedData; 0206 }; 0207 0208 0209 } // namespace Marble 0210 0211 #endif 0212