[Marble-devel] turn the map

Bernhard Beschow bbeschow at cs.tu-berlin.de
Thu Apr 5 14:00:58 UTC 2012


> Hi Bernhard,

Hi Konrad,

> first i like to say:
> thanks for the heading code - works great in spherical mode.
> 
> i add a setHeading() methode to the PositionMarker plugin.

PositionTracking::direction() already returns an angle. So I'd somehow use that for setting the widget's heading upon the gpsLocation() signal.

BTW, do you have a public git repository somewhere, so I can see your patches more easily?

> Now, if a Gps device is connected, the map is turned to allways drive 
> upwards.
> (could also be tested with the FileReader plugin).
> find the code attached , may usefull for others.
> 
> additional, i made a smal modification to:
> MarbleMap::setHeading() to avoid having heading values greater than 360°
> if(heading > 359)//enz
>     heading = heading-360;
> 
> if(heading < -359)//enz
>     heading = heading+360;
> 
> For now this is all i needed, but in future, of course,
> heading have to be fixed for mercator projection.
> 
> In opposite to heading, Kml GroundOverlay works correct
> only for none spherical projection.
> 
> Adding following code to GeoImageGraphicsItem::paint()
> 
> //heading enz
> painter->translate( viewport->width()/2, viewport->height()/2 );
> painter->rotate( viewport->heading() * RAD2DEG );
> painter->translate( -viewport->width()/2, -viewport->height()/2 );
> //enz
> 
> the GroundOverlay image is turned correct in mercator projection,
> but, of course, not in spherical.

Ideally, we'd reuse the texture mappers here after we make them all respect the heading (read below).

> One question about your heading code:
> In TileScalingTextureMapper::mapTexture you are using translate/rotate
> for the QPainter.
> this is called for non sperical projection, never for spherical.
> I can not see where you consider the ViewPortParams:heading value in 
> spherical
> projection - but it works ?!

Have a look at ViewportParams::setHeading(). You can see that the heading is considered there when setting the planet axis. So the axis contains the heading, which implicitly makes the SphericalScanlineTextureMapper work like expected, since it makes use of the axis. The other texture mappers, however, don't make use of the axis, which means they have to be adopted first.

More questions? Feel free to ask, or ping me on #marble (->shentey).

Cheers,
Bernhard


> br, konrad
> 
> ----- Original Message ----- 
> From: <bbeschow at cs.tu-berlin.de>
> To: "Konrad Enzensberger" <e.konrad at mpegcode.com>; <marble-devel at kde.org>
> Sent: Thursday, March 22, 2012 10:16 PM
> Subject: Re: turn the map
> 
> 
> > Hi Konrad,
> >
> >>>>You mean a compass that allows for moving the map (panning)?
> >> no, turning the map.
> >> In GoogleEarth ou see two compass, with the upper one it is possible
> >> to turn the map (in any zoom level).
> >> Or, for example, if i have connected a GpsDevice, i would like
> >> to turn the map automatically the way that you allways drive upwards,
> >
> > Ah, I see. Nice idea. Unfortunately, rotation is currently not supported
> > in Marble-master at all. I have an experimental "rotation" branch in my
> > github repository[1], where it's possible to rotate the map. However, only
> > spherical projection works correctly at the moment, whereas there is
> > almost no rotation support for the flat projections. I'd appreciate any
> > help, though! If you need more information, don't hesitate to ask.
> >
> > Greetings,
> > Bernhard
> >
> > [1] https://github.com/shentok/marble/commits/rotation
> >
> >> ----- Original Message -----
> >> From: <bbeschow at cs.tu-berlin.de>
> >> To: "Konrad Enzensberger" <e.konrad at mpegcode.com>; <marble-devel at kde.org>
> >> Sent: Thursday, March 22, 2012 12:52 PM
> >> Subject: Re: turn the map
> >>
> >>
> >>> Hello Konrad,
> >>>
> >>>> i like to develope a new compass plugin
> >>>> like the compass used in GoogleEarth.
> >>>> I need to be able to turn the map in any zoom level.
> >>>>
> >>>> Is there a marblewidget api methode i can use
> >>>> to turn the map?
> >>>> could you give me some hint how to start ?
> >>>
> >>>
> >>> You mean a compass that allows for moving the map (panning)? If so, then
> >>> have a look at the NavigationFloatItem and perhaps take that as a base
> >>> for
> >>> your plugin.
> >>>
> >>> HTH.
> >>>
> >>> Greetings,
> >>> Bernhard
> >>>
> >>>
> >>
> >>
> >
> > 
> 


More information about the Marble-devel mailing list