• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • tools
  • osm-addresses
tools/osm-addresses/OsmParser.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2011 Dennis Nienhüser <earthwings@gentoo.org>
9 //
10 
11 #include "OsmParser.h"
12 #include "OsmRegionTree.h"
13 
14 #include "GeoDataLinearRing.h"
15 #include "GeoDataLineString.h"
16 #include "GeoDataPolygon.h"
17 #include "GeoDataDocument.h"
18 #include "GeoDataFolder.h"
19 #include "GeoDataPlacemark.h"
20 #include "GeoDataMultiGeometry.h"
21 #include "GeoDataStyle.h"
22 #include "GeoDataStyleMap.h"
23 #include "GeoDataLineStyle.h"
24 #include "GeoDataFeature.h"
25 #include "geodata/writer/GeoWriter.h"
26 #include "geodata/data/GeoDataExtendedData.h"
27 #include <geodata/handlers/kml/KmlElementDictionary.h>
28 
29 #include <QDebug>
30 #include <QTime>
31 
32 namespace Marble
33 {
34 
35 using namespace Oxygen;
36 
37 namespace {
38  struct GrahamScanHelper {
39  Coordinate coordinate;
40  qreal direction;
41 
42  GrahamScanHelper( const Coordinate &coordinate_=Coordinate(), qreal direction_=0.0 )
43  : coordinate( coordinate_ ), direction( direction_ )
44  {
45  // nothing to do
46  }
47 
48  double turnDirection( const GrahamScanHelper &two, const GrahamScanHelper &three )
49  {
50  return ( two.coordinate.lat - coordinate.lat ) * ( three.coordinate.lon - coordinate.lon )
51  - ( two.coordinate.lon - coordinate.lon ) * ( three.coordinate.lat - coordinate.lat );
52  }
53 
54  static bool directionLessThan( const GrahamScanHelper &one, const GrahamScanHelper &two )
55  {
56  return one.direction < two.direction;
57  }
58  };
59 }
60 
61 bool moreImportantAdminArea( const OsmRegion &a, const OsmRegion b )
62 {
63  return a.adminLevel() < b.adminLevel();
64 }
65 
66 OsmParser::OsmParser( QObject *parent ) :
67  QObject( parent ), m_convexHull( 0 )
68 {
69  m_categoryMap["tourism/camp_site"] = OsmPlacemark::AccomodationCamping;
70  m_categoryMap["tourism/hostel"] = OsmPlacemark::AccomodationHostel;
71  m_categoryMap["tourism/hotel"] = OsmPlacemark::AccomodationHotel;
72  m_categoryMap["tourism/motel"] = OsmPlacemark::AccomodationMotel;
73  //m_categoryMap["/"] = OsmPlacemark::AccomodationYouthHostel;
74  m_categoryMap["amenity/library"] = OsmPlacemark::AmenityLibrary;
75  m_categoryMap["amenity/college"] = OsmPlacemark::EducationCollege;
76  m_categoryMap["amenity/school"] = OsmPlacemark::EducationSchool;
77  m_categoryMap["amenity/university"] = OsmPlacemark::EducationUniversity;
78  m_categoryMap["amenity/bar"] = OsmPlacemark::FoodBar;
79  m_categoryMap["amenity/biergarten"] = OsmPlacemark::FoodBiergarten;
80  m_categoryMap["amenity/cafe"] = OsmPlacemark::FoodCafe;
81  m_categoryMap["amenity/fast_food"] = OsmPlacemark::FoodFastFood;
82  m_categoryMap["amenity/pub"] = OsmPlacemark::FoodPub;
83  m_categoryMap["amenity/restaurant"] = OsmPlacemark::FoodRestaurant;
84  m_categoryMap["amenity/doctor"] = OsmPlacemark::HealthDoctors;
85  m_categoryMap["amenity/doctors"] = OsmPlacemark::HealthDoctors;
86  m_categoryMap["amenity/hospital"] = OsmPlacemark::HealthHospital;
87  m_categoryMap["amenity/pharmacy"] = OsmPlacemark::HealthPharmacy;
88  m_categoryMap["amenity/atm"] = OsmPlacemark::MoneyAtm;
89  m_categoryMap["amenity/bank"] = OsmPlacemark::MoneyBank;
90  m_categoryMap["shop/beverages"] = OsmPlacemark::ShoppingBeverages;
91  m_categoryMap["shop/hifi"] = OsmPlacemark::ShoppingHifi;
92  m_categoryMap["shop/supermarket"] = OsmPlacemark::ShoppingSupermarket;
93  m_categoryMap["tourism/attraction"] = OsmPlacemark::TouristAttraction;
94  m_categoryMap["tourism/castle"] = OsmPlacemark::TouristCastle;
95  m_categoryMap["amenity/cinema"] = OsmPlacemark::TouristCinema;
96  m_categoryMap["tourism/monument"] = OsmPlacemark::TouristMonument;
97  m_categoryMap["tourism/museum"] = OsmPlacemark::TouristMuseum;
98  m_categoryMap["historic/ruins"] = OsmPlacemark::TouristRuin;
99  m_categoryMap["amenity/theatre"] = OsmPlacemark::TouristTheatre;
100  m_categoryMap["tourism/theme_park"] = OsmPlacemark::TouristThemePark;
101  m_categoryMap["tourism/viewpoint"] = OsmPlacemark::TouristViewPoint;
102  m_categoryMap["tourism/zoo"] = OsmPlacemark::TouristZoo;
103  m_categoryMap["aeroway/aerodrome"] = OsmPlacemark::TransportAirport;
104  m_categoryMap["aeroway/terminal"] = OsmPlacemark::TransportAirportTerminal;
105  m_categoryMap["amenity/bus_station"] = OsmPlacemark::TransportBusStation;
106  m_categoryMap["highway/bus_stop"] = OsmPlacemark::TransportBusStop;
107  m_categoryMap["highway/speed_camera"] = OsmPlacemark::TransportSpeedCamera;
108  m_categoryMap["amenity/car_sharing"] = OsmPlacemark::TransportCarShare;
109  m_categoryMap["amenity/car_rental"] = OsmPlacemark::TransportRentalCar;
110  m_categoryMap["amenity/bicycle_rental"] = OsmPlacemark::TransportRentalBicycle;
111  m_categoryMap["amenity/fuel"] = OsmPlacemark::TransportFuel;
112  m_categoryMap["amenity/parking"] = OsmPlacemark::TransportParking;
113  m_categoryMap["amenity/taxi"] = OsmPlacemark::TransportTaxiRank;
114  m_categoryMap["railway/station"] = OsmPlacemark::TransportTrainStation;
115  m_categoryMap["railway/tram_stop"] = OsmPlacemark::TransportTramStop;
116 }
117 
118 void OsmParser::addWriter( Writer* writer )
119 {
120  m_writers.push_back( writer );
121 }
122 
123 Node::operator OsmPlacemark() const
124 {
125  OsmPlacemark placemark;
126  placemark.setCategory( category );
127  placemark.setName( name.trimmed() );
128  placemark.setHouseNumber( houseNumber.trimmed() );
129  placemark.setLongitude( lon );
130  placemark.setLatitude( lat );
131  return placemark;
132 }
133 
134 Node::operator Coordinate() const
135 {
136  Coordinate coordinate;
137  coordinate.lon = lon;
138  coordinate.lat = lat;
139  return coordinate;
140 }
141 
142 Way::operator OsmPlacemark() const
143 {
144  OsmPlacemark placemark;
145  placemark.setCategory( category );
146  placemark.setName( name.trimmed() );
147  placemark.setHouseNumber( houseNumber.trimmed() );
148  return placemark;
149 }
150 
151 void Way::setPosition( const QHash<int, Coordinate> &database, OsmPlacemark &placemark ) const
152 {
153  if ( !nodes.isEmpty() ) {
154  if ( nodes.first() == nodes.last() && database.contains( nodes.first() ) ) {
155  GeoDataLinearRing ring;
156  foreach( int id, nodes ) {
157  if ( database.contains( id ) ) {
158  const Coordinate &node = database[id];
159  GeoDataCoordinates coordinates( node.lon, node.lat, 0.0, GeoDataCoordinates::Degree );
160  ring << coordinates;
161  } else {
162  qDebug() << "Missing node " << id << " in database";
163  }
164  }
165 
166  if ( !ring.isEmpty() ) {
167  GeoDataCoordinates center = ring.latLonAltBox().center();
168  placemark.setLongitude( center.longitude( GeoDataCoordinates::Degree ) );
169  placemark.setLatitude( center.latitude( GeoDataCoordinates::Degree ) );
170  }
171  } else {
172  int id = nodes.at( nodes.size() / 2 );
173  if ( database.contains( id ) ) {
174  const Coordinate &node = database[id];
175  placemark.setLongitude( node.lon );
176  placemark.setLatitude( node.lat );
177  }
178  }
179  }
180 }
181 
182 void Way::setRegion( const QHash<int, Node> &database, const OsmRegionTree & tree, QList<OsmOsmRegion> & osmOsmRegions, OsmPlacemark &placemark ) const
183 {
184  if ( !city.isEmpty() ) {
185  foreach( const OsmOsmRegion & region, osmOsmRegions ) {
186  if ( region.region.name() == city ) {
187  placemark.setRegionId( region.region.identifier() );
188  return;
189  }
190  }
191 
192  foreach( const Node & node, database ) {
193  if ( node.category >= OsmPlacemark::PlacesRegion &&
194  node.category <= OsmPlacemark::PlacesIsland &&
195  node.name == city ) {
196  qDebug() << "Creating a new implicit region from " << node.name << " at " << node.lon << "," << node.lat;
197  OsmOsmRegion region;
198  region.region.setName( city );
199  region.region.setLongitude( node.lon );
200  region.region.setLatitude( node.lat );
201  placemark.setRegionId( region.region.identifier() );
202  osmOsmRegions.push_back( region );
203  return;
204  }
205  }
206 
207  qDebug() << "Unable to locate city " << city << ", setting it up without coordinates";
208  OsmOsmRegion region;
209  region.region.setName( city );
210  placemark.setRegionId( region.region.identifier() );
211  osmOsmRegions.push_back( region );
212  return;
213  }
214 
215  GeoDataCoordinates position( placemark.longitude(), placemark.latitude(), 0.0, GeoDataCoordinates::Degree );
216  placemark.setRegionId( tree.smallestRegionId( position ) );
217 }
218 
219 void OsmParser::read( const QFileInfo &content, const QString &areaName )
220 {
221  QTime timer;
222  timer.start();
223 
224  m_nodes.clear();
225  m_ways.clear();
226  m_relations.clear();
227 
228  m_placemarks.clear();
229  m_osmOsmRegions.clear();
230 
231  int pass = 0;
232  bool needAnotherPass = false;
233  do {
234  qWarning() << "Step 1." << pass << ": Parsing input file " << content.fileName();
235  parse( content, pass++, needAnotherPass );
236  }
237  while ( needAnotherPass );
238 
239  qWarning() << "Step 2: " << m_coordinates.size() << "coordinates."
240  << "Now extracting regions from" << m_relations.size() << "relations";
241 
242  QHash<int, Relation>::iterator itpoint = m_relations.begin();
243  QHash<int, Relation>::iterator const endpoint = m_relations.end();
244  for(; itpoint != endpoint; ++itpoint ) {
245  if ( itpoint.value().isAdministrativeBoundary /*&& relation.isMultipolygon*/ ) {
246  importMultipolygon( itpoint.value() );
247  if ( !itpoint.value().relations.isEmpty() ) {
248  qDebug() << "Ignoring relations inside the relation " << itpoint.value().name;
249  }
250  }
251  }
252 
253  m_relations.clear();
254 
255  for ( int i = 0; i < m_osmOsmRegions.size(); ++i ) {
256  OsmOsmRegion &osmOsmRegion = m_osmOsmRegions[i];
257  GeoDataCoordinates center = osmOsmRegion.region.geometry().latLonAltBox().center();
258  osmOsmRegion.region.setLongitude( center.longitude( GeoDataCoordinates::Degree ) );
259  osmOsmRegion.region.setLatitude( center.latitude( GeoDataCoordinates::Degree ) );
260  }
261 
262  qWarning() << "Step 3: Creating region hierarchies from" << m_osmOsmRegions.size() << "administrative boundaries";
263 
264  QMultiMap<int,int> sortedRegions;
265  for ( int i = 0; i < m_osmOsmRegions.size(); ++i ) {
266  sortedRegions.insert( m_osmOsmRegions[i].region.adminLevel(), i );
267  }
268 
269  for ( int i = 0; i < m_osmOsmRegions.size(); ++i ) {
270  GeoDataLinearRing const & ring = m_osmOsmRegions[i].region.geometry().outerBoundary();
271  OsmOsmRegion* parent = 0;
272  qDebug() << "Examining admin region " << i << " of " << m_osmOsmRegions.count();
273  for ( int level=m_osmOsmRegions[i].region.adminLevel()-1; level >= 0 && parent == 0; --level ) {
274  QList<int> candidates = sortedRegions.values( level );
275  qDebug() << "Examining " << candidates.count() << "admin regions on level" << level;
276  foreach( int j, candidates ) {
277  GeoDataLinearRing const & outer = m_osmOsmRegions[j].region.geometry().outerBoundary();
278  if ( contains<GeoDataLinearRing, GeoDataLinearRing>( outer, ring ) ) {
279  if ( parent == 0 || contains<GeoDataLinearRing, GeoDataLinearRing>( parent->region.geometry().outerBoundary(), outer ) ) {
280  qDebug() << "Parent found: " << m_osmOsmRegions[i].region.name() << ", level " << m_osmOsmRegions[i].region.adminLevel()
281  << "is a child of " << m_osmOsmRegions[j].region.name() << ", level " << m_osmOsmRegions[j].region.adminLevel();
282  parent = &m_osmOsmRegions[j];
283  break;
284  }
285  }
286  }
287  }
288 
289  m_osmOsmRegions[i].parent = parent;
290  }
291 
292  for ( int i = 0; i < m_osmOsmRegions.size(); ++i ) {
293  int const parent = m_osmOsmRegions[i].parent ? m_osmOsmRegions[i].parent->region.identifier() : 0;
294  m_osmOsmRegions[i].region.setParentIdentifier( parent );
295  }
296 
297  OsmRegion mainArea;
298  mainArea.setIdentifier( 0 );
299  mainArea.setName( areaName );
300  mainArea.setAdminLevel( 1 );
301  QPair<float, float> minLon( -180.0, 180.0 ), minLat( -90.0, 90.0 );
302  foreach( const Coordinate & node, m_coordinates ) {
303  minLon.first = qMin( node.lon, minLon.first );
304  minLon.second = qMax( node.lon, minLon.second );
305  minLat.first = qMin( node.lat, minLat.first );
306  minLat.second = qMax( node.lat, minLat.second );
307  }
308  GeoDataLatLonBox center( minLat.second, minLat.first,
309  minLon.second, minLon.first );
310  mainArea.setLongitude( center.center().longitude( GeoDataCoordinates::Degree ) );
311  mainArea.setLatitude( center.center().latitude( GeoDataCoordinates::Degree ) );
312 
313  QList<OsmRegion> regions;
314  foreach( const OsmOsmRegion & region, m_osmOsmRegions ) {
315  regions << region.region;
316  }
317 
318  qSort( regions.begin(), regions.end(), moreImportantAdminArea );
319  OsmRegionTree regionTree( mainArea );
320  regionTree.append( regions );
321  Q_ASSERT( regions.isEmpty() );
322  int left = 0;
323  regionTree.traverse( left );
324 
325  qWarning() << "Step 4: Creating placemarks from" << m_nodes.size() << "nodes";
326 
327  foreach( const Node & node, m_nodes ) {
328  if ( node.save ) {
329  OsmPlacemark placemark = node;
330  GeoDataCoordinates position( node.lon, node.lat, 0.0, GeoDataCoordinates::Degree );
331  placemark.setRegionId( regionTree.smallestRegionId( position ) );
332 
333  if ( !node.name.isEmpty() ) {
334  placemark.setHouseNumber( QString() );
335  m_placemarks.push_back( placemark );
336  }
337 
338  if ( !node.street.isEmpty() && node.name != node.street ) {
339  placemark.setCategory( OsmPlacemark::Address );
340  placemark.setName( node.street.trimmed() );
341  placemark.setHouseNumber( node.houseNumber.trimmed() );
342  m_placemarks.push_back( placemark );
343  }
344  }
345  }
346 
347  qWarning() << "Step 5: Creating placemarks from" << m_ways.size() << "ways";
348  QMultiMap<QString, Way> waysByName;
349  foreach ( const Way & way, m_ways ) {
350  if ( way.save ) {
351  if ( !way.name.isEmpty() && !way.nodes.isEmpty() ) {
352  waysByName.insert( way.name, way );
353  }
354 
355  if ( !way.street.isEmpty() && way.name != way.street && !way.nodes.isEmpty() ) {
356  waysByName.insert( way.street, way );
357  }
358  } else {
359  ++m_statistic.uselessWays;
360  }
361  }
362 
363  QSet<QString> keys = QSet<QString>::fromList( waysByName.keys() );
364  foreach( const QString & key, keys ) {
365  QList<QList<Way> > merged = merge( waysByName.values( key ) );
366  foreach( const QList<Way> ways, merged ) {
367  Q_ASSERT( !ways.isEmpty() );
368  OsmPlacemark placemark = ways.first();
369  ways.first().setPosition( m_coordinates, placemark );
370  ways.first().setRegion( m_nodes, regionTree, m_osmOsmRegions, placemark );
371 
372  if ( placemark.category() != OsmPlacemark::Address && !ways.first().name.isEmpty() ) {
373  placemark.setHouseNumber( QString() );
374  m_placemarks.push_back( placemark );
375  }
376 
377  if ( !ways.first().isBuilding || !ways.first().houseNumber.isEmpty() ) {
378  placemark.setCategory( OsmPlacemark::Address );
379  QString name = ways.first().street.isEmpty() ? ways.first().name : ways.first().street;
380  if ( !name.isEmpty() ) {
381  placemark.setName( name.trimmed() );
382  placemark.setHouseNumber( ways.first().houseNumber.trimmed() );
383  m_placemarks.push_back( placemark );
384  }
385  }
386  }
387  }
388 
389  m_convexHull = convexHull();
390  m_coordinates.clear();
391  m_nodes.clear();
392  m_ways.clear();
393 
394  Q_ASSERT( regions.isEmpty() );
395  foreach( const OsmOsmRegion & region, m_osmOsmRegions ) {
396  regions << region.region;
397  }
398 
399  qSort( regions.begin(), regions.end(), moreImportantAdminArea );
400  regionTree = OsmRegionTree( mainArea );
401  regionTree.append( regions );
402  Q_ASSERT( regions.isEmpty() );
403  left = 0;
404  regionTree.traverse( left );
405  regions = regionTree;
406 
407  qWarning() << "Step 6: " << m_statistic.mergedWays << " ways merged," << m_statistic.uselessWays << "useless ways."
408  << "Now serializing" << regions.size() << "regions";
409  foreach( const OsmRegion & region, regions ) {
410  foreach( Writer * writer, m_writers ) {
411  writer->addOsmRegion( region );
412  }
413  }
414 
415  qWarning() << "Step 7: Serializing" << m_placemarks.size() << "placemarks";
416  foreach( const OsmPlacemark & placemark, m_placemarks ) {
417  foreach( Writer * writer, m_writers ) {
418  Q_ASSERT( !placemark.name().isEmpty() );
419  writer->addOsmPlacemark( placemark );
420  }
421  }
422 
423  qWarning() << "Step 8: There is no step 8. Done after " << timer.elapsed() / 1000 << "s.";
424  //writeOutlineKml( areaName );
425 }
426 
427 QList< QList<Way> > OsmParser::merge( const QList<Way> &ways ) const
428 {
429  QList<WayMerger> mergers;
430 
431  foreach( const Way & way, ways ) {
432  mergers << WayMerger( way );
433  }
434 
435  bool moved = false;
436  do {
437  moved = false;
438  for( int i = 0; i < mergers.size(); ++i ) {
439  for ( int j = i + 1; j < mergers.size(); ++j ) {
440  if ( mergers[i].compatible( mergers[j] ) ) {
441  mergers[i].merge( mergers[j] );
442  moved = true;
443  mergers.removeAt( j );
444  }
445  }
446  }
447  } while ( moved );
448 
449  QList< QList<Way> > result;
450  foreach( const WayMerger & merger, mergers ) {
451  result << merger.ways;
452  }
453  m_statistic.mergedWays += ( ways.size() - result.size() );
454 
455  return result;
456 }
457 
458 void OsmParser::importMultipolygon( const Relation &relation )
459 {
461  typedef QPair<int, RelationRole> RelationPair;
462  QVector<GeoDataLineString> outer;
463  QVector<GeoDataLineString> inner;
464  foreach( const RelationPair & pair, relation.ways ) {
465  if ( pair.second == Outer ) {
466  importWay( outer, pair.first );
467  } else if ( pair.second == Inner ) {
468  importWay( inner, pair.first );
469  } else {
470  qDebug() << "Ignoring way " << pair.first << " with unknown relation role.";
471  }
472  }
473 
474  foreach( const GeoDataLineString & string, outer ) {
475  if ( string.isEmpty() || !( string.first() == string.last() ) ) {
476  qDebug() << "Ignoring open polygon in relation " << relation.name << ". Check data.";
477  continue;
478  }
479 
480  GeoDataPolygon polygon;
481  polygon.setOuterBoundary( string );
482  Q_ASSERT( polygon.outerBoundary().size() > 0 );
483 
484  foreach( const GeoDataLineString & hole, inner ) {
485  if ( contains<GeoDataLinearRing, GeoDataLineString>( polygon.outerBoundary(), hole ) ) {
486  polygon.appendInnerBoundary( hole );
487  }
488  }
489 
490  OsmOsmRegion region;
491  region.region.setName( relation.name );
492  region.region.setGeometry( polygon );
493  region.region.setAdminLevel( relation.adminLevel );
494  qDebug() << "Adding administrative region " << relation.name;
495  m_osmOsmRegions.push_back( region );
496  }
497 }
498 
499 void OsmParser::importWay( QVector<GeoDataLineString> &ways, int id )
500 {
501  if ( !m_ways.contains( id ) ) {
502  qDebug() << "Skipping unknown way " << id << ". Check data.";
503  return;
504  }
505 
506  GeoDataLineString way;
507  foreach( int node, m_ways[id].nodes ) {
508  if ( !m_coordinates.contains( node ) ) {
509  qDebug() << "Skipping unknown node " << node << ". Check data.";
510  } else {
511  const Coordinate &nd = m_coordinates[node];
512  GeoDataCoordinates coordinates( nd.lon, nd.lat, 0.0, GeoDataCoordinates::Degree );
513  way << coordinates;
514  }
515  }
516 
517  QList<int> remove;
518  do {
519  remove.clear();
520  for ( int i = 0; i < ways.size(); ++i ) {
521  const GeoDataLineString &existing = ways[i];
522  if ( existing.first() == way.first() ) {
523  way = reverse( way ) << existing;
524  remove.push_front( i );
525  } else if ( existing.last() == way.first() ) {
526  GeoDataLineString copy = existing;
527  way = copy << way;
528  remove.push_front( i );
529  } else if ( existing.first() == way.last() ) {
530  way << existing;
531  remove.push_front( i );
532  } else if ( existing.last() == way.last() ) {
533  way << reverse( existing );
534  remove.push_front( i );
535  }
536  }
537 
538  foreach( int key, remove ) {
539  ways.remove( key );
540  }
541  } while ( !remove.isEmpty() );
542 
543  ways.push_back( way );
544 }
545 
546 GeoDataLineString OsmParser::reverse( const GeoDataLineString & string )
547 {
548  GeoDataLineString result;
549  for ( int i = string.size() - 1; i >= 0; --i ) {
550  result << string[i];
551  }
552  return result;
553 }
554 
555 bool OsmParser::shouldSave( ElementType /*type*/, const QString &key, const QString &value )
556 {
557  typedef QList<QString> Dictionary;
558  static QHash<QString, Dictionary> interestingTags;
559  if ( interestingTags.isEmpty() ) {
560  Dictionary highways;
561  highways << "primary" << "secondary" << "tertiary";
562  highways << "residential" << "unclassified" << "road";
563  highways << "living_street" << "service" << "track";
564  highways << "bus_stop" << "platform" << "speed_camera";
565  interestingTags["highway"] = highways;
566 
567  Dictionary aeroways;
568  aeroways << "aerodrome" << "terminal";
569  interestingTags["aeroway"] = aeroways;
570 
571  interestingTags["aerialway"] = Dictionary() << "station";
572 
573  Dictionary leisures;
574  leisures << "sports_centre" << "stadium" << "pitch";
575  leisures << "park" << "dance";
576  interestingTags["leisure"] = leisures;
577 
578  Dictionary amenities;
579  amenities << "restaurant" << "food_court" << "fast_food";
580  amenities << "pub" << "bar" << "cafe";
581  amenities << "biergarten" << "kindergarten" << "school";
582  amenities << "college" << "university" << "library";
583  amenities << "ferry_terminal" << "bus_station" << "car_rental";
584  amenities << "car_sharing" << "fuel" << "parking";
585  amenities << "bank" << "pharmacy" << "hospital";
586  amenities << "cinema" << "nightclub" << "theatre";
587  amenities << "taxi" << "bicycle_rental" << "atm";
588  interestingTags["amenity"] = amenities;
589 
590  Dictionary shops;
591  shops << "beverages" << "supermarket" << "hifi";
592  interestingTags["shop"] = shops;
593 
594  Dictionary tourism;
595  tourism << "attraction" << "camp_site" << "caravan_site";
596  tourism << "chalet" << "chalet" << "hostel";
597  tourism << "hotel" << "motel" << "museum";
598  tourism << "theme_park" << "viewpoint" << "zoo";
599  interestingTags["tourism"] = tourism;
600 
601  Dictionary historic;
602  historic << "castle" << "fort" << "monument";
603  historic << "ruins";
604  interestingTags["historic"] = historic;
605 
606  Dictionary railway;
607  railway << "station" << "tram_stop";
608  interestingTags["railway"] = railway;
609 
610  Dictionary places;
611  places << "region" << "county" << "city";
612  places << "town" << "village" << "hamlet";
613  places << "isolated_dwelling" << "suburb" << "locality";
614  places << "island";
615  interestingTags["place"] = places;
616  }
617 
618  return interestingTags.contains( key ) &&
619  interestingTags[key].contains( value );
620 }
621 
622 void OsmParser::setCategory( Element &element, const QString &key, const QString &value )
623 {
624  QString const term = key + '/' + value;
625  if ( m_categoryMap.contains( term ) ) {
626  if ( element.category != OsmPlacemark::UnknownCategory ) {
627  qDebug() << "Overwriting category " << element.category << " with " << m_categoryMap[term] << " for " << element.name;
628  }
629  element.category = m_categoryMap[term];
630  }
631 }
632 
633 // From http://en.wikipedia.org/wiki/Graham_scan#Pseudocode
634 GeoDataLinearRing* OsmParser::convexHull() const
635 {
636  Q_ASSERT(m_coordinates.size()>2);
637  QList<Coordinate> coordinates = m_coordinates.values();
638 
639  QVector<GrahamScanHelper> points;
640  points.reserve( coordinates.size()+1 );
641  Coordinate start = coordinates.first();
642  int startPos = 0;
643  for ( int i=0; i<coordinates.size(); ++i ) {
644  if ( coordinates[i].lon < start.lon ) {
645  start = coordinates[i];
646  startPos = i;
647  }
648  points << coordinates[i];
649  }
650 
651  int const n = points.size();
652  Q_ASSERT( n == coordinates.size() );
653  Q_ASSERT( n>2 );
654  qSwap( points[1], points[startPos] );
655 
656  Q_ASSERT( start.lat != 360.0 );
657 
658  for ( int i=0; i<points.size(); ++i ) {
659  points[i].direction = atan2( start.lon - points[i].coordinate.lon,
660  start.lat - points[i].coordinate.lat );
661  }
662 
663  qSort( points.begin(), points.end(), GrahamScanHelper::directionLessThan );
664  points << points.first();
665 
666  int m = 2;
667  for ( int i=3; i<=n; ++i ) {
668  while ( points[m-1].turnDirection( points[m], points[i] ) <= 0 ) {
669  if ( m == 2 ) {
670  qSwap( points[m], points[i] );
671  ++i;
672  } else {
673  --m;
674  }
675 
676  Q_ASSERT( n+1 == points.size() );
677  Q_ASSERT( m > 0 );
678  Q_ASSERT( m <= n );
679  Q_ASSERT( i >= 0 );
680  Q_ASSERT( i <= n );
681  }
682 
683  ++m;
684  qSwap( points[m], points[i] );
685  }
686 
687  GeoDataLinearRing* ring = new GeoDataLinearRing;
688  for ( int i=1; i<=m; ++i ) {
689  ring->append(GeoDataCoordinates(points[i].coordinate.lon, points[i].coordinate.lat, 0.0, GeoDataCoordinates::Degree));
690  }
691 
692  return ring;
693 }
694 
695 QColor OsmParser::randomColor() const
696 {
697  QVector<QColor> colors = QVector<QColor>() << aluminumGray4 << brickRed4;
698  colors << woodBrown4 << forestGreen4 << hotOrange4;
699  colors << seaBlue2 << skyBlue4 << sunYellow6;
700  return colors.at( qrand() % colors.size() );
701 }
702 
703 void OsmParser::writeKml( const QString &area, const QString &version, const QString &date, const QString &transport, const QString &payload, const QString &filename ) const
704 {
705  GeoDataDocument* document = new GeoDataDocument;
706 
707  //foreach( const OsmOsmRegion & region, m_osmOsmRegions ) {
708  GeoDataPlacemark* placemark = new GeoDataPlacemark;
709  placemark->setName( area );
710  if ( !version.isEmpty() ) {
711  placemark->extendedData().addValue( GeoDataData( "version", version ) );
712  }
713  if ( !date.isEmpty() ) {
714  placemark->extendedData().addValue( GeoDataData( "date", date ) );
715  }
716  if ( !transport.isEmpty() ) {
717  placemark->extendedData().addValue( GeoDataData( "transport", transport ) );
718  }
719  if ( !payload.isEmpty() ) {
720  placemark->extendedData().addValue( GeoDataData( "payload", payload ) );
721  }
722 
723  GeoDataStyle style;
724  GeoDataLineStyle lineStyle;
725  QColor color = randomColor();
726  color.setAlpha( 200 );
727  lineStyle.setColor( color );
728  lineStyle.setWidth( 4 );
729  style.setLineStyle( lineStyle );
730  style.setId( color.name().replace( '#', 'f' ) );
731 
732  GeoDataStyleMap styleMap;
733  styleMap.setId( color.name().replace( '#', 'f' ) );
734  styleMap.insert( "normal", QString( "#" ).append( style.id() ) );
735  document->addStyle( style );
736 
737  placemark->setStyleUrl( QString( "#" ).append( styleMap.id() ) );
738 
739  //placemark->setGeometry( new GeoDataLinearRing( region.region.geometry().outerBoundary() ) );
740  GeoDataMultiGeometry *geometry = new GeoDataMultiGeometry;
741  geometry->append( m_convexHull );
742  placemark->setGeometry( geometry );
743 
744  document->append( placemark );
745  document->addStyleMap( styleMap );
746 // }
747 
748  GeoWriter writer;
749  writer.setDocumentType( kml::kmlTag_nameSpaceOgc22 );
750 
751  QFile file( filename );
752  if ( !file.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) {
753  qCritical() << "Cannot write to " << file.fileName();
754  }
755 
756  if ( !writer.write( &file, document ) ) {
757  qCritical() << "Can not write to " << file.fileName();
758  }
759  file.close();
760 }
761 
762 Coordinate::Coordinate(float lon_, float lat_) : lon(lon_), lat(lat_)
763 {
764  // nothing to do
765 }
766 
767 }
768 
769 #include "OsmParser.moc"
GeoDataDocument.h
Marble::OsmRegion::setLongitude
void setLongitude(qreal longitude)
Definition: OsmRegion.cpp:62
Marble::Writer::addOsmRegion
virtual void addOsmRegion(const OsmRegion &region)=0
Marble::GeoDataLineStyle
specifies the style how lines are drawn
Definition: GeoDataLineStyle.h:36
Marble::Statistic::mergedWays
unsigned int mergedWays
Definition: tools/osm-addresses/OsmParser.h:140
QList::clear
void clear()
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::Coordinate::Coordinate
Coordinate(float lon=0.0, float lat=0.0)
Definition: tools/osm-addresses/OsmParser.cpp:762
Marble::ElementType
ElementType
Definition: tools/osm-addresses/OsmParser.h:32
Marble::OsmParser::m_coordinates
QHash< int, Coordinate > m_coordinates
Definition: tools/osm-addresses/OsmParser.h:167
Marble::GeoDataDocument::addStyleMap
void addStyleMap(const GeoDataStyleMap &map)
Add a stylemap to the stylemap storage.
Definition: GeoDataDocument.cpp:166
Marble::WayMerger
Definition: tools/osm-addresses/OsmParser.h:88
Marble::OsmPlacemark::EducationUniversity
Definition: OsmPlacemark.h:38
Marble::OsmPlacemark::PlacesIsland
Definition: OsmPlacemark.h:85
Marble::GeoDataDocument
A container for Features, Styles and in the future Schemas.
Definition: GeoDataDocument.h:65
Marble::Coordinate::lon
float lon
Definition: tools/osm-addresses/OsmParser.h:65
Marble::GeoDataLinearRing
A LinearRing that allows to store a closed, contiguous set of line segments.
Definition: GeoDataLinearRing.h:68
Marble::OsmRegion
A lightweight data structure to represent administrative regions like villages, cities, states, ...
Definition: OsmRegion.h:26
Marble::OsmPlacemark::Address
Definition: OsmPlacemark.h:34
QMap::values
QList< T > values() const
Marble::OsmParser::setCategory
void setCategory(Element &element, const QString &key, const QString &value)
Definition: tools/osm-addresses/OsmParser.cpp:622
Marble::OsmPlacemark::TransportAirport
Definition: OsmPlacemark.h:63
QVector::begin
iterator begin()
QList::push_back
void push_back(const T &value)
QColor::name
QString name() const
GeoDataPolygon.h
Marble::OsmPlacemark::TouristRuin
Definition: OsmPlacemark.h:58
Marble::Way::nodes
QList< int > nodes
Definition: tools/osm-addresses/OsmParser.h:80
Marble::OsmRegionTree::smallestRegionId
int smallestRegionId(const GeoDataCoordinates &coordinates) const
Definition: OsmRegionTree.cpp:82
Marble::OsmPlacemark::TouristTheatre
Definition: OsmPlacemark.h:59
Marble::OsmParser::writeKml
void writeKml(const QString &area, const QString &version, const QString &date, const QString &transport, const QString &payload, const QString &outputKml) const
Definition: tools/osm-addresses/OsmParser.cpp:703
Marble::Way
Definition: tools/osm-addresses/OsmParser.h:79
Marble::OsmRegion::geometry
const GeoDataPolygon & geometry() const
Definition: OsmRegion.cpp:102
Marble::OsmParser::node
GeoDataPoint * node(quint64 id)
Definition: src/plugins/runner/osm/OsmParser.cpp:71
Marble::OsmRegion::setName
void setName(const QString &name)
Definition: OsmRegion.cpp:52
Marble::OsmPlacemark::AccomodationHostel
Definition: OsmPlacemark.h:30
Marble::OsmPlacemark
A lightweight data structure to represent points of interest like addresses with support for serializ...
Definition: OsmPlacemark.h:24
QList::at
const T & at(int i) const
QFile::fileName
QString fileName() const
Marble::GeoDataColorStyle::setColor
void setColor(const QColor &value)
Set a new color.
Definition: GeoDataColorStyle.cpp:84
Marble::OsmParser::read
void read(const QFileInfo &file, const QString &areaName)
Definition: tools/osm-addresses/OsmParser.cpp:219
Marble::OsmPlacemark::setCategory
void setCategory(OsmCategory category)
Definition: OsmPlacemark.cpp:28
QList::removeAt
void removeAt(int i)
Marble::Element::houseNumber
QString houseNumber
Definition: tools/osm-addresses/OsmParser.h:56
GeoDataStyle.h
Marble::Node::lon
float lon
Definition: tools/osm-addresses/OsmParser.h:72
Marble::OsmRegionTree
Definition: OsmRegionTree.h:21
Marble::OsmOsmRegion::region
OsmRegion region
Definition: tools/osm-addresses/OsmParser.h:47
Marble::Writer
Definition: Writer.h:22
QColor::setAlpha
void setAlpha(int alpha)
Marble::OsmPlacemark::TransportTramStop
Definition: OsmPlacemark.h:75
Marble::OsmPlacemark::MoneyAtm
Definition: OsmPlacemark.h:48
QVector::first
T & first()
Marble::GeoDataStyleMap
a class to map different styles to one style
Definition: GeoDataStyleMap.h:38
Marble::OsmParser::polygon
GeoDataPolygon * polygon(quint64 id)
Definition: src/plugins/runner/osm/OsmParser.cpp:91
GeoDataExtendedData.h
Marble::GeoDataCoordinates::latitude
qreal latitude(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
retrieves the latitude of the GeoDataCoordinates object use the unit parameter to switch between Radi...
Definition: GeoDataCoordinates.cpp:751
Marble::OsmPlacemark::TransportSpeedCamera
Definition: OsmPlacemark.h:72
GeoDataLineStyle.h
QTime
Marble::Outer
Definition: tools/osm-addresses/OsmParser.h:41
Marble::OsmPlacemark::FoodBar
Definition: OsmPlacemark.h:39
QFile
Marble::GeoDataCoordinates::Degree
Definition: GeoDataCoordinates.h:66
Marble::OsmRegion::setAdminLevel
void setAdminLevel(int level)
Definition: OsmRegion.cpp:117
Marble::Oxygen::hotOrange4
QColor const hotOrange4
Definition: MarbleColors.h:86
Marble::Coordinate::lat
float lat
Definition: tools/osm-addresses/OsmParser.h:66
QList::size
int size() const
GeoWriter.h
Marble::OsmPlacemark::setName
void setName(const QString &name)
Definition: OsmPlacemark.cpp:38
Marble::moreImportantAdminArea
bool moreImportantAdminArea(const OsmRegion &a, const OsmRegion b)
Definition: tools/osm-addresses/OsmParser.cpp:61
Coordinate
Represents a coordinate with the properties of a name and coordinates.
Definition: Coordinate.h:28
Marble::OsmParser::m_relations
QHash< int, Relation > m_relations
Definition: tools/osm-addresses/OsmParser.h:173
Marble::OsmPlacemark::TransportAirportTerminal
Definition: OsmPlacemark.h:64
Marble::OsmPlacemark::TouristCinema
Definition: OsmPlacemark.h:55
QHash::iterator
GeoDataMultiGeometry.h
QMap::keys
QList< Key > keys() const
QObject::name
const char * name() const
Marble::GeoDataStyle
an addressable style group
Definition: GeoDataStyle.h:55
QTime::elapsed
int elapsed() const
Marble::OsmPlacemark::TransportRentalCar
Definition: OsmPlacemark.h:71
Marble::OsmPlacemark::setLatitude
void setLatitude(qreal latitude)
Definition: OsmPlacemark.cpp:88
Marble::OsmPlacemark::TransportTrainStation
Definition: OsmPlacemark.h:74
GeoDataFeature.h
QList::count
int count(const T &value) const
Marble::GeoDataPolygon::latLonAltBox
virtual const GeoDataLatLonAltBox & latLonAltBox() const
Returns the smallest latLonAltBox that contains the Polygon.
Definition: GeoDataPolygon.cpp:118
Marble::OsmPlacemark::TouristCastle
Definition: OsmPlacemark.h:54
Marble::OsmPlacemark::AccomodationMotel
Definition: OsmPlacemark.h:32
Marble::OsmPlacemark::AmenityLibrary
Definition: OsmPlacemark.h:35
OsmParser.h
Marble::OsmPlacemark::setRegionId
void setRegionId(int id)
Definition: OsmPlacemark.cpp:58
Marble::GeoDataFeature::setName
void setName(const QString &value)
Set a new name for this feature.
Definition: GeoDataFeature.cpp:549
Marble::Oxygen::aluminumGray4
QColor const aluminumGray4
Definition: MarbleColors.h:92
OsmRegionTree.h
Marble::OsmRegion::setLatitude
void setLatitude(qreal latitude)
Definition: OsmRegion.cpp:72
QHash
Marble::OsmPlacemark::FoodFastFood
Definition: OsmPlacemark.h:42
Marble::OsmPlacemark::AccomodationHotel
Definition: OsmPlacemark.h:31
KmlElementDictionary.h
Marble::OsmPlacemark::ShoppingBeverages
Definition: OsmPlacemark.h:50
QFileInfo::fileName
QString fileName() const
QObject
QList::isEmpty
bool isEmpty() const
QString::isEmpty
bool isEmpty() const
Marble::GeoDataLineStyle::setWidth
void setWidth(const float &width)
Set the width of the line.
Definition: GeoDataLineStyle.cpp:95
QString::trimmed
QString trimmed() const
QVector::remove
void remove(int i)
Marble::GeoWriter
Standard Marble way of writing XML This class is intended to be a standardised way of writing XML for...
Definition: GeoWriter.h:29
GeoDataLineString.h
Marble::OsmPlacemark::UnknownCategory
Definition: OsmPlacemark.h:28
Marble::Oxygen::sunYellow6
QColor const sunYellow6
Definition: MarbleColors.h:78
Marble::OsmPlacemark::HealthPharmacy
Definition: OsmPlacemark.h:47
Marble::OsmPlacemark::FoodRestaurant
Definition: OsmPlacemark.h:44
Marble::OsmRegion::name
QString name() const
Definition: OsmRegion.cpp:47
Marble::Element::street
QString street
Definition: tools/osm-addresses/OsmParser.h:55
Marble::Node
Definition: tools/osm-addresses/OsmParser.h:71
Marble::OsmPlacemark::MoneyBank
Definition: OsmPlacemark.h:49
Marble::GeoDataDocument::addStyle
void addStyle(const GeoDataStyle &style)
Add a style to the style storage.
Definition: GeoDataDocument.cpp:134
Marble::Oxygen::seaBlue2
QColor const seaBlue2
Definition: MarbleColors.h:64
QMultiMap::insert
QMap< Key, T >::iterator insert(const Key &key, const T &value)
Marble::OsmPlacemark::TouristViewPoint
Definition: OsmPlacemark.h:61
Marble::Oxygen::skyBlue4
QColor const skyBlue4
Definition: MarbleColors.h:56
QSet< QString >
Marble::OsmPlacemark::TouristMonument
Definition: OsmPlacemark.h:56
QList::first
T & first()
QString
QList
Marble::OsmPlacemark::HealthHospital
Definition: OsmPlacemark.h:46
QColor
Marble::OsmParser::OsmParser
OsmParser()
Definition: src/plugins/runner/osm/OsmParser.cpp:21
GeoDataPlacemark.h
Marble::Element
Definition: tools/osm-addresses/OsmParser.h:52
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
Marble::OsmPlacemark::latitude
qreal latitude() const
Latitude of the placemark's center point, in degree.
Definition: OsmPlacemark.cpp:83
Marble::OsmPlacemark::name
QString name() const
Placemark name.
Definition: OsmPlacemark.cpp:33
Marble::GeoDataPolygon::outerBoundary
GeoDataLinearRing & outerBoundary()
Returns the outer boundary that is represented as a LinearRing.
Definition: GeoDataPolygon.cpp:123
GeoDataStyleMap.h
Marble::GeoDataContainer::append
void append(GeoDataFeature *other)
add an element
Definition: GeoDataContainer.cpp:272
QPair
Marble::OsmPlacemark::HealthDoctors
Definition: OsmPlacemark.h:45
Marble::GeoDataLatLonBox::center
virtual GeoDataCoordinates center() const
returns the center of this box
Definition: GeoDataLatLonBox.cpp:276
Marble::OsmParser::shouldSave
bool shouldSave(ElementType type, const QString &key, const QString &value)
Definition: tools/osm-addresses/OsmParser.cpp:555
Marble::GeoDataFeature::setStyleUrl
void setStyleUrl(const QString &value)
Set the styleUrl of this feature to value.
Definition: GeoDataFeature.cpp:631
Marble::GeoDataMultiGeometry::append
void append(GeoDataGeometry *other)
add an element
Definition: GeoDataMultiGeometry.cpp:187
QFileInfo
Marble::kml::kmlTag_nameSpaceOgc22
const char * kmlTag_nameSpaceOgc22
Definition: KmlElementDictionary.cpp:34
QList::end
iterator end()
QVector::reserve
void reserve(int size)
Marble::GeoDataCoordinates::longitude
qreal longitude(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
retrieves the longitude of the GeoDataCoordinates object use the unit parameter to switch between Rad...
Definition: GeoDataCoordinates.cpp:739
Marble::GeoDataLatLonAltBox::center
virtual GeoDataCoordinates center() const
returns the center of this box
Definition: GeoDataLatLonAltBox.cpp:151
Marble::GeoWriter::setDocumentType
void setDocumentType(const QString &documentType)
Set the current document type.
Definition: GeoWriter.cpp:79
Marble::OsmPlacemark::EducationCollege
Definition: OsmPlacemark.h:36
GeoDataLinearRing.h
QFile::close
virtual void close()
Marble::Statistic::uselessWays
unsigned int uselessWays
Definition: tools/osm-addresses/OsmParser.h:141
Marble::OsmPlacemark::setLongitude
void setLongitude(qreal longitude)
Definition: OsmPlacemark.cpp:78
Marble::OsmPlacemark::TransportBusStop
Definition: OsmPlacemark.h:66
Marble::OsmPlacemark::TransportTaxiRank
Definition: OsmPlacemark.h:73
Marble::OsmPlacemark::FoodCafe
Definition: OsmPlacemark.h:41
Marble::OsmPlacemark::FoodPub
Definition: OsmPlacemark.h:43
Marble::OsmPlacemark::TouristMuseum
Definition: OsmPlacemark.h:57
GeoDataFolder.h
Marble::GeoDataStyle::setLineStyle
void setLineStyle(const GeoDataLineStyle &style)
set the line style
Definition: GeoDataStyle.cpp:107
QString::replace
QString & replace(int position, int n, QChar after)
Marble::Oxygen::brickRed4
QColor const brickRed4
Definition: MarbleColors.h:32
Marble::OsmPlacemark::TouristZoo
Definition: OsmPlacemark.h:62
QVector::at
const T & at(int i) const
Marble::OsmOsmRegion
Definition: tools/osm-addresses/OsmParser.h:45
Marble::GeoDataObject::id
QString id() const
Get the id of the object.
Definition: GeoDataObject.cpp:75
Marble::OsmPlacemark::longitude
qreal longitude() const
Longitude of the placemark's center point, in degree.
Definition: OsmPlacemark.cpp:73
Marble::GeoDataData
Definition: GeoDataData.h:26
Marble::Node::lat
float lat
Definition: tools/osm-addresses/OsmParser.h:73
Marble::OsmPlacemark::TransportRentalBicycle
Definition: OsmPlacemark.h:70
Marble::OsmParser::parse
virtual bool parse(const QFileInfo &file, int pass, bool &needAnotherPass)=0
direction
qreal direction
Definition: tools/osm-addresses/OsmParser.cpp:40
Marble::OsmParser::way
GeoDataLineString * way(quint64 id)
Definition: src/plugins/runner/osm/OsmParser.cpp:81
QVector
Marble::GeoDataObject::setId
void setId(const QString &value)
Set the id of the object.
Definition: GeoDataObject.cpp:80
Marble::GeoDataLineString::isEmpty
bool isEmpty() const
Returns whether the LineString has no nodes at all.
Definition: GeoDataLineString.cpp:133
Marble::GeoDataExtendedData::addValue
void addValue(const GeoDataData &data)
add a data object to the GeoDataExtendedData with the key
Definition: GeoDataExtendedData.cpp:71
Marble::Way::setPosition
void setPosition(const QHash< int, Coordinate > &database, OsmPlacemark &placemark) const
Definition: tools/osm-addresses/OsmParser.cpp:151
Marble::OsmPlacemark::TransportFuel
Definition: OsmPlacemark.h:68
Marble::OsmPlacemark::TransportCarShare
Definition: OsmPlacemark.h:67
QHash::isEmpty
bool isEmpty() const
Marble::OsmPlacemark::ShoppingHifi
Definition: OsmPlacemark.h:51
Marble::OsmPlacemark::AccomodationCamping
Definition: OsmPlacemark.h:29
Marble::Coordinate
Definition: tools/osm-addresses/OsmParser.h:64
Marble::OsmPlacemark::ShoppingSupermarket
Definition: OsmPlacemark.h:52
QList::last
T & last()
Marble::Element::name
QString name
Definition: tools/osm-addresses/OsmParser.h:54
Marble::Inner
Definition: tools/osm-addresses/OsmParser.h:42
QSet::fromList
QSet< T > fromList(const QList< T > &list)
Marble::Oxygen::forestGreen4
QColor const forestGreen4
Definition: MarbleColors.h:74
Marble::OsmRegion::adminLevel
int adminLevel() const
Definition: OsmRegion.cpp:112
Marble::GeoDataMultiGeometry
Definition: GeoDataMultiGeometry.h:33
Marble::OsmRegion::identifier
int identifier() const
Unique (per process) region identifier.
Definition: OsmRegion.cpp:27
Marble::OsmRegion::setIdentifier
void setIdentifier(int identifier)
Identifier change.
Definition: OsmRegion.cpp:32
Marble::OsmPlacemark::setHouseNumber
void setHouseNumber(const QString &houseNumber)
Definition: OsmPlacemark.cpp:48
QVector::push_back
void push_back(const T &value)
Marble::Writer::addOsmPlacemark
virtual void addOsmPlacemark(const OsmPlacemark &placemark)=0
QTime::start
void start()
QMap::insert
iterator insert(const Key &key, const T &value)
QHash::contains
bool contains(const Key &key) const
Marble::GeoWriter::write
bool write(QIODevice *device, const GeoNode *feature)
The main API call to use the XML writer.
Definition: GeoWriter.cpp:28
Marble::OsmPlacemark::TransportBusStation
Definition: OsmPlacemark.h:65
Marble::GeoDataFeature::extendedData
GeoDataExtendedData & extendedData() const
Return the ExtendedData assigned to the feature.
Definition: GeoDataFeature.cpp:743
QMultiMap
Marble::OsmParser::addWriter
void addWriter(Writer *writer)
Definition: tools/osm-addresses/OsmParser.cpp:118
Marble::OsmPlacemark::TransportParking
Definition: OsmPlacemark.h:69
Marble::Element::city
QString city
Definition: tools/osm-addresses/OsmParser.h:57
QObject::parent
QObject * parent() const
QVector::size
int size() const
Marble::Element::category
OsmPlacemark::OsmCategory category
Definition: tools/osm-addresses/OsmParser.h:58
Marble::Oxygen::woodBrown4
QColor const woodBrown4
Definition: MarbleColors.h:26
Marble::OsmPlacemark::TouristThemePark
Definition: OsmPlacemark.h:60
QVector::end
iterator end()
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
Marble::OsmPlacemark::TouristAttraction
Definition: OsmPlacemark.h:53
Marble::GeoDataPolygon::setOuterBoundary
void setOuterBoundary(const GeoDataLinearRing &boundary)
Sets the given LinearRing as an outer boundary of the Polygon.
Definition: GeoDataPolygon.cpp:133
QList::begin
iterator begin()
Marble::OsmPlacemark::FoodBiergarten
Definition: OsmPlacemark.h:40
Marble::GeoDataLineString::latLonAltBox
virtual const GeoDataLatLonAltBox & latLonAltBox() const
Returns the smallest latLonAltBox that contains the LineString.
Definition: GeoDataLineString.cpp:580
Marble::OsmPlacemark::PlacesRegion
Definition: OsmPlacemark.h:76
Marble::Element::save
bool save
Definition: tools/osm-addresses/OsmParser.h:53
Marble::Way::setRegion
void setRegion(const QHash< int, Node > &database, const OsmRegionTree &tree, QList< OsmOsmRegion > &osmOsmRegions, OsmPlacemark &placemark) const
Definition: tools/osm-addresses/OsmParser.cpp:182
Marble::GeoDataLatLonBox
A class that defines a 2D bounding box for geographic data.
Definition: GeoDataLatLonBox.h:51
coordinate
Coordinate coordinate
Definition: tools/osm-addresses/OsmParser.cpp:39
Marble::OsmPlacemark::EducationSchool
Definition: OsmPlacemark.h:37
Marble::GeoDataPlacemark::setGeometry
void setGeometry(GeoDataGeometry *entry)
Sets the current Geometry of this Placemark.
Definition: GeoDataPlacemark.cpp:230
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal