HyperGraphElementAction* VertexPointXYZDrawAction::operator()(HyperGraph::HyperGraphElement* element,
        HyperGraphElementAction::Parameters* params ) {

    if (typeid(*element).name()!=_typeName)
        return 0;
    initializeDrawActionsCache();
    refreshPropertyPtrs(params);
    if (! _previousParams)
        return this;

    if (_show && !_show->value())
        return this;
    VertexPointXYZ* that = static_cast<VertexPointXYZ*>(element);


    glPushMatrix();
    glPushAttrib(GL_ENABLE_BIT | GL_POINT_BIT);
    glDisable(GL_LIGHTING);
    glColor3f(LANDMARK_VERTEX_COLOR);
    float ps = _pointSize ? _pointSize->value() :  1.f;
    glTranslatef((float)that->estimate()(0),(float)that->estimate()(1),(float)that->estimate()(2));
    opengl::drawPoint(ps);
    glPopAttrib();
    drawCache(that->cacheContainer(), params);
    drawUserData(that->userData(), params);
    glPopMatrix();
    return this;
}
void DownloadListWidgetCompactDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
#pragma message("This is quite costy - room for optimization?")
  try {
    auto iter = m_Cache.find(index.row());
    if (iter != m_Cache.end()) {
      drawCache(painter, option, *iter);
      return;
    }

    m_ItemWidget->resize(QSize(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2), option.rect.height()));
    if (index.row() % 2 == 1) {
      m_ItemWidget->setBackgroundRole(QPalette::AlternateBase);
    } else {
      m_ItemWidget->setBackgroundRole(QPalette::Base);
    }

    int downloadIndex = index.data().toInt();
    if (downloadIndex >= m_Manager->numTotalDownloads()) {
      paintPendingDownload(downloadIndex - m_Manager->numTotalDownloads());
    } else {
      paintRegularDownload(downloadIndex);
    }

#pragma message("caching disabled because changes in the list (including resorting) doesn't work correctly")
    if (false) {
//    if (state >= DownloadManager::STATE_READY) {
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
      QPixmap cache = m_ItemWidget->grab();
#else
      QPixmap cache = QPixmap::grabWidget(m_ItemWidget);
#endif
      m_Cache[index.row()] = cache;
      drawCache(painter, option, cache);
    } else {
      painter->save();
      painter->translate(QPoint(0, option.rect.topLeft().y()));

      m_ItemWidget->render(painter);
      painter->restore();
    }
  } catch (const std::exception &e) {
    qCritical("failed to paint download list item %d: %s", index.row(), e.what());
  }
}
  HyperGraphElementAction* VertexSE3PriorDrawAction::operator()(HyperGraph::HyperGraphElement* element, 
                 HyperGraphElementAction::Parameters* params_){
    if (typeid(*element).name()!=_typeName)
      return 0;
    initializeDrawActionsCache();
    refreshPropertyPtrs(params_);

    if (! _previousParams)
      return this;
    
    if (_show && !_show->value())
      return this;

    VertexSE3Prior* that = static_cast<VertexSE3Prior*>(element);

    glColor3f(POSE_VERTEX_PRIOR_COLOR);
    glPushMatrix();
    glMultMatrixd(that->estimate().matrix().data());
    opengl::drawArrow2D(_triangleX->value(), _triangleY->value(), _triangleX->value()*.3f);
    drawCache(that->cacheContainer(), params_);
    drawUserData(that->userData(), params_);
    glPopMatrix();
    return this;
  }