[Marble-devel] Review Request: GeoPainter: specific rendering for untesselated linestrings across IDL

Torsten Rahn tackat at kde.org
Mon Feb 6 05:59:30 UTC 2012


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


Oh, oh, we didn't cover that case before?

- Torsten Rahn


On Feb. 5, 2012, 9:11 p.m., Thibaut Gridel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103876/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2012, 9:11 p.m.)
> 
> 
> Review request for Marble and Torsten Rahn.
> 
> 
> Description
> -------
> 
> Default linestrings and linerings have NoTessellation set.
> A linestring which crosses the IDL is displayed while inserting fixed points on the IDL because of how current CrossesDateline in GeoData works.
> This patch discards toDateLineCorrected for this case, and renders the screen straight line properly.
> 
> Also a performance boost not using toDateLineCorrected in the general case.
> 
> As a side note, the original bug could be alleviated while setting tesselation...
> 
> 
> This addresses bug 247360.
>     http://bugs.kde.org/show_bug.cgi?id=247360
> 
> 
> Diffs
> -----
> 
>   src/lib/Projections/AbstractProjection.cpp ed0488a 
>   src/lib/geodata/data/GeoDataLineString.cpp 2900374 
>   src/lib/geodata/data/GeoDataLinearRing.cpp d3d51df 
> 
> Diff: http://git.reviewboard.kde.org/r/103876/diff/diff
> 
> 
> Testing
> -------
> 
> Following code, inspired by original bug, with the 3 kinds of tesselation, works as expected.
> compile with:
> g++ -I /usr/include/qt4/ -I include/marble/ -o test test.cpp -Llib/ -lmarblewidget -lQtGui
> 
> 
> #include <QtGui/QApplication>
> #include <MarbleWidget.h>
> #include <GeoPainter.h>
> #include <GeoDataLinearRing.h>
> #include <GeoDataCoordinates.h>
> 
> using namespace Marble;
> 
> class MyMarbleWidget : public MarbleWidget
> {
> public:
>     virtual void customPaint(GeoPainter* painter);
> };
> 
> void MyMarbleWidget::customPaint(GeoPainter* painter)
> {
>     const qreal lonWest  = -130;
>     const qreal latNorth = 40;
>     const qreal lonEast  = 160;
>     const qreal latSouth = 30;
> 
>     Marble::GeoDataCoordinates coordTopLeft(lonWest, latNorth, 0, Marble::GeoDataCoordinates::Degree);
>     Marble::GeoDataCoordinates coordTopRight(lonEast, latNorth + 20, 0, Marble::GeoDataCoordinates::Degree);
>     Marble::GeoDataCoordinates coordBottomLeft(lonWest, latSouth, 0, Marble::GeoDataCoordinates::Degree);
>     Marble::GeoDataCoordinates coordBottomRight(lonEast, latSouth, 0, Marble::GeoDataCoordinates::Degree);
> 
>     Marble::GeoDataLinearRing polyRingTesselated;
>     polyRingTesselated.setTessellationFlags( Tessellate );
>     polyRingTesselated << coordTopLeft << coordTopRight << coordBottomRight << coordBottomLeft;
> 
>     Marble::GeoDataLinearRing polyRingLatitude;
>     polyRingLatitude.setTessellationFlags( Tessellate | RespectLatitudeCircle );
>     polyRingLatitude << coordTopLeft << coordTopRight << coordBottomRight << coordBottomLeft;
> 
>     Marble::GeoDataLinearRing polyRingDefault;
>     polyRingDefault << coordTopLeft << coordTopRight << coordBottomRight << coordBottomLeft;
> 
>     GeoDataLineString diag( Tessellate );
>     diag << coordBottomLeft << coordTopRight;
> 
> 
>     painter->setPen(Qt::blue);
>     painter->drawPolygon(polyRingTesselated);
>     painter->drawPolyline( diag );
> 
>     painter->setPen(Qt::green);
>     painter->drawPolygon(polyRingLatitude);
> 
>     painter->setPen(Qt::red);
>     painter->drawPolygon(polyRingDefault);
> }
> 
> int main(int argc, char** argv)
> {
>     QApplication app(argc,argv);
>     MyMarbleWidget *mapWidget = new MyMarbleWidget;
>     mapWidget->setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
>     mapWidget->setProjection(Marble::Mercator);
>     mapWidget->show();
>     return app.exec();
> }
> 
> 
> Thanks,
> 
> Thibaut Gridel
> 
>

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


More information about the Marble-devel mailing list