From: ema Date: Thu, 21 Sep 2017 08:31:02 +0000 (+0300) Subject: Corrections afer rebasing on V 7.2.0 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=173f5b0dcc46f50dd73130c2958c5fdecb01a544;p=occt-copy.git Corrections afer rebasing on V 7.2.0 --- diff --git a/src/OpenGl/OpenGl_CappingRenderer.cxx b/src/OpenGl/OpenGl_CappingRenderer.cxx index d5e0e65075..9009e9989c 100644 --- a/src/OpenGl/OpenGl_CappingRenderer.cxx +++ b/src/OpenGl/OpenGl_CappingRenderer.cxx @@ -298,7 +298,7 @@ void OpenGl_CappingRenderer::renderOne (const Handle(OpenGl_Workspace)& theWo aViewScale = static_cast (aViewDim.Y() / aContext->Viewport()[3]); } - aHatchScale = 1.0f / (aViewScale * anAspectHatching->TextureRes (aContext)->SizeY()); + aHatchScale = 1.0f / (aViewScale * anAspectHatching->TextureSet (aContext)->First()->SizeY()); } } @@ -355,7 +355,7 @@ void OpenGl_CappingRenderer::renderSection (const Handle(OpenGl_Workspace)& theW if (theHatchScale != 1.0 || theHatchRotate != 0.0) { - const Handle(Graphic3d_TextureParams)& aTexParams = theHatchAspect->TextureParams(); + const Handle(Graphic3d_TextureParams)& aTexParams = theHatchAspect->TextureSet(aContext)->First()->Sampler()->Parameters(); aPrevScale = aTexParams->Scale(); aPrevRotate = aTexParams->Rotation(); @@ -381,7 +381,7 @@ void OpenGl_CappingRenderer::renderSection (const Handle(OpenGl_Workspace)& theW if (theHatchScale != 1.0 || theHatchRotate != 0.0) { - const Handle(Graphic3d_TextureParams)& aTexParams = theHatchAspect->TextureParams(); + const Handle(Graphic3d_TextureParams)& aTexParams = theHatchAspect->TextureSet(aContext)->First()->Sampler()->Parameters(); aTexParams->SetScale (aPrevScale); aTexParams->SetRotation (aPrevRotate); diff --git a/src/OpenGl/OpenGl_ShaderManager.cxx b/src/OpenGl/OpenGl_ShaderManager.cxx index f1a34468d9..f425a5f5aa 100644 --- a/src/OpenGl/OpenGl_ShaderManager.cxx +++ b/src/OpenGl/OpenGl_ShaderManager.cxx @@ -1291,8 +1291,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFboBlit() } myContext->BindProgram (myBlitProgram); - myBlitProgram->SetSampler (myContext, "uColorSampler", 0); - myBlitProgram->SetSampler (myContext, "uDepthSampler", 1); + myBlitProgram->SetSampler(myContext, "uColorSampler", Graphic3d_TextureUnit_0); + myBlitProgram->SetSampler(myContext, "uDepthSampler", Graphic3d_TextureUnit_1); myContext->BindProgram (NULL); return Standard_True; } @@ -1385,8 +1385,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramOitCompositing (const St } myContext->BindProgram (aProgram); - aProgram->SetSampler (myContext, "uAccumTexture", 0); - aProgram->SetSampler (myContext, "uWeightTexture", 1); + aProgram->SetSampler(myContext, "uAccumTexture", Graphic3d_TextureUnit_0); + aProgram->SetSampler(myContext, "uWeightTexture", Graphic3d_TextureUnit_1); myContext->BindProgram (Handle(OpenGl_ShaderProgram)()); return Standard_True; } @@ -2386,8 +2386,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramStereo (Handle(OpenGl_Sh } myContext->BindProgram (theProgram); - theProgram->SetSampler (myContext, "uLeftSampler", 0); - theProgram->SetSampler (myContext, "uRightSampler", 1); + theProgram->SetSampler(myContext, "uLeftSampler", Graphic3d_TextureUnit_0); + theProgram->SetSampler(myContext, "uRightSampler", Graphic3d_TextureUnit_1); myContext->BindProgram (NULL); return Standard_True; } diff --git a/src/VrmlData/VrmlData_IndexedFaceSet.cxx b/src/VrmlData/VrmlData_IndexedFaceSet.cxx index 94a5d687ab..f3871a3470 100644 --- a/src/VrmlData/VrmlData_IndexedFaceSet.cxx +++ b/src/VrmlData/VrmlData_IndexedFaceSet.cxx @@ -39,8 +39,8 @@ #include #include #include -#include -#include +//#include +//#include #include #include #include @@ -56,240 +56,240 @@ IMPLEMENT_STANDARD_RTTIEXT(VrmlData_IndexedFaceSet,VrmlData_Faceted) #pragma warning (disable:4996) #endif -// Auxiliary tools -namespace -{ - // Tool to get triangles from triangulation taking into account face - // orientation and location - class TriangleAccessor - { - public: - TriangleAccessor (const TopoDS_Face& aFace) - { - TopLoc_Location aLoc; - myPoly = BRep_Tool::Triangulation (aFace, aLoc); - myTrsf = aLoc.Transformation(); - myNbTriangles = (myPoly.IsNull() ? 0 : myPoly->Triangles().Length()); - myInvert = (aFace.Orientation() == TopAbs_REVERSED); - if (myTrsf.IsNegative()) - myInvert = ! myInvert; - } - - int NbTriangles () const { return myNbTriangles; } - - // get i-th triangle and outward normal - void GetTriangle (int iTri, gp_Vec &theNormal, gp_Pnt &thePnt1, gp_Pnt &thePnt2, gp_Pnt &thePnt3) - { - // get positions of nodes - int iNode1, iNode2, iNode3; - myPoly->Triangles()(iTri).Get (iNode1, iNode2, iNode3); - thePnt1 = myPoly->Nodes()(iNode1); - thePnt2 = myPoly->Nodes()(myInvert ? iNode3 : iNode2); - thePnt3 = myPoly->Nodes()(myInvert ? iNode2 : iNode3); - - // apply transormation if not identity - if (myTrsf.Form() != gp_Identity) - { - thePnt1.Transform (myTrsf); - thePnt2.Transform (myTrsf); - thePnt3.Transform (myTrsf); - } - - // calculate normal - theNormal = (thePnt2.XYZ() - thePnt1.XYZ()) ^ (thePnt3.XYZ() - thePnt1.XYZ()); - Standard_Real aNorm = theNormal.Magnitude(); - if (aNorm > gp::Resolution()) - theNormal /= aNorm; - } - - private: - Handle(Poly_Triangulation) myPoly; - gp_Trsf myTrsf; - int myNbTriangles; - bool myInvert; - }; - - // convert to float and, on big-endian platform, to little-endian representation - inline float convertFloat (Standard_Real aValue) - { -#ifdef OCCT_BINARY_FILE_DO_INVERSE - return OSD_BinaryFile::InverseShortReal ((float)aValue); -#else - return (float)aValue; -#endif - } - - // A static method adding nodes to a mesh and keeping coincident (sharing) nodes. - static Standard_Integer AddVertex(Handle(StlMesh_Mesh)& mesh, - BRepBuilderAPI_CellFilter& filter, - BRepBuilderAPI_VertexInspector& inspector, - const gp_XYZ& p) - { - Standard_Integer index; - inspector.SetCurrent(p); - gp_XYZ minp = inspector.Shift(p, -Precision::Confusion()); - gp_XYZ maxp = inspector.Shift(p, +Precision::Confusion()); - filter.Inspect(minp, maxp, inspector); - const TColStd_ListOfInteger& indices = inspector.ResInd(); - if (indices.IsEmpty() == Standard_False) - { - index = indices.First(); // it should be only one - inspector.ClearResList(); - } - else - { - index = mesh->AddVertex(p.X(), p.Y(), p.Z()); - filter.Add(index, p); - inspector.Add(p); - } - return index; - } - - void createFromMesh(Handle(TopoDS_TShape)& theShapeWithMesh) - { - TopoDS_Shape aShape; - //aShape.Orientation(TopAbs_FORWARD); - - aShape.TShape(theShapeWithMesh); - if (aShape.IsNull()) - return; - - // Write to STL and then read again to get BRep model (vrml fills only triangulation) - //StlAPI::Write(aShape, "D:/Temp/tempfile"); - //StlAPI::Read(aShape, "D:/Temp/tempfile"); - - gp_XYZ p1, p2, p3; - TopoDS_Vertex Vertex1, Vertex2, Vertex3; - TopoDS_Face AktFace; - TopoDS_Wire AktWire; - BRepBuilderAPI_Sewing aSewingTool; - Standard_Real x1, y1, z1; - Standard_Real x2, y2, z2; - Standard_Real x3, y3, z3; - Standard_Integer i1,i2,i3; - - aSewingTool.Init(1.0e-06,Standard_True); - - TopoDS_Compound aComp; - BRep_Builder BuildTool; - BuildTool.MakeCompound( aComp ); - - Handle(StlMesh_Mesh) aSTLMesh = new StlMesh_Mesh(); - aSTLMesh->AddDomain(); - - // Filter unique vertices to share the nodes of the mesh. - BRepBuilderAPI_CellFilter uniqueVertices(Precision::Confusion()); - BRepBuilderAPI_VertexInspector inspector(Precision::Confusion()); - - // Read mesh - for (TopExp_Explorer exp (aShape, TopAbs_FACE); exp.More(); exp.Next()) - { - TriangleAccessor aTool (TopoDS::Face (exp.Current())); - for (int iTri = 1; iTri <= aTool.NbTriangles(); iTri++) - { - gp_Vec aNorm; - gp_Pnt aPnt1, aPnt2, aPnt3; - aTool.GetTriangle(iTri, aNorm, aPnt1, aPnt2, aPnt3); - - i1 = AddVertex(aSTLMesh, uniqueVertices, inspector, aPnt1.XYZ()); - i2 = AddVertex(aSTLMesh, uniqueVertices, inspector, aPnt2.XYZ()); - i3 = AddVertex(aSTLMesh, uniqueVertices, inspector, aPnt3.XYZ()); - aSTLMesh->AddTriangle(i1, i2, i3, aNorm.X(), aNorm.Y(), aNorm.Z()); - } - } - - StlMesh_MeshExplorer aMExp (aSTLMesh); - Standard_Integer NumberDomains = aSTLMesh->NbDomains(); - Standard_Integer iND; - for (iND=1;iND<=NumberDomains;iND++) - { - for (aMExp.InitTriangle (iND); aMExp.MoreTriangle (); aMExp.NextTriangle ()) - { - aMExp.TriangleVertices (x1,y1,z1,x2,y2,z2,x3,y3,z3); - p1.SetCoord(x1,y1,z1); - p2.SetCoord(x2,y2,z2); - p3.SetCoord(x3,y3,z3); - - if ((!(p1.IsEqual(p2,0.0))) && (!(p1.IsEqual(p3,0.0)))) - { - Vertex1 = BRepBuilderAPI_MakeVertex(p1); - Vertex2 = BRepBuilderAPI_MakeVertex(p2); - Vertex3 = BRepBuilderAPI_MakeVertex(p3); - - AktWire = BRepBuilderAPI_MakePolygon( Vertex1, Vertex2, Vertex3, Standard_True); - - if( !AktWire.IsNull()) - { - AktFace = BRepBuilderAPI_MakeFace( AktWire); - if(!AktFace.IsNull()) - BuildTool.Add( aComp, AktFace ); - } - } - } - } - aSTLMesh->Clear(); - - aSewingTool.Init(); - aSewingTool.Load( aComp ); - aSewingTool.Perform(); - aShape = aSewingTool.SewedShape(); - if ( aShape.IsNull() ) - aShape = aComp; - - ShapeUpgrade_UnifySameDomain anUSD(aShape); - anUSD.SetLinearTolerance(1e-5); - anUSD.Build(); - aShape = anUSD.Shape(); - - if (aShape.ShapeType() == TopAbs_SHELL && TopoDS::Shell(aShape).Closed()) - { - TopoDS_Solid aSolid; - TopoDS_Shell aShell = TopoDS::Shell (aShape); - if (!aShell.Free ()) { - aShell.Free(Standard_True); - } - BRep_Builder aBuilder; - aBuilder.MakeSolid (aSolid); - aBuilder.Add (aSolid, aShell); - - Standard_Boolean isOk = Standard_True; - try { - OCC_CATCH_SIGNALS - BRepClass3d_SolidClassifier bsc3d (aSolid); - Standard_Real t = Precision::Confusion(); - bsc3d.PerformInfinitePoint(t); - - if (bsc3d.State() == TopAbs_IN) { - TopoDS_Solid aSolid2; - aBuilder.MakeSolid (aSolid2); - aShell.Reverse(); - aBuilder.Add (aSolid2, aShell); - aSolid = aSolid2; - } - } - catch (Standard_Failure) { isOk = Standard_False; } - if (isOk) aShape = aSolid; - } - - // Trying to apply "Combine to Cylinder" - - //ShapeUpgrade_CombineToCylinder cmb2Cyl; - //Standard_Boolean isOk = Standard_True; - //try { - // OCC_CATCH_SIGNALS - // cmb2Cyl.SetShape(aShape); - // cmb2Cyl.SetAngularTolerance(20); - // cmb2Cyl.SetLinearTolerance(3); - // cmb2Cyl.Build(); - //} - //catch (Standard_Failure) { isOk = Standard_False; } - //if (isOk && cmb2Cyl.IsDone()) - // aShape = cmb2Cyl.Shape(); - - theShapeWithMesh = aShape.TShape(); - } -} - +//// Auxiliary tools +//namespace +//{ +// // Tool to get triangles from triangulation taking into account face +// // orientation and location +// class TriangleAccessor +// { +// public: +// TriangleAccessor (const TopoDS_Face& aFace) +// { +// TopLoc_Location aLoc; +// myPoly = BRep_Tool::Triangulation (aFace, aLoc); +// myTrsf = aLoc.Transformation(); +// myNbTriangles = (myPoly.IsNull() ? 0 : myPoly->Triangles().Length()); +// myInvert = (aFace.Orientation() == TopAbs_REVERSED); +// if (myTrsf.IsNegative()) +// myInvert = ! myInvert; +// } +// +// int NbTriangles () const { return myNbTriangles; } +// +// // get i-th triangle and outward normal +// void GetTriangle (int iTri, gp_Vec &theNormal, gp_Pnt &thePnt1, gp_Pnt &thePnt2, gp_Pnt &thePnt3) +// { +// // get positions of nodes +// int iNode1, iNode2, iNode3; +// myPoly->Triangles()(iTri).Get (iNode1, iNode2, iNode3); +// thePnt1 = myPoly->Nodes()(iNode1); +// thePnt2 = myPoly->Nodes()(myInvert ? iNode3 : iNode2); +// thePnt3 = myPoly->Nodes()(myInvert ? iNode2 : iNode3); +// +// // apply transormation if not identity +// if (myTrsf.Form() != gp_Identity) +// { +// thePnt1.Transform (myTrsf); +// thePnt2.Transform (myTrsf); +// thePnt3.Transform (myTrsf); +// } +// +// // calculate normal +// theNormal = (thePnt2.XYZ() - thePnt1.XYZ()) ^ (thePnt3.XYZ() - thePnt1.XYZ()); +// Standard_Real aNorm = theNormal.Magnitude(); +// if (aNorm > gp::Resolution()) +// theNormal /= aNorm; +// } +// +// private: +// Handle(Poly_Triangulation) myPoly; +// gp_Trsf myTrsf; +// int myNbTriangles; +// bool myInvert; +// }; +// +// // convert to float and, on big-endian platform, to little-endian representation +// inline float convertFloat (Standard_Real aValue) +// { +//#ifdef OCCT_BINARY_FILE_DO_INVERSE +// return OSD_BinaryFile::InverseShortReal ((float)aValue); +//#else +// return (float)aValue; +//#endif +// } +// +// // A static method adding nodes to a mesh and keeping coincident (sharing) nodes. +// static Standard_Integer AddVertex(Handle(StlMesh_Mesh)& mesh, +// BRepBuilderAPI_CellFilter& filter, +// BRepBuilderAPI_VertexInspector& inspector, +// const gp_XYZ& p) +// { +// Standard_Integer index; +// inspector.SetCurrent(p); +// gp_XYZ minp = inspector.Shift(p, -Precision::Confusion()); +// gp_XYZ maxp = inspector.Shift(p, +Precision::Confusion()); +// filter.Inspect(minp, maxp, inspector); +// else +// const TColStd_ListOfInteger& indices = inspector.ResInd(); +// if (indices.IsEmpty() == Standard_False) +// { +// index = indices.First(); // it should be only one +// inspector.ClearResList(); +// } +// { +// index = mesh->AddVertex(p.X(), p.Y(), p.Z()); +// filter.Add(index, p); +// inspector.Add(p); +// } +// return index; +// } +// +// void createFromMesh(Handle(TopoDS_TShape)& theShapeWithMesh) +// { +// TopoDS_Shape aShape; +// //aShape.Orientation(TopAbs_FORWARD); +// +// aShape.TShape(theShapeWithMesh); +// if (aShape.IsNull()) +// return; +// +// // Write to STL and then read again to get BRep model (vrml fills only triangulation) +// //StlAPI::Write(aShape, "D:/Temp/tempfile"); +// //StlAPI::Read(aShape, "D:/Temp/tempfile"); +// +// gp_XYZ p1, p2, p3; +// TopoDS_Vertex Vertex1, Vertex2, Vertex3; +// TopoDS_Face AktFace; +// TopoDS_Wire AktWire; +// BRepBuilderAPI_Sewing aSewingTool; +// Standard_Real x1, y1, z1; +// Standard_Real x2, y2, z2; +// Standard_Real x3, y3, z3; +// Standard_Integer i1,i2,i3; +// +// aSewingTool.Init(1.0e-06,Standard_True); +// +// TopoDS_Compound aComp; +// BRep_Builder BuildTool; +// BuildTool.MakeCompound( aComp ); +// +// Handle(StlMesh_Mesh) aSTLMesh = new StlMesh_Mesh(); +// aSTLMesh->AddDomain(); +// +// // Filter unique vertices to share the nodes of the mesh. +// BRepBuilderAPI_CellFilter uniqueVertices(Precision::Confusion()); +// BRepBuilderAPI_VertexInspector inspector(Precision::Confusion()); +// +// // Read mesh +// for (TopExp_Explorer exp (aShape, TopAbs_FACE); exp.More(); exp.Next()) +// { +// TriangleAccessor aTool (TopoDS::Face (exp.Current())); +// for (int iTri = 1; iTri <= aTool.NbTriangles(); iTri++) +// { +// gp_Vec aNorm; +// gp_Pnt aPnt1, aPnt2, aPnt3; +// aTool.GetTriangle(iTri, aNorm, aPnt1, aPnt2, aPnt3); +// +// i1 = AddVertex(aSTLMesh, uniqueVertices, inspector, aPnt1.XYZ()); +// i2 = AddVertex(aSTLMesh, uniqueVertices, inspector, aPnt2.XYZ()); +// i3 = AddVertex(aSTLMesh, uniqueVertices, inspector, aPnt3.XYZ()); +// aSTLMesh->AddTriangle(i1, i2, i3, aNorm.X(), aNorm.Y(), aNorm.Z()); +// } +// } +// +// StlMesh_MeshExplorer aMExp (aSTLMesh); +// Standard_Integer NumberDomains = aSTLMesh->NbDomains(); +// Standard_Integer iND; +// for (iND=1;iND<=NumberDomains;iND++) +// { +// for (aMExp.InitTriangle (iND); aMExp.MoreTriangle (); aMExp.NextTriangle ()) +// { +// aMExp.TriangleVertices (x1,y1,z1,x2,y2,z2,x3,y3,z3); +// p1.SetCoord(x1,y1,z1); +// p2.SetCoord(x2,y2,z2); +// p3.SetCoord(x3,y3,z3); +// +// if ((!(p1.IsEqual(p2,0.0))) && (!(p1.IsEqual(p3,0.0)))) +// { +// Vertex1 = BRepBuilderAPI_MakeVertex(p1); +// Vertex2 = BRepBuilderAPI_MakeVertex(p2); +// Vertex3 = BRepBuilderAPI_MakeVertex(p3); +// +// AktWire = BRepBuilderAPI_MakePolygon( Vertex1, Vertex2, Vertex3, Standard_True); +// +// if( !AktWire.IsNull()) +// { +// AktFace = BRepBuilderAPI_MakeFace( AktWire); +// if(!AktFace.IsNull()) +// BuildTool.Add( aComp, AktFace ); +// } +// } +// } +// } +// aSTLMesh->Clear(); +// +// aSewingTool.Init(); +// aSewingTool.Load( aComp ); +// aSewingTool.Perform(); +// aShape = aSewingTool.SewedShape(); +// if ( aShape.IsNull() ) +// aShape = aComp; +// +// ShapeUpgrade_UnifySameDomain anUSD(aShape); +// anUSD.SetLinearTolerance(1e-5); +// anUSD.Build(); +// aShape = anUSD.Shape(); +// +// if (aShape.ShapeType() == TopAbs_SHELL && TopoDS::Shell(aShape).Closed()) +// { +// TopoDS_Solid aSolid; +// TopoDS_Shell aShell = TopoDS::Shell (aShape); +// if (!aShell.Free ()) { +// aShell.Free(Standard_True); +// } +// BRep_Builder aBuilder; +// aBuilder.MakeSolid (aSolid); +// aBuilder.Add (aSolid, aShell); +// +// Standard_Boolean isOk = Standard_True; +// try { +// OCC_CATCH_SIGNALS +// BRepClass3d_SolidClassifier bsc3d (aSolid); +// Standard_Real t = Precision::Confusion(); +// bsc3d.PerformInfinitePoint(t); +// +// if (bsc3d.State() == TopAbs_IN) { +// TopoDS_Solid aSolid2; +// aBuilder.MakeSolid (aSolid2); +// aShell.Reverse(); +// aBuilder.Add (aSolid2, aShell); +// aSolid = aSolid2; +// } +// } +// catch (Standard_Failure) { isOk = Standard_False; } +// if (isOk) aShape = aSolid; +// } +// +// // Trying to apply "Combine to Cylinder" +// +// //ShapeUpgrade_CombineToCylinder cmb2Cyl; +// //Standard_Boolean isOk = Standard_True; +// //try { +// // OCC_CATCH_SIGNALS +// // cmb2Cyl.SetShape(aShape); +// // cmb2Cyl.SetAngularTolerance(20); +// // cmb2Cyl.SetLinearTolerance(3); +// // cmb2Cyl.Build(); +// //} +// //catch (Standard_Failure) { isOk = Standard_False; } +// //if (isOk && cmb2Cyl.IsDone()) +// // aShape = cmb2Cyl.Shape(); +// +// theShapeWithMesh = aShape.TShape(); +// } +//} +// //======================================================================= //function : readData //purpose : diff --git a/src/XCAFDoc/XCAFDoc.cxx b/src/XCAFDoc/XCAFDoc.cxx index 009b7e26e8..8c772203f2 100644 --- a/src/XCAFDoc/XCAFDoc.cxx +++ b/src/XCAFDoc/XCAFDoc.cxx @@ -289,17 +289,6 @@ Standard_GUID XCAFDoc::ViewRefEnabledShapesGUID() //purpose : //======================================================================= -Standard_GUID XCAFDoc::ViewRefNoteGUID() -{ - static Standard_GUID ID("C814ACC6-43AC-4812-9B2A-4E9A2A549354"); - return ID; -} - -//======================================================================= -//function : ViewRefPlaneGUID -//purpose : -//======================================================================= - Standard_GUID XCAFDoc::ViewRefAnnotationGUID() { static Standard_GUID ID("A2B5BA42-DD00-43f5-8882-4B5F8E76B9D2"); diff --git a/src/XCAFDoc/XCAFDoc.hxx b/src/XCAFDoc/XCAFDoc.hxx index 42c0475d04..b96694e2b6 100644 --- a/src/XCAFDoc/XCAFDoc.hxx +++ b/src/XCAFDoc/XCAFDoc.hxx @@ -136,7 +136,6 @@ public: Standard_EXPORT static Standard_GUID ClipPlaneVisibleRefGUID(); //! Return GUIDs for GraphNode representing specified types of View - Standard_EXPORT static Standard_GUID ViewRefNoteGUID(); Standard_EXPORT static Standard_GUID ViewRefAnnotationGUID(); //! Returns GUID for UAttribute identifying lock flag diff --git a/src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx b/src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx index f666b962dd..6032233af1 100644 --- a/src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx +++ b/src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx @@ -34,14 +34,14 @@ enum { ExtraRef_SubshapeIndex }; -const Standard_GUID& +const Standard_GUID& XCAFDoc_AssemblyItemRef::GetID() { static Standard_GUID s_ID("3F2E4CD6-169B-4747-A321-5670E4291F5D"); return s_ID; } -Handle(XCAFDoc_AssemblyItemRef) +Handle(XCAFDoc_AssemblyItemRef) XCAFDoc_AssemblyItemRef::Get(const TDF_Label& theLabel) { Handle(XCAFDoc_AssemblyItemRef) aThis; @@ -49,9 +49,9 @@ XCAFDoc_AssemblyItemRef::Get(const TDF_Label& theLabel) return aThis; } -Handle(XCAFDoc_AssemblyItemRef) +Handle(XCAFDoc_AssemblyItemRef) XCAFDoc_AssemblyItemRef::Set(const TDF_Label& theLabel, - const XCAFDoc_AssemblyItemId& theItemId) +const XCAFDoc_AssemblyItemId& theItemId) { Handle(XCAFDoc_AssemblyItemRef) aThis; if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis)) @@ -63,10 +63,10 @@ XCAFDoc_AssemblyItemRef::Set(const TDF_Label& theLabel, return aThis; } -Handle(XCAFDoc_AssemblyItemRef) +Handle(XCAFDoc_AssemblyItemRef) XCAFDoc_AssemblyItemRef::Set(const TDF_Label& theLabel, - const XCAFDoc_AssemblyItemId& theItemId, - const Standard_GUID& theAttrGUID) +const XCAFDoc_AssemblyItemId& theItemId, +const Standard_GUID& theAttrGUID) { Handle(XCAFDoc_AssemblyItemRef) aThis; if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis)) @@ -79,10 +79,10 @@ XCAFDoc_AssemblyItemRef::Set(const TDF_Label& theLabel, return aThis; } -Handle(XCAFDoc_AssemblyItemRef) +Handle(XCAFDoc_AssemblyItemRef) XCAFDoc_AssemblyItemRef::Set(const TDF_Label& theLabel, - const XCAFDoc_AssemblyItemId& theItemId, - const Standard_Integer theShapeIndex) +const XCAFDoc_AssemblyItemId& theItemId, +const Standard_Integer theShapeIndex) { Handle(XCAFDoc_AssemblyItemRef) aThis; if (!theLabel.IsNull() && !theLabel.FindAttribute(XCAFDoc_AssemblyItemRef::GetID(), aThis)) @@ -101,7 +101,7 @@ XCAFDoc_AssemblyItemRef::XCAFDoc_AssemblyItemRef() } -Standard_Boolean +Standard_Boolean XCAFDoc_AssemblyItemRef::IsOrphan() const { if (myItemId.IsNull()) @@ -152,31 +152,31 @@ XCAFDoc_AssemblyItemRef::IsOrphan() const return Standard_False; } -Standard_Boolean +Standard_Boolean XCAFDoc_AssemblyItemRef::HasExtraRef() const { return (myExtraRef != ExtraRef_None); } -Standard_Boolean +Standard_Boolean XCAFDoc_AssemblyItemRef::IsGUID() const { return (myExtraRef == ExtraRef_AttrGUID && Standard_GUID::CheckGUIDFormat(myExtraId.ToCString())); } -Standard_Boolean +Standard_Boolean XCAFDoc_AssemblyItemRef::IsSubshapeIndex() const { return (myExtraRef == ExtraRef_SubshapeIndex && myExtraId.IsIntegerValue()); } -const XCAFDoc_AssemblyItemId& +const XCAFDoc_AssemblyItemId& XCAFDoc_AssemblyItemRef::GetItem() const { return myItemId; } -Standard_GUID +Standard_GUID XCAFDoc_AssemblyItemRef::GetGUID() const { if (IsGUID()) @@ -185,7 +185,7 @@ XCAFDoc_AssemblyItemRef::GetGUID() const return Standard_GUID(); } -Standard_Integer +Standard_Integer XCAFDoc_AssemblyItemRef::GetSubshapeIndex() const { if (IsSubshapeIndex()) @@ -194,7 +194,7 @@ XCAFDoc_AssemblyItemRef::GetSubshapeIndex() const return 0; } -void +void XCAFDoc_AssemblyItemRef::SetItem(const XCAFDoc_AssemblyItemId& theItemId) { Backup(); @@ -223,55 +223,13 @@ void XCAFDoc_AssemblyItemRef::SetGUID(const Standard_GUID& theAttrGUID) Backup(); myExtraRef = ExtraRef_AttrGUID; Standard_Character aGUIDStr[Standard_GUID_SIZE + 1]; - theAttrGUID.ToCString(aGUIDStr); + theAttrGUID.ToCString(aGUIDStr); aGUIDStr[Standard_GUID_SIZE] = '\0'; myExtraId.Clear(); myExtraId.AssignCat(aGUIDStr); } -void -XCAFDoc_AssemblyItemRef::SetSubshapeIndex(Standard_Integer theSubshapeIndex) -{ - Backup(); - myExtraRef = ExtraRef_SubshapeIndex; - myExtraId.Clear(); - myExtraId.AssignCat(theSubshapeIndex); -} - -void -XCAFDoc_AssemblyItemRef::ClearExtraRef() -{ - Backup(); - myExtraRef = ExtraRef_None; - myExtraId.Clear(); -} - -void -XCAFDoc_AssemblyItemRef::SetItem(const TColStd_ListOfAsciiString& thePath) -{ - Backup(); - myItemId.Init(thePath); -} - void -XCAFDoc_AssemblyItemRef::SetItem(const TCollection_AsciiString& theString) -{ - Backup(); - myItemId.Init(theString); -} - -void XCAFDoc_AssemblyItemRef::SetGUID(const Standard_GUID& theAttrGUID) -{ - Backup(); - myExtraRef = ExtraRef_AttrGUID; - Standard_Character aGUIDStr[Standard_GUID_SIZE + 1]; - theAttrGUID.ToCString(aGUIDStr); - aGUIDStr[Standard_GUID_SIZE] = '\0'; - myExtraId.Clear(); - myExtraId.AssignCat(aGUIDStr); -} - -void XCAFDoc_AssemblyItemRef::SetSubshapeIndex(Standard_Integer theSubshapeIndex) { Backup(); @@ -280,7 +238,7 @@ XCAFDoc_AssemblyItemRef::SetSubshapeIndex(Standard_Integer theSubshapeIndex) myExtraId.AssignCat(theSubshapeIndex); } -void +void XCAFDoc_AssemblyItemRef::ClearExtraRef() { Backup(); @@ -288,19 +246,19 @@ XCAFDoc_AssemblyItemRef::ClearExtraRef() myExtraId.Clear(); } -const Standard_GUID& +const Standard_GUID& XCAFDoc_AssemblyItemRef::ID() const { return GetID(); } -Handle(TDF_Attribute) +Handle(TDF_Attribute) XCAFDoc_AssemblyItemRef::NewEmpty() const { return new XCAFDoc_AssemblyItemRef(); } -void +void XCAFDoc_AssemblyItemRef::Restore(const Handle(TDF_Attribute)& theAttrFrom) { Handle(XCAFDoc_AssemblyItemRef) anOther = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theAttrFrom); @@ -312,9 +270,9 @@ XCAFDoc_AssemblyItemRef::Restore(const Handle(TDF_Attribute)& theAttrFrom) } } -void +void XCAFDoc_AssemblyItemRef::Paste(const Handle(TDF_Attribute)& theAttrInto, - const Handle(TDF_RelocationTable)& /*theRT*/) const +const Handle(TDF_RelocationTable)& /*theRT*/) const { Handle(XCAFDoc_AssemblyItemRef) anOther = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theAttrInto); if (!anOther.IsNull()) @@ -325,7 +283,7 @@ XCAFDoc_AssemblyItemRef::Paste(const Handle(TDF_Attribute)& theAttrInto, } } -Standard_OStream& +Standard_OStream& XCAFDoc_AssemblyItemRef::Dump(Standard_OStream& theOS) const { theOS << "Path: " << myItemId.ToString(); diff --git a/src/XCAFDoc/XCAFDoc_ViewTool.hxx b/src/XCAFDoc/XCAFDoc_ViewTool.hxx index e1c952651f..80ab5af2fb 100644 --- a/src/XCAFDoc/XCAFDoc_ViewTool.hxx +++ b/src/XCAFDoc/XCAFDoc_ViewTool.hxx @@ -113,10 +113,7 @@ public: //! Returns all View labels defined for label Shapes transparency Standard_EXPORT Standard_Boolean GetViewLabelsForEnabledShapesLabel(const TDF_Label& theShapesTransparencyL, TDF_LabelSequence& theViews) const; - - //! Returns all View labels defined for label NotesL - Standard_EXPORT Standard_Boolean GetViewLabelsForNote(const TDF_Label& theNoteL, TDF_LabelSequence& theViews) const; - + //! Adds a view definition to a View table and returns its label Standard_EXPORT TDF_Label AddView() ;