From 3672dea7c5c49f3ae8d64fb6e0ba3d8dfd62db0d Mon Sep 17 00:00:00 2001 From: szv Date: Thu, 9 Jan 2014 15:49:16 +0400 Subject: [PATCH] 0024523: Colors and layers are lost during loopback test (read-write-read) Command XGetShapeColor corrected to return generic color --- src/XDEDRAW/XDEDRAW_Colors.cxx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/XDEDRAW/XDEDRAW_Colors.cxx b/src/XDEDRAW/XDEDRAW_Colors.cxx index 60d4ba50c2..7b3c1a94ce 100644 --- a/src/XDEDRAW/XDEDRAW_Colors.cxx +++ b/src/XDEDRAW/XDEDRAW_Colors.cxx @@ -38,7 +38,7 @@ static Standard_Integer setColor (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { - if (argc <6) { + if (argc < 6) { di<<"Use: "<Main()); - XCAFDoc_ColorType ctype = ( argc <=6 ? XCAFDoc_ColorGen : - argv[6][0] == 's' ? XCAFDoc_ColorSurf : XCAFDoc_ColorCurv ); + const XCAFDoc_ColorType ctype = ( argc <= 6 ? XCAFDoc_ColorGen : ( argv[6][0] == 's' ? XCAFDoc_ColorSurf : XCAFDoc_ColorCurv ) ); if ( !aLabel.IsNull() ) { myColors->SetColor ( aLabel, Col, ctype ); } @@ -88,8 +87,8 @@ static Standard_Integer getColor (Draw_Interpretor& di, Standard_Integer argc, c static Standard_Integer getShapeColor (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { - if (argc!=4) { - di<<"Use: "<GetData(), argv[2], aLabel); + if ( aLabel.IsNull() ) { + di << " no such label in document\n"; + return 1; + } + Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(Doc->Main()); + const XCAFDoc_ColorType ctype = ( argc <= 3 ? XCAFDoc_ColorGen : ( argv[3][0] == 's' ? XCAFDoc_ColorSurf : XCAFDoc_ColorCurv ) ); + Quantity_Color col; - - if ( !myColors->GetColor(aLabel, argv[3][0] == 's' ? XCAFDoc_ColorSurf : XCAFDoc_ColorCurv, col) ) return 0; - + if ( !myColors->GetColor(aLabel, ctype, col) ) return 0; + TCollection_AsciiString Entry; Entry = col.StringName ( col.Name() ); di << Entry.ToCString(); - + return 0; }