* ./hurricane/src/hurricane:

- New: In Query, add support for Markers, although they are Go's, are stored
        in a separate QuadTree directly at Cell level. In a very similar fashion
        to the ExtensionGos. Sometimes should look if thoses mecanism could be
        unified.

  * ./hurricane/src/viewer:
    - New: In CellWidget, add support for displaying References. Uses the Marker
        Query. For now labels are displayed centered on the reference point,
        making that point hard to see. That behavior may be changed later if
        needs to be.
    - Bug: In InspectorWidget, the History::push() wasn't updating the ComboBox
        index. The line was strangely commented out (?).
This commit is contained in:
Jean-Paul Chaput 2010-04-03 13:56:07 +00:00
parent 3a25248804
commit d1d2a2ea01
7 changed files with 97 additions and 42 deletions

View File

@ -114,7 +114,7 @@ namespace Hurricane {
void Query::doQuery ()
{
if ( _stack.getTopArea().isEmpty() || !_stack.getTopCell() ) return;
if ( _stack.getTopArea().isEmpty() or not _stack.getTopCell() ) return;
//cerr << "Query::doQuery() - " << _stack.getTopCell() << " " << _stack.getTopArea() << " " << _basicLayer << endl;
@ -122,16 +122,16 @@ namespace Hurricane {
while ( !_stack.empty() ) {
// Process the Components of the current instance.
if ( hasGoCallback() && _basicLayer && (_filter.isSet(DoComponents)) ) {
if ( hasGoCallback() and _basicLayer and (_filter.isSet(DoComponents)) ) {
//if ( getInstance() )
// cerr << getTab() << getInstance() << " " << getTransformation() << endl;
//else
// cerr << " TopCell: " << getMasterCell() << " " << getTransformation() << endl;
if ( !getMasterCell()->isTerminal() || (_filter.isSet(DoTerminalCells)) ) {
if ( not getMasterCell()->isTerminal() or (_filter.isSet(DoTerminalCells)) ) {
forEach ( Slice*, islice, getMasterCell()->getSlices() ) {
if ( !(*islice)->getLayer()->contains(getBasicLayer()) ) continue;
if ( !(*islice)->getBoundingBox().intersect(getArea()) ) continue;
if ( not (*islice)->getLayer()->contains(getBasicLayer()) ) continue;
if ( not (*islice)->getBoundingBox().intersect(getArea()) ) continue;
forEach ( Go*, igo, (*islice)->getGosUnder(_stack.getArea()) )
goCallback ( *igo );
@ -139,16 +139,22 @@ namespace Hurricane {
}
}
if ( !getMasterCell()->isTerminal() && (_filter.isSet(DoRubbers)) ) {
if ( (not getMasterCell()->isTerminal() or (_filter.isSet(DoTerminalCells)))
and _filter.isSet(DoMarkers) ) {
forEach ( Marker*, marker, getMasterCell()->getMarkersUnder(_stack.getArea()) )
markerCallback ( *marker );
}
if ( not getMasterCell()->isTerminal() and (_filter.isSet(DoRubbers)) ) {
forEach ( Rubber*, rubber, getMasterCell()->getRubbersUnder(_stack.getArea()) )
rubberCallback ( *rubber );
}
if ( hasExtensionGoCallback() && (_filter.isSet(DoExtensionGos)) ) {
if ( !getMasterCell()->isTerminal() || (_filter.isSet(DoTerminalCells)) ) {
if ( hasExtensionGoCallback() and (_filter.isSet(DoExtensionGos)) ) {
if ( not getMasterCell()->isTerminal() or (_filter.isSet(DoTerminalCells)) ) {
forEach ( ExtensionSlice*, islice, getMasterCell()->getExtensionSlices() ) {
if ( !( (*islice)->getMask() & _extensionMask ) ) continue;
if ( !(*islice)->getBoundingBox().intersect(getArea()) ) continue;
if ( not ( (*islice)->getMask() & _extensionMask ) ) continue;
if ( not (*islice)->getBoundingBox().intersect(getArea()) ) continue;
forEach ( Go*, igo, (*islice)->getGosUnder(_stack.getArea()) )
extensionGoCallback ( *igo );
@ -156,7 +162,7 @@ namespace Hurricane {
}
}
if ( (_filter.isSet(DoMasterCells)) && hasMasterCellCallback() )
if ( (_filter.isSet(DoMasterCells)) and hasMasterCellCallback() )
masterCellCallback ();
_stack.progress ();
@ -165,27 +171,27 @@ namespace Hurricane {
bool Query::hasGoCallback () const
{
return false;
}
{ return false; }
bool Query::hasMarkerCallback () const
{ return false; }
bool Query::hasRubberCallback () const
{
return false;
}
{ return false; }
bool Query::hasExtensionGoCallback () const
{
return false;
}
{ return false; }
bool Query::hasMasterCellCallback () const
{
return false;
}
{ return false; }
void Query::markerCallback ( Marker* )
{ }
void Query::rubberCallback ( Rubber* )

View File

@ -298,11 +298,13 @@ namespace Hurricane {
enum QueryFilter { DoMasterCells = 1
, DoTerminalCells = 2
, DoComponents = 4
, DoRubbers = 8
, DoExtensionGos = 16
, DoMarkers = 8
, DoRubbers = 16
, DoExtensionGos = 32
, DoAll = DoMasterCells
| DoTerminalCells
| DoComponents
| DoMarkers
| DoRubbers
| DoExtensionGos
};
@ -321,10 +323,12 @@ namespace Hurricane {
inline Instance* getInstance ();
//inline const Tabulation& getTab () const;
virtual bool hasGoCallback () const;
virtual bool hasMarkerCallback () const;
virtual bool hasRubberCallback () const;
virtual bool hasExtensionGoCallback () const;
virtual bool hasMasterCellCallback () const;
virtual void goCallback ( Go* ) = 0;
virtual void markerCallback ( Marker* );
virtual void rubberCallback ( Rubber* );
virtual void extensionGoCallback ( Go* ) = 0;
virtual void masterCellCallback () = 0;

View File

@ -844,16 +844,41 @@ namespace Hurricane {
}
bool CellWidget::DrawingQuery::hasRubberCallback () const
bool CellWidget::DrawingQuery::hasMarkerCallback () const
{ return true; }
void CellWidget::DrawingQuery::markerCallback ( Marker* marker )
{ drawMarker ( marker, getArea(), getTransformation() ); }
void CellWidget::DrawingQuery::drawMarker ( const Marker* marker
, const Box& area
, const Transformation& transformation
)
{
return true;
static QRect rectangle;
const Reference* reference = dynamic_cast<const Reference*>(marker);
if ( reference ) {
_goCount++;
Box bb = transformation.getBox(reference->getBoundingBox()).inflate(DbU::lambda(5.0));
rectangle = _cellWidget->dbuToDisplayRect ( bb );
if ( _cellWidget->isDrawable("text.reference") and (getDepth() < 2) ) {
const char* refName = reference->getName()._getSharedName()->_getSString().c_str();
_cellWidget->drawDisplayText ( rectangle, refName, BigFont|Bold|Center|Frame );
}
}
}
bool CellWidget::DrawingQuery::hasRubberCallback () const
{ return true; }
void CellWidget::DrawingQuery::rubberCallback ( Rubber* rubber )
{
drawRubber ( rubber, getArea(), getTransformation() );
}
{ drawRubber ( rubber, getArea(), getTransformation() ); }
void CellWidget::DrawingQuery::drawRubber ( const Rubber* rubber
@ -1381,7 +1406,7 @@ namespace Hurricane {
if ( isDrawable((*iLayer)->getName()) ) {
_drawingQuery.setBasicLayer ( *iLayer );
_drawingQuery.setFilter ( getQueryFilter().unset(Query::DoMasterCells|Query::DoRubbers) );
_drawingQuery.setFilter ( getQueryFilter().unset(Query::DoMasterCells|Query::DoRubbers|Query::DoMarkers) );
_drawingQuery.doQuery ();
}
if ( _enableRedrawInterrupt ) QApplication::processEvents();
@ -1398,7 +1423,18 @@ namespace Hurricane {
_drawingPlanes.setBrush ( Graphics::getBrush("boundaries",getDarkening()) );
_drawingQuery.setBasicLayer ( NULL );
_drawingQuery.setFilter ( getQueryFilter().unset(Query::DoComponents|Query::DoRubbers) );
_drawingQuery.setFilter ( getQueryFilter().unset(Query::DoComponents|Query::DoRubbers|Query::DoMarkers) );
_drawingQuery.doQuery ();
}
}
if ( /*!timeout("redraw [markers]",timer,10.0,timedout) &&*/ (!_redrawManager.interrupted()) ) {
if ( isDrawable("text.reference") ) {
_drawingPlanes.setPen ( Graphics::getPen ("text.reference",getDarkening()) );
_drawingPlanes.setBrush ( Graphics::getBrush("text.reference",getDarkening()) );
_drawingQuery.setBasicLayer ( NULL );
_drawingQuery.setFilter ( getQueryFilter().unset(Query::DoComponents|Query::DoMasterCells) );
_drawingQuery.doQuery ();
}
}
@ -1409,7 +1445,7 @@ namespace Hurricane {
_drawingPlanes.setBrush ( Graphics::getBrush("rubber",getDarkening()) );
_drawingQuery.setBasicLayer ( NULL );
_drawingQuery.setFilter ( getQueryFilter().unset(Query::DoComponents|Query::DoMasterCells) );
_drawingQuery.setFilter ( getQueryFilter().unset(Query::DoComponents|Query::DoMasterCells|Query::DoMarkers) );
_drawingQuery.doQuery ();
}
}

View File

@ -53,6 +53,7 @@ namespace Hurricane {
const Name DisplayStyle::TextCell = "text.cell";
const Name DisplayStyle::TextInstance = "text.instance";
const Name DisplayStyle::TextComponent = "text.component";
const Name DisplayStyle::TextReference = "text.reference";
const Name DisplayStyle::Undef = "undef";
@ -270,6 +271,7 @@ namespace Hurricane {
addDrawingStyle ( Viewer, TextCell , "8822441188224411", 255, 255, 255, 0, 1.0 );
addDrawingStyle ( Viewer, TextInstance , "8822441188224411", 255, 255, 255, 0, 1.0 );
addDrawingStyle ( Viewer, TextComponent, "FFFFFFFFFFFFFFFF", 255, 255, 255, 0, 1.0 );
addDrawingStyle ( Viewer, TextReference, "FFFFFFFFFFFFFFFF", 255, 255, 255, 0, 1.0 );
addDrawingStyle ( Viewer, Undef , "2244118822441188", 238, 130, 238, 0, 1.0 );
}

View File

@ -66,7 +66,7 @@ namespace Hurricane {
_depth++;
_slots.push_back ( slot->getClone() );
_comboBox->addItem ( QString("%1: %2").arg(_depth).arg(_slots[_slots.size()-1]->getDataString().c_str()));
//_comboBox->setCurrentIndex ( _depth );
_comboBox->setCurrentIndex ( _depth );
//cerr << "After History::push()" << endl;
}
@ -161,14 +161,14 @@ namespace Hurricane {
InspectorWidget::InspectorWidget ( QWidget* parent )
: QWidget(parent)
, _baseModel(NULL)
, _sortModel(NULL)
, _historyComboBox(NULL)
, _view(NULL)
, _rowHeight(20)
, _history()
, _rootOccurrence()
: QWidget (parent)
, _baseModel (NULL)
, _sortModel (NULL)
, _historyComboBox(NULL)
, _view (NULL)
, _rowHeight (20)
, _history ()
, _rootOccurrence ()
{
setAttribute ( Qt::WA_DeleteOnClose );
setAttribute ( Qt::WA_QuitOnClose, false );

View File

@ -457,11 +457,13 @@ namespace Hurricane {
void setDrawExtensionGo ( const Name& );
virtual bool hasMasterCellCallback () const;
virtual bool hasGoCallback () const;
virtual bool hasMarkerCallback () const;
virtual bool hasRubberCallback () const;
virtual bool hasExtensionGoCallback () const;
virtual void masterCellCallback ();
virtual void goCallback ( Go* );
virtual void rubberCallback ( Rubber* );
virtual void markerCallback ( Marker* );
virtual void extensionGoCallback ( Go* );
void drawMasterCell ( const Cell* cell
, const Transformation& transformation
@ -475,6 +477,10 @@ namespace Hurricane {
, const Box& area
, const Transformation& transformation
);
void drawMarker ( const Marker* marker
, const Box& area
, const Transformation& transformation
);
void drawExtensionGo ( CellWidget* widget
, const Go* go
, const BasicLayer* basicLayer

View File

@ -157,6 +157,7 @@ namespace Hurricane {
static const Name TextCell;
static const Name TextInstance;
static const Name TextComponent;
static const Name TextReference;
static const Name Undef;
static const Name UnmatchedGroup;