void GraphView::mouseReleaseEvent ( QMouseEvent * me){
    setPoint(me->x(), me->y(), disc->verts[sPoint]);

    emit pointChanged(sPoint,disc->verts[sPoint].x,disc->verts[sPoint].y);
    mouseTrack = 0;
    repaint(true);
}
void IqAmeSymbol::setPoint(IqAmeGeoPoint *geoPoint)
{
    if (m_point != geoPoint) {
        m_point = geoPoint;
        emit pointChanged();
    }
}
示例#3
0
TransTemplatePlot::TransTemplatePlot(QWidget *parent) :
    QwtPlot(parent)
{
    this->enableAxis(xTop, false);
    this->enableAxis(xBottom, false);
    this->enableAxis(yLeft, false);
    this->enableAxis(yRight, false);

    mHistogramPlot = new QwtPlotHistogram();
    QColor bg( Qt::blue );
    bg.setAlpha( 150 );
    mHistogramPlot->setPen(QPen(bg));
    mHistogramPlot->setBrush( QBrush( bg ) );
    mHistogramPlot->setStyle( QwtPlotHistogram::Columns );
    mHistogramPlot->attach(this);

    mTransPosCurve = new QwtPlotCurve();
    setAxisScale( QwtPlot::yRight,  0.0, 255.0 );
    mTransPosCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
    mTransPosCurve->setYAxis(yRight);
    mTransPosCurve->setSymbol( new QwtSymbol( QwtSymbol::Ellipse,
                                              QBrush(QColor(191, 191, 191, 127)),
                                              QPen(QColor(187, 187, 187, 191), 1),
                                              QSize(10, 10) ) );
    mTransPosCurve->attach(this);

    TransCanvasPicker *canvasPicker = new TransCanvasPicker( this );
    connect(canvasPicker, SIGNAL(pointChanged(QVector<QPointF>)), SLOT(handleTransChange(QVector<QPointF>)));
}
void GraphView::mousePressEvent ( QMouseEvent * me){
    /* Select the closest point */
    Vert p;
    setPoint(me->x(), me->y(), p);

    if(disc){
        double bestdist = DIST_2D(p.x,p.y,disc->verts[0].x,disc->verts[0].y);
        sPoint = 0;
        for(int i = 0; i < disc->numVert; i++){
            cout << DIST_2D(p.x,p.y,disc->verts[i].x,disc->verts[i].y)  << " ";
            if(bestdist > DIST_2D(p.x,p.y,disc->verts[i].x,disc->verts[i].y)){
                bestdist = DIST_2D(p.x,p.y,disc->verts[i].x,disc->verts[i].y);
                sPoint = i;
            }
        }
    }

    cout << disc->vertLabels[sPoint] << " (" << sPoint << ")"<< endl;

    setPoint(me->x(), me->y(), disc->verts[sPoint]);

    emit pointChanged(sPoint,disc->verts[sPoint].x,disc->verts[sPoint].y);
    mouseTrack = 1;
    repaint(true);
}
示例#5
0
// The constructor for the ellipse object
GLEEllipse::GLEEllipse(double resolution, QSize imageSize, GLEDrawingArea *area) :
	GLEDrawingObject(resolution, imageSize, area)
{
	// Make sure the ellipse is updated if a point changes or
	// the image size changes
	connect(this, SIGNAL(pointChanged()),
			this, SLOT(updateEllipse()));
	connect(this, SIGNAL(imageChanged()),
			this, SLOT(updateEllipse()));
	connect(this, SIGNAL(propertyChanged(int)),
			this, SLOT(updateFromProperty(int)));

	amove = false;

	pointHash[Angle] = QPointF(0.0, 0.0);

	// More to be added
	validProperties
		<< FillColour
		<< LineColour
		<< LineWidth
		<< LineStyle;
	properties[FillColour] = propertyDescriptions[FillColour].defaultValue;
	properties[LineColour] = propertyDescriptions[LineColour].defaultValue;
	properties[LineWidth] = propertyDescriptions[LineWidth].defaultValue;
	properties[LineStyle] = propertyDescriptions[LineStyle].defaultValue;
}
示例#6
0
文件: text.cpp 项目: pnkfelix/glx-gle
// The constructor for the line object
GLEText::GLEText(double resolution, QSize imageSize, GLEDrawingArea *area) :
	GLEDrawingObject(resolution, imageSize, area)
{
	lastdpi = -1;
	// Make sure the line is updated if a point changes or
	// the image size changes
	connect(this, SIGNAL(pointChanged()),
			this, SLOT(updateText()));
	connect(this, SIGNAL(imageChanged()),
			this, SLOT(resChanged()));
	connect(this, SIGNAL(propertyChanged(int)),
			this, SLOT(updateFromProperty(int)));

	amove = false;
	drawPoint = QPointF(0.0,0.0);

	// More to be added
	validProperties
		<< Text
		<< FontName
		<< FontStyle
		<< FontSize
		<< Alignment
		<< LineColour;
	properties[Text] = propertyDescriptions[Text].defaultValue;
	properties[FontName] = propertyDescriptions[FontName].defaultValue;
	properties[FontStyle] = propertyDescriptions[FontStyle].defaultValue;
	properties[FontSize] = propertyDescriptions[FontSize].defaultValue;
	properties[Alignment] = propertyDescriptions[Alignment].defaultValue;
	properties[LineColour] = propertyDescriptions[LineColour].defaultValue;
}
void QgsAdvancedDigitizingDockWidget::lockConstraint( bool activate /* default true */ )
{
  CadConstraint *constraint = objectToConstraint( sender() );
  if ( !constraint )
  {
    return;
  }

  if ( activate )
  {
    QString textValue = constraint->lineEdit()->text();
    if ( !textValue.isEmpty() )
    {
      bool ok;
      double value = parseUserInput( textValue, ok );
      if ( ok )
      {
        constraint->setValue( value );
      }
      else
      {
        activate = false;
      }
    }
    else
    {
      activate = false;
    }
  }
  constraint->setLockMode( activate ? CadConstraint::HardLock : CadConstraint::NoLock );

  if ( activate )
  {
    // deactivate perpendicular/parallel if angle has been activated
    if ( constraint == mAngleConstraint.get() )
    {
      lockAdditionalConstraint( NoConstraint );
    }

    // run a fake map mouse event to update the paint item
    emit pointChanged( mCadPointList.value( 0 ) );
  }
}
void QgsAdvancedDigitizingDockWidget::updateConstraintValue( CadConstraint *constraint, const QString &textValue, bool convertExpression )
{
  if ( !constraint || textValue.isEmpty() )
  {
    return;
  }

  if ( constraint->lockMode() == CadConstraint::NoLock )
    return;

  bool ok;
  double value = parseUserInput( textValue, ok );
  if ( !ok )
    return;

  constraint->setValue( value, convertExpression );
  // run a fake map mouse event to update the paint item
  emit pointChanged( mCadPointList.value( 0 ) );
}
void QgsMapToolAdvancedDigitizing::deactivate()
{
  QgsMapToolEdit::deactivate();
  disconnect( mCadDockWidget, SIGNAL( pointChanged( QgsPoint ) ), this, SLOT( cadPointChanged( QgsPoint ) ) );
  mCadDockWidget->disable();
}