30 #include "../../core/PaperConfig.h" 
   31 #include "../../core/pattern/singleton/Context.h" 
   32 #include "../../core/Utils.h" 
   67   m_middleBlockSize = 5;
 
   74   m_spacingLineText = 9.5;
 
   76   QBrush brush = painter->brush();
 
   78   QBrush bhWhite(QColor(255,255,255,255));
 
   79   QBrush bhGreyBack(QColor(145,145,145,255));
 
   80   QBrush bhGreyBox(QColor(180,180,180,255));
 
   82   QPen pen(QColor(0,0,0,255));
 
   84   double zoomFactor = 1. / scale; 
 
   86   QPointF ll = view->mapToScene(0, view->height());
 
   87   QPointF ur = view->mapToScene(view->width(), 0);
 
   95   QRectF rfV(QPointF(ll.x(), ll.y()), QPointF(ll.x() + m_height * zoomFactor, ur.y()));
 
   96   QRectF rfBackV(QPointF(ll.x(), ll.y()), QPointF(ll.x() + (m_cornerSize - 1.5) * zoomFactor, ur.y() - ((m_height) * zoomFactor)));
 
   97   QRectF rfPaperV(QPointF(ll.x(), 0), QPointF(ll.x() + (m_cornerSize - 1.5) * zoomFactor, h));
 
   98   QLineF rfLineV(QPointF(ll.x() + m_cornerSize * zoomFactor, ll.y()), QPointF(ll.x() + m_height * zoomFactor, ur.y() - (m_height * zoomFactor)));
 
  101   QRectF rfRectCorner(QPointF(ll.x(), ur.y()), QPointF(ll.x() + m_cornerSize * zoomFactor, ur.y() - m_height * zoomFactor));
 
  104   painter->setPen(Qt::NoPen);
 
  107   painter->setBrush(bhGreyBox);
 
  108   painter->drawRect(rfV);
 
  110   painter->setBrush(bhGreyBack);
 
  111   painter->drawRect(rfBackV);
 
  113   painter->setBrush(bhWhite);
 
  114   painter->drawRect(rfPaperV);
 
  116   painter->setBrush(brush);
 
  119   painter->setPen(pen);
 
  121   painter->drawLine(rfLineV);
 
  130   painter->setFont(ft);
 
  132   double urx = rfBackV.topRight().x();
 
  133   double ury = rfBackV.bottomLeft().y();
 
  134   double lly = rfBackV.topRight().y();
 
  141   for(
int i = (
int)lly ; i < (int) ury ; ++i)
 
  143     if((i % (
int)m_blockSize) == 0)
 
  145       box = QLineF(QPointF(x, i), QPointF(x - m_longLine * zoomFactor, i));
 
  147       std::stringstream ss;
 
  151       QPointF pTranslate = QPointF(x - m_spacingLineText * zoomFactor, i);
 
  153       QPointF p1 = view->mapFromScene(pTranslate);
 
  154       p1.setY(p1.y() + wtxt/2.);
 
  159       m.translate( p1.x(), p1.y() );
 
  161       m.translate( -p1.x(), -p1.y() );
 
  163       painter->setMatrixEnabled(
false);
 
  164       painter->setTransform(m);
 
  165       painter->setFont(ft);
 
  166       painter->drawText(p1, ss.str().c_str());
 
  170     else if((i % (
int)m_middleBlockSize) == 0)
 
  172       box = QLineF(QPointF(x, i), QPointF(x - m_mediumLine * zoomFactor, i));
 
  174     else if((i % (
int)m_smallBlockSize) == 0)
 
  176       box = QLineF(QPointF(x, i), QPointF(x - m_smallLine * zoomFactor, i));
 
  179     painter->drawLine(box);
 
  182   painter->setBrush(bhGreyBox);
 
  183   painter->setPen(Qt::NoPen);
 
  184   painter->drawRect(rfRectCorner);
 
virtual void drawRuler(QGraphicsView *view, QPainter *painter, double scale)
 
Class responsible for paper setting. Size, orientation, custom size, etc. 
 
virtual void textBoundingBox(double &w, double &h, std::string txt)
A method that calculates the height and width of a text. 
 
static Context & getInstance()
It returns a reference to the singleton instance. 
 
Utils * getUtils()
Returns pointer with functions to manipulate the canvas and conversion between projections. 
 
virtual void getPaperSize(double &w, double &h)
Returns paper size. Height and Width. 
 
PaperConfig * getPaperConfig() const 
Returns paper setting. 
 
Utility class with functions to manipulate the canvas and conversion between projections. 
 
Class that represents a vertical ruler with the coordinate system in mm.