本文整理汇总了C++中GeoDataDocument::placemarkList方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoDataDocument::placemarkList方法的具体用法?C++ GeoDataDocument::placemarkList怎么用?C++ GeoDataDocument::placemarkList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoDataDocument
的用法示例。
在下文中一共展示了GeoDataDocument::placemarkList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: simpleParseTest
void TestGxTimeStamp::simpleParseTest()
{
QString const centerContent (
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<kml xmlns=\"http://www.opengis.net/kml/2.2\""
" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">"
"<Document>"
"<Placemark>"
"<Camera>"
"<gx:TimeStamp>"
"<when>1987-06-05T04:03:02-01:00</when>"
"</gx:TimeStamp>"
"</Camera>"
"</Placemark>"
"</Document>"
"</kml>" );
GeoDataDocument* dataDocument = parseKml( centerContent );
QCOMPARE( dataDocument->placemarkList().size(), 1 );
GeoDataPlacemark *placemark = dataDocument->placemarkList().at( 0 );
GeoDataAbstractView* view = placemark->abstractView();
QVERIFY( view != 0 );
GeoDataCamera* camera = dynamic_cast<GeoDataCamera*>( view );
QVERIFY( camera != 0 );
QCOMPARE( camera->timeStamp().when().toUTC(), QDateTime::fromString( "1987-06-05T04:03:02-01:00", Qt::ISODate).toUTC() );
delete dataDocument;
}
示例2: simpleParseTest
void TestGxTimeSpan::simpleParseTest()
{
QString const centerContent (
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<kml xmlns=\"http://www.opengis.net/kml/2.2\""
" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">"
"<Document>"
"<Placemark>"
"<LookAt>"
"<gx:TimeSpan>"
"<begin>2010-05-28T02:02:09Z</begin>"
"<end>2010-05-28T02:02:56Z</end>"
"</gx:TimeSpan>"
"</LookAt>"
"</Placemark>"
"</Document>"
"</kml>" );
GeoDataDocument* dataDocument = parseKml( centerContent );
QCOMPARE( dataDocument->placemarkList().size(), 1 );
GeoDataPlacemark *placemark = dataDocument->placemarkList().at( 0 );
QVERIFY( placemark->lookAt() != 0 );
QCOMPARE( placemark->lookAt()->timeSpan().begin().when(), QDateTime::fromString( "2010-05-28T02:02:09Z", Qt::ISODate) );
QCOMPARE( placemark->lookAt()->timeSpan().end().when(), QDateTime::fromString( "2010-05-28T02:02:56Z", Qt::ISODate) );
delete dataDocument;
}
示例3: parseBoundingBox
void MonavMap::parseBoundingBox( const QFileInfo &file )
{
GeoDataLineString points;
bool tooLarge = false;
QFile input( file.absoluteFilePath() );
if ( input.open( QFile::ReadOnly ) ) {
GeoDataParser parser( GeoData_KML );
if ( !parser.read( &input ) ) {
mDebug() << "Could not parse file: " << parser.errorString();
return;
}
GeoDocument *doc = parser.releaseDocument();
input.close();
GeoDataDocument *document = dynamic_cast<GeoDataDocument*>( doc );
QVector<GeoDataPlacemark*> placemarks = document->placemarkList();
if ( placemarks.size() == 1 ) {
GeoDataPlacemark* placemark = placemarks.first();
m_name = placemark->name();
m_version = placemark->extendedData().value( "version" ).value().toString();
m_date = placemark->extendedData().value( "date" ).value().toString();
m_transport = placemark->extendedData().value( "transport" ).value().toString();
m_payload = placemark->extendedData().value( "payload" ).value().toString();
GeoDataMultiGeometry* geometry = dynamic_cast<GeoDataMultiGeometry*>( placemark->geometry() );
if ( geometry->size() > 1500 ) {
tooLarge = true;
}
for ( int i = 0; geometry && i < geometry->size(); ++i ) {
GeoDataLinearRing* poly = dynamic_cast<GeoDataLinearRing*>( geometry->child( i ) );
if ( poly ) {
for ( int j = 0; j < poly->size(); ++j ) {
points << poly->at( j );
}
m_tiles.push_back( *poly );
}
if ( poly->size() > 1500 ) {
tooLarge = true;
}
}
} else {
mDebug() << "File " << file.absoluteFilePath() << " does not contain one placemark, but " << placemarks.size();
}
delete doc;
}
m_boundingBox = points.latLonAltBox();
if ( tooLarge ) {
// The bounding box polygon is rather complicated, therefore not allowing a quick check
// and also occupying memory. Discard the polygon and only store the rectangular bounding
// box. Only happens for non-simplified bounding box polygons.
mDebug() << "Discarding too large bounding box poylgon for " << file.absoluteFilePath() << ". Please check for a map update.";
m_tiles.clear();
}
}
示例4: initialize
void RouteSimulationPositionProviderPlugin::initialize()
{
m_currentIndex = -1;
m_lineString.clear();
GeoDataDocument* document = const_cast<MarbleModel *>( marbleModel() )->routingManager()->alternativeRoutesModel()->currentRoute();
if ( document && document->size() > 0 ) {
foreach( const GeoDataPlacemark *placemark, document->placemarkList() ) {
GeoDataGeometry* geometry = placemark->geometry();
GeoDataLineString* lineString = dynamic_cast<GeoDataLineString*>( geometry );
if ( lineString ) {
m_lineString << *lineString;
}
}
}
示例5: simpleParseTest
void TestTimeStamp::simpleParseTest()
{
QString const centerContent (
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<kml xmlns=\"http://www.opengis.net/kml/2.2\""
" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">"
"<Document>"
"<Placemark><TimeSpan><begin>1988</begin><end>1999</end></TimeSpan></Placemark>"
"<Placemark><TimeSpan><begin>1989-04</begin><end>1999-05</end></TimeSpan></Placemark>"
"<Placemark><TimeSpan><begin>1990-02-03</begin><end>1999-04-08</end></TimeSpan></Placemark>"
"<Placemark><TimeSpan><begin>1997-07-16T07:30:15Z</begin><end>1997-08-17T02:35:12Z</end></TimeSpan></Placemark>"
"<Placemark><TimeSpan><begin>1997-07-16T10:30:15+03:00</begin><end>1998-07-16T10:30:15+03:00</end></TimeSpan></Placemark>"
"</Document>"
"</kml>" );
GeoDataDocument* dataDocument = parseKml( centerContent );
QCOMPARE( dataDocument->placemarkList().size(), 5 );
GeoDataPlacemark* placemark1 = dataDocument->placemarkList().at( 0 );
QCOMPARE( placemark1->timeSpan().begin().when().date().year(), 1988 );
QCOMPARE( placemark1->timeSpan().end().when().date().year(), 1999 );
GeoDataPlacemark* placemark2 = dataDocument->placemarkList().at( 1 );
QCOMPARE( placemark2->timeSpan().begin().when().date().year(), 1989 );
QCOMPARE( placemark2->timeSpan().begin().when().date().month(), 4 );
QCOMPARE( placemark2->timeSpan().end().when().date().year(), 1999 );
QCOMPARE( placemark2->timeSpan().end().when().date().month(), 5 );
GeoDataPlacemark* placemark3 = dataDocument->placemarkList().at( 2 );
QCOMPARE( placemark3->timeSpan().begin().when().date().year(), 1990 );
QCOMPARE( placemark3->timeSpan().begin().when().date().month(), 2 );
QCOMPARE( placemark3->timeSpan().begin().when().date().day(), 3 );
QCOMPARE( placemark3->timeSpan().end().when().date().year(), 1999 );
QCOMPARE( placemark3->timeSpan().end().when().date().month(), 4 );
QCOMPARE( placemark3->timeSpan().end().when().date().day(), 8 );
GeoDataPlacemark* placemark4 = dataDocument->placemarkList().at( 3 );
QCOMPARE( placemark4->timeSpan().begin().when(), QDateTime::fromString( "1997-07-16T07:30:15Z", Qt::ISODate ) );
QCOMPARE( placemark4->timeSpan().end().when(), QDateTime::fromString( "1997-08-17T02:35:12Z", Qt::ISODate ) );
GeoDataPlacemark* placemark5 = dataDocument->placemarkList().at( 4 );
QCOMPARE( placemark5->timeSpan().begin().when(), QDateTime::fromString( "1997-07-16T10:30:15+03:00", Qt::ISODate ) );
QCOMPARE( placemark5->timeSpan().end().when(), QDateTime::fromString( "1998-07-16T10:30:15+03:00", Qt::ISODate ) );
delete dataDocument;
}
示例6: simpleParseTest
void TestModel::simpleParseTest()
{
QString const centerContent (
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<kml xmlns=\"http://www.opengis.net/kml/2.2\">"
"<Placemark>"
"<Model id=\"model_4\">"
"<altitudeMode>relativeToGround</altitudeMode>"
"<Location>"
"<longitude>-105.27</longitude>"
"<latitude>40.00</latitude>"
"<altitude>23.4</altitude>"
"</Location>"
"<Orientation>"
"<heading>1</heading>"
"<tilt>2</tilt>"
"<roll>3</roll>"
"</Orientation>"
"<Scale>"
"<x>3</x>"
"<y>4</y>"
"<z>5</z>"
"</Scale>"
"<Link>"
"<href>MackyBldg.kmz/files/CU Macky.dae</href>"
"<refreshMode>onExpire</refreshMode>"
"</Link>"
"<ResourceMap id=\"resourcemap_for_model_4\">"
"<Alias>"
"<sourceHref>../files/CU-Macky-4sideturretnoCulling.jpg</sourceHref>"
"<targetHref>../files/CU-Macky-4sideturretnoCulling.jpg</targetHref>"
"</Alias>"
"</ResourceMap>"
"</Model>"
"</Placemark>"
"</kml>" );
GeoDataDocument* dataDocument = parseKml( centerContent );
QCOMPARE( dataDocument->placemarkList().size(), 1 );
GeoDataPlacemark *placemark = dataDocument->placemarkList().at( 0 );
GeoDataModel *model = dynamic_cast<GeoDataModel*>( placemark->geometry() );
QVERIFY( model != 0 );
QCOMPARE( model->altitudeMode(), RelativeToGround);
QCOMPARE( model->location().altitude(), 23.4);
QCOMPARE( model->location().latitude(GeoDataCoordinates::Degree), 40.00 );
QCOMPARE( model->location().longitude(GeoDataCoordinates::Degree), -105.27 );
QCOMPARE( model->orientation().heading(), 1.0);
QCOMPARE( model->orientation().tilt(), 2.0);
QCOMPARE( model->orientation().roll(), 3.0);
QCOMPARE( model->scale().x(), 3.0);
QCOMPARE( model->scale().y(), 4.0);
QCOMPARE( model->scale().z(), 5.0);
QCOMPARE( model->link().href(), QString("MackyBldg.kmz/files/CU Macky.dae"));
QCOMPARE( model->link().refreshMode(), GeoDataLink::OnExpire );
QCOMPARE( model->targetHref(), QString("../files/CU-Macky-4sideturretnoCulling.jpg"));
QCOMPARE( model->sourceHref(), QString("../files/CU-Macky-4sideturretnoCulling.jpg"));
delete dataDocument;
}
示例7: simpleParseTest
void TestTrack::simpleParseTest()
{
//example track recorded using a Garmin Vista HCx and downloaded using gpsbabel
QString content(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<gpx"
" version=\"1.0\""
" creator=\"GPSBabel - http://www.gpsbabel.org\""
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
" xmlns=\"http://www.topografix.com/GPX/1/0\""
" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\">"
"<time>2011-07-03T14:19:57Z</time>"
"<bounds minlat=\"47.231073193\" minlon=\"12.549449634\" maxlat=\"48.502999926\" maxlon=\"14.302069964\"/>"
"<trk>"
" <name>test track</name>"
"<number>1</number>"
"<trkseg>"
"<trkpt lat=\"47.231477033\" lon=\"12.560534449\">"
" <ele>1130.647705</ele>"
" <time>2011-06-24T10:33:40Z</time>"
"</trkpt>"
"<trkpt lat=\"47.231486840\" lon=\"12.560604354\">"
" <ele>1127.763672</ele>"
" <time>2011-06-24T10:33:55Z</time>"
"</trkpt>"
"<trkpt lat=\"47.231497569\" lon=\"12.560612401\">"
" <ele>1121.995850</ele>"
" <time>2011-06-24T10:34:00Z</time>"
"</trkpt>"
"</trkseg>"
"</trk>"
"</gpx>"
);
GpxParser parser;
QByteArray array( content.toUtf8() );
QBuffer buffer( &array );
buffer.open( QIODevice::ReadOnly );
qDebug() << "Buffer content:" << endl << buffer.buffer();
if ( !parser.read( &buffer ) ) {
QFAIL( "Could not parse data!" );
return;
}
GeoDocument* document = parser.releaseDocument();
QVERIFY( document );
GeoDataDocument *dataDocument = static_cast<GeoDataDocument*>( document );
GeoDataPlacemark* placemark = dataDocument->placemarkList().at( 0 );
QCOMPARE( placemark->geometry()->geometryId(), GeoDataMultiGeometryId );
GeoDataMultiGeometry* multiGeo = static_cast<GeoDataMultiGeometry*>( placemark->geometry() );
GeoDataTrack* track = static_cast<GeoDataTrack*>( &multiGeo->at( 0 ) );
QCOMPARE( track->size(), 3 );
{
QDateTime when = track->whenList().at( 0 );
QCOMPARE( when, QDateTime( QDate( 2011, 6, 24 ), QTime( 10, 33, 40 ), Qt::UTC ) );
}
{
GeoDataCoordinates coord = track->coordinatesAt( 0 );
QCOMPARE( coord.longitude( GeoDataCoordinates::Degree ), 12.560534449 );
QCOMPARE( coord.latitude( GeoDataCoordinates::Degree ), 47.231477033 );
QCOMPARE( coord.altitude(), 1130.647705 );
}
{
GeoDataCoordinates coord = track->coordinatesAt( QDateTime( QDate( 2011, 6, 24 ), QTime( 10, 33, 40 ), Qt::UTC ) );
QCOMPARE( coord.longitude( GeoDataCoordinates::Degree ), 12.560534449 );
QCOMPARE( coord.latitude( GeoDataCoordinates::Degree ), 47.231477033 );
QCOMPARE( coord.altitude(), 1130.647705 );
}
{
const GeoDataLineString* lineString = track->lineString();
QCOMPARE( lineString->size(), 3 );
GeoDataCoordinates coord = lineString->at( 0 );
QCOMPARE( coord.longitude( GeoDataCoordinates::Degree ), 12.560534449 );
QCOMPARE( coord.latitude( GeoDataCoordinates::Degree ), 47.231477033 );
QCOMPARE( coord.altitude(), 1130.647705 );
}
delete document;
}
示例8: extendedDataHeartRateTest
void TestTrack::extendedDataHeartRateTest()
{
//example track recorded using a Garmin Oregon 450 and downloading using it's USB mass storare mode
QString content(
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
"<gpx xmlns=\"http://www.topografix.com/GPX/1/1\" "
" xmlns:gpxx=\"http://www.garmin.com/xmlschemas/WaypointExtension/v1\" "
" xmlns:gpxtrx=\"http://www.garmin.com/xmlschemas/GpxExtensions/v3\" "
" xmlns:gpxtpx=\"http://www.garmin.com/xmlschemas/TrackPointExtension/v1\" "
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
" creator=\"Oregon 450\" "
" version=\"1.1\" "
" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 "
"http://www.topografix.com/GPX/1/1/gpx.xsd "
"http://www.garmin.com/xmlschemas/WaypointExtension/v1 "
"http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd "
"http://www.garmin.com/xmlschemas/TrackPointExtension/v1 "
"http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd\" "
" >"
" <metadata>"
" <link href=\"http://www.garmin.com\">"
" <text>Garmin International</text>"
" </link>"
" <time>2011-10-29T15:29:19Z</time>"
" </metadata>"
" <trk>"
" <name>29-OKT-11 17:29:17</name>"
" <extensions>"
" <gpxtrx:TrackExtension>"
" <gpxtrx:DisplayColor>Black</gpxtrx:DisplayColor>"
" </gpxtrx:TrackExtension>"
" </extensions>"
" <trkseg>"
" <trkpt lat=\"47.951347\" lon=\"13.228035\">"
" <ele>571.16</ele>"
" <time>2011-10-29T08:35:31Z</time>"
" <extensions>"
" <gpxtpx:TrackPointExtension>"
" <gpxtpx:hr>108</gpxtpx:hr>"
" </gpxtpx:TrackPointExtension>"
" </extensions>"
" </trkpt>"
" <trkpt lat=\"47.951348\" lon=\"13.228035\">"
" <ele>573.56</ele>"
" <time>2011-10-29T08:35:37Z</time>"
" <extensions>"
" <gpxtpx:TrackPointExtension>"
" <gpxtpx:hr>109</gpxtpx:hr>"
" </gpxtpx:TrackPointExtension>"
" </extensions>"
" </trkpt>"
" <trkpt lat=\"47.951349\" lon=\"13.228036\">"
" <ele>572.12</ele>"
" <time>2011-10-29T08:35:43Z</time>"
" <extensions>"
" <gpxtpx:TrackPointExtension>"
" <gpxtpx:hr>110</gpxtpx:hr>"
" </gpxtpx:TrackPointExtension>"
" </extensions>"
" </trkpt>"
" </trkseg>"
" </trk>"
"</gpx>"
);
GpxParser parser;
QByteArray array( content.toUtf8() );
QBuffer buffer( &array );
buffer.open( QIODevice::ReadOnly );
qDebug() << "Buffer content:" << endl << buffer.buffer();
if ( !parser.read( &buffer ) ) {
QFAIL( "Could not parse data!" );
return;
}
GeoDocument* document = parser.releaseDocument();
QVERIFY( document );
GeoDataDocument *dataDocument = static_cast<GeoDataDocument*>( document );
GeoDataPlacemark* placemark = dataDocument->placemarkList().at( 0 );
QCOMPARE( placemark->geometry()->geometryId(), GeoDataMultiGeometryId );
GeoDataMultiGeometry* multiGeo = static_cast<GeoDataMultiGeometry*>( placemark->geometry() );
GeoDataTrack* track = static_cast<GeoDataTrack*>( &multiGeo->at( 0 ) );
QCOMPARE( track->size(), 3 );
{
GeoDataSimpleArrayData* hr = track->extendedData().simpleArrayData( "heartrate" );
QCOMPARE( hr->size(), 3 );
QCOMPARE( hr->valueAt( 0 ), QVariant( "108" ) );
QCOMPARE( hr->valueAt( 2 ), QVariant( "110" ) );
}
delete document;
}