Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEATURE]: svg- and text items can be used as watermarks in QGIS serv…
…er. Developed for Faunalia ( http://www.faunalia.it) with funding from Regione Toscana \- Settore SISTEMA INFORMATIVO TERRITORIALE ED AMBIENTALE
- Loading branch information
Showing
19 changed files
with
694 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/*************************************************************************** | ||
qgsmaptoolsvgannotation.cpp | ||
--------------------------- | ||
begin : November, 2012 | ||
copyright : (C) 2012 by Marco Hugentobler | ||
email : marco dot hugentobler at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsmaptoolsvgannotation.h" | ||
#include "qgssvgannotationitem.h" | ||
#include <QMouseEvent> | ||
|
||
QgsMapToolSvgAnnotation::QgsMapToolSvgAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas ) | ||
{ | ||
|
||
} | ||
|
||
QgsMapToolSvgAnnotation::~QgsMapToolSvgAnnotation() | ||
{ | ||
|
||
} | ||
|
||
QgsAnnotationItem* QgsMapToolSvgAnnotation::createItem( QMouseEvent* e ) | ||
{ | ||
QgsSvgAnnotationItem* svgItem = new QgsSvgAnnotationItem( mCanvas ); | ||
svgItem->setMapPosition( toMapCoordinates( e->pos() ) ); | ||
svgItem->setSelected( true ); | ||
svgItem->setFrameSize( QSizeF( 200, 100 ) ); | ||
return svgItem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*************************************************************************** | ||
qgsmaptoolsvgannotation.h | ||
------------------------- | ||
begin : November, 2012 | ||
copyright : (C) 2012 by Marco Hugentobler | ||
email : marco dot hugentobler at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSMAPTOOLSVGANNOTATION_H | ||
#define QGSMAPTOOLSVGANNOTATION_H | ||
|
||
#include "qgsmaptoolannotation.h" | ||
|
||
class QgsMapToolSvgAnnotation: public QgsMapToolAnnotation | ||
{ | ||
public: | ||
QgsMapToolSvgAnnotation( QgsMapCanvas* canvas ); | ||
~QgsMapToolSvgAnnotation(); | ||
protected: | ||
QgsAnnotationItem* createItem( QMouseEvent* e ); | ||
}; | ||
|
||
#endif // QGSMAPTOOLSVGANNOTATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/*************************************************************************** | ||
qgssvgannotationdialog.cpp | ||
-------------------------- | ||
begin : November, 2012 | ||
copyright : (C) 2012 by Marco Hugentobler | ||
email : marco dot hugentobler at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgssvgannotationdialog.h" | ||
#include "qgsannotationwidget.h" | ||
#include "qgssvgannotationitem.h" | ||
#include <QFileDialog> | ||
#include <QFileInfo> | ||
#include <QGraphicsScene> | ||
|
||
QgsSvgAnnotationDialog::QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent, Qt::WindowFlags f): | ||
QDialog( parent, f ), mItem( item ), mEmbeddedWidget( 0 ) | ||
{ | ||
setupUi( this ); | ||
mEmbeddedWidget = new QgsAnnotationWidget( mItem ); | ||
mEmbeddedWidget->show(); | ||
mStackedWidget->addWidget( mEmbeddedWidget ); | ||
mStackedWidget->setCurrentWidget( mEmbeddedWidget ); | ||
|
||
if( mItem ) | ||
{ | ||
mFileLineEdit->setText( mItem->filePath() ); | ||
} | ||
|
||
QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) ); | ||
QPushButton* deleteButton = new QPushButton( tr( "Delete" ) ); | ||
QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) ); | ||
mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole ); | ||
} | ||
|
||
QgsSvgAnnotationDialog::QgsSvgAnnotationDialog(): QDialog(), mItem( 0 ), mEmbeddedWidget( 0 ) | ||
{ | ||
|
||
} | ||
|
||
QgsSvgAnnotationDialog::~QgsSvgAnnotationDialog() | ||
{ | ||
|
||
} | ||
|
||
void QgsSvgAnnotationDialog::on_mBrowseToolButton_clicked() | ||
{ | ||
QString directory; | ||
QFileInfo fi( mFileLineEdit->text() ); | ||
if ( fi.exists() ) | ||
{ | ||
directory = fi.absolutePath(); | ||
} | ||
QString filename = QFileDialog::getOpenFileName( 0, tr( "html" ), directory, "*.html" ); | ||
mFileLineEdit->setText( filename ); | ||
} | ||
|
||
void QgsSvgAnnotationDialog::applySettingsToItem() | ||
{ | ||
if ( mEmbeddedWidget ) | ||
{ | ||
mEmbeddedWidget->apply(); | ||
} | ||
|
||
if( mItem ) | ||
{ | ||
mItem->setFilePath( mFileLineEdit->text() ); | ||
mItem->update(); | ||
} | ||
|
||
} | ||
|
||
void QgsSvgAnnotationDialog::deleteItem() | ||
{ | ||
QGraphicsScene* scene = mItem->scene(); | ||
if ( scene ) | ||
{ | ||
scene->removeItem( mItem ); | ||
} | ||
delete mItem; | ||
mItem = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/*************************************************************************** | ||
qgssvgannotationdialog.h | ||
------------------------ | ||
begin : November, 2012 | ||
copyright : (C) 2012 by Marco Hugentobler | ||
email : marco dot hugentobler at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSSVGANNOTATIONDIALOG_H | ||
#define QGSSVGANNOTATIONDIALOG_H | ||
|
||
#include "ui_qgsformannotationdialogbase.h" | ||
|
||
class QgsSvgAnnotationItem; | ||
class QgsAnnotationWidget; | ||
|
||
class QgsSvgAnnotationDialog: public QDialog, private Ui::QgsFormAnnotationDialogBase | ||
{ | ||
Q_OBJECT | ||
public: | ||
QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0); | ||
~QgsSvgAnnotationDialog(); | ||
|
||
private slots: | ||
void on_mBrowseToolButton_clicked(); | ||
void applySettingsToItem(); | ||
void deleteItem(); | ||
|
||
private: | ||
QgsSvgAnnotationDialog(); //forbidden | ||
|
||
QgsSvgAnnotationItem* mItem; | ||
QgsAnnotationWidget* mEmbeddedWidget; | ||
}; | ||
|
||
#endif // QGSSVGANNOTATIONDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#ifndef QGSSVGANNOTATIONITEMDIALOG_H | ||
#define QGSSVGANNOTATIONITEMDIALOG_H | ||
|
||
#endif // QGSSVGANNOTATIONITEMDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.