QGIS API Documentation  master-59fd5e0
src/gui/qgshtmlannotationitem.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                               qgshtmlannotationitem.h
00003                               ------------------------
00004   begin                : February 9, 2010
00005   copyright            : (C) 2010 by Marco Hugentobler
00006   email                : marco dot hugentobler at hugis dot net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef QGSHTMLANNOTATIONITEM_H
00019 #define QGSHTMLANNOTATIONITEM_H
00020 
00021 #include "qgsannotationitem.h"
00022 #include "qgsfeature.h"
00023 #include <QObject>
00024 #include <QWebView>
00025 #include <QWebFrame>
00026 
00027 class QGraphicsProxyWidget;
00028 
00030 class GUI_EXPORT QgsHtmlAnnotationItem: public QObject, public QgsAnnotationItem
00031 {
00032     Q_OBJECT
00033   public:
00034     QgsHtmlAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0 );
00035     ~QgsHtmlAnnotationItem();
00036 
00037     void paint( QPainter * painter );
00038 
00040     void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
00041 
00042     QSizeF minimumFrameSize() const;
00043 
00045     void setMapPosition( const QgsPoint& pos );
00046 
00047     void setHTMLPage( const QString& htmlFile );
00048     QString htmlPage() const { return mHtmlFile; }
00049 
00050     void writeXML( QDomDocument& doc ) const;
00051     void readXML( const QDomDocument& doc, const QDomElement& itemElem );
00052 
00053     QgsVectorLayer* vectorLayer() const { return mVectorLayer; }
00054 
00055   private slots:
00057     void setFeatureForMapPosition();
00059     void updateVisibility();
00060 
00061     void javascript();
00062 
00063   private:
00064     QGraphicsProxyWidget* mWidgetContainer;
00065     QWebView* mWebView;
00067     QgsVectorLayer* mVectorLayer;
00069     bool mHasAssociatedFeature;
00071     QgsFeatureId mFeatureId;
00072     QgsFeature mFeature;
00073     QString mHtmlFile;
00074     QString mHtmlSource;
00075 
00076     QString replaceText( QString displayText, QgsVectorLayer *layer, QgsFeature &feat );
00077 };
00078 
00079 #endif // QGSHTMLANNOTATIONITEM_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines