0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / QANewBRepNaming / QANewBRepNaming_LoaderParent.cxx
CommitLineData
b311480e 1// Created on: 1999-10-25
2// Created by: Sergey ZARITCHNY
3// Copyright (c) 1999-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17
42cf5bc1 18#include <BRepBuilderAPI_MakeShape.hxx>
19#include <QANewBRepNaming_LoaderParent.hxx>
20#include <TDataStd_Name.hxx>
7fd59977 21#include <TDF_Label.hxx>
42cf5bc1 22#include <TNaming.hxx>
7fd59977 23#include <TNaming_Builder.hxx>
42cf5bc1 24#include <TNaming_NamedShape.hxx>
25#include <TopExp.hxx>
7fd59977 26#include <TopExp_Explorer.hxx>
42cf5bc1 27#include <TopLoc_Location.hxx>
28#include <TopoDS_Iterator.hxx>
29#include <TopoDS_Shape.hxx>
30#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
7fd59977 31#include <TopTools_DataMapOfShapeShape.hxx>
7fd59977 32#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
42cf5bc1 33#include <TopTools_ListIteratorOfListOfShape.hxx>
34#include <TopTools_ListOfShape.hxx>
7fd59977 35#include <TopTools_MapIteratorOfMapOfShape.hxx>
42cf5bc1 36#include <TopTools_MapOfShape.hxx>
7fd59977 37
38//=======================================================================
39//function : GetDangleShapes
40//purpose : Returns dangle sub shapes Generator - Dangle.
41//=======================================================================
7fd59977 42Standard_Boolean QANewBRepNaming_LoaderParent::GetDangleShapes(const TopoDS_Shape& ShapeIn,
43 const TopAbs_ShapeEnum GeneratedFrom,
44 TopTools_DataMapOfShapeShape& Dangles)
45{
46 Dangles.Clear();
47 TopTools_IndexedDataMapOfShapeListOfShape subShapeAndAncestors;
48 TopAbs_ShapeEnum GeneratedTo;
49 if (GeneratedFrom == TopAbs_FACE) GeneratedTo = TopAbs_EDGE;
50 else if (GeneratedFrom == TopAbs_EDGE) GeneratedTo = TopAbs_VERTEX;
51 else return Standard_False;
52 TopExp::MapShapesAndAncestors(ShapeIn, GeneratedTo, GeneratedFrom, subShapeAndAncestors);
53 for (Standard_Integer i = 1; i <= subShapeAndAncestors.Extent(); i++) {
54 const TopoDS_Shape& mayBeDangle = subShapeAndAncestors.FindKey(i);
55 const TopTools_ListOfShape& ancestors = subShapeAndAncestors.FindFromIndex(i);
56 if (ancestors.Extent() == 1) Dangles.Bind(ancestors.First(), mayBeDangle);
57 }
dde68833 58 return !Dangles.IsEmpty();
7fd59977 59}
60
61//=======================================================================
62//function : GetDangleShapes
63//purpose : Returns dangle sub shapes.
64//=======================================================================
65/*
66Standard_Boolean QANewBRepNaming_LoaderParent::GetDangleShapes(const TopoDS_Shape& ShapeIn,
67 const TopAbs_ShapeEnum GeneratedFrom,
68 TopTools_MapOfShape& Dangles)
69{
70 Dangles.Clear();
71 TopTools_IndexedDataMapOfShapeListOfShape subShapeAndAncestors;
72 TopAbs_ShapeEnum GeneratedTo;
73 if (GeneratedFrom == TopAbs_FACE) GeneratedTo = TopAbs_EDGE;
74 else if (GeneratedFrom == TopAbs_EDGE) GeneratedTo = TopAbs_VERTEX;
75 else return Standard_False;
76 TopExp::MapShapesAndAncestors(ShapeIn, GeneratedTo, GeneratedFrom, subShapeAndAncestors);
77 for (Standard_Integer i = 1; i <= subShapeAndAncestors.Extent(); i++) {
78 const TopoDS_Shape& mayBeDangle = subShapeAndAncestors.FindKey(i);
79 const TopTools_ListOfShape& ancestors = subShapeAndAncestors.FindFromIndex(i);
80 if (ancestors.Extent() == 1) Dangles.Add(mayBeDangle);
81 }
dde68833 82 return !Dangles.IsEmpty();
7fd59977 83}
84*/
85//=======================================================================
86//function : LoadGeneratedDangleShapes
87//purpose :
88//=======================================================================
89
90void QANewBRepNaming_LoaderParent::LoadGeneratedDangleShapes(const TopoDS_Shape& ShapeIn,
91 const TopAbs_ShapeEnum GeneratedFrom,
92 TNaming_Builder& Builder)
93{
94 TopTools_DataMapOfShapeShape dangles;
95 if (!QANewBRepNaming_LoaderParent::GetDangleShapes(ShapeIn, GeneratedFrom, dangles)) return;
96 TopTools_DataMapIteratorOfDataMapOfShapeShape itr(dangles);
97 for (; itr.More(); itr.Next()) Builder.Generated(itr.Key(), itr.Value());
98}
99