[Marble-devel] Drawing Placemarks - with a name.
Miguel Chavez Gamboa
miguel.chavez.gamboa at gmail.com
Wed Dec 22 04:22:57 CET 2010
Hi,
Im using marble lib from the svn, latest revision, and I would like to know
about the placemarks.
I want to set Placemarks on the marble widget with the names of points in a
route (programatically), like the runners example in the techbase to mark a
point somewhere with a label and a dot.
I have viewed the marble code and the techbase runners Example to get some
clues, and I wrote the next code:
void MainWindow::setPlaces()
{
QVector<GeoDataPlacemark *> *vector = new QVector<GeoDataPlacemark *>;
foreach ( LCDestinationInfo point, viaPoints ) {
GeoDataPlacemark *placemark = new GeoDataPlacemark( point.name );
placemark->setCoordinate( GeoDataPoint( point.gdCoordinate ) );
placemark->setDescription("Add a description!");
GeoDataLookAt *lookAt = new GeoDataLookAt( theMap->lookAt() ) ;
lookAt->setLatitude( point.gdCoordinate.latitude() );
lookAt->setLongitude( point.gdCoordinate.longitude() );
placemark->setLookAt( lookAt );
vector->append( placemark );
}
MarblePlacemarkModel *placemarkModel =
static_cast<MarblePlacemarkModel*>( theMap->placemarkModel() );
placemarkModel->setPlacemarkContainer( vector );
}
The code runs without problems, nothing is painted on the map at the
locations. After the application's window lost focus (i launch a
calculator or show the yakuake window), the program crashes.This make
me think about an update in the marble widget and the inserted
placemarks making some unexpected thing together.
Maybe im not using the right class (GeoDataPlacemark). I have seen on the
documentation the classes VisiblePlacemark, PlacemarkLayout, and
PlacemarkPainter, but i could not find how to use them.
I also tried to use marbleWidget's addPlacemarkFile() method (and did
further tests with marble -the application- opening a kml file) with sample
xml <http://code.google.com/apis/kml/documentation/kml_tut.html#placemarks>from
google kml documentation, but nothing is rendered on the map (i think
the placemarks are not visible or not drawn, just added invisible placemarks
-like bookmarks-). I noted that if i placed placemarks with a
path<http://code.google.com/apis/kml/documentation/kml_tut.html#paths>
the
path is drawn on the map (with the addPlacemarkFile() method), which makes
me think that drawing
Placemarks<http://code.google.com/apis/kml/documentation/kml_tut.html#placemarks>is
not implemented in marble when loading placemarks from kml files.
I also found PlacemarkTextAnnotation class, and the osmannotate plugin but
this is not compiled (commented on the CMakeLists.txt). Is it not finished?
I found a video <http://www.youtube.com/watch?v=hTKc546-gjQ> that shows
annotations, a feature near to what i want... but that seems to be old (1
year) and not present on the marble source code. And a blog post about
adding annotations for a GSOC
project<http://techespanto.wordpress.com/2010/05/05/gsoc-10-proposal-adding-bookmark-and-annotation-feature-in-kde-marble/>
(some
months ago).
Well, any help will be appreciated.
Thanks.
--
Miguel Chavez Gamboa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/marble-devel/attachments/20101221/c9ab83ec/attachment.htm
More information about the Marble-devel
mailing list