[Marble-devel] Adding placemarks using Marble bindings for Python
Dennis Nienhüser
earthwings at gentoo.org
Fri Jul 19 14:16:41 UTC 2013
Hi,
your approach looks right to me. The Python bindings indeed lack the
treeModel (and some other) methods. I created bug 322573 [0] to track it
down. Hopefully we can extend them to cover more of our API.
Regards,
Dennis
[0] https://bugs.kde.org/show_bug.cgi?id=322573
On 09.01.2013 17:54, Jes Sik wrote:
> Hello,
>
> I'm developing a small application using Python bindings for
> Marble. I want my application to gather some geographic data from a
> database and pinpoint several coordinates in a map.
>
> As far as I understand, such can be achieved by the use of
> /placemarks/, as explained in this fragment of code extracted from one
> of the Marble Tutorials
> <http://http://techbase.kde.org/Projects/Marble/Runners/DisplayGeoDataPlacemark>,
> where /GeoDataPlacemarks/are instantiated and then added to a
> /GeoDataDocument/that will later render them in the map.
>
> GeoDataPlacemark *place = new GeoDataPlacemark( "Bucharest" );
> place->setCoordinate( 25.97, 44.43, 0.0, GeoDataCoordinates::Degree );
> place->setPopulation( 1877155 );
> place->setCountryCode ( "Romania" );
>
>
> GeoDataDocument *document = new GeoDataDocument;
> document->append( place );
>
> // Add the document to MarbleWidget's tree model
> mapWidget->model()->treeModel()->addDocument( document );
>
> Trying to reproduce these lines of code in Python have proven to
> be unsuccesful. The MarbleWidget.model() doesn't seem to have the
> corresponding treeModel(). Even so, looking at the /MarbleModel.sip
> files/ inside the Marble source code, the /treeModel/ attribute is
> commented.
>
> This is a small snippet of the code I'm using, which would be
> equivalent to the one above.
>
> mapWidget = Marble.MarbleWidget()
> mapWidget.resize(800,600)
>
> place = Marble.GeoDataPlacemark( "Bucharest" )
> place.setCoordinate( 25.97, 44.43, 0.0,
> Marble.GeoDataCoordinates.Degree )
> place.setPopulation( 1877155 )
> place.setCountryCode ( "Romania" )
>
> document = Marble.GeoDataDocument()
> document.append( place )
>
> mapWidget.model().treeModel().addDocument(document) --> this
> is where the compiler warns there is no tree model attribute
>
>
>
> My question is whether the addition of placemarks can be done
> using python bindings, and if so, whether my approach is correct or
> if there is another way to do it.
>
> Thanks in advance,
>
> Jess
>
>
> _______________________________________________
> Marble-devel mailing list
> Marble-devel at kde.org
> https://mail.kde.org/mailman/listinfo/marble-devel
More information about the Marble-devel
mailing list