[Marble-commits] KDE/kdeedu/marble/src/lib
Thibaut Gridel
tgridel at free.fr
Sat Jul 17 11:00:17 CEST 2010
SVN commit 1150962 by tgridel:
GeoDataPlacemark: use setGeometry(GeoDataGeometry*) instead of references
M +2 -34 geodata/data/GeoDataPlacemark.cpp
M +1 -5 geodata/data/GeoDataPlacemark.h
M +1 -1 geodata/handlers/gpx/GPXtrkTagHandler.cpp
M +4 -4 geodata/handlers/kml/KmlCoordinatesTagHandler.cpp
M +2 -2 geodata/handlers/kml/KmlLineStringTagHandler.cpp
M +2 -2 geodata/handlers/kml/KmlMultiGeometryTagHandler.cpp
M +2 -2 geodata/handlers/kml/KmlPolygonTagHandler.cpp
M +2 -2 gps/PositionTracking.cpp
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataPlacemark.cpp #1150961:1150962
@@ -107,46 +107,14 @@
p()->m_coordinate.setParent( this );
}
-void GeoDataPlacemark::setGeometry( const GeoDataPoint& point )
+void GeoDataPlacemark::setGeometry( GeoDataGeometry *entry )
{
detach();
delete p()->m_geometry;
- p()->m_geometry = new GeoDataPoint( point );
+ p()->m_geometry = entry;
p()->m_geometry->setParent( this );
}
-void GeoDataPlacemark::setGeometry( const GeoDataLineString& point )
-{
- detach();
- delete p()->m_geometry;
- p()->m_geometry = new GeoDataLineString( point );
- p()->m_geometry->setParent( this );
-}
-
-void GeoDataPlacemark::setGeometry( const GeoDataLinearRing& point )
-{
- detach();
- delete p()->m_geometry;
- p()->m_geometry = new GeoDataLinearRing( point );
- p()->m_geometry->setParent( this );
-}
-
-void GeoDataPlacemark::setGeometry( const GeoDataPolygon& point )
-{
- detach();
- delete p()->m_geometry;
- p()->m_geometry = new GeoDataPolygon( point );
- p()->m_geometry->setParent( this );
-}
-
-void GeoDataPlacemark::setGeometry( const GeoDataMultiGeometry& point )
-{
- detach();
- delete p()->m_geometry;
- p()->m_geometry = new GeoDataMultiGeometry( point );
- p()->m_geometry->setParent( this );
-}
-
qreal GeoDataPlacemark::area() const
{
return p()->m_area;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataPlacemark.h #1150961:1150962
@@ -116,11 +116,7 @@
* to any @see GeoDataGeometry like @see GeoDataPoint, at see GeoDataLineString,
* @see GeoDataLinearRing and @see GeoDataMultiGeometry
*/
- void setGeometry( const GeoDataPoint& entry );
- void setGeometry( const GeoDataLineString& entry );
- void setGeometry( const GeoDataLinearRing& entry );
- void setGeometry( const GeoDataMultiGeometry& entry );
- void setGeometry( const GeoDataPolygon& entry );
+ void setGeometry( GeoDataGeometry *entry );
/**
* Return the area size of the feature in square km.
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/gpx/GPXtrkTagHandler.cpp #1150961:1150962
@@ -42,7 +42,7 @@
{
GeoDataDocument* doc = parentItem.nodeAs<GeoDataDocument>();
GeoDataPlacemark *placemark = new GeoDataPlacemark;
- GeoDataMultiGeometry multigeometry;
+ GeoDataMultiGeometry *multigeometry = new GeoDataMultiGeometry;
placemark->setGeometry(multigeometry);
placemark->setStyleUrl("#map-track");
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlCoordinatesTagHandler.cpp #1150961:1150962
@@ -54,16 +54,16 @@
Q_FOREACH( const QString& line, coordinatesLines ) {
QStringList coordinates = line.trimmed().split( ',' );
if ( parentItem.represents( kmlTag_Point ) && parentItem.is<GeoDataFeature>() ) {
- GeoDataPoint coord;
+ GeoDataPoint *coord = new GeoDataPoint;
if ( coordinates.size() == 2 ) {
- coord.set( DEG2RAD * coordinates.at( 0 ).toDouble(),
+ coord->set( DEG2RAD * coordinates.at( 0 ).toDouble(),
DEG2RAD * coordinates.at( 1 ).toDouble() );
} else if( coordinates.size() == 3 ) {
- coord.set( DEG2RAD * coordinates.at( 0 ).toDouble(),
+ coord->set( DEG2RAD * coordinates.at( 0 ).toDouble(),
DEG2RAD * coordinates.at( 1 ).toDouble(),
coordinates.at( 2 ).toDouble() );
}
- parentItem.nodeAs<GeoDataPlacemark>()->setCoordinate( coord );
+ parentItem.nodeAs<GeoDataPlacemark>()->setCoordinate( *coord );
parentItem.nodeAs<GeoDataPlacemark>()->setGeometry( coord );
} else {
GeoDataCoordinates coord;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlLineStringTagHandler.cpp #1150961:1150962
@@ -43,22 +43,22 @@
GeoStackItem parentItem = parser.parentElement();
+ GeoDataLineString *lineString = new GeoDataLineString;
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_LineString << ">"
<< " parent item name: " << parentItem.qualifiedName().first;
#endif
if( parentItem.represents( kmlTag_Placemark ) ) {
- GeoDataLineString lineString;
parentItem.nodeAs<GeoDataPlacemark>()->setGeometry( lineString );
return parentItem.nodeAs<GeoDataPlacemark>()->geometry();
} else if( parentItem.represents( kmlTag_MultiGeometry ) ) {
- GeoDataLineString *lineString = new GeoDataLineString;
parentItem.nodeAs<GeoDataMultiGeometry>()->append( lineString );
return lineString;
} else {
+ delete lineString;
return 0;
}
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlMultiGeometryTagHandler.cpp #1150961:1150962
@@ -42,8 +42,8 @@
GeoStackItem parentItem = parser.parentElement();
+ GeoDataMultiGeometry *geom = new GeoDataMultiGeometry;
if( parentItem.represents( kmlTag_Placemark ) ) {
- GeoDataMultiGeometry geom;
parentItem.nodeAs<GeoDataPlacemark>()->setGeometry( geom );
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_MultiGeometry << ">"
@@ -52,7 +52,6 @@
return parentItem.nodeAs<GeoDataPlacemark>()->geometry();
} else if( parentItem.represents( kmlTag_MultiGeometry ) ) {
- GeoDataMultiGeometry *geom = new GeoDataMultiGeometry;
parentItem.nodeAs<GeoDataMultiGeometry>()->append( geom );
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_MultiGeometry << ">"
@@ -60,6 +59,7 @@
#endif
return geom;
} else {
+ delete geom;
return 0;
}
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/handlers/kml/KmlPolygonTagHandler.cpp #1150961:1150962
@@ -42,21 +42,21 @@
GeoStackItem parentItem = parser.parentElement();
+ GeoDataPolygon *polygon = new GeoDataPolygon;
#ifdef DEBUG_TAGS
mDebug() << "Parsed <" << kmlTag_Polygon << ">"
<< " parent item name: " << parentItem.qualifiedName().first;
#endif
if( parentItem.represents( kmlTag_Placemark ) ) {
- GeoDataPolygon polygon;
parentItem.nodeAs<GeoDataPlacemark>()->setGeometry( polygon );
return parentItem.nodeAs<GeoDataPlacemark>()->geometry();
} else if( parentItem.represents( kmlTag_MultiGeometry ) ) {
- GeoDataPolygon *polygon = new GeoDataPolygon;
parentItem.nodeAs<GeoDataMultiGeometry>()->append( polygon );
return polygon;
} else {
+ delete polygon;
return 0;
}
}
--- trunk/KDE/kdeedu/marble/src/lib/gps/PositionTracking.cpp #1150961:1150962
@@ -29,10 +29,10 @@
m_document->setName("Position Tracking");
GeoDataPlacemark *placemark = new GeoDataPlacemark;
- GeoDataMultiGeometry multiGeometry;
+ GeoDataMultiGeometry *multiGeometry = new GeoDataMultiGeometry;
GeoDataLineString *lineString = new GeoDataLineString;
- multiGeometry.append(lineString);
+ multiGeometry->append(lineString);
placemark->setGeometry(multiGeometry);
m_document->append(placemark);
More information about the Marble-commits
mailing list