* ./hurricane/src/viewer:

- Change: In DisplayStyle, new attribute "goMatched" to tell if the style
        is associated to a given Go and therefore should be displayed in the
        Layer table.
This commit is contained in:
Jean-Paul Chaput 2010-06-22 20:37:28 +00:00
parent de68831335
commit 85b246eb16
3 changed files with 36 additions and 24 deletions

View File

@ -2,7 +2,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
// //
// =================================================================== // ===================================================================
// //
@ -65,17 +65,20 @@ namespace Hurricane {
, int blue , int blue
, int borderWidth , int borderWidth
, float threshold , float threshold
) : _name(name) , bool goMatched
, _red(red) )
, _green(green) : _name (name)
, _blue(blue) , _red (red)
, _borderWidth(borderWidth) , _green (green)
, _pattern(pattern) , _blue (blue)
, _color(NULL) , _borderWidth(borderWidth)
, _pen(NULL) , _pattern (pattern)
, _brush(NULL) , _color (NULL)
, _threshold(threshold) , _pen (NULL)
, _refcount(1) , _brush (NULL)
, _threshold (threshold)
, _goMatched (goMatched)
, _refcount (1)
{ {
} }
@ -88,9 +91,10 @@ namespace Hurricane {
, int blue , int blue
, int borderWidth , int borderWidth
, float threshold , float threshold
, bool goMatched
) )
{ {
DrawingStyle* style = new DrawingStyle ( name, pattern, red, green, blue, borderWidth, threshold ); DrawingStyle* style = new DrawingStyle ( name, pattern, red, green, blue, borderWidth, threshold, goMatched );
//if ( Graphics::isEnabled() ) //if ( Graphics::isEnabled() )
// style->qtAllocate (); // style->qtAllocate ();
@ -234,6 +238,7 @@ namespace Hurricane {
, int blue , int blue
, int borderWidth , int borderWidth
, float threshold , float threshold
, bool goMatched
) )
{ {
size_t i = findIndex ( key ); size_t i = findIndex ( key );
@ -245,7 +250,7 @@ namespace Hurricane {
} }
return _drawingStyles[i] = return _drawingStyles[i] =
DrawingStyle::create ( key, pattern, red, green, blue, borderWidth, threshold ); DrawingStyle::create ( key, pattern, red, green, blue, borderWidth, threshold, goMatched );
} }
@ -398,12 +403,13 @@ namespace Hurricane {
, int blue , int blue
, int borderWidth , int borderWidth
, float threshold , float threshold
, bool goMatched
) )
{ {
size_t gi; size_t gi;
findOrCreate ( groupKey, gi ); findOrCreate ( groupKey, gi );
_groups[gi]->addDrawingStyle ( key, pattern, red, green, blue, borderWidth, threshold ); _groups[gi]->addDrawingStyle ( key, pattern, red, green, blue, borderWidth, threshold, goMatched );
} }

View File

@ -244,12 +244,11 @@ namespace Hurricane {
gridBuffer.addSection ( _createGroupItem(groups[gi]->getName()), Qt::AlignHCenter ); gridBuffer.addSection ( _createGroupItem(groups[gi]->getName()), Qt::AlignHCenter );
for ( size_t si=0 ; si<styles.size() ; si++ ) { for ( size_t si=0 ; si<styles.size() ; si++ ) {
if ( not styles[si]->isGoMatched() ) continue;
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue; if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
if ( styles[si]->getName() == DisplayStyle::Background ) continue; if ( styles[si]->getName() == DisplayStyle::Background ) continue;
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
if ( styles[si]->getName() == DisplayStyle::SelectionDraw ) continue; if ( styles[si]->getName() == DisplayStyle::SelectionDraw ) continue;
if ( styles[si]->getName() == DisplayStyle::SelectionFill ) continue; if ( styles[si]->getName() == DisplayStyle::SelectionFill ) continue;
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
PaletteNamedItem* item = _createNamedItem ( styles[si]->getName() ); PaletteNamedItem* item = _createNamedItem ( styles[si]->getName() );
gridBuffer.addWidget ( item ); gridBuffer.addWidget ( item );

View File

@ -2,7 +2,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
// //
// =================================================================== // ===================================================================
// //
@ -54,12 +54,14 @@ namespace Hurricane {
, int blue =0 , int blue =0
, int borderWidth=0 , int borderWidth=0
, float threshold =1.0 , float threshold =1.0
, bool goMatched =true
); );
DrawingStyle* link (); DrawingStyle* link ();
size_t unlink (); size_t unlink ();
// Accessors. // Accessors.
void qtAllocate (); void qtAllocate ();
inline bool isGoMatched () const;
inline const Name& getName () const; inline const Name& getName () const;
inline const string& getPattern () const; inline const string& getPattern () const;
QColor getColor ( int darkening ) const; QColor getColor ( int darkening ) const;
@ -79,16 +81,18 @@ namespace Hurricane {
QPen *_pen; QPen *_pen;
QBrush *_brush; QBrush *_brush;
float _threshold; float _threshold;
bool _goMatched;
size_t _refcount; size_t _refcount;
// Internal - Constructors & Destructors. // Internal - Constructors & Destructors.
DrawingStyle ( const Name& name DrawingStyle ( const Name& name
, const string& pattern ="FFFFFFFFFFFFFFFF" , const string& pattern
, int red =0 , int red
, int green =0 , int green
, int blue =0 , int blue
, int borderWidth=0 , int borderWidth
, float threshold =1.0 , float threshold
, bool goMatched
); );
DrawingStyle ( const DrawingStyle& ); DrawingStyle ( const DrawingStyle& );
~DrawingStyle (); ~DrawingStyle ();
@ -120,6 +124,7 @@ namespace Hurricane {
, int blue , int blue
, int borderWidth , int borderWidth
, float threshold , float threshold
, bool goMatched
); );
protected: protected:
@ -192,6 +197,7 @@ namespace Hurricane {
, int blue , int blue
, int borderWidth , int borderWidth
, float threshold , float threshold
, bool goMatched =true
); );
protected: protected:
@ -215,6 +221,7 @@ namespace Hurricane {
// Functions. // Functions.
inline bool DrawingStyle::isGoMatched () const { return _goMatched; }
inline const Name& DrawingStyle::getName () const { return _name; } inline const Name& DrawingStyle::getName () const { return _name; }
inline const string& DrawingStyle::getPattern () const { return _pattern; } inline const string& DrawingStyle::getPattern () const { return _pattern; }
inline float DrawingStyle::getThreshold () const { return _threshold; } inline float DrawingStyle::getThreshold () const { return _threshold; }