[Marble-devel] Review Request: provide nodeType information for downcasting

tgridel at free.fr tgridel at free.fr
Sat Jul 25 14:52:07 CEST 2009



> On 2009-07-25 12:20:58, jmho_ wrote:
> > I think this is conceptually wrong for the following reasons:
> > 
> > 1) casting in C++ is like goto in C, we should not use it.
> > 2) if we want to cast in a safe way, we should use the compilers RTTI, or maybe Qt's,
> >   but not build our own RTTI

Please let me explain the reason beforehand:

The solution has been discussed yesterday with Torsten, Saro and Andrew on IRC 
to cover the specific need to write back the GeoData to a file, using a pattern
similar to the GeoParser.
In that respect, parsing the stack of GeoNodes is not funny.

Moreover, there already are some isSomething() boolean to cover more specific
identification needs which i fear would not scale much.

Last, Qt Provides the same solution to identify QGraphicsItem with type() and a
cast template.

The patch i propose is a solution to this problem, if you have a better idea
I would be very happy to see it.

With regards compiler RTTI this is not a given everywhere (Qt can compile
without this support)


- tgridel


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


On 2009-07-24 20:35:16, tgridel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/1119/
> -----------------------------------------------------------
> 
> (Updated 2009-07-24 20:35:16)
> 
> 
> Review request for marble.
> 
> 
> Summary
> -------
> 
> any class which inherits from GeoNode can specify a nodeType to provide downcasting
> 
> 
> Diffs
> -----
> 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataColorStyle.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataContainer.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataDocument.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataFeature.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataFolder.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataGeometry.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataHotSpot.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataIconStyle.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLabelStyle.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLatLonAltBox.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLatLonBox.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLineString.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLineStyle.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataLinearRing.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataMultiGeometry.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataObject.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataPlacemark.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataPoint.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataPolyStyle.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataPolygon.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataStyle.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataStyleMap.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataStyleSelector.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoDocument.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoDocument.cpp 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneDocument.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneFilter.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneGroup.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneHead.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneIcon.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneItem.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneLayer.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneLegend.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneMap.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoScenePalette.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneProperty.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneSection.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneSettings.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneTexture.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneVector.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneXmlDataSource.h 1001551 
>   /trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneZoom.h 1001551 
> 
> Diff: http://reviewboard.kde.org/r/1119/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> tgridel
> 
>



More information about the Marble-devel mailing list