Results 1 to 20 of 20

Thread: qt-mobility

  1. #1
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default qt-mobility

    Hi, I'm trying to get route information using qt-mobility 1.1.0 (and qt-4.7.0).
    Here I retrieve text instructions for my route:

    Qt Code:
    1. void MainWindow::routeFinished()
    2. {
    3. QGeoRouteReply *reply = static_cast<QGeoRouteReply*>(sender());
    4.  
    5. if (!reply)
    6. return;
    7.  
    8. if (reply->routes().size() < 1)
    9. return;
    10.  
    11. QGeoMapRouteObject *route = new QGeoMapRouteObject(reply->routes().at(0));
    12. QColor routeColor(Qt::blue);
    13. routeColor.setAlpha(127); //semi-transparent
    14. QPen pen(routeColor);
    15. pen.setWidth(7);
    16. pen.setCosmetic(true);
    17. pen.setCapStyle(Qt::RoundCap);
    18. route->setPen(pen);
    19. m_mapWidget->addMapObject(route);
    20.  
    21.  
    22. QGeoRouteSegment segment = reply->routes().at(0).firstRouteSegment();
    23.  
    24. while(segment.isValid())
    25. {
    26. qDebug() << segment.maneuver().instructionText();
    27. segment = segment.nextRouteSegment();
    28. }
    29. }
    To copy to clipboard, switch view to plain text mode 

    but I get only the first segment's instructions, the others are empty (""), while isValid() goes ok. What am I doing wrong here?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    Not all segments contain text, that's perfectly normal.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    Quote Originally Posted by wysota View Post
    Not all segments contain text, that's perfectly normal.
    It's always only the first one. I don't think it's because all the others don't contain text.

    I think this is a bug in nextRouteSegment()
    Last edited by untitled; 20th November 2010 at 17:52.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    Are the maneuvers valid at all?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    Quote Originally Posted by wysota View Post
    Are the maneuvers valid at all?
    They are, I added a check:
    Qt Code:
    1. if(segment.isValid())
    To copy to clipboard, switch view to plain text mode 
    and it passed.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    I'm asking about maneuvers, not segments.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    Quote Originally Posted by wysota View Post
    I'm asking about maneuvers, not segments.
    Sorry.
    Wow, they are not valid, only the first one is =\
    Am I doing something wrong in my code?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    No. Simply not each route segment is associated with a maneuver. If there is a road intersection and you are driving straight, you are not making any maneuvers yet you are entering a new route segment.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    So how do I get the rest of instructionText()?
    I'm sure they do exist and are valid..

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    This might be the only text the routing server provides.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    I don't get it. Every firstRouteSegmen() has a valid maneuver and instructionText(), but the server does not provide the next ones? Semi-implemented functionality?

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    Check the text, it probably contains the description of the whole route.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    Quote Originally Posted by wysota View Post
    Check the text, it probably contains the description of the whole route.
    I was checking it with:
    Qt Code:
    1. qDebug() << segment.maneuver().instructionText();
    To copy to clipboard, switch view to plain text mode 
    and all I got is the first segment before the first maneuver.
    Output is for example:
    Qt Code:
    1. "Head towards Kirkkokatu on Hämeenkatu. Go for 0.4 miles."
    To copy to clipboard, switch view to plain text mode 

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    And how complex is the route segment? What is the shape of the segment?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #15
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    The segment is always a straight way between two maneuvers (turns). I set routes on map by clicking the mouse, I make them pretty easy with 1 turn = 1 maneuver and 2 segments.

  16. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    So why do you expect more than one text?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  17. #17
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    Because there are 2 segmenst and get 1 text.
    No matter how many segments I make in a route, always 1 text and empty ones after that.
    Maybe I'm not getting something in how to retrieve the text or set other segments manyally...

  18. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    Again, if that's how the source you are using (I'm guessing Navteq) returns the data, there is nothing you can do about it. That's probably how it works to avoid having to generate unnecessary data.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  19. #19
    Join Date
    Nov 2010
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: qt-mobility

    Hm.
    I need to show the whole routes instructions. Like:
    "Head towards blabla. Go for 0.4 miles"
    "Head towards blabla2. Go for 15 miles"
    etc..
    Is that an unnecessary data?

  20. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt-mobility

    Quote Originally Posted by untitled View Post
    Hm.
    I need to show the whole routes instructions. Like:
    "Head towards blabla. Go for 0.4 miles"
    "Head towards blabla2. Go for 15 miles"
    etc..
    Is that an unnecessary data?
    From usability point of view, in most cases yes. Usually you're only interested in the upcoming segment. When you are traveling it, you can update the route and get instructions for the next segment. There is a high chance you will never reach the destination of your route so why generate (and transmit) textual description for it?

    If you want instructions for all segments upfront, you have to use a source that will give them to you or convince the source you are currently using to do it. Bearing the fact that you are using a limited free service, there is a chance that if you pay for the service, you will get richer results.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QT mobility 1.1 integration
    By daarsh in forum Newbie
    Replies: 0
    Last Post: 11th October 2010, 06:55
  2. Problems with Qt Mobility compiling!
    By cueMan in forum Installation and Deployment
    Replies: 1
    Last Post: 28th September 2010, 10:48
  3. Somebody help me, about QT mobility
    By HiJack in forum Qt Tools
    Replies: 2
    Last Post: 24th July 2010, 10:14
  4. Qt Mobility's MM API v/s Qt Phonon
    By rohitratri in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 24th May 2010, 07:33
  5. Qt mobility: bearercloud & bearermonitor
    By marco500 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th March 2010, 15:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.