[Marble-commits] KDE/kdeedu/marble/src
Gaurav Gupta
1989.gaurav at googlemail.com
Sun Aug 15 19:55:38 CEST 2010
SVN commit 1164052 by ggupta:
Added GeoDataCoordinate along with lookAt in bookmark.kml file, bookmark icons and ExtendedData Tag writers
M +4 -4 QtMainWindow.cpp
M +7 -13 lib/BookmarkInfoDialog.cpp
M +5 -0 lib/BookmarkManager.cpp
M +28 -0 lib/BookmarkManager.h
M +18 -8 lib/GeoDataTreeModel.cpp
M +4 -0 lib/MarbleWidget.cpp
M +5 -0 lib/MarbleWidget.h
M +19 -1 lib/geodata/data/GeoDataExtendedData.cpp
M +24 -0 lib/geodata/data/GeoDataExtendedData.h
M +2 -2 lib/geodata/data/GeoDataPlacemark.cpp
M +1 -1 lib/geodata/data/GeoDataPlacemark.h
A lib/geodata/writers/kml/KmlDataTagWriter.cpp [License: LGPL]
A lib/geodata/writers/kml/KmlDataTagWriter.h [License: LGPL]
A lib/geodata/writers/kml/KmlExtendedDataTagWriter.cpp [License: LGPL]
A lib/geodata/writers/kml/KmlExtendedDataTagWriter.h [License: LGPL]
M +5 -0 lib/geodata/writers/kml/KmlPlacemarkTagWriter.cpp
M +4 -0 marble.qrc
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1164051:1164052
@@ -42,6 +42,7 @@
#include <QtNetwork/QNetworkProxy>
#include "BookmarkInfoDialog.h"
+//#include "EditBookmarkDialog.h"
#include "MarbleDirs.h"
#include "MarbleAboutDialog.h"
#include "QtMarbleConfigDialog.h"
@@ -241,15 +242,15 @@
connect(m_aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
//Bookmark Actions
- m_addBookmarkAct = new QAction(tr("&Add Bookmark"),this);
+ m_addBookmarkAct = new QAction( QIcon(":/icons/bookmarkNew.png"), tr("&Add Bookmark"),this);
m_addBookmarkAct->setShortcut(tr("Ctrl+B"));
m_addBookmarkAct->setStatusTip(tr("Add Bookmark"));
connect( m_addBookmarkAct, SIGNAL( triggered() ), this, SLOT( openBookmarkInfoDialog() ) );
- m_removeAllBookmarksAct = new QAction(tr("&Remove all Bookmarks"),this);
+ m_removeAllBookmarksAct = new QAction( QIcon(":/icons/bookmarkRemove.png"), tr("&Remove all Bookmarks"),this);
m_removeAllBookmarksAct->setStatusTip(tr("Remove all Bookmarks"));
connect( m_removeAllBookmarksAct, SIGNAL( triggered() ), this, SLOT( removeAllBookmarks() ) );
- m_addBookmarkFolderAct = new QAction( tr("&New Bookmark Folder"),this);
+ m_addBookmarkFolderAct = new QAction( QIcon(":/icons/bookmarkAddFolder.png"), tr("&New Bookmark Folder"),this);
m_addBookmarkFolderAct->setStatusTip(tr("New Bookmark Folder"));
connect( m_addBookmarkFolderAct, SIGNAL( triggered() ), this, SLOT( openNewBookmarkFolderDialog() ) );
@@ -466,7 +467,6 @@
dialog->exec();
delete dialog;
}
-
void MainWindow::createPluginMenus()
{
// Remove and delete toolbars if they exist
--- trunk/KDE/kdeedu/marble/src/lib/BookmarkInfoDialog.cpp #1164051:1164052
@@ -13,6 +13,7 @@
#include "MarbleDebug.h"
#include "BookmarkManager.h"
#include "GeoDataPlacemark.h"
+#include "GeoDataPoint.h"
#include "GeoDataFolder.h"
#include "GeoDataCoordinates.h"
#include "NewFolderInfoDialog.h"
@@ -81,19 +82,6 @@
bookmarkName = placemark.address();
}
- /* if( !extended.value("country").value().toString().isEmpty() )
- bookmarkName = extended.value("country").value().toString() ;
- else if( !extended.value("state").value().toString().isEmpty() )
- bookmarkName = extended.value("state").value().toString() ;
- else if( !extended.value("county").value().toString().isEmpty() )
- bookmarkName = extended.value("county").value().toString() ;
- else if( !extended.value("village").value().toString().isEmpty() )
- bookmarkName = extended.value("village").value().toString() ;
- else if( !extended.value("suburb").value().toString().isEmpty() )
- bookmarkName = extended.value("suburb").value().toString() ;
- else if( !extended.value("road").value().toString().isEmpty() )
- bookmarkName = extended.value("road").value().toString() ;
- */
name->setText( bookmarkName );
name->selectAll();
@@ -151,6 +139,12 @@
bookmark.setDescription( description->toPlainText() );
//allow for HTML in the description
bookmark.setDescriptionCDATA( true );
+ bookmark.setCoordinate( m_widget->centerLongitude(), m_widget->centerLatitude(), 0, GeoDataPoint::Degree );
+
+ GeoDataData data;
+ data.setValue(true);
+ data.setDisplayName("isBookmark");
+ bookmark.extendedData().addValue("isBookmark",data );
GeoDataLookAt *lookAt = new GeoDataLookAt( m_widget->lookAt() ) ;
bookmark.setLookAt( lookAt );
--- trunk/KDE/kdeedu/marble/src/lib/BookmarkManager.cpp #1164051:1164052
@@ -32,6 +32,11 @@
delete d;
}
+QString BookmarkManager::bookmarkFile() const
+{
+ return MarbleDirs::path( d->m_bookmarkFileRelativePath );
+}
+
bool BookmarkManager::loadFile( const QString &relativeFilePath)
{
--- trunk/KDE/kdeedu/marble/src/lib/BookmarkManager.h #1164051:1164052
@@ -34,18 +34,46 @@
~BookmarkManager();
+ /**
+ * @brief load bookmark file as GeoDataDocument and return true
+ * if loaded successfully else false
+ * @param relativeFilePath relative path of bookmark file
+ */
bool loadFile( const QString &relativeFilePath );
+ /**
+ * @brief return bookmark file path
+ */
+ QString bookmarkFile() const;
+
+ /**
+ * @brief add bookmark in a folder
+ * @param bookmark bookmark to be added
+ * @param folderName folder name in which bookmark to be added
+ */
void addBookmark( const GeoDataPlacemark &bookmark, const QString &folderName ) ;
+ /**
+ * @brief return Vector of folders
+ */
QVector<GeoDataFolder*> folders() const;
+ /**
+ * @brief add a folder
+ * @param folder name of folder to be created
+ */
void addNewBookmarkFolder( const QString &folder );
+ /**
+ * @brief remove all folders and bookmarks except default folder
+ */
void removeAllBookmarks();
private:
+ /**
+ * @brief updates bookmark file and return true if updated successfully
+ */
bool updateBookmarkFile() const;
BookmarkManagerPrivate *d;
--- trunk/KDE/kdeedu/marble/src/lib/GeoDataTreeModel.cpp #1164051:1164052
@@ -20,6 +20,7 @@
// Marble
#include "GeoDataDocument.h"
#include "GeoDataContainer.h"
+#include "GeoDataExtendedData.h"
#include "GeoDataPlacemark.h"
#include "GeoDataParser.h"
#include "GeoDataStyle.h"
@@ -169,31 +170,40 @@
if ( role == Qt::DisplayRole ) {
GeoDataPlacemark *placemark = dynamic_cast<GeoDataPlacemark*>( object );
+
if ( placemark ) {
- if ( index.column() == 0 )
+ if ( index.column() == 0 ){
return QVariant( placemark->name() );
- else if ( index.column() == 1 )
+ }
+ else if ( index.column() == 1 ){
return QVariant( placemark->nodeType() );
- else if ( index.column() == 2 )
+ }
+ else if ( index.column() == 2 ){
return QVariant( placemark->popularity() );
- else if ( index.column() == 3 )
+ }
+ else if ( index.column() == 3 ){
return QVariant( placemark->popularityIndex() );
}
+ }
GeoDataFeature *feature = dynamic_cast<GeoDataFeature*>( object );
if ( feature ) {
- if ( index.column() == 0 )
+ if ( index.column() == 0 ){
return QVariant( feature->name() );
- else if ( index.column() == 1 )
+ }
+ else if ( index.column() == 1 ){
return QVariant( feature->nodeType() );
}
+ }
GeoDataGeometry *geometry = dynamic_cast<GeoDataGeometry*>( object );
- if ( geometry && index.column() == 1 )
+ if ( geometry && index.column() == 1 ){
return QVariant( geometry->nodeType() );
+ }
GeoDataObject *item = dynamic_cast<GeoDataObject*>( object );
- if ( item && index.column() == 1 )
+ if ( item && index.column() == 1 ){
return QVariant( item->nodeType() );
+ }
}
else if ( role == Qt::CheckStateRole
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1164051:1164052
@@ -1417,6 +1417,10 @@
d->m_model->bookmarkManager()->addBookmark( bookmark, folderName );
}
+QString MarbleWidget::bookmarkFile() const
+{
+ return d->m_model->bookmarkManager()->bookmarkFile();
+}
bool MarbleWidget::loadBookmarkFile( const QString &relativeFileName )
{
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.h #1164051:1164052
@@ -577,6 +577,11 @@
void addBookmark( const GeoDataPlacemark &bookmark, const QString &folderName ) const;
+ /**
+ * @brief Returns path of file where bookmarks are saved
+ */
+ QString bookmarkFile() const;
+
bool loadBookmarkFile( const QString& relativeFileName);
QVector<GeoDataFolder*> folders();
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataExtendedData.cpp #1164051:1164052
@@ -10,7 +10,6 @@
#include "GeoDataExtendedData.h"
#include "GeoDataExtendedData_p.h"
-
#include <QtCore/QDataStream>
#include "GeoDataTypes.h"
@@ -60,6 +59,25 @@
d->hash.insert( key , data );
}
+QHash< QString, GeoDataData >::const_iterator GeoDataExtendedData::constBegin( ) const
+{
+ return d->hash.constBegin();
+}
+
+QHash< QString, GeoDataData >::const_iterator GeoDataExtendedData::constEnd( ) const
+{
+ return d->hash.constEnd();
+}
+
+int GeoDataExtendedData::size() const
+{
+ return d->hash.size();
+}
+
+bool GeoDataExtendedData::isEmpty( ) const
+{
+ return d->hash.empty();
+}
void GeoDataExtendedData::pack( QDataStream& stream ) const
{
GeoDataObject::pack( stream );
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataExtendedData.h #1164051:1164052
@@ -17,6 +17,7 @@
#include "GeoDataData.h"
#include "geodata_export.h"
+#include <QHash>
namespace Marble
{
@@ -54,10 +55,33 @@
void addValue( const QString& key, const GeoDataData& data );
/**
+ * @brief return const Begin iterator for QHash
+ */
+ QHash< QString, GeoDataData >::const_iterator constBegin( ) const;
+
+ /**
+ * @brief return const End iterator for QHash
+ */
+
+ QHash< QString, GeoDataData >::const_iterator constEnd( ) const;
+
+ /**
+ * @brief return size of QHash
+ */
+
+ int size( ) const;
+
+ /**
+ * @brief return wthethe QHash is empty or not
+ */
+ bool isEmpty( ) const;
+
+ /**
* @brief return value of GeoDataExtendedData object associated with the given @p key as a modifiable reference
*/
GeoDataData& valueRef( const QString& key ) const;
+
/**
* @brief Serialize the ExtendedData to a stream
* @param stream the stream
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataPlacemark.cpp #1164051:1164052
@@ -114,10 +114,10 @@
}
}
-void GeoDataPlacemark::setCoordinate( qreal lon, qreal lat, qreal alt )
+void GeoDataPlacemark::setCoordinate( qreal lon, qreal lat, qreal alt, GeoDataPoint::Unit _unit)
{
detach();
- p()->m_coordinate = GeoDataPoint( lon, lat, alt );
+ p()->m_coordinate = GeoDataPoint( lon, lat, alt, _unit );
p()->m_coordinate.setParent( this );
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataPlacemark.h #1164051:1164052
@@ -104,7 +104,7 @@
* Set the coordinate of the placemark in @p longitude and
* @p latitude.
*/
- void setCoordinate( qreal longitude, qreal latitude, qreal altitude = 0 );
+ void setCoordinate( qreal longitude, qreal latitude, qreal altitude = 0, GeoDataPoint::Unit _unit = GeoDataPoint::Radian );
/**
* Set the coordinate of the placemark with an @p GeoDataPoint.
--- trunk/KDE/kdeedu/marble/src/lib/geodata/writers/kml/KmlPlacemarkTagWriter.cpp #1164051:1164052
@@ -11,6 +11,7 @@
#include "KmlPlacemarkTagWriter.h"
#include "KmlElementDictionary.h"
+#include "GeoDataExtendedData.h"
#include "GeoDataPlacemark.h"
#include "GeoDataTypes.h"
#include "GeoWriter.h"
@@ -49,6 +50,10 @@
writer.writeEndElement();
}
+ if( !placemark.extendedData().isEmpty() ){
+ writeElement( placemark.extendedData(), writer );
+ }
+
if( placemark.geometry() ) {
writeElement( *placemark.geometry(), writer );
}
--- trunk/KDE/kdeedu/marble/src/marble.qrc #1164051:1164052
@@ -5,6 +5,10 @@
<file>icons/arrow-left.png</file>
<file>icons/arrow-right.png</file>
<file>icons/arrow-up.png</file>
+ <file>icons/bookmarkAddFolder.png</file>
+ <file>icons/bookmarkEdit.png</file>
+ <file>icons/bookmarkNew.png</file>
+ <file>icons/bookmarkRemove.png</file>
<file>icons/document-open.png</file>
<file>icons/document-print.png</file>
<file>icons/document-save-as.png</file>
More information about the Marble-commits
mailing list