[Marble-devel] Re: RoutingModel.h missing?

Dennis Nienhüser earthwings at gentoo.org
Mon Oct 11 22:33:41 CEST 2010


 Hi Miguel,

the A and B points are indeed forced by the current RoutingWidget. This
is ugly for a programming interface, so I'll change it soon. For the
time being you can call setPosition(0, source) and setPosition(1,
destination) instead of appending to the route request.

I hope I'll find some time in the next days to improve it and write a
little techbase tutorial on it.

Regards,
Dennis

On 08.10.2010 07:48, Miguel Chavez Gamboa wrote:
> Hi again, i hope this mail does not get splitted like the others.
>
> I modified the CMakeList.txt, to install the missing headers. Used the
> next code, but on the map the route is not shown, just the source (A)
> and Destination (B) Points are drawn. 
>
> ---Code---
>
> connect(theMap->model()->routingManager()->routingModel(),
> SIGNAL(routeCalculated(int)), SLOT(routeCalculated(int)));
> connect(theMap->model()->routingManager(),
> SIGNAL(routeRetrieved(GeoDataDocument*)),
> SLOT(routeRetrieved(GeoDataDocument*)));
>
> RouteRequest * request =
> theMap->model()->routingManager()->routeRequest();
> request->setRoutePreference(RouteRequest::Pedestrian);
> GeoDataCoordinates source( -118.14498, 34.0259, 0.0,
> GeoDataCoordinates::Degree );
> request->append(source);
> GeoDataCoordinates destination( -118.0918, 34.0230, 0.0,
> GeoDataCoordinates::Degree );
> request->append(destination);
> theMap->model()->routingManager()->retrieveRoute( request );
> int routeCount =
> theMap->model()->routingManager()->routingModel()->rowCount();
>
> ---Code---
>
> The routeRetrieved signal from ther RoutingManager is emitted, the
> routeCount gets 0, and routingModel's signal routeCalculated(int) is
> not emitted. 
> Why? Am I missing something to calcuate the route?
>
> If I use the MarbleControlBox and I enable its routing tab, in the
> routing tab, i can see four "points", A,B,C and D, I suppose because
> of the RouteRequest->Add(). And if I remove by hand the A and B which
> are not drawn (i cant see them in all the globe), everything works fine.
>
> But if i do not remove the A and B points (sources and destination
> that I think are set by the MarbleControlBox), and set the work
> Offline (of the RoutingManager) as:
>
> 1.- setWorkOffline(true): I can see the "Get Directions" button with a
> couple of circles spinning, which i can think it is busy getting the
> route directions, and it never finishes, it gets the street names,
> city,etc... A and B are empty, my added points are C and D, which i
> think this is the reason.
>
> 2.- setWorkOffline(false), It gets a "0.0 km (Yours)", it gets the
> street names, city,etc... but no route is calculated (again, A and B
> are empty, B and C are my added points).
>
> How can i programatically remove the empty positions A and B or
> replace the empty ones by the source and destination coordinates i
> created? I tried with RouteRequest->remove() but did not worked.
>
> My intention is not to use the MarbleControlBox, because user
> intervention is not needed in my application, the source and
> destination points are taken from a database and should be set
> programatically.
>
> Thanks for your help.
>
> On Thu, Oct 7, 2010 at 1:07 AM, Dennis Nienhüser
> <earthwings at gentoo.org <mailto:earthwings at gentoo.org>> wrote:
>
>     Hi,
>
>     the routing related classes are not yet exported: There'll be some
>     API changes
>     in them in the near future that will change the way route request
>     options are
>     set and some other changes to make it easily usable from the
>     outside. I want
>     to export them for KDE 4.6, however, to support that kind of usage.
>
>     If you're willing to adapt your code to any API changes, you can
>     manually
>     export the missing headers (RoutingModel, RoutingManager,
>     RouteRequest may be
>     enough) now. I haven't fully tested that yet, YMMV. It's probably
>     a good idea
>     to CC yourself to bug 248086 [1] which I'll update with the
>     progress on this.
>     Note that the code posted in comment #1 in that bug is already a
>     bit outdated,
>     RouteSkeleton is now RouteRequest and shouldn't be created on its
>     own, but
>     requested from the RoutingManager.
>
>     Regards,
>     Dennis
>
>     [1] https://bugs.kde.org/show_bug.cgi?id=248086
>
>     Am Donnerstag, 7. Oktober 2010, um 06:03:50 schrieb Miguel Chavez
>     Gamboa:
>     > Hi,
>     >
>     >
>     > Sorry for the inconvenience caused by my previous mail with
>     formated text,
>     > this goes in plain text.
>     >
>     >
>     > Im trying to incorporate marble and its new offline routing
>     capabilities in
>     > my own project, and Im reading the marble source code and the
>     > documentation. From the marble source code, i got some code to
>     start and
>     > experiment.
>     >
>     > The next code (adapted from marble source) is causing me some
>     troubles.
>     >
>     > RoutingManager *routingManager = theMap->model()->routingManager();
>     > RoutingModel   *routingModel   = routingManager->routingModel();
>     > bool hasRoute = routingModel->rowCount(); //here is the problem
>     >
>     > My includes are:
>     >
>     > #include <marble/global.h>
>     > #include <marble/MarbleModel.h>
>     > #include <marble/RoutingManager.h>
>     >
>     > The third line (getting the rowCount), causes the compilation to
>     fail with
>     > the error:
>     > error: invalid use of incomplete type ‘struct Marble::RoutingModel’
>     > As I have seen, the RoutingModel Class is defined (as Class
>     RoutingModel;)
>     >  in RoutingManager.h, but included in the ControlView.cpp file as '
>     > #include "routing/RoutingModel.h" ' .
>     >
>     > Are the "routing"-folder headers  inside the marble lib sources not
>     > installed (at /usr/include/marble) ?
>     > Is this intentional, only for the Marble application (not the
>     library) ?
>     >
>     > What is the correct way to incorporate routing capabilities to
>     another
>     > application? What Classes to use? The RoutingManager?
>     >
>     >
>     > Im using the marble code from the anonymous kde svn repository
>     (svn://
>     > anonsvn.kde.org/home/kde/trunk/KDE/kdeedu/marble/src
>     <http://anonsvn.kde.org/home/kde/trunk/KDE/kdeedu/marble/src>).
>     >
>     > Thanks in advance,
>
>     _______________________________________________
>     Marble-devel mailing list
>     Marble-devel at kde.org <mailto:Marble-devel at kde.org>
>     https://mail.kde.org/mailman/listinfo/marble-devel
>
>
>
>
> -- 
> Miguel Chavez Gamboa
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/marble-devel/attachments/20101011/a8e8ff42/attachment.htm 


More information about the Marble-devel mailing list