#include "digesttreescene.h"
#include <QtGui>
#include "ogdf/basic/Array.h"
#include "ogdf/basic/Graph_d.h"
#include "ogdf/tree/TreeLayout.h"
#include <vector>
#include <iostream>
#include <assert.h>
#include <boost/lexical_cast.hpp>

static const double Pi = 3.14159265358979323846264338327950288419717;

static void 
testDraw(DigestTreeScene * scene) 
{
  std::string prefix[5] = {"/ndn/1", "/ndn/2", "/ndn/3", "/ndn/4", "/ndn/5"};
  std::string nick[5] = {"tom", "jerry", "jason", "michael", "hurry"};
  std::vector<Sync::MissingDataInfo> v;
  for (int i = 0; i < 5; i++)
  {
    Sync::MissingDataInfo mdi = {prefix[i], Sync::SeqNo(0), Sync::SeqNo(i * (2 << i) )};
    v.push_back(mdi);
  }

  scene->processUpdate(v, "12341234@!#%!@");

  for (int i = 0; i < 5; i++)
  {
   scene-> msgReceived(prefix[i].c_str(), nick[i].c_str());
  }
}

DigestTreeScene::DisplayUserPtr DigestTreeScene::DisplayUserNullPtr;

DigestTreeScene::DigestTreeScene(QWidget *parent)
  : QGraphicsScene(parent)
{
  previouslyUpdatedUser = DisplayUserNullPtr;
//  testDraw(this);
}

void
DigestTreeScene::processUpdate(const std::vector<Sync::MissingDataInfo> &v, QString digest)
{
  int n = v.size();
  bool rePlot = false; 
  for (int i = 0; i < n; i++) 
  {
    Roster_iterator it = m_roster.find(v[i].prefix.c_str());
    if (it == m_roster.end()) {
      rePlot = true; 
      DisplayUserPtr p(new DisplayUser());
      p->setPrefix(v[i].prefix.c_str());
      p->setSeq(v[i].high);
      m_roster.insert(p->getPrefix(), p);
    }
  }

  if (rePlot) 
  {
    plot(digest);
  }
  else 
  {
    for (int i = 0; i < n; i++) 
    {
      Roster_iterator it = m_roster.find(v[i].prefix.c_str());
      if (it != m_roster.end()) {
        DisplayUserPtr p = it.value();
        QGraphicsTextItem *item = p->getSeqTextItem();
        QGraphicsRectItem *rectItem = p->getInnerRectItem();
        std::string s = boost::lexical_cast<std::string>(p->getSeqNo().getSeq());
        item->setPlainText(s.c_str());
        QRectF textBR = item->boundingRect();
        QRectF rectBR = rectItem->boundingRect();
        item->setPos(rectBR.x() + (rectBR.width() - textBR.width())/2, rectBR.y() + (rectBR.height() - textBR.height())/2);
      }
    }
    m_rootDigest->setPlainText(digest);
  }
}

void
DigestTreeScene::msgReceived(QString prefix, QString nick)
{
  Roster_iterator it = m_roster.find(prefix);
  if (it != m_roster.end()) 
  {
    DisplayUserPtr p = it.value();
    if (nick != p->getNick()) {
      p->setNick(nick);
      QGraphicsTextItem *nickItem = p->getNickTextItem();
      QGraphicsRectItem *nickRectItem = p->getNickRectItem();
      nickItem->setPlainText(p->getNick());
      QRectF rectBR = nickRectItem->boundingRect();
      QRectF nickBR = nickItem->boundingRect();
      nickItem->setPos(rectBR.x() + (rectBR.width() - nickBR.width())/2, rectBR.y() + 5);
    }

    reDrawNode(p, Qt::red);

    if (previouslyUpdatedUser != DisplayUserNullPtr) 
    {
      reDrawNode(previouslyUpdatedUser, Qt::darkBlue);
    }

    previouslyUpdatedUser = p;
  }
}

void
DigestTreeScene::clearAll()
{
  clear();
  m_graph.clear();
  m_roster.clear();
}

void
DigestTreeScene::plot(QString digest)
{
  clear();
  m_graph.clear();
  int n = m_roster.size();
  ogdf::node root = m_graph.newNode();
  int rootIndex = root->index();
  for (int i = 0; i < n; i++) {
     ogdf::node leaf = m_graph.newNode();
     m_graph.newEdge(root, leaf);
  }
  ogdf::GraphAttributes GA(m_graph);

  int nodeSize = 40;
  int siblingDistance = 100, levelDistance = 100;
  ogdf::TreeLayout layout;
  layout.siblingDistance(siblingDistance);
  layout.levelDistance(levelDistance);
  layout.callSortByPositions(GA, m_graph);

  int width = GA.boundingBox().width();
  int height = GA.boundingBox().height();
  //setSceneRect(QRect(- (width + nodeSize) / 2, - 50, width + nodeSize, height + nodeSize));
  GA.setAllWidth(nodeSize);
  GA.setAllHeight(nodeSize);

  plotEdge(GA);
  plotNode(GA, rootIndex, digest);

  previouslyUpdatedUser = DisplayUserNullPtr;

}

void
DigestTreeScene::plotEdge(ogdf::GraphAttributes &GA)
{
  ogdf::edge e;
  forall_edges(e, m_graph) {
    ogdf::node source = e->source();
    ogdf::node target = e->target();
    int nodeSize = GA.width(target);
    int x1 = GA.x(source), y1 = -GA.y(source);
    int x2 = GA.x(target), y2 = -GA.y(target);
    QPointF src(x1 + nodeSize/2, y1 + nodeSize/2);
    QPointF dest(x2 + nodeSize/2, y2 + nodeSize/2);
    QLineF line(src, dest);
    double angle = ::acos(line.dx() / line.length());

    double arrowSize = 10;
    QPointF sourceArrowP0 = src + QPointF((nodeSize/2 + 10) * line.dx() / line.length(),  (nodeSize/2 +10) * line.dy() / line.length());
    QPointF sourceArrowP1 = sourceArrowP0 + QPointF(cos(angle + Pi / 3 - Pi/2) * arrowSize,
                                                    sin(angle + Pi / 3 - Pi/2) * arrowSize);
    QPointF sourceArrowP2 = sourceArrowP0 + QPointF(cos(angle + Pi - Pi / 3 - Pi/2) * arrowSize,
                                                         sin(angle + Pi - Pi / 3 - Pi/2) * arrowSize);

    addLine(QLineF(sourceArrowP0, dest), QPen(Qt::black));
    addPolygon(QPolygonF() << sourceArrowP0<< sourceArrowP1 << sourceArrowP2, QPen(Qt::black), QBrush(Qt::black));
  }
}

void
DigestTreeScene::plotNode(ogdf::GraphAttributes &GA, int rootIndex, QString digest)
{
  ogdf::node n;
  RosterIterator it(m_roster);
  forall_nodes(n, m_graph) {
    double x = GA.x(n);
    double y = -GA.y(n);
    double w = GA.width(n);
    double h = GA.height(n);
    int rim = 3;
    QRectF boundingRect(x, y, w, h);
    QRectF innerBoundingRect(x + rim, y + rim, w - rim * 2, h - rim * 2);

    if (n->index() == rootIndex) 
    {
      addRect(boundingRect, QPen(Qt::black), QBrush(Qt::darkRed));
      addRect(innerBoundingRect, QPen(Qt::black), QBrush(Qt::lightGray));

      QRectF digestRect(x - w, y - h, 3 * w, 30);
      addRect(digestRect, QPen(Qt::darkCyan), QBrush(Qt::darkCyan));
      QGraphicsTextItem *digestItem = addText(digest);
      QRectF digestBoundingRect = digestItem->boundingRect();
      digestItem->setDefaultTextColor(Qt::white);
      digestItem->setFont(QFont("Cursive", 12, QFont::Bold));
      digestItem->setPos(x - w + (3 * w - digestBoundingRect.width()) / 2, y - h + 5);
      m_rootDigest = digestItem;
    }
    else
    {
      if (it.hasNext()) 
      {
        it.next();
      }
      else 
      {
        abort();
      }
      DisplayUserPtr p = it.value();
      QGraphicsRectItem *rectItem = addRect(boundingRect, QPen(Qt::black), QBrush(Qt::darkBlue));
      p->setRimRectItem(rectItem);

      QGraphicsRectItem *innerRectItem = addRect(innerBoundingRect, QPen(Qt::black), QBrush(Qt::lightGray));
      p->setInnerRectItem(innerRectItem);

      std::string s = boost::lexical_cast<std::string>(p->getSeqNo().getSeq());
      QGraphicsTextItem *seqItem = addText(s.c_str());
      seqItem->setFont(QFont("Cursive", 12, QFont::Bold));
      QRectF seqBoundingRect = seqItem->boundingRect(); 
      seqItem->setPos(x + w / 2 - seqBoundingRect.width() / 2, y + h / 2 - seqBoundingRect.height() / 2);
      p->setSeqTextItem(seqItem);

      QRectF textRect(x - w / 2, y + h, 2 * w, 30);
      QGraphicsRectItem *nickRectItem = addRect(textRect, QPen(Qt::darkCyan), QBrush(Qt::darkCyan));
      p->setNickRectItem(nickRectItem);
      QGraphicsTextItem *nickItem = addText(p->getNick());
      QRectF textBoundingRect = nickItem->boundingRect();
      nickItem->setDefaultTextColor(Qt::white);
      nickItem->setFont(QFont("Cursive", 12, QFont::Bold));
      nickItem->setPos(x + w / 2 - textBoundingRect.width() / 2, y + h + 5);
      p->setNickTextItem(nickItem);
    }

  }
}

void
DigestTreeScene::reDrawNode(DisplayUserPtr p, QColor rimColor)
{
    QGraphicsRectItem *rimItem = p->getRimRectItem();
    rimItem->setBrush(QBrush(rimColor));
    QGraphicsRectItem *innerItem = p->getInnerRectItem();
    innerItem->setBrush(QBrush(Qt::lightGray));
    QGraphicsTextItem *seqTextItem = p->getSeqTextItem();
    std::string s = boost::lexical_cast<std::string>(p->getSeqNo().getSeq());
    seqTextItem->setPlainText(s.c_str());
    QRectF textBR = seqTextItem->boundingRect();
    QRectF innerBR = innerItem->boundingRect();
    seqTextItem->setPos(innerBR.x() + (innerBR.width() - textBR.width())/2, innerBR.y() + (innerBR.height() - textBR.height())/2);
}

