Attribute ColorByLayer was added for shapes that should be colored by the color of their layer or, if it's absent, by the parent component's layer color.
Fixing inconsistency of iterating through the map of Styles
Improving ColorByLayer mechanism
Fix for Map/IndexedMad differences.
Renaming according to convention of naming collection typedefs
TDF_Label L = labels.Value(i);
// collect color settings
- XCAFPrs_DataMapOfShapeStyle settings;
+ XCAFPrs_IndexedDataMapOfShapeStyle settings;
TopLoc_Location loc;
XCAFPrs::CollectStyleSettings ( L, loc, settings );
if ( settings.Extent() <=0 ) continue;
//=======================================================================
void IGESCAFControl_Writer::MakeColors (const TopoDS_Shape &S,
- const XCAFPrs_DataMapOfShapeStyle &settings,
+ const XCAFPrs_IndexedDataMapOfShapeStyle &settings,
XCAFPrs_DataMapOfStyleTransient &colors,
TopTools_MapOfShape &Map,
const XCAFPrs_Style &inherit)
// check if shape has its own style (or inherits from ancestor)
XCAFPrs_Style style = inherit;
- if ( settings.IsBound(S) ) {
- XCAFPrs_Style own = settings.Find(S);
+ if ( settings.Contains(S) ) {
+ XCAFPrs_Style own = settings.FindFromKey(S);
if ( own.IsSetColorCurv() ) style.SetColorCurv ( own.GetColorCurv() );
if ( own.IsSetColorSurf() ) style.SetColorSurf ( own.GetColorSurf() );
}
#include <IGESControl_Writer.hxx>
#include <Standard_CString.hxx>
#include <TDF_LabelSequence.hxx>
-#include <XCAFPrs_DataMapOfShapeStyle.hxx>
+#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
#include <XCAFPrs_DataMapOfStyleTransient.hxx>
#include <TopTools_MapOfShape.hxx>
class XSControl_WorkSession;
//! Recursively iterates on subshapes and assigns colors
//! to faces and edges (if set)
- Standard_EXPORT void MakeColors (const TopoDS_Shape& S, const XCAFPrs_DataMapOfShapeStyle& settings, XCAFPrs_DataMapOfStyleTransient& colors, TopTools_MapOfShape& Map, const XCAFPrs_Style& inherit);
+ Standard_EXPORT void MakeColors (const TopoDS_Shape& S, const XCAFPrs_IndexedDataMapOfShapeStyle& settings, XCAFPrs_DataMapOfStyleTransient& colors, TopTools_MapOfShape& Map, const XCAFPrs_Style& inherit);
Standard_Boolean myColorMode;
#include <XCAFDoc_Volume.hxx>
#include <XCAFPrs.hxx>
#include <XCAFPrs_DataMapIteratorOfDataMapOfStyleShape.hxx>
-#include <XCAFPrs_DataMapOfShapeStyle.hxx>
+#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
#include <XCAFPrs_DataMapOfStyleShape.hxx>
#include <XCAFPrs_Style.hxx>
#include <XSControl_TransferWriter.hxx>
//=======================================================================
static void MakeSTEPStyles (STEPConstruct_Styles &Styles,
const TopoDS_Shape &S,
- const XCAFPrs_DataMapOfShapeStyle &settings,
+ const XCAFPrs_IndexedDataMapOfShapeStyle &settings,
Handle(StepVisual_StyledItem) &override,
TopTools_MapOfShape &Map,
const MoniTool_DataMapOfShapeTransient& myMapCompMDGPR,
// check if shape has its own style (r inherits from ancestor)
XCAFPrs_Style style;
if ( inherit ) style = *inherit;
- if ( settings.IsBound(S) ) {
- XCAFPrs_Style own = settings.Find(S);
+ if ( settings.Contains(S) ) {
+ XCAFPrs_Style own = settings.FindFromKey(S);
if ( !own.IsVisible() ) style.SetVisibility ( Standard_False );
if ( own.IsSetColorCurv() ) style.SetColorCurv ( own.GetColorCurv() );
if ( own.IsSetColorSurf() ) style.SetColorSurf ( own.GetColorSurf() );
continue;
// collect settings set on that label
- XCAFPrs_DataMapOfShapeStyle settings;
+ XCAFPrs_IndexedDataMapOfShapeStyle settings;
TDF_LabelSequence seq;
seq.Append ( L );
XCAFDoc_ShapeTool::GetSubShapes ( L, seq );
if ( ! style.IsSetColorCurv() && ! style.IsSetColorSurf() && isVisible ) continue;
TopoDS_Shape sub = XCAFDoc_ShapeTool::GetShape ( lab );
- settings.Bind ( sub, style );
+ XCAFPrs_Style* aMapStyle = settings.ChangeSeek (sub);
+ if (aMapStyle == NULL)
+ settings.Add ( sub, style );
+ else
+ *aMapStyle = style;
}
if ( settings.Extent() <=0 ) continue;
}
+//=======================================================================
+//function : ColorByLayerGUID
+//purpose :
+//=======================================================================
+
+Standard_GUID XCAFDoc::ColorByLayerGUID ()
+{
+ static Standard_GUID ID ("279e8c1e-70af-4130-b626-9cc52a537db8");
+ return ID;
+}
+
+
//=======================================================================
//function : SHUORefGUID
//purpose :
Standard_EXPORT static Standard_GUID NoteRefGUID();
Standard_EXPORT static Standard_GUID InvisibleGUID();
+
+ Standard_EXPORT static Standard_GUID ColorByLayerGUID();
//! Returns GUID for UAttribute identifying external reference on no-step file
Standard_EXPORT static Standard_GUID ExternRefGUID();
else L.ForgetAttribute( XCAFDoc::InvisibleGUID() );
}
+//=======================================================================
+//function : IsColorByLayer
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_ColorTool::IsColorByLayer (const TDF_Label& L) const
+{
+ Handle(TDataStd_UAttribute) aUAttr;
+ return L.FindAttribute(XCAFDoc::ColorByLayerGUID(), aUAttr);
+}
+
+//=======================================================================
+//function : SetColorByLayer
+//purpose :
+//=======================================================================
+
+void XCAFDoc_ColorTool::SetColorByLayer (const TDF_Label& L,
+ const Standard_Boolean isColorByLayer)
+{
+ Handle(TDataStd_UAttribute) aUAttr;
+ if ( isColorByLayer ) {
+ Handle(XCAFDoc_GraphNode) aSHUO;
+ if (ShapeTool()->IsShape(L) || ShapeTool()->GetSHUO( L, aSHUO ) )
+ if (!L.FindAttribute(XCAFDoc::ColorByLayerGUID(), aUAttr))
+ aUAttr->Set( L, XCAFDoc::ColorByLayerGUID() );
+ }
+ else L.ForgetAttribute( XCAFDoc::ColorByLayerGUID() );
+}
+
//=======================================================================
//function : SetInstanceColor
//purpose :
//! Set the visibility of object on label. Do nothing if there no any object.
//! Set UAttribute with corresponding GUID.
Standard_EXPORT void SetVisibility (const TDF_Label& shapeLabel, const Standard_Boolean isvisible = Standard_True);
-
+
+ //! Return TRUE if object color defined by its Layer, FALSE if not.
+ Standard_EXPORT Standard_Boolean IsColorByLayer (const TDF_Label& L) const;
+
+ //! Set the Color defined by Layer flag on label. Do nothing if there no any object.
+ //! Set UAttribute with corresponding GUID.
+ Standard_EXPORT void SetColorByLayer (const TDF_Label& shapeLabel, const Standard_Boolean isColorByLayer = Standard_False);
+
//! Sets the color of component that styled with SHUO structure
//! Returns FALSE if no sush component found
//! NOTE: create SHUO structeure if it is necessary and if <isCreateSHUO>
XCAFPrs.hxx
XCAFPrs_AISObject.cxx
XCAFPrs_AISObject.hxx
-XCAFPrs_DataMapIteratorOfDataMapOfShapeStyle.hxx
+XCAFPrs_DataMapIteratorOfIndexedDataMapOfShapeStyle.hxx
XCAFPrs_DataMapIteratorOfDataMapOfStyleShape.hxx
XCAFPrs_DataMapIteratorOfDataMapOfStyleTransient.hxx
-XCAFPrs_DataMapOfShapeStyle.hxx
+XCAFPrs_IndexedDataMapOfShapeStyle.hxx
XCAFPrs_DataMapOfStyleShape.hxx
XCAFPrs_DataMapOfStyleTransient.hxx
XCAFPrs_Driver.cxx
//=======================================================================
void XCAFPrs::CollectStyleSettings (const TDF_Label& theLabel,
- const TopLoc_Location& theLoc,
- XCAFPrs_DataMapOfShapeStyle& theSettings)
+ const TopLoc_Location& theLoc,
+ XCAFPrs_IndexedDataMapOfShapeStyle& theSettings,
+ const Quantity_ColorRGBA& theLayerColor)
{
// for references, first collect colors of referred shape
{
TDF_Label aLabelRef;
if (XCAFDoc_ShapeTool::GetReferredShape (theLabel, aLabelRef))
{
+ Quantity_ColorRGBA aLayerColor = theLayerColor;
+ Handle(XCAFDoc_LayerTool) aLayerTool = XCAFDoc_DocumentTool::LayerTool (theLabel);
+ Handle(TColStd_HSequenceOfExtendedString) aLayerNames = new TColStd_HSequenceOfExtendedString();
+ aLayerTool->GetLayers (theLabel, aLayerNames);
+ if (aLayerNames->Length() == 1)
+ {
+ TDF_Label aLayer = aLayerTool->FindLayer (aLayerNames->First());
+ Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool(theLabel);
+ Quantity_ColorRGBA aColor;
+ if (aColorTool->GetColor (aLayer, XCAFDoc_ColorGen, aColor))
+ aLayerColor = aColor;
+ }
TopLoc_Location aLocSub = theLoc.Multiplied (XCAFDoc_ShapeTool::GetLocation (theLabel));
- CollectStyleSettings (aLabelRef, aLocSub, theSettings);
+ CollectStyleSettings (aLabelRef, aLocSub, theSettings, aLayerColor);
}
}
for (TDF_LabelSequence::Iterator aComponentIter (aComponentLabSeq); aComponentIter.More(); aComponentIter.Next())
{
const TDF_Label& aComponentLab = aComponentIter.Value();
- CollectStyleSettings (aComponentLab, theLoc, theSettings);
+ CollectStyleSettings (aComponentLab, theLoc, theSettings, theLayerColor);
}
}
}
}
else
{
- Quantity_ColorRGBA aColor;
- if (aColorTool->GetColor (aLabel, XCAFDoc_ColorGen, aColor))
+ if (aColorTool->IsColorByLayer(aLabel))
{
- aStyle.SetColorCurv (aColor.GetRGB());
- aStyle.SetColorSurf (aColor);
- }
- if (aColorTool->GetColor (aLabel, XCAFDoc_ColorSurf, aColor))
- {
- aStyle.SetColorSurf (aColor);
+ Quantity_ColorRGBA aLayerColor = theLayerColor;
+ Handle(XCAFDoc_LayerTool) aLayerTool = XCAFDoc_DocumentTool::LayerTool (aLabel);
+ Handle(TColStd_HSequenceOfExtendedString) aLayerNames = new TColStd_HSequenceOfExtendedString();
+ aLayerTool->GetLayers (aLabel, aLayerNames);
+ if (aLayerNames->Length() == 1)
+ {
+ TDF_Label aLayer = aLayerTool->FindLayer (aLayerNames->First());
+ Quantity_ColorRGBA aColor;
+ if (aColorTool->GetColor (aLayer, XCAFDoc_ColorGen, aColor))
+ aLayerColor = aColor;
+ }
+
+ aStyle.SetColorCurv (aLayerColor.GetRGB());
+ aStyle.SetColorSurf (aLayerColor);
}
- if (aColorTool->GetColor (aLabel, XCAFDoc_ColorCurv, aColor))
+ else
{
- aStyle.SetColorCurv (aColor.GetRGB());
+ Quantity_ColorRGBA aColor;
+ if (aColorTool->GetColor (aLabel, XCAFDoc_ColorGen, aColor))
+ {
+ aStyle.SetColorCurv (aColor.GetRGB());
+ aStyle.SetColorSurf (aColor);
+ }
+ if (aColorTool->GetColor (aLabel, XCAFDoc_ColorSurf, aColor))
+ {
+ aStyle.SetColorSurf (aColor);
+ }
+ if (aColorTool->GetColor (aLabel, XCAFDoc_ColorCurv, aColor))
+ {
+ aStyle.SetColorCurv (aColor.GetRGB());
+ }
}
}
for (TopTools_SequenceOfShape::Iterator aShuoShapeIter (aShuoShapeSeq); aShuoShapeIter.More(); aShuoShapeIter.Next())
{
const TopoDS_Shape& aShuoShape = aShuoShapeIter.Value();
- theSettings.Bind (aShuoShape, aShuoStyle);
+ XCAFPrs_Style* aMapStyle = theSettings.ChangeSeek (aShuoShape);
+ if (aMapStyle == NULL)
+ theSettings.Add (aShuoShape, aShuoStyle);
+ else
+ *aMapStyle = aShuoStyle;
}
continue;
}
}
}
aSubshape.Move (theLoc);
- theSettings.Bind (aSubshape, aStyle);
+ XCAFPrs_Style* aMapStyle = theSettings.ChangeSeek (aSubshape);
+ if (aMapStyle == NULL)
+ theSettings.Add (aSubshape, aStyle);
+ else
+ *aMapStyle = aStyle;
}
}
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <XCAFPrs_DataMapOfShapeStyle.hxx>
+#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
#include <Standard_Boolean.hxx>
class TDF_Label;
class TopLoc_Location;
//! shape - style correspondence
//! The location <loc> is for internal use, it
//! should be Null location for external call
- Standard_EXPORT static void CollectStyleSettings (const TDF_Label& L, const TopLoc_Location& loc, XCAFPrs_DataMapOfShapeStyle& settings);
+ Standard_EXPORT static void CollectStyleSettings (const TDF_Label& L, const TopLoc_Location& loc, XCAFPrs_IndexedDataMapOfShapeStyle& settings, const Quantity_ColorRGBA& theLayerColor = Quantity_ColorRGBA(Quantity_NOC_WHITE));
//! Set ViewNameMode for indicate display names or not.
Standard_EXPORT static void SetViewNameMode (const Standard_Boolean viewNameMode);
#include <TopoDS_Iterator.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFPrs.hxx>
-#include <XCAFPrs_DataMapOfShapeStyle.hxx>
-#include <XCAFPrs_DataMapIteratorOfDataMapOfShapeStyle.hxx>
+#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
+#include <XCAFPrs_DataMapIteratorOfIndexedDataMapOfShapeStyle.hxx>
#include <XCAFPrs_Style.hxx>
// Collecting information on colored subshapes
TopLoc_Location aLoc;
- XCAFPrs_DataMapOfShapeStyle aSettings;
+ XCAFPrs_IndexedDataMapOfShapeStyle aSettings;
XCAFPrs::CollectStyleSettings (myLabel, aLoc, aSettings);
// Getting default colors
// collect sub-shapes with the same style into compounds
BRep_Builder aBuilder;
- NCollection_DataMap<XCAFPrs_Style, TopoDS_Compound, XCAFPrs_Style> aStyleGroups;
- for (XCAFPrs_DataMapIteratorOfDataMapOfShapeStyle aStyledShapeIter (aSettings);
+ NCollection_IndexedDataMap<XCAFPrs_Style, TopoDS_Compound, XCAFPrs_Style> aStyleGroups;
+ for (XCAFPrs_DataMapIteratorOfIndexedDataMapOfShapeStyle aStyledShapeIter (aSettings);
aStyledShapeIter.More(); aStyledShapeIter.Next())
{
TopoDS_Compound aComp;
- if (aStyleGroups.Find (aStyledShapeIter.Value(), aComp))
+ if (aStyleGroups.FindFromKey (aStyledShapeIter.Value(), aComp))
{
aBuilder.Add (aComp, aStyledShapeIter.Key());
continue;
aBuilder.MakeCompound (aComp);
aBuilder.Add (aComp, aStyledShapeIter.Key());
- aStyleGroups.Bind (aStyledShapeIter.Value(), aComp);
+ TopoDS_Compound* aMapShape = aStyleGroups.ChangeSeek (aStyledShapeIter.Value());
+ if (aMapShape == NULL)
+ aStyleGroups.Add (aStyledShapeIter.Value(), aComp);
+ else
+ *aMapShape = aComp;
}
aSettings.Clear();
// assign custom aspects
- for (NCollection_DataMap<XCAFPrs_Style, TopoDS_Compound, XCAFPrs_Style>::Iterator aStyleGroupIter (aStyleGroups);
+ for (NCollection_IndexedDataMap<XCAFPrs_Style, TopoDS_Compound, XCAFPrs_Style>::Iterator aStyleGroupIter (aStyleGroups);
aStyleGroupIter.More(); aStyleGroupIter.Next())
{
const TopoDS_Compound& aComp = aStyleGroupIter.Value();
+++ /dev/null
-// Copyright (c) 2015 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#ifndef XCAFPrs_DataMapIteratorOfDataMapOfShapeStyle_HeaderFile
-#define XCAFPrs_DataMapIteratorOfDataMapOfShapeStyle_HeaderFile
-
-#include <XCAFPrs_DataMapOfShapeStyle.hxx>
-
-#endif
--- /dev/null
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef XCAFPrs_DataMapIteratorOfIndexedDataMapOfShapeStyle_HeaderFile
+#define XCAFPrs_DataMapIteratorOfIndexedDataMapOfShapeStyle_HeaderFile
+
+#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
+
+#endif
+++ /dev/null
-// Created on: 2000-08-11
-// Created by: Andrey BETENEV
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef XCAFPrs_DataMapOfShapeStyle_HeaderFile
-#define XCAFPrs_DataMapOfShapeStyle_HeaderFile
-
-#include <TopoDS_Shape.hxx>
-#include <XCAFPrs_Style.hxx>
-#include <TopTools_ShapeMapHasher.hxx>
-#include <NCollection_DataMap.hxx>
-
-typedef NCollection_DataMap<TopoDS_Shape,XCAFPrs_Style,TopTools_ShapeMapHasher> XCAFPrs_DataMapOfShapeStyle;
-typedef NCollection_DataMap<TopoDS_Shape,XCAFPrs_Style,TopTools_ShapeMapHasher>::Iterator XCAFPrs_DataMapIteratorOfDataMapOfShapeStyle;
-
-
-#endif
--- /dev/null
+// Created on: 2000-08-11
+// Created by: Andrey BETENEV
+// Copyright (c) 2000-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef XCAFPrs_IndexedDataMapOfShapeStyle_HeaderFile
+#define XCAFPrs_IndexedDataMapOfShapeStyle_HeaderFile
+
+#include <TopoDS_Shape.hxx>
+#include <XCAFPrs_Style.hxx>
+#include <TopTools_ShapeMapHasher.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+
+typedef NCollection_IndexedDataMap<TopoDS_Shape,XCAFPrs_Style,TopTools_ShapeMapHasher> XCAFPrs_IndexedDataMapOfShapeStyle;
+typedef NCollection_IndexedDataMap<TopoDS_Shape,XCAFPrs_Style,TopTools_ShapeMapHasher>::Iterator XCAFPrs_DataMapIteratorOfIndexedDataMapOfShapeStyle;
+
+
+#endif
NbAreaProp++;
}
Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool(aDoc->Main());
+ Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool(aDoc->Main());
Quantity_ColorRGBA col;
Standard_Boolean IsColor = Standard_False;
+ Standard_Boolean IsByLayer = Standard_False;
if(CTool->GetColor(L,XCAFDoc_ColorGen,col))
IsColor = Standard_True;
else if(CTool->GetColor(L,XCAFDoc_ColorSurf,col))
IsColor = Standard_True;
else if(CTool->GetColor(L,XCAFDoc_ColorCurv,col))
IsColor = Standard_True;
- if(IsColor) {
- TCollection_AsciiString Entry1;
- Entry1 = col.GetRGB().StringName(col.GetRGB().Name());
- if(PrintStructMode) di<<"Color("<<Entry1.ToCString()<<" "<<col.Alpha()<<") ";
- NbShapesWithColor++;
+ else if(CTool->IsColorByLayer(L))
+ IsByLayer = Standard_True;
+ if(IsColor || IsByLayer) {
+ if(IsByLayer)
+ {
+ Handle(TColStd_HSequenceOfExtendedString) aLayerS;
+ LTool->GetLayers(L, aLayerS);
+ // Currently for DXF pnly, thus
+ // only 1 Layer should be.
+ if(aLayerS->Length() == 1)
+ {
+ TDF_Label aLayer = LTool->FindLayer (aLayerS->First());
+ Quantity_ColorRGBA aColor;
+ if (CTool->GetColor (aLayer, XCAFDoc_ColorGen, aColor))
+ {
+ TCollection_AsciiString aColorName = aColor.GetRGB().StringName(aColor.GetRGB().Name());
+ di<<"Color(" << aColorName.ToCString() << ") ";
+ }
+ else
+ {
+ di<<"Color(ByLayer) ";
+ }
+ }
+ NbShapesWithColor++;
+ }
+ else
+ {
+ TCollection_AsciiString Entry1;
+ Entry1 = col.GetRGB().StringName(col.GetRGB().Name());
+ if(PrintStructMode) di<<"Color("<<Entry1.ToCString()<<" "<<col.Alpha()<<") ";
+ NbShapesWithColor++;
+ }
}
- Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool(aDoc->Main());
Handle(TColStd_HSequenceOfExtendedString) aLayerS;
LTool->GetLayers(L, aLayerS);
if(!aLayerS.IsNull() && aLayerS->Length()>0) {