All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
SciFigs::LineEditor Class Reference

Brief description of class still missing. More...

#include <LineEditor.h>

List of all members.

Public Member Functions

 LineEditor (LineLayer *layer)
int lineIndex () const
void mouseMoveEvent (const QPoint &pt)
bool mousePressEvent (QMouseEvent *e)
void wheelEvent (QWheelEvent *e)
 ~LineEditor ()

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing

References TRACE.

{
  TRACE;
  _layer=layer;
  _lineIndex=-1;
  _original=0;
  _deformation=0;
}

Restore orignal line if current point not accepted by user

References TRACE.

{
  TRACE;
  // Editor is still active...
  if(_lineIndex>=0) restoreOriginal();
  delete [] _original;
  delete [] _deformation;
}

Member Function Documentation

int SciFigs::LineEditor::lineIndex ( ) const [inline]

Referenced by SciFigs::LineLayer::mouseMoveEvent().

{return _lineIndex;}
void SciFigs::LineEditor::mouseMoveEvent ( const QPoint &  pt)

References SciFigs::GraphContentLayer::graphContent(), SciFigs::GraphContent::options(), SciFigs::GraphContentOptions::s2r(), TRACE, QGpCoreTools::Point2D::x(), and QGpCoreTools::Point2D::y().

Referenced by SciFigs::LineLayer::mouseMoveEvent().

{
  TRACE;
  if(_lineIndex<0) return;
  Point2D p=_layer->graphContent()->options().s2r(pt);
  _dx=_original[_pointIndex].x() - p.x();
  _dy=_original[_pointIndex].y() - p.y();
  deformLine();
}
bool SciFigs::LineEditor::mousePressEvent ( QMouseEvent *  e)

Return true if this object can be deleted

References TRACE.

Referenced by SciFigs::LineLayer::mousePressEvent().

{
  TRACE;
  if(_lineIndex<0) { // The first click which generated this object
    pointAt(e->pos());
    if(_lineIndex<0) return true;
    _deformZ=e->modifiers() & Qt::ShiftModifier;
    _deformationWidth=0.2;
    _dx=0.0;
    _dy=0.0;
    saveOriginal();
  } else {
    if(e->buttons() & Qt::LeftButton) {
      // By removing the current index, the curve cannot be modified any more
      // The destructor won't restore the original curve
      _lineIndex=-1;
      return true;
    }
  }
  return false;
}
void SciFigs::LineEditor::wheelEvent ( QWheelEvent *  e)

References TRACE.

Referenced by SciFigs::LineLayer::wheelEvent().

{
  TRACE;
  int d=e->delta()/120;
  if(e->modifiers() & Qt::ShiftModifier) {
    _pointIndex +=d;
    if(_pointIndex>=_count) _pointIndex=_count-1;
    else if(_pointIndex<0) _pointIndex=0;
  } else {
    _deformationWidth *= pow(1.2, d);
    if(_deformationWidth<0.2) _deformationWidth=0.2;
  }
  setDeformation();
  deformLine();
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines