Standard_Boolean aFound;
theHolle = Standard_False;
//it is not verified information
- for(Standard_Integer c = 0; c <= 1; c++)
+ for(Standard_Integer c = 0; c <= 1 && !aFormV.IsNull(); c++)
{
aFound = Standard_False;
Standard_Boolean aCaseSens = Standard_False;
Handle(TCollection_HAsciiString) descr = SVPLA->Description();
Handle(TCollection_HAsciiString) hName = SVPLA->Name();
TCollection_ExtendedString aLayerName(hName->String());
+ TDF_Label aLayerLabel;
+
+ // check invisibility
+ Standard_Boolean isVisible = Standard_True;;
+ Interface_EntityIterator subs = WS->Graph().Sharings(SVPLA);
+ for (subs.Start(); subs.More() && isVisible; subs.Next()) {
+ if (!subs.Value()->IsKind(STANDARD_TYPE(StepVisual_Invisibility))) continue;
+#ifdef OCCT_DEBUG
+ std::cout << "\tLayer \"" << aLayerName << "\" is invisible" << std::endl;
+#endif
+ isVisible = Standard_False;
+ }
// find a target shape and its label in the document
for (Standard_Integer j = 1; j <= SVPLA->NbAssignedItems(); j++) {
TDF_Label shL;
if (!STool->Search(S, shL, Standard_True, Standard_True, Standard_True)) continue;
- LTool->SetLayer(shL, aLayerName);
+ if (aLayerLabel.IsNull())
+ aLayerLabel = LTool->AddLayer(aLayerName, isVisible);
+ LTool->SetLayer(shL, aLayerLabel);
}
- // check invisibility
- Interface_EntityIterator subs = WS->Graph().Sharings(SVPLA);
- for (subs.Start(); subs.More(); subs.Next()) {
- if (!subs.Value()->IsKind(STANDARD_TYPE(StepVisual_Invisibility))) continue;
-#ifdef OCCT_DEBUG
- std::cout << "\tLayer \"" << aLayerName << "\" is invisible" << std::endl;
-#endif
- //TDF_Label InvLayerLab = LTool->FindLayer(aLayerName);
- TDF_Label InvLayerLab = LTool->AddLayer(aLayerName); //skl for OCC3926
- TDataStd_UAttribute::Set (InvLayerLab, XCAFDoc::InvisibleGUID());
- }
+ if (!aLayerLabel.IsNull())
+ LTool->SetVisibility(aLayerLabel, isVisible);
}
return Standard_True;
}
for (Standard_Integer idu = 1; idu <= DU->NbElements(); idu++) {
Handle(StepBasic_DerivedUnitElement) DUE = DU->ElementsValue(idu);
Handle(StepBasic_NamedUnit) NU = DUE->Unit();
+ if (NU.IsNull())
+ continue;
if (NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit)) ||
NU->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit)))
{
//purpose :
//=======================================================================
-TDF_Label XCAFDoc_LayerTool::FindLayer(const TCollection_ExtendedString& aLayer) const
+TDF_Label XCAFDoc_LayerTool::FindLayer(const TCollection_ExtendedString& aLayer,
+ const Standard_Boolean theToFindWithProperty,
+ const Standard_Boolean theToFindVisible) const
{
TDF_ChildIterator it( Label() );
TDF_Label lab;
for (; it.More(); it.Next()) {
TDF_Label aLabel = it.Value();
Handle(TDataStd_Name) aName;
- if ( aLabel.FindAttribute (TDataStd_Name::GetID(), aName) && (aName->Get().IsEqual(aLayer)) ) {
+ if ( aLabel.FindAttribute (TDataStd_Name::GetID(), aName) && (aName->Get().IsEqual(aLayer)) &&
+ (!theToFindWithProperty || (theToFindWithProperty && (IsVisible(aLabel) == theToFindVisible))) )
+ {
lab = aLabel;
break;
}
//purpose :
//=======================================================================
-TDF_Label XCAFDoc_LayerTool::AddLayer(const TCollection_ExtendedString& aLayer) const
+TDF_Label XCAFDoc_LayerTool::AddLayer(const TCollection_ExtendedString& theLayer) const
{
TDF_Label lab;
- if ( FindLayer(aLayer, lab) )
+ if ( FindLayer(theLayer, lab) )
return lab;
TDF_TagSource aTag;
TDF_Label aLabel = aTag.NewChild( Label() );
Handle(TDataStd_Name) aName = new TDataStd_Name;
- aName->Set(aLabel, aLayer);
+ aName->Set(aLabel, theLayer);
return aLabel;
}
+//=======================================================================
+//function : AddLayer
+//purpose :
+//=======================================================================
+
+TDF_Label XCAFDoc_LayerTool::AddLayer(const TCollection_ExtendedString& theLayer,
+ const Standard_Boolean theToFindVisible) const
+{
+ TDF_Label lab = FindLayer(theLayer, Standard_True, theToFindVisible);
+ if (!lab.IsNull())
+ return lab;
+ TDF_TagSource aTag;
+ TDF_Label aLabel = aTag.NewChild(Label());
+ Handle(TDataStd_Name) aName = new TDataStd_Name;
+ aName->Set(aLabel, theLayer);
+ return aLabel;
+}
//=======================================================================
//function : RemoveLayer
//! Returns False if Layer is not found in Layertable
Standard_EXPORT Standard_Boolean FindLayer (const TCollection_ExtendedString& aLayer, TDF_Label& lab) const;
- //! Finds a Layer definition in a Layertable and returns
- //! its label if found (or Null label else)
- Standard_EXPORT TDF_Label FindLayer (const TCollection_ExtendedString& aLayer) const;
+ //! Finds a Layer definition in a Layertable by name
+ //! Returns first founded label with the same name if <theToFindWithProperty> is false
+ //! If <theToFindWithProperty> is true returns first label that
+ //! contains or not contains visible attr, according to the <theToFindVisible> parameter
+ Standard_EXPORT TDF_Label FindLayer (const TCollection_ExtendedString& aLayer, const Standard_Boolean theToFindWithProperty = Standard_False, const Standard_Boolean theToFindVisible = Standard_True) const;
//! Adds a Layer definition to a Layertable and returns
//! its label (returns existing label if the same Layer
//! is already defined)
- Standard_EXPORT TDF_Label AddLayer (const TCollection_ExtendedString& aLayer) const;
+ Standard_EXPORT TDF_Label AddLayer (const TCollection_ExtendedString& theLayer) const;
+
+ //! Adds a Layer definition to a Layertable and returns its label
+ //! Returns existing label (if it is already defined)
+ //! of visible or invisible layer, according to <theToFindVisible> parameter
+ Standard_EXPORT TDF_Label AddLayer(const TCollection_ExtendedString& theLayer, const Standard_Boolean theToFindVisible) const;
//! Removes Layer from the Layertable
Standard_EXPORT void RemoveLayer (const TDF_Label& lab) const;
--- /dev/null
+puts "========================"
+puts "0032049: Data Exchange - STEP file import problems"
+puts "========================"
+
+pload OCAF
+catch { Close D }
+
+# Read file
+ReadStep D [locate_data_file bug32049_sp7_04dx_242.stp]
+
+# Check file
+set xst [ XStat D ]
+if { [regexp {Number of labels with layer link = 191} $xst] != 1 } {
+ puts "Error: Incorrect number of layer references"
+}
+
+if { [regexp {Number of layers = 5} $xst] != 1 } {
+ puts "Error: incorrect number of layers"
+}
+
+Close D
--- /dev/null
+puts "========================"
+puts "0032049: Data Exchange - STEP file import problems"
+puts "========================"
+
+pload OCAF
+
+# Read files
+ReadStep D_1 [locate_data_file bug32049_test.stp]
+ReadStep D_2 [locate_data_file bug32049_sp7_10nx_242.stp]
+
+Close D_1
+Close D_2
# !!!! This file is generated automatically, do not edit manually! See end script
-puts "TODO CR23096 ALL: LAYERS : Faulty"
-
-
set filename tr9_r0701-db.stp
set ref_data {
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 1 ( 1 )
COLORS : Colors = WHITE ( WHITE )
-NLAYERS : NLayers = 1 ( 2 )
-LAYERS : Layers = 2 ( { 0} { 2} )
+NLAYERS : NLayers = 1 ( 1 )
+LAYERS : Layers = 2 ( { 2} )
}
# !!!! This file is generated automatically, do not edit manually! See end script
-puts "TODO CR23096 ALL: LAYERS : Faulty"
-
-
set filename tr8_pr3_al.stp
set ref_data {
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 4 ( 4 )
COLORS : Colors = BLUE GREEN RED YELLOW ( BLUE GREEN RED YELLOW )
-NLAYERS : NLayers = 0 ( 1 )
-LAYERS : Layers = ( LayerA )
+NLAYERS : NLayers = 0 ( 0 )
+LAYERS : Layers = ( )
}
# !!!! This file is generated automatically, do not edit manually! See end script
-puts "TODO CR23096 ALL: LAYERS : Faulty"
-
-
set filename tr10_r0701_db.stp
set ref_data {
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 1 ( 1 )
COLORS : Colors = WHITE ( WHITE )
-NLAYERS : NLayers = 1 ( 2 )
-LAYERS : Layers = 2 ( { 0} { 2} )
+NLAYERS : NLayers = 1 ( 1 )
+LAYERS : Layers = 2 ( { 2} )
}