コード例 #1
0
//! change the copyright font
void QgsCopyrightLabelPlugin::setFont( QFont theQFont )
{
  mQFont = theQFont;
  //save state to the project file.....
  QgsProject::instance()->writeEntry( "CopyrightLabel", "/FontName", theQFont.family() );
  //save state to the project file.....
  QgsProject::instance()->writeEntry( "CopyrightLabel", "/FontSize", theQFont.pointSize() );
  refreshCanvas();
}
コード例 #2
0
ファイル: plugin.cpp プロジェクト: veikoviil/Quantum-GIS
// Unload the plugin by cleaning up the GUI
void QgsNorthArrowPlugin::unload()
{
  // remove the GUI
  qGisInterface->removePluginMenu( tr( "&Decorations" ), myQActionPointer );
  qGisInterface->removeToolBarIcon( myQActionPointer );
  // remove the northarrow from the canvas
  disconnect( qGisInterface->mapCanvas(), SIGNAL( renderComplete( QPainter * ) ),
              this, SLOT( renderNorthArrow( QPainter * ) ) );
  refreshCanvas();

  delete myQActionPointer;
}
コード例 #3
0
void QgsScaleBarPluginGui::on_buttonBox_accepted()
{
  hide();
  emit changePlacement( cboPlacement->currentIndex() );
  emit changePreferredSize( spnSize->value() );
  emit changeSnapping( chkSnapping->isChecked() );
  emit changeEnabled( chkEnable->isChecked() );
  emit changeStyle( cboStyle->currentIndex() );
  emit changeColor( pbnChangeColor->color() );
  emit refreshCanvas();
  accept();
}
コード例 #4
0
// Slot called when the  menu item is activated
void QgsScaleBarPlugin::run()
{
  QgsScaleBarPluginGui *myPluginGui = new QgsScaleBarPluginGui( qGisInterface->mainWindow(), QgisGui::ModalDialogFlags );
  myPluginGui->setAttribute( Qt::WA_DeleteOnClose );
  myPluginGui->setPreferredSize( mPreferredSize );
  myPluginGui->setSnapping( mSnapping );
  myPluginGui->setPlacementLabels( mPlacementLabels );
  myPluginGui->setPlacement( mPlacementIndex );
  myPluginGui->setEnabled( mEnabled );
  myPluginGui->setStyleLabels( mStyleLabels );
  myPluginGui->setStyle( mStyleIndex );
  myPluginGui->setColor( mColor );

  connect( myPluginGui, SIGNAL( changePreferredSize( int ) ), this, SLOT( setPreferredSize( int ) ) );
  connect( myPluginGui, SIGNAL( changeSnapping( bool ) ), this, SLOT( setSnapping( bool ) ) );
  connect( myPluginGui, SIGNAL( changePlacement( int ) ), this, SLOT( setPlacement( int ) ) );
  connect( myPluginGui, SIGNAL( changeEnabled( bool ) ), this, SLOT( setEnabled( bool ) ) );
  connect( myPluginGui, SIGNAL( changeStyle( int ) ), this, SLOT( setStyle( int ) ) );
  connect( myPluginGui, SIGNAL( changeColor( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( myPluginGui, SIGNAL( refreshCanvas() ), this, SLOT( refreshCanvas() ) );
  myPluginGui->show();
  //set the map units in the spin box
  int myUnits = qGisInterface->mapCanvas()->mapUnits();
  switch ( myUnits )
  {
    case 0:
      myPluginGui->getSpinSize()->setSuffix( tr( " metres/km" ) );
      break;
    case 1:
      myPluginGui->getSpinSize()->setSuffix( tr( " feet/miles" ) );
      break;
    case 2:
      myPluginGui->getSpinSize()->setSuffix( tr( " degrees" ) );
      break;
    default:
      QgsDebugMsg( QString( "Error: not picked up map units - actual value = %1" ).arg( myUnits ) );
  };
}
コード例 #5
0
ファイル: erasertool.cpp プロジェクト: ang2ara/kelir
void
EraserTool::paint(PaintCanvas *canvas) {
  mRefreshRect = QRectF(mStartPoint, mEndPoint).normalized().toRect()
    .adjusted(-mPen.width(), -mPen.width(), mPen.width(), mPen.width());
  mPainter.begin(canvas->editImage());

  mPainter.setRenderHint(QPainter::Antialiasing, false);
  mPainter.setPen(mPen);
  if(mStartPoint == mEndPoint)
    mPainter.drawPoint(mStartPoint);
  else
    mPainter.drawLine(mStartPoint, mEndPoint);

  mPainter.end();
  refreshCanvas(canvas);
}
コード例 #6
0
ファイル: plugin.cpp プロジェクト: veikoviil/Quantum-GIS
// Slot called when the buffer menu item is activated
void QgsNorthArrowPlugin::run()
{
  QgsNorthArrowPluginGui *myPluginGui = new QgsNorthArrowPluginGui( qGisInterface->mainWindow(), QgisGui::ModalDialogFlags );
  myPluginGui->setAttribute( Qt::WA_DeleteOnClose );
  //overides function by the same name created in .ui
  myPluginGui->setRotation( mRotationInt );
  myPluginGui->setPlacementLabels( mPlacementLabels );
  myPluginGui->setPlacement( mPlacementIndex );
  myPluginGui->setEnabled( mEnable );
  myPluginGui->setAutomatic( mAutomatic );

  //listen for when the layer has been made so we can draw it
  connect( myPluginGui, SIGNAL( rotationChanged( int ) ), this, SLOT( rotationChanged( int ) ) );
  connect( myPluginGui, SIGNAL( changePlacement( int ) ), this, SLOT( setPlacement( int ) ) );
  connect( myPluginGui, SIGNAL( enableAutomatic( bool ) ), this, SLOT( setAutomatic( bool ) ) );
  connect( myPluginGui, SIGNAL( enableNorthArrow( bool ) ), this, SLOT( setEnabled( bool ) ) );
  connect( myPluginGui, SIGNAL( needToRefresh() ), this, SLOT( refreshCanvas() ) );
  myPluginGui->show();
}
コード例 #7
0
ファイル: plugin.cpp プロジェクト: HydroCouple/FVHMComponent
/*
* Initialize the GUI interface for the plugin
*/
void QgsNorthArrowPlugin::initGui()
{
  // Create the action for tool
  myQActionPointer = new QAction( QIcon( ":/north_arrow.png" ), tr( "&North Arrow" ), this );
  myQActionPointer->setWhatsThis( tr( "Creates a north arrow that is displayed on the map canvas" ) );
  // Connect the action to the run
  connect( myQActionPointer, SIGNAL( activated() ), this, SLOT( run() ) );
  //render the arrow each time the map is rendered
  connect( qGisInterface->mapCanvas(), SIGNAL( renderComplete( QPainter * ) ), this, SLOT( renderNorthArrow( QPainter * ) ) );
  //this resets this plugin up if a project is loaded
  connect( qGisInterface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
  // Add the icon to the toolbar & appropriate menu
  qGisInterface->addToolBarIcon( myQActionPointer );
  qGisInterface->addPluginToMenu( tr( "&Decorations" ), myQActionPointer );

  projectRead();
  refreshCanvas();

}
コード例 #8
0
ファイル: stroketool.cpp プロジェクト: hadesain/kelir
QImage
StrokeTool::paintStroke(PaintCanvas *canvas) {
    QPainterPath path;
    path = strokePathCubic(m_pStrokePoints);
    mRefreshRect = path.controlPointRect().toRect()
                   .adjusted(-mPen.width(), -mPen.width(), mPen.width(), mPen.width());

    QImage strokeImage(mRefreshRect.size(), QImage::Format_ARGB32_Premultiplied);
    strokeImage.setOffset(mRefreshRect.topLeft());
    strokeImage.fill(0);

    mPainter.begin(&strokeImage);
    mPainter.setRenderHint(QPainter::Antialiasing, true);
    mPainter.setPen(mPen);
    mPainter.drawPath(path.translated(-mRefreshRect.topLeft()));
    mPainter.end();

    mPainter.begin(canvas->editImage());
    mPainter.drawImage(mRefreshRect, strokeImage);
    mPainter.end();

    refreshCanvas(canvas);
    return strokeImage;
}
コード例 #9
0
//! set whether copyright label is enabled
void QgsCopyrightLabelPlugin::setEnable( bool theBool )
{
  mEnable = theBool;
  QgsProject::instance()->writeEntry( "CopyrightLabel", "/Enabled", mEnable );
  refreshCanvas();
}
コード例 #10
0
//! set placement of copyright label
void QgsCopyrightLabelPlugin::setPlacement( int placementIndex )
{
  mPlacementIndex = placementIndex;
  QgsProject::instance()->writeEntry( "CopyrightLabel", "/Placement", mPlacementIndex );
  refreshCanvas();
}
コード例 #11
0
//! change the copyright text color
void QgsCopyrightLabelPlugin::setColor( QColor theQColor )
{
  mLabelQColor = theQColor;
  QgsProject::instance()->writeEntry( "CopyrightLabel", "/Color", mLabelQColor.name() );
  refreshCanvas();
}
コード例 #12
0
//! change the copyright text
void QgsCopyrightLabelPlugin::setLabel( QString theLabelQString )
{
  mLabelQString = theLabelQString;
  QgsProject::instance()->writeEntry( "CopyrightLabel", "/Label", mLabelQString );
  refreshCanvas();
}