mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0024523: Colors and layers are lost during loopback test (read-write-read)
Command XGetShapeColor corrected to return generic color
This commit is contained in:
parent
de76a20cc8
commit
3672dea7c5
@ -51,8 +51,7 @@ static Standard_Integer setColor (Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
Quantity_Color Col ( Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5]), Quantity_TOC_RGB );
|
Quantity_Color Col ( Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atof(argv[5]), Quantity_TOC_RGB );
|
||||||
|
|
||||||
Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(Doc->Main());
|
Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(Doc->Main());
|
||||||
XCAFDoc_ColorType ctype = ( argc <=6 ? XCAFDoc_ColorGen :
|
const XCAFDoc_ColorType ctype = ( argc <= 6 ? XCAFDoc_ColorGen : ( argv[6][0] == 's' ? XCAFDoc_ColorSurf : XCAFDoc_ColorCurv ) );
|
||||||
argv[6][0] == 's' ? XCAFDoc_ColorSurf : XCAFDoc_ColorCurv );
|
|
||||||
if ( !aLabel.IsNull() ) {
|
if ( !aLabel.IsNull() ) {
|
||||||
myColors->SetColor ( aLabel, Col, ctype );
|
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)
|
static Standard_Integer getShapeColor (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
{
|
{
|
||||||
if (argc!=4) {
|
if (argc < 3) {
|
||||||
di<<"Use: "<<argv[0]<<" Doc Label ColorType(s/c)"<<"\n";
|
di<<"Use: "<<argv[0]<<" Doc Label [curve|surf]"<<"\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Handle(TDocStd_Document) Doc;
|
Handle(TDocStd_Document) Doc;
|
||||||
@ -98,10 +97,16 @@ static Standard_Integer getShapeColor (Draw_Interpretor& di, Standard_Integer ar
|
|||||||
|
|
||||||
TDF_Label aLabel;
|
TDF_Label aLabel;
|
||||||
TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
|
TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
|
||||||
Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(Doc->Main());
|
if ( aLabel.IsNull() ) {
|
||||||
Quantity_Color col;
|
di << " no such label in document\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !myColors->GetColor(aLabel, argv[3][0] == 's' ? XCAFDoc_ColorSurf : XCAFDoc_ColorCurv, col) ) return 0;
|
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, ctype, col) ) return 0;
|
||||||
|
|
||||||
TCollection_AsciiString Entry;
|
TCollection_AsciiString Entry;
|
||||||
Entry = col.StringName ( col.Name() );
|
Entry = col.StringName ( col.Name() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user