Ejemplo n.º 1
0
void GraphicsScene::updatePointMembership (CmdMediator &cmdMediator,
                                           GeometryWindow *geometryWindow)
{
  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsScene::updatePointMembership";

  CallbackSceneUpdateAfterCommand ftor (m_graphicsLinesForCurves,
                                        *this,
                                        cmdMediator.document (),
                                        geometryWindow);
  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
                                                                                                     &CallbackSceneUpdateAfterCommand::callback);

  // First pass:
  // 1) Mark all points as Not Wanted (this is done while creating the map)
  m_graphicsLinesForCurves.lineMembershipReset ();

  // Next pass:
  // 1) Existing points that are found in the map are marked as Wanted
  // 2) Add new points that were just created in the Document. The new points are marked as Wanted
  cmdMediator.iterateThroughCurvePointsAxes (ftorWithCallback);
  cmdMediator.iterateThroughCurvesPointsGraphs (ftorWithCallback);

  // Next pass:
  // 1) Remove points that were just removed from the Document
  m_graphicsLinesForCurves.lineMembershipPurge (cmdMediator.document().modelCurveStyles());
}
void Transformation::update (bool fileIsLoaded,
                             const CmdMediator &cmdMediator,
                             const MainWindowModel &modelMainWindow)
{
  LOG4CPP_DEBUG_S ((*mainCat)) << "Transformation::update";

  if (!fileIsLoaded) {

    m_transformIsDefined = false;

  } else {

    setModelCoords (cmdMediator.document().modelCoords(),
                    modelMainWindow);

    CallbackUpdateTransform ftor (m_modelCoords,
                                  cmdMediator.document().documentAxesPointsRequired());

    Functor2wRet<const QString &, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
                                                                                                      &CallbackUpdateTransform::callback);
    cmdMediator.iterateThroughCurvePointsAxes (ftorWithCallback);

    if (ftor.transformIsDefined ()) {

      updateTransformFromMatrices (ftor.matrixScreen(),
                                   ftor.matrixGraph());
    } else {

      m_transformIsDefined = false;

    }
  }
}
Ejemplo n.º 3
0
void TransformationStateDefined::updateAxesChecker (CmdMediator &cmdMediator,
                                                    const Transformation &transformation)
{
  CallbackAxesCheckerFromAxesPoints ftor;
  Functor2wRet<const QString &, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
                                                                                                    &CallbackAxesCheckerFromAxesPoints::callback);
  cmdMediator.iterateThroughCurvePointsAxes (ftorWithCallback);

  m_axesChecker->prepareForDisplay (ftor.points(),
                                    cmdMediator.document().modelCurveStyles().pointRadius(AXIS_CURVE_NAME),
                                    cmdMediator.document().modelAxesChecker(),
                                    cmdMediator.document().modelCoords(),
                                    transformation);
  m_axesChecker->setVisible (true);
  startTimer (cmdMediator.document().modelAxesChecker());
}