source: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawAll.cpp @ 26

Last change on this file since 26 was 26, checked in by chou, 17 years ago

Release 3 du viewer:
Etape 1 et 2 du projet complet et à jour.

  • Property svn:executable set to *
File size: 3.7 KB
Line 
1#include "window.h"
2
3using namespace morpheo::tools::viewer::parser;
4using namespace morpheo::tools::viewer::bdd;
5using namespace morpheo::tools::viewer::graphics;
6
7void Window::paintEvent( QPaintEvent * )
8{
9   
10  /*draw window size*/
11  setMinimumSize(600,600);
12   
13  if(paint){
14    painter.begin(this);
15    painter.setPen(Qt::blue);
16    painter.drawRect(MARGEX,MARGEY,MARGEX+450,MARGEY+450);
17
18   
19    for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){
20      portX = it->get_x();
21      portY = it->get_y();
22      drawPort(portX + MARGEX,portY + MARGEY ,EAST,it->getDirection());
23
24    } 
25   
26    for(QList<Port>::iterator it=port_west.begin(); it!=port_west.end(); ++it){
27      portX = it->get_x() ;
28      portY = it->get_y() ;
29      drawPort(portX + MARGEX,portY + MARGEY, WEST, it->getDirection());
30
31    }
32
33    for(QList<Port>::iterator it=port_north.begin(); it!=port_north.end(); ++it){
34      portX = it->get_x() ;
35      portY = it->get_y() ;
36      drawPort(portX + MARGEX ,portY+MARGEY,NORTH,it->getDirection());
37
38    }
39
40    for(QList<Port>::iterator it=port_south.begin(); it!=port_south.end(); ++it){
41      portX = it->get_x() ;
42      portY = it->get_y() ;
43      drawPort(portX + MARGEX,portY+MARGEY,SOUTH,it->getDirection());
44
45    }
46   
47    if(p.getArchitecture()!=NULL){
48      compo = p.getComponent();
49      for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){
50        Coord *co = it->get_Position();
51        posX = co->get_hg_x()+MARGEX;
52        posY = co->get_hg_y()+MARGEY;
53        tailleX = co->get_size_x();
54        tailleY = co->get_size_y();
55        painter.drawRect(posX,posY,tailleX,tailleY);
56        if (componentName){
57          QString compo_name = QString::fromStdString(it->getName());
58          painter.drawText(posX , posY + tailleY/2,compo_name);
59        }
60        Coord *co2=new Coord( co->get_hg_x() + tailleX/2, co->get_hg_y() + tailleY/2,tailleX/2,tailleY/2);
61
62        QList<Port> ports2=(it->getPortEast(co2));
63        for (QList<Port>::iterator it2=ports2.begin();it2!=ports2.end();++it2) 
64          {
65           
66            portX =it2->get_x();
67            portY =it2->get_y();
68            drawPort(portX + MARGEX,portY+MARGEY , EAST,it2->getDirection());
69          }
70        ports2=(it->getPortWest(co));
71        for (QList<Port>::iterator it2=ports2.begin();it2!=ports2.end();++it2) 
72          {
73           
74            portX =it2->get_x();
75            portY =it2->get_y();
76            drawPort(portX + MARGEX ,portY+MARGEY ,WEST,it2->getDirection());
77          }
78        ports2=(it->getPortNorth(co));
79        for (QList<Port>::iterator it2=ports2.begin();it2!=ports2.end();++it2) 
80          {
81           
82            portX =it2->get_x();
83            portY =it2->get_y();
84            drawPort(portX + MARGEX ,portY+MARGEY,NORTH,it2->getDirection());
85           
86          }
87        ports2=(it->getPortSouth(co));
88        for (QList<Port>::iterator it2=ports2.begin();it2!=ports2.end();++it2) 
89          {
90           
91            portX =it2->get_x();
92            portY =it2->get_y();
93            drawPort(portX + MARGEX ,portY+MARGEY,SOUTH,it2->getDirection());
94
95          }
96        painter.setPen(Qt::red);
97        QList<PortMap> *pm=it->getPortMap();
98       
99        for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) 
100          {
101            Signal *s=base->getSignal(&p,it->getName(),new PortMap(*it3));
102            painter.drawLine(s->get_src_x()+MARGEX,s->get_src_y()+MARGEY,s->get_dest_x()+MARGEX,s->get_dest_y()+MARGEY);
103
104            if(signalName){
105              QString signal_name = QString::fromStdString(it3->getName());
106              if(s->get_src_x() > s->get_dest_x())
107                painter.drawText(s->get_dest_x() + MARGEX - 40 ,s->get_dest_y() + MARGEY-10, signal_name);
108              if(s->get_src_x() < s->get_dest_x())
109                painter.drawText(s->get_dest_x() + MARGEX - 40 ,s->get_dest_y() + MARGEY-10, signal_name);
110            }
111
112          }
113        if(charg_open){
114          charg_open = false;
115          mess_charg->close();
116        }
117        painter.setPen(Qt::blue);
118      }
119    }
120    painter.end();
121  }
122   if(mess_open){
123    mess_open = false;
124    mess->close();
125   }
126}
127
128void Window::repaint(){
129}
130
Note: See TracBrowser for help on using the repository browser.