- Adding function to correctly display routingGraph in knik
The dbuToDisplayRect function now has a boolean argument which is true by default and define the way the rectangle is passed to display. If true, it's like we pass 2 corners to define the rectangle If false, it's like we pass the bottom left corner, width and height (directly QT compliant)
This commit is contained in:
parent
5afca323b2
commit
ddc3e541f1
|
@ -541,6 +541,7 @@ namespace Hurricane {
|
|||
, _cellWidget(widget)
|
||||
, _drawExtensionGo(NULL)
|
||||
, _goCount(0)
|
||||
, _goExtensionCount(0)
|
||||
, _instanceCount(0)
|
||||
{ }
|
||||
|
||||
|
@ -631,8 +632,10 @@ namespace Hurricane {
|
|||
, const Transformation& transformation
|
||||
)
|
||||
{
|
||||
if ( _drawExtensionGo )
|
||||
if ( _drawExtensionGo ) {
|
||||
_goExtensionCount++;
|
||||
_drawExtensionGo ( widget, go, basicLayer, area, transformation );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1026,6 +1029,7 @@ namespace Hurricane {
|
|||
Box redrawBox = displayToDbuBox ( redrawArea );
|
||||
|
||||
_drawingQuery.resetGoCount ();
|
||||
_drawingQuery.resetGoExtensionCount();
|
||||
_drawingQuery.resetInstanceCount();
|
||||
_drawingQuery.setExtensionMask ( 0 );
|
||||
_drawingQuery.setArea ( redrawBox );
|
||||
|
@ -1125,6 +1129,11 @@ namespace Hurricane {
|
|||
<< " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getGoCount()) << " s/go)";
|
||||
else
|
||||
cerr << " 0 Gos";
|
||||
if ( _drawingQuery.getGoExtensionCount() )
|
||||
cerr << " " << _drawingQuery.getGoExtensionCount()
|
||||
<< " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getGoExtensionCount()) << " s/ego)";
|
||||
else
|
||||
cerr << " 0 eGos";
|
||||
if ( _drawingQuery.getInstanceCount() )
|
||||
cerr << " " << _drawingQuery.getInstanceCount()
|
||||
<< " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getInstanceCount()) << " s/inst)";
|
||||
|
@ -1740,22 +1749,35 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
QRect CellWidget::dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const
|
||||
QRect CellWidget::dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2, bool usePoint ) const
|
||||
{
|
||||
return QRect ( dbuToDisplayX(x1)
|
||||
, dbuToDisplayY(y2)
|
||||
, dbuToDisplayX(x2) - dbuToDisplayX(x1)
|
||||
, dbuToDisplayY(y1) - dbuToDisplayY(y2)
|
||||
);
|
||||
if ( usePoint ) {
|
||||
int width = dbuToDisplayX(x2) - dbuToDisplayX(x1);
|
||||
int height = dbuToDisplayY(y1) - dbuToDisplayY(y2);
|
||||
return QRect ( dbuToDisplayX(x1)
|
||||
, dbuToDisplayY(y2)
|
||||
, width?width:1
|
||||
, height?height:1
|
||||
);
|
||||
} else {
|
||||
int width = dbuToDisplayLength ( x2 - x1 );
|
||||
int height = dbuToDisplayLength ( y2 - y1 );
|
||||
return QRect ( dbuToDisplayX(x1)
|
||||
, dbuToDisplayY(y2)
|
||||
, width?width:1
|
||||
, height?height:1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QRect CellWidget::dbuToDisplayRect ( const Box& box ) const
|
||||
QRect CellWidget::dbuToDisplayRect ( const Box& box, bool usePoint ) const
|
||||
{
|
||||
return dbuToDisplayRect ( box.getXMin()
|
||||
, box.getYMin()
|
||||
, box.getXMax()
|
||||
, box.getYMax()
|
||||
, usePoint
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -150,8 +150,8 @@ namespace Hurricane {
|
|||
void drawScreenRect ( const QRect& , size_t plane=PlaneId::Working );
|
||||
void drawScreenPolyline ( const QPoint*, int, int, size_t plane=PlaneId::Working );
|
||||
// Geometric conversions.
|
||||
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
|
||||
QRect dbuToDisplayRect ( const Box& box ) const;
|
||||
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2, bool usePoint=true ) const;
|
||||
QRect dbuToDisplayRect ( const Box& box , bool usePoint=true ) const;
|
||||
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
|
||||
QPoint dbuToDisplayPoint ( const Point& point ) const;
|
||||
inline int dbuToDisplayX ( DbU::Unit x ) const;
|
||||
|
@ -386,8 +386,10 @@ namespace Hurricane {
|
|||
, const Transformation& transformation
|
||||
);
|
||||
inline unsigned int getGoCount () const;
|
||||
inline unsigned int getGoExtensionCount () const;
|
||||
inline unsigned int getInstanceCount () const;
|
||||
inline void resetGoCount ();
|
||||
inline void resetGoExtensionCount ();
|
||||
inline void resetInstanceCount ();
|
||||
|
||||
protected:
|
||||
|
@ -396,6 +398,7 @@ namespace Hurricane {
|
|||
map<Name,pair<InitExtensionGo_t*,DrawExtensionGo_t*> >
|
||||
_drawExtensionGos;
|
||||
unsigned int _goCount;
|
||||
unsigned int _goExtensionCount;
|
||||
unsigned int _instanceCount;
|
||||
};
|
||||
|
||||
|
@ -508,6 +511,10 @@ namespace Hurricane {
|
|||
{ _goCount = 0; }
|
||||
|
||||
|
||||
inline void CellWidget::DrawingQuery::resetGoExtensionCount ()
|
||||
{ _goExtensionCount = 0; }
|
||||
|
||||
|
||||
inline void CellWidget::DrawingQuery::resetInstanceCount ()
|
||||
{ _instanceCount = 0; }
|
||||
|
||||
|
@ -516,6 +523,10 @@ namespace Hurricane {
|
|||
{ return _goCount; }
|
||||
|
||||
|
||||
inline unsigned int CellWidget::DrawingQuery::getGoExtensionCount () const
|
||||
{ return _goExtensionCount; }
|
||||
|
||||
|
||||
inline unsigned int CellWidget::DrawingQuery::getInstanceCount () const
|
||||
{ return _instanceCount; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue