[Marble-devel] Review Request 110058: Spherical Projection Panning

Dennis Nienhüser earthwings at gentoo.org
Sun Apr 28 08:53:09 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/110058/#review31691
-----------------------------------------------------------


Hi Paul, thanks for the awesome patch! Quite impressive that you're able to implement this rather massive change (it removes one of the fundamental assumptions) with a reasonable small amount of code.

What I'd like to have is some timing measurements to ensure we're not losing rendering performance when no panning is in effect. Getting Bernhard's thoughts on the rendering part would be great.

I was wondering about the stars plugin -- it does not change its rendering when panning is applied, but I think it needs to take that into account. Torsten, can you have a look at that?

Some nitpicking on code style and API below.


src/lib/LayerInterface.h
<http://git.reviewboard.kde.org/r/110058/#comment23603>

    Please describe its effect



src/lib/LayerInterface.h
<http://git.reviewboard.kde.org/r/110058/#comment23619>

    I'm afraid that API users might confuse stationary with geostationary. What about renaming the property screenStationary?



src/lib/MarbleModel.cpp
<http://git.reviewboard.kde.org/r/110058/#comment23604>

    I don't like the API too much -- too many parameters that only make sense because of their names. Additionally it requires everyone using the old home() method to adjust their code. Can we leave the original one as is and introduce a new
    
    QPoint globeCenterOffset() const
    void setGlobeCenterOffset( const QPoint &offset )
    
    Benefits I see is that existing API users are not affected by it and the method name is a better indicator of its purpose.
    



src/lib/MarbleWidget.h
<http://git.reviewboard.kde.org/r/110058/#comment23606>

    Please add API documentation.
    Is this actually used? m_transform seems not to be set.
    



src/lib/MarbleWidget.cpp
<http://git.reviewboard.kde.org/r/110058/#comment23605>

    I think polarity is calculated wrong when screen panning is active sometimes: You can observe the compass showing wrong values of S or N, and when screen panning the globe towards the screen top, geo panning (changing lon/lat center) by mouse uses the wrong direction.



src/lib/MarbleWidgetInputHandler.cpp
<http://git.reviewboard.kde.org/r/110058/#comment23607>

    l => line or something else less cryptical



src/lib/MarbleWidgetInputHandler.cpp
<http://git.reviewboard.kde.org/r/110058/#comment23608>

    there's also an in-place translate() method, i.e. 
    
    boundingRect.translate( MarbleWidgetInputHandler::d->m_widget->pan() )



src/lib/Projections/SphericalProjection.cpp
<http://git.reviewboard.kde.org/r/110058/#comment23618>

    w vs. width and h vs. height seem to be quite confusing local variable names.
    



src/lib/RenderPlugin.h
<http://git.reviewboard.kde.org/r/110058/#comment23610>

    Please describe its effect (see above)



src/lib/RenderPlugin.h
<http://git.reviewboard.kde.org/r/110058/#comment23611>

    bool enabled or bool stationary



src/lib/SphericalScanlineTextureMapper.cpp
<http://git.reviewboard.kde.org/r/110058/#comment23612>

    remove



src/lib/SphericalScanlineTextureMapper.cpp
<http://git.reviewboard.kde.org/r/110058/#comment23613>

    Please use a less cryptic variable name



src/lib/SphericalScanlineTextureMapper.cpp
<http://git.reviewboard.kde.org/r/110058/#comment23615>

    please use curly brackets also for one-liners. More occurrences below.



src/lib/ViewportParams.h
<http://git.reviewboard.kde.org/r/110058/#comment23616>

    pass a const reference, please



src/lib/ViewportParams.h
<http://git.reviewboard.kde.org/r/110058/#comment23617>

    The name is too cryptic and lacks camel case. virtualWidth()? Same for vheight, vsize. Can you add API documentation as well, please?
    


- Dennis Nienhüser


On April 18, 2013, 11:02 p.m., Paul Nader wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/110058/
> -----------------------------------------------------------
> 
> (Updated April 18, 2013, 11:02 p.m.)
> 
> 
> Review request for Marble, Bernhard Beschow and Dennis Nienhüser.
> 
> 
> Description
> -------
> 
> Spherical Projection Panning
> ----------------------------
> 
> This new feature allows users to pan the globe during spherical projection mode. To pan the globe: Shift Key + Mouse Left Button
> 
> No gestures and no Routing Layer, as yet. 
> 
> I am more than happy to help anyone porting existing plugins, etc to use panning.
> 
> Suggestions and improvements are also welcome.
> 
> 1. Introduction
> 
> The rest if this description explains the design of the spherical panning algorithms proposed for the marble application widget.
> 
> Spherical projection panning is the action of translating the globe (or the scene viewpoint) in a plane orthogonal to  
> the line of sight of the viewer. For flat map (equirect projection) or mercator map (mercator projection) the rotation 
> and panning actions are roughly equivalent and hence they remain unchanged.
> 
> 2. Implementation Notes
> 
> There are several areas affected by the spherical panning implementation:
> 
> o Texture Mapping
> o Layers
> o Plugins
> o Input Event Processing
> 
> 2.1 Texture Mapping
> 
> Panning is implemented in the SphericalScanlineTextureMapper class. When panning is started a snapshot of the earth is constructed
> by creating and image 3 times the size of the current viewport. This image is texture mapped and the background is set to transparent.
> The image is then displayed translated appropriately to match the screen coordinates. As panning mouse move events continue to be  
> processed the same image is displayed with the appropriate translation correction. As a consequence there is an initial delay, mostly
> unappreciable, at the start of panning but once it is in progress is is very fast as the SphericalScanlineTextureMapper class is only
> translating and displaying a pre-built image. When rotating a panned globe the texture mapping algorithm also ensures the appropriate
> sections of tiles are rendered taking into account the amount of pan in effect.
> 
> 2.2 Layers
> 
> None of the layers are aware any panning is in effect as it is already taken into account in the texture mapping algorithm. On the other
> hand MapInfoDialog and possibly the Routing layer (TBD) are rendered independent of the globe texture layers and also are required to
> translate their paint artefacts.
> 
> The LayerInterface class has been modified to include a new boolean data member (m_stationary together with a getter and setter) 
> initialised to false so that by default layers remain statically positioned and the LayerManager class has been modified to test whether 
> the layer is stationary or alternatively should be panned. If so the LayerManager translates the painter by the current amount of pan. 
> The layer itself is unaware any panning is taking effect although the viewport display is modified.
>  
> The TextureColorizer remains the only exception mainly because it creates a painter of its own to paint on a separate image. It cannot
> share the main GeoPainter instance because a display device can only have one painter.
> 
> 2.3 Plugins
> 
> Plugins have also been affected similarly. Some plugins require their paint artifacts to be positioned statically in the screen (eg, the
> compass, elevation profile, etc) while others require their paint artifacts to be translated (eg, postal codes, earthquakes, photo, etc).
> 
> The approach used is exactly the same as that taken for layers. The RenderPlugin class has been modified to include a new boolean data
> memeber (m_stationary together with a getter and setter) initialised to false so that by default plugins remain statically positioned.
> The AbstractDataPlugin class has been modified to test whether the plugin is stationary or alternatively should be panned. If so the
> AbstractDataPlugin translates the painter by the current amount of pan.  The plugin itself is unaware any panning is taking effect
> although the viewport display is modified.
> 
> The current list of plugins that are modified to be pannable are:
> 
> PostalCodePlugin
> EarthquakePlugin
> PhotoPlugin
> StarsPlugin
> WikipediaPlugin
> OpenCachingComPlugin
> WeatherPlugin.cpp
> OpenDesktopPlugin.cpp
> 
> 2.4 Input Event Processing
> 
> The MarbleWidgetInputHandler class is responsible for handling most user events such as mouse moves and key presses. MarbleWidgetInputHandler
> has been modified to additionally process mouse move events when the shift key is also pressed and the current widget projection is set
> to Spherical. The same action during Flat and Mercator projections are processed as a rotation request and handled using the current methods.
> 
> When panning commences the input handler records the current position to be used to determine how much panning is in effect. The pan is then
> applied to the MarbleWidget through a new method called pan overloaded to take a point or a pair of screen coordinates. The MarbleWidget then
> applies the pan to the viewport so that it is accessible in all renderable classes.
> 
> Enjoy.
> 
> 
> Diffs
> -----
> 
>   src/QtMainWindow.cpp cc69642 
>   src/lib/AbstractDataPlugin.cpp ce527f9 
>   src/lib/GoToDialog.cpp 57b65de 
>   src/lib/LayerInterface.h 46a20da 
>   src/lib/LayerInterface.cpp c3629de 
>   src/lib/LayerManager.cpp 0df19d2 
>   src/lib/MapInfoDialog.cpp 5219983 
>   src/lib/MarbleModel.h 8753615 
>   src/lib/MarbleModel.cpp 5df138a 
>   src/lib/MarbleWidget.h 9203250 
>   src/lib/MarbleWidget.cpp be1e228 
>   src/lib/MarbleWidgetInputHandler.cpp 1bdba92 
>   src/lib/PopupItem.cpp f9f0c2c 
>   src/lib/Projections/SphericalProjection.cpp cebb73d 
>   src/lib/RenderPlugin.h 90355ed 
>   src/lib/RenderPlugin.cpp b9b95c9 
>   src/lib/ScanlineTextureMapperContext.cpp ff3197b 
>   src/lib/SphericalScanlineTextureMapper.h 8ab69b9 
>   src/lib/SphericalScanlineTextureMapper.cpp 5808705 
>   src/lib/TextureColorizer.cpp f372830 
>   src/lib/VectorMap.cpp cf3dcef 
>   src/lib/ViewportParams.h 6b97f55 
>   src/lib/ViewportParams.cpp f82a8b7 
>   src/lib/layers/VectorMapLayer.cpp f05c88a 
>   src/lib/routing/RoutingInputWidget.cpp cbfc898 
>   src/lib/routing/RoutingLayer.cpp 1f07854 
>   src/plugins/render/aprs/AprsPlugin.cpp 550192f 
>   src/plugins/render/atmosphere/AtmospherePlugin.cpp 492c111 
>   src/plugins/render/earthquake/EarthquakePlugin.cpp 1205521 
>   src/plugins/render/opencachingcom/OpenCachingComModel.cpp ee35912 
>   src/plugins/render/opencachingcom/OpenCachingComPlugin.cpp 576198f 
>   src/plugins/render/opendesktop/OpenDesktopPlugin.cpp b1cef50 
>   src/plugins/render/photo/PhotoPlugin.cpp cdb6243 
>   src/plugins/render/postalcode/PostalCodePlugin.cpp 87feacd 
>   src/plugins/render/stars/StarsPlugin.cpp d8d1a08 
>   src/plugins/render/weather/WeatherPlugin.cpp 4be0c5d 
>   src/plugins/render/wikipedia/WikipediaPlugin.cpp 89cf51e 
> 
> Diff: http://git.reviewboard.kde.org/r/110058/diff/
> 
> 
> Testing
> -------
> 
> Ubuntu 11.40 32-bit / Qt 4.8.1 (marble-qt only)
> 
> 
> File Attachments
> ----------------
> 
> Panned
>   http://git.reviewboard.kde.org/media/uploaded/files/2013/04/16/17._Satellites.png
> 
> 
> Thanks,
> 
> Paul Nader
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20130428/f3802715/attachment-0001.html>


More information about the Marble-devel mailing list