Marble

GeoDataPlacemark.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5// SPDX-FileCopyrightText: 2008-2009 Patrick Spendrin <ps_ml@gmx.de>
6//
7
8#ifndef MARBLE_GEODATAPLACEMARK_H
9#define MARBLE_GEODATAPLACEMARK_H
10
11#include <QDateTime>
12
13#include "GeoDataCoordinates.h"
14#include "GeoDataFeature.h"
15
16#include "geodata_export.h"
17
19
20namespace Marble
21{
22
23class GeoDataPlacemarkPrivate;
24class OsmPlacemarkData;
25class GeoDataLookAt;
26class GeoDataPolygon;
27class GeoDataGeometry;
28
29/**
30 * @short a class representing a point of interest on the map
31 *
32 * This class represents a point of interest, e.g. a city or a
33 * mountain. It is filled with data by the KML or GPX loader and the
34 * PlacemarkModel makes use of it.
35 *
36 * A Placemark can have an associated geometry which will be rendered to the map
37 * along with the placemark's point icon. If you would like to render more than
38 * one geometry for any one placemark than use @see setGeometry() to set add a
39 * @see MultiGeometry.
40 *
41 * This is more or less only a GeoDataFeature with a geographic
42 * position and a country code attached to it. The country code is
43 * not provided in a KML file.
44 */
45
46class GEODATA_EXPORT GeoDataPlacemark : public GeoDataFeature
47{
48public:
49 /**
50 * Create a new placemark.
51 */
53
54 /**
55 * Create a new placemark from existing placemark @p placemark
56 */
57 GeoDataPlacemark(const GeoDataPlacemark &placemark);
58
59 /**
60 * Create a new placemark with the given @p name.
61 */
62 explicit GeoDataPlacemark(const QString &name);
63
64 /**
65 * Delete the placemark
66 */
67 ~GeoDataPlacemark() override;
68
69 GeoDataPlacemark &operator=(const GeoDataPlacemark &other);
70
71 /**
72 * Equality operators.
73 */
74 bool operator==(const GeoDataPlacemark &other) const;
75 bool operator!=(const GeoDataPlacemark &other) const;
76
77 const char *nodeType() const override;
78
79 GeoDataFeature *clone() const override;
80
81 /**
82 * @brief A categorization of a placemark as defined by ...FIXME.
83 * There is an additional osm tag mapping to GeoDataVisualCategory
84 * in OsmPlacemarkData
85 */
87 None,
88 Default,
89 Unknown,
90
91 // The order of the cities needs to stay fixed as the
92 // algorithms rely on that.
93 SmallCity,
94 SmallCountyCapital,
95 SmallStateCapital,
96 SmallNationCapital,
97 MediumCity,
98 MediumCountyCapital,
99 MediumStateCapital,
100 MediumNationCapital,
101 BigCity,
102 BigCountyCapital,
103 BigStateCapital,
104 BigNationCapital,
105 LargeCity,
106 LargeCountyCapital,
107 LargeStateCapital,
108 LargeNationCapital,
109 Nation,
110
111 // Terrain
112 Mountain,
113 Volcano,
114 Mons, // m
115 Valley, // v
116 Continent,
117 Ocean,
118 OtherTerrain, // o
119
120 // Space Terrain
121 Crater, // c
122 Mare, // a
123
124 // Places of Interest
125 GeographicPole,
126 MagneticPole,
127 ShipWreck,
128 AirPort,
129 Observatory,
130
131 // Military
132 MilitaryDangerArea,
133
134 // Runners
135 OsmSite,
137
138 // Planets
139 MannedLandingSite, // h
140 RoboticRover, // r
141 UnmannedSoftLandingSite, // u
142 UnmannedHardLandingSite, // i
143
144 Bookmark,
145
146 Satellite,
147
148 /*
149 * Start of OpenStreetMap categories
150 */
151
152 PlaceCity, // please keep order (used in for loops)
153 PlaceCityCapital,
154 PlaceCityNationalCapital,
155 PlaceSuburb,
156 PlaceHamlet,
157 PlaceLocality,
158 PlaceTown,
159 PlaceTownCapital,
160 PlaceTownNationalCapital,
161 PlaceVillage,
162 PlaceVillageCapital,
163 PlaceVillageNationalCapital, // please keep order (used in for loops)
164
165 NaturalWater,
166 NaturalReef,
167 NaturalWood,
168 NaturalBeach,
169 NaturalWetland,
170 NaturalGlacier,
171 NaturalIceShelf,
172 NaturalScrub,
173 NaturalCliff,
174 NaturalHeath,
175
176 HighwayTrafficSignals,
177 HighwayElevator,
178
179 // OpenStreetMap highways
180 HighwaySteps, // please keep order (used in for loops)
181 HighwayUnknown,
182 HighwayPath,
183 HighwayFootway,
184 HighwayTrack,
185 HighwayPedestrian,
186 HighwayCorridor,
187 HighwayCycleway,
188 HighwayService,
189 HighwayRoad,
190 HighwayResidential,
191 HighwayLivingStreet,
192 HighwayUnclassified,
193 HighwayTertiaryLink,
194 HighwayTertiary,
195 HighwaySecondaryLink,
196 HighwaySecondary,
197 HighwayPrimaryLink,
198 HighwayPrimary,
199 HighwayRaceway,
200 HighwayTrunkLink,
201 HighwayTrunk,
202 HighwayMotorwayLink,
203 HighwayMotorway, // please keep order (used in for loops)
204
205 // OSM building
206 Building,
207
208 // OpenStreetMap category Accommodation
209 AccomodationCamping,
210 AccomodationHostel,
211 AccomodationHotel,
212 AccomodationMotel,
213 AccomodationYouthHostel,
214 AccomodationGuestHouse,
215
216 // OpenStreetMap category Education
217 EducationCollege,
218 EducationSchool,
219 EducationUniversity,
220
221 // OpenStreetMap category Food
222 FoodBar,
223 FoodBiergarten,
224 FoodCafe,
225 FoodFastFood,
226 FoodPub,
227 FoodRestaurant,
228
229 // OpenStreetMap category Health
230 HealthDentist,
231 HealthDoctors,
232 HealthHospital,
233 HealthPharmacy,
234 HealthVeterinary,
235
236 // OpenStreetMap category Money
237 MoneyAtm,
238 MoneyBank,
239
240 // OpenStreetMap category Amenity
241 AmenityLibrary,
242 AmenityKindergarten, ///< @since 0.26.0
243 AmenityEmbassy,
244 AmenityEmergencyPhone,
245 AmenityMountainRescue,
246 AmenityCommunityCentre,
247 AmenityCinema,
248 AmenityFountain,
249 AmenityNightClub,
250 AmenityBench,
251 AmenityCourtHouse,
252 AmenityFireStation,
253 AmenityHuntingStand,
254 AmenityPolice,
255 AmenityPostBox,
256 AmenityPostOffice,
257 AmenityPrison,
258 AmenityRecycling,
259 AmenityShelter, ///< @since 0.26.0
260 AmenityTelephone,
261 AmenityTheatre,
262 AmenityToilets,
263 AmenityTownHall,
264 AmenityWasteBasket,
265 AmenityDrinkingWater,
266 AmenityGraveyard,
267 AmenityChargingStation,
268 AmenityCarWash,
269 AmenitySocialFacility,
270
271 // OpenStreetMap category Barrier
272 BarrierCityWall,
273 BarrierGate,
274 BarrierLiftGate,
275 BarrierWall,
276
277 NaturalPeak,
278 NaturalVolcano,
279 NaturalTree,
280 NaturalCave,
281
282 // OpenStreetMap category Shopping
283 ShopBeverages, // please keep order (used in for loops)
284 ShopHifi,
285 ShopSupermarket,
286 ShopAlcohol,
287 ShopBakery,
288 ShopButcher,
289 ShopConfectionery,
290 ShopConvenience,
291 ShopGreengrocer,
292 ShopSeafood,
293 ShopDepartmentStore,
294 ShopKiosk,
295 ShopBag,
296 ShopClothes,
297 ShopFashion,
298 ShopJewelry,
299 ShopShoes,
300 ShopVarietyStore,
301 ShopBeauty,
302 ShopChemist,
303 ShopCosmetics,
304 ShopHairdresser,
305 ShopOptician,
306 ShopPerfumery,
307 ShopDoitYourself,
308 ShopFlorist,
309 ShopHardware,
310 ShopFurniture,
311 ShopElectronics,
312 ShopMobilePhone,
313 ShopBicycle,
314 ShopCar,
315 ShopCarRepair,
316 ShopCarParts,
317 ShopMotorcycle,
318 ShopOutdoor,
319 ShopSports,
320 ShopCopy,
321 ShopArt,
322 ShopMusicalInstrument,
323 ShopPhoto,
324 ShopBook,
325 ShopGift,
326 ShopStationery,
327 ShopLaundry,
328 ShopPet,
329 ShopToys,
330 ShopTravelAgency,
331 ShopDeli,
332 ShopTobacco,
333 ShopTea,
334 ShopComputer,
335 ShopGardenCentre,
336 Shop, // please keep order (used in for loops)
337
338 ManmadeBridge,
339 ManmadeLighthouse,
340 ManmadePier,
341 ManmadeWaterTower,
342 ManmadeWindMill,
343 ManmadeCommunicationsTower,
344
345 // OpenStreetMap category Tourist
346 TourismArtwork,
347 TourismAttraction,
348 TourismInformation,
349 TourismMuseum,
350 TourismThemePark,
351 TourismViewPoint,
352 TourismZoo,
353 TourismAlpineHut,
354 TourismWildernessHut,
355
356 // OpenStreetMap category Historic
357 HistoricArchaeologicalSite,
358 HistoricCastle,
359 HistoricMemorial,
360 HistoricMonument,
361 HistoricRuins,
362
363 // OpenStreetMap category Transport
364 TransportAerodrome,
365 TransportHelipad,
366 TransportAirportTerminal,
367 TransportAirportGate, ///< @since 0.26.0
368 TransportAirportRunway, ///< @since 0.26.0
369 TransportAirportTaxiway, ///< @since 0.26.0
370 TransportAirportApron, ///< @since 0.26.0
371 TransportBusStation,
372 TransportBusStop,
373 TransportCarShare,
374 TransportFuel,
375 TransportParking,
376 TransportParkingSpace,
377 TransportPlatform,
378 TransportRentalBicycle,
379 TransportRentalCar,
380 TransportRentalSki,
381 TransportTaxiRank,
382 TransportTrainStation,
383 TransportTramStop,
384 TransportBicycleParking,
385 TransportMotorcycleParking,
386 TransportSubwayEntrance,
387 TransportSpeedCamera,
388
389 // OpenStreetMap category religion
390 ReligionPlaceOfWorship,
391 ReligionBahai,
392 ReligionBuddhist,
393 ReligionChristian,
394 ReligionMuslim,
395 ReligionHindu,
396 ReligionJain,
397 ReligionJewish,
398 ReligionShinto,
399 ReligionSikh,
400 ReligionTaoist,
401
402 // OpenStreetMap category Leisure
403 LeisureGolfCourse,
404 LeisureMarina, ///< @since 0.26.0
405 LeisureWaterPark,
406 LeisurePark,
407 LeisurePlayground,
408 LeisurePitch,
409 LeisureSportsCentre,
410 LeisureStadium,
411 LeisureTrack,
412 LeisureSwimmingPool,
413 LeisureMinigolfCourse,
414
415 LanduseAllotments,
416 LanduseBasin,
417 LanduseCemetery,
418 LanduseCommercial,
419 LanduseConstruction,
420 LanduseFarmland,
421 LanduseFarmyard,
422 LanduseGarages,
423 LanduseGrass,
424 LanduseIndustrial,
425 LanduseLandfill,
426 LanduseMeadow,
427 LanduseMilitary,
428 LanduseQuarry,
429 LanduseRailway,
430 LanduseReservoir,
431 LanduseResidential,
432 LanduseRetail,
433 LanduseOrchard,
434 LanduseVineyard,
435
436 RailwayRail, // please keep order (used in for loops)
437 RailwayNarrowGauge,
438 RailwayTram,
439 RailwayLightRail,
440 RailwayAbandoned,
441 RailwaySubway,
442 RailwayPreserved,
443 RailwayMiniature,
444 RailwayConstruction,
445 RailwayMonorail,
446 RailwayFunicular, // please keep order (used in for loops)
447
448 // OpenStreetMap category Power
449 PowerTower,
450
451 // OpenStreetMap category Aerialway
452 AerialwayStation,
453 AerialwayPylon, // node only
454 // below please keep order (used in for loops)
455 AerialwayCableCar,
456 AerialwayGondola,
457 AerialwayChairLift,
458 AerialwayMixedLift,
459 AerialwayDragLift,
460 AerialwayTBar,
461 AerialwayJBar,
462 AerialwayPlatter,
463 AerialwayRopeTow,
464 AerialwayMagicCarpet,
465 AerialwayZipLine,
466 AerialwayGoods, // please keep order (used in for loops)
467
468 // OpenStreetMap category Piste
469 PisteDownhill,
470 PisteNordic,
471 PisteSkitour,
472 PisteSled,
473 PisteHike,
474 PisteSleigh,
475 PisteIceSkate,
476 PisteSnowPark,
477 PistePlayground,
478 PisteSkiJump,
479
480 // Waterways
481 WaterwayCanal, // please keep order (used in for loops)
482 WaterwayDitch,
483 WaterwayDrain,
484 WaterwayRiver,
485 WaterwayWeir,
486 WaterwayStream, // please keep order (used in for loops)
487
488 CrossingSignals, // pedestrian vs highway crossing with traffic signals
489 CrossingIsland, // pedestrian vs highway crossing with a traffic island
490 CrossingZebra, // pedestrian vs highway zebra crossing
491 CrossingRailway, // pedestrian or highway vs railway crossing
492
493 // Admin level tags for depicting boundary
494 AdminLevel1, // please keep order (used in for loops)
495 AdminLevel2,
496 AdminLevel3,
497 AdminLevel4,
498 AdminLevel5,
499 AdminLevel6,
500 AdminLevel7,
501 AdminLevel8,
502 AdminLevel9,
503 AdminLevel10,
504 AdminLevel11, // please keep order (used in for loops)
505
506 BoundaryMaritime,
507
508 IndoorDoor,
509 IndoorWall,
510 IndoorRoom,
511
512 // Custom OSM Tags
513 Landmass,
514 UrbanArea,
515 InternationalDateLine,
516 Bathymetry, ///< @since 0.26.0
517
518 // Important: Make sure that this is always the last
519 // item and just use it to specify the array size
520 LastIndex
521 };
522
523 /**
524 * Return the symbol index of the placemark.
525 */
526 GeoDataVisualCategory visualCategory() const;
527
528 /**
529 * Sets the symbol @p category of the placemark.
530 * @param index the new category to be used.
531 */
532 void setVisualCategory(GeoDataVisualCategory index);
533
534 /**
535 * Return the coordinates of the placemark at time @p dateTime as a GeoDataCoordinates
536 *
537 * The @p dateTime parameter should be used if the placemark geometry() is a
538 * GeoDataTrack and thus contains several coordinates associated with a date and time.
539 *
540 * The @p iconAtCoordinates boolean is set to true if an icon should be drawn to
541 * represent the placemark at these coordinates as described in
542 * https://code.google.com/apis/kml/documentation/kmlreference.html#placemark,
543 * it is set to false otherwise.
544 *
545 * @see GeoDataTrack::GeoDataTrack
546 */
547 GeoDataCoordinates coordinate(const QDateTime &dateTime = QDateTime(), bool *iconAtCoordinates = nullptr) const;
548
549 /**
550 * The geometry of the GeoDataPlacemark is to be rendered to the marble map
551 * along with the icon at the coordinate associated with this Placemark.
552 * @return a pointer to the current Geometry object
553 */
554 GeoDataGeometry *geometry();
555 const GeoDataGeometry *geometry() const;
556
557 /**
558 * @brief displays the name of a place in the locale language of the user
559 */
560 QString displayName() const;
561
562 /**
563 * @since 0.26.0
564 */
565 QString categoryName() const;
566
567 /**
568 * Return the coordinates of the placemark as @p longitude,
569 * @p latitude and @p altitude.
570 */
571 void coordinate(qreal &longitude, qreal &latitude, qreal &altitude) const;
572
573 /**
574 * Quick, safe accessor to the placemark's OsmPlacemarkData stored within it's
575 * ExtendedData. If the extendedData does not contain osmData, the function
576 * inserts a default-constructed one, and returns a reference to it.
577 */
578 OsmPlacemarkData &osmData();
579 const OsmPlacemarkData &osmData() const;
580
581 void setOsmData(const OsmPlacemarkData &osmData);
582 bool hasOsmData() const;
583 /**
584 * @since 0.26.0
585 */
586 void clearOsmData();
587
588 /**
589 * Set the coordinate of the placemark in @p longitude and
590 * @p latitude.
591 */
592 void setCoordinate(qreal longitude, qreal latitude, qreal altitude = 0, GeoDataCoordinates::Unit _unit = GeoDataCoordinates::Radian);
593
594 /**
595 * Set the coordinate of the placemark with an @p GeoDataPoint.
596 */
597 void setCoordinate(const GeoDataCoordinates &coordinate);
598
599 /**
600 * Sets the current Geometry of this Placemark. @see geometry() and the class
601 * overview for description of the geometry concept. The geometry can be set
602 * to any @see GeoDataGeometry like @see GeoDataPoint,@see GeoDataLineString,
603 * @see GeoDataLinearRing and @see GeoDataMultiGeometry
604 */
605 void setGeometry(GeoDataGeometry *entry);
606
607 /**
608 * Return the area size of the feature in square km.
609 *
610 * FIXME: Once we make Marble more area-aware we need to
611 * move this into the GeoDataArea class which will get
612 * inherited from GeoDataPlacemark (or GeoDataFeature).
613 */
614 qreal area() const;
615
616 /**
617 * Set the area size of the feature in square km.
618 */
619 void setArea(qreal area);
620
621 /**
622 * Return the population of the placemark.
623 */
624 qint64 population() const;
625 /**
626 * Sets the @p population of the placemark.
627 * @param population the new population value
628 */
629 void setPopulation(qint64 population);
630
631 /**
632 * Return the state of the placemark.
633 */
634 const QString state() const;
635
636 /**
637 * Set the state @p state of the placemark.
638 */
639 void setState(const QString &state);
640
641 /**
642 * Return the country code of the placemark.
643 */
644 const QString countryCode() const;
645
646 /**
647 * Set the country @p code of the placemark.
648 */
649 void setCountryCode(const QString &code);
650
651 /**
652 * Returns whether balloon is visible or not
653 */
654 bool isBalloonVisible() const;
655
656 /**
657 * Set visibility of the balloon
658 */
659 void setBalloonVisible(bool visible);
660
661 /**
662 * Serialize the Placemark to a data stream. This is a binary serialisation
663 * and is deserialised using @see unpack()
664 * @param stream the QDataStream to serialise object to.
665 */
666 void pack(QDataStream &stream) const override;
667
668 /**
669 * Serialise this Placemark to a XML stream writer @see QXmlStreamWriter in
670 * the Qt documentation for more info. This will output the XML
671 * representation of this Placemark. The default XML format is KML, to have
672 * other formats supported you need to create a subclass and override this
673 * method.
674 * @param stream the XML Stream Reader to output to.
675 */
676 virtual QXmlStreamWriter &pack(QXmlStreamWriter &stream) const;
677
678 virtual QXmlStreamWriter &operator<<(QXmlStreamWriter &stream) const;
679
680 /**
681 * Deserialize the Placemark from a data stream. This has the opposite effect
682 * from @see pack()
683 * @param stream the QDataStream to deserialise from.
684 */
685 void unpack(QDataStream &stream) override;
686
687 /**
688 * Returns GeoDataLookAt object if lookAt is setup earlier
689 * otherwise It will convert GeoDataCoordinates of Placemark
690 * to GeoDataLookAt with range equals to altitude of
691 * GeoDataCoordinate
692 */
693 const GeoDataLookAt *lookAt() const;
694 GeoDataLookAt *lookAt();
695
696 static bool placemarkLayoutOrderCompare(const GeoDataPlacemark *a, const GeoDataPlacemark *b);
697
698private:
699 Q_DECLARE_PRIVATE(GeoDataPlacemark)
700};
701
702}
703
704#endif
Represents a coordinate with the properties of a name and coordinates.
Definition Coordinate.h:19
A 3d point representation.
Unit
enum used constructor to specify the units used
A base class for all geodata features.
A base class for all geodata features.
a class representing a point of interest on the map
GeoDataVisualCategory
A categorization of a placemark as defined by ...FIXME.
This class is used to encapsulate the osm data fields kept within a placemark's extendedData.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.