File indexing completed on 2024-06-16 03:46:31

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_OSMPLACEMARK_H
0007 #define MARBLE_OSMPLACEMARK_H
0008 
0009 #include <QString>
0010 
0011 namespace Marble {
0012 
0013 class DatabaseQuery;
0014 
0015 /**
0016   * A lightweight data structure to represent points of interest
0017   * like addresses with support for serialization.
0018   */
0019 class OsmPlacemark
0020 {
0021 public:
0022     enum OsmCategory {
0023         UnknownCategory,
0024         AccomodationCamping,
0025         AccomodationHostel,
0026         AccomodationHotel,
0027         AccomodationMotel,
0028         AccomodationYouthHostel,
0029         Address,
0030         AmenityLibrary,
0031         EducationCollege,
0032         EducationSchool,
0033         EducationUniversity,
0034         FoodBar,
0035         FoodBiergarten,
0036         FoodCafe,
0037         FoodFastFood,
0038         FoodPub,
0039         FoodRestaurant,
0040         HealthDoctors,
0041         HealthHospital,
0042         HealthPharmacy,
0043         MoneyAtm,
0044         MoneyBank,
0045         ShoppingBeverages,
0046         ShoppingHifi,
0047         ShoppingSupermarket,
0048         TouristAttraction,
0049         TouristCastle,
0050         TouristCinema,
0051         TouristMonument,
0052         TouristMuseum,
0053         TouristRuin,
0054         TouristTheatre,
0055         TouristThemePark,
0056         TouristViewPoint,
0057         TouristZoo,
0058         TransportAirport,
0059         TransportAirportTerminal,
0060         TransportAirportGate,
0061         TransportAirportRunway,
0062         TransportAirportApron,
0063         TransportAirportTaxiway,
0064         TransportBusStation,
0065         TransportBusStop,
0066         TransportCarShare,
0067         TransportFuel,
0068         TransportParking,
0069         TransportRentalBicycle,
0070         TransportRentalCar,
0071         TransportSpeedCamera,
0072         TransportTaxiRank,
0073         TransportTrainStation,
0074         TransportTramStop,
0075         PlacesRegion,
0076         PlacesCounty,
0077         PlacesCity,
0078         PlacesTown,
0079         PlacesVillage,
0080         PlacesHamlet,
0081         PlacesIsolatedDwelling,
0082         PlacesSuburb,
0083         PlacesLocality,
0084         PlacesIsland,
0085         HistoricMemorial
0086     };
0087 
0088     OsmPlacemark();
0089 
0090     OsmCategory category() const;
0091 
0092     void setCategory( OsmCategory category );
0093 
0094     /** Placemark name */
0095     QString name() const;
0096 
0097     void setName( const QString &name );
0098 
0099     /** Placemark's house number, if any */
0100     QString houseNumber() const;
0101 
0102     void setHouseNumber( const QString &houseNumber );
0103 
0104     /** Identifier of the smallest region containing this placemark,
0105         0 if none (~main area). */
0106     int regionId() const;
0107 
0108     void setRegionId( int id );
0109 
0110     /** Regions' name */
0111     QString additionalInformation() const;
0112 
0113     void setAdditionalInformation( const QString &name );
0114 
0115     /** Longitude of the placemark's center point, in degree */
0116     qreal longitude() const;
0117 
0118     void setLongitude( qreal longitude );
0119 
0120     /** Latitude of the placemark's center point, in degree */
0121     qreal latitude() const;
0122 
0123     void setLatitude( qreal latitude );
0124 
0125     /** Placemarks are sorted by name by default */
0126     bool operator<( const OsmPlacemark &other) const;
0127 
0128     bool operator==( const OsmPlacemark &other ) const;
0129 
0130     qreal matchScore( const DatabaseQuery* query ) const;
0131 
0132 private:
0133     int m_regionId;
0134 
0135     OsmCategory m_category;
0136 
0137     QString m_name;
0138 
0139     QString m_houseNumber;
0140 
0141     QString m_additionalInformation;
0142 
0143     qreal m_longitude;
0144 
0145     qreal m_latitude;
0146 };
0147 
0148 }
0149 
0150 #endif // MARBLE_OSMPLACEMARK_H