0020504: EDF 1078 GEOM: Point color is not good at study loading

This commit is contained in:
dmv 2009-10-02 12:12:45 +00:00
parent 2dddd7ebfd
commit 0bbe510fee
3 changed files with 12 additions and 5 deletions

View File

@ -1194,7 +1194,7 @@ void AddObjectColors (const Handle(TDocStd_Document)& theDoc,
}
SALOMEDS::Color aColor = obj->GetColor();
if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
if ( aColor.R >= 0 && aColor.G >= 0 && aColor.B >= 0 )
{
TCollection_AsciiString aCommand( "\n\t" );
aCommand += aName + ".SetColor(SALOMEDS.Color(" + aColor.R + "," + aColor.G + "," + aColor.B + "))";

View File

@ -338,9 +338,9 @@ SALOMEDS::Color GEOM_Object::GetColor()
bool isFound = _label.FindChild(COLOR_LABEL).FindAttribute(TDataStd_RealArray::GetID(), anArray);
SALOMEDS::Color aColor;
aColor.R = isFound ? anArray->Value( 1 ) : 0.f;
aColor.G = isFound ? anArray->Value( 2 ) : 0.f;
aColor.B = isFound ? anArray->Value( 3 ) : 0.f;
aColor.R = isFound ? anArray->Value( 1 ) : -1;
aColor.G = isFound ? anArray->Value( 2 ) : -1;
aColor.B = isFound ? anArray->Value( 3 ) : -1;
return aColor;
}

View File

@ -680,7 +680,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
if ( !aGeomObject->_is_nil() )
{
SALOMEDS::Color aSColor = aGeomObject->GetColor();
bool hasColor = aSColor.R > 0 || aSColor.G > 0 || aSColor.B > 0;
bool hasColor = aSColor.R >= 0 && aSColor.G >= 0 && aSColor.B >= 0;
if( !hasColor && aGeomObject->GetType() == GEOM_GROUP ) // auto color for group
{
GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
@ -723,6 +723,13 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
Quantity_Color aQuanColor( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
AISShape->SetColor( aQuanColor );
AISShape->SetShadingColor( aQuanColor );
if ( myShape.ShapeType() == TopAbs_VERTEX ) {
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
anAspect->SetColor( aQuanColor );
anAspect->SetScale( myScaleOfMarker );
anAspect->SetTypeOfMarker( myTypeOfMarker );
AISShape->Attributes()->SetPointAspect( anAspect );
}
}
}
}