1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024727: Convertation of the generic classes to the non-generic. Part 3

1) Generic class "Intf_InterferencePolyhedron" from "Intf" package converted to the non-generic class and moved to the "IntPatch" package. Name of this class was changed to "IntPatch_InterferencePolyhedron".

2) Generic class "MoniTool_Elem" from "MoniTool" package converted to the non-generic class "MoniTool_TransientElem".

3) Generic class "IntWalk_PWalking" from "IntWalk" package converted to the non-generic class. And internal class "TheInt2S" of "IntWalk_PWalking" moved from IntWalk_PWalking.cdl to IntWalk.cdl for correct building. Also several "*.cxx" files of this class merged to one ".cxx".

4) Generic class "Transfer_SimpleBinder" from "Transfer" package converted to the non-generic class and moved to the "TransferBRep" package. Name of this class was changed to "TransferBRep_BinderOfShape".

5) Generic class "Geom2dInt_CurveTool" from "Geom2dInt" package converted to the non-generic class "Geom2dInt_Geom2dCurveTool".

6) Generic class "MAT2d_BisectingLocus" from "MAT2d" package converted to the non-generic class and moved to the "BRepMAT2d" package. Name of this class was changed to "BRepMAT2d_BisectingLocus".

7) Generic class "MAT_Mat" from "MAT" package converted to the non-generic class and moved to the "MAT2d" package. Name of this class was changed to "MAT2d_Mat2d".
This commit is contained in:
dln
2014-03-12 12:09:23 +04:00
committed by bugmaster
parent ebc93ae74f
commit 47cbf13472
33 changed files with 1041 additions and 1155 deletions

View File

@@ -27,7 +27,8 @@ uses
Geom2d,
gp,
TopoDS,
TopTools
TopTools,
Bisector
is
class Explorer;
@@ -35,8 +36,10 @@ is
-- bisecting locus from a Wire, a Face, or a set of
-- curves from Geom2d.
class BisectingLocus instantiates BisectingLocus from MAT2d
(Explorer from BRepMAT2d);
class BisectingLocus;
---Purpose: Constuction of the map of the bisector locus on a
-- set of geometrys from Geom2d.
---Purpose: the map of bisecting locus.
class LinkTopoBilo;

View File

@@ -0,0 +1,163 @@
-- Created on: 1993-07-06
-- Created by: Yves FRICAUD
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-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.
class BisectingLocus from BRepMAT2d
---Purpose : BisectingLocus generates and contains the Bisecting_Locus
-- of a set of lines from Geom2d, defined by <ExploSet>.
--
-- If the set of lines contains closed lines:
-- ------------------------------------------
-- These lines cut the plane in areas.
-- One map can be computed for each area.
--
-- Bisecting locus computes a map in an area.
-- The area is defined by a side (MAT_Left,MAT_Right)
-- on one of the closed lines.
--
-- If the set of lines contains only open lines:
-- --------------------------------------------
-- the map recovers all the plane.
--
-- Warning: Assume the orientation of the closed lines are
-- compatible.
--
-- Assume the explo contains only lines located in the
-- area where the bisecting locus will be computed.
--
-- Assume a line don't cross itself or an other line.
--
-- Remark:
-- the curves coming from the explorer can be
-- decomposed in different parts. It the case for the
-- curves other than circles or lines.
--
-- The map of bisecting locus is described by a graph.
-- - The BasicsElements correspond to elements on
-- the figure described by the Explorer from BRepMAT2d.
-- - The Arcs correspond to the bisectors.
-- - The Nodes are the extremities of the arcs.
uses
Graph from MAT,
Arc from MAT,
BasicElt from MAT,
Node from MAT,
Side from MAT,
DataMapOfIntegerBasicElt from MAT,
DataMapOfBiIntInteger from MAT2d,
Bisec from Bisector,
Geometry from Geom2d,
Pnt2d from gp,
Tool2d from MAT2d,
Explorer from BRepMAT2d
is
Create returns BisectingLocus from BRepMAT2d;
---Category: Construction.
Compute (me : in out ;
anExplo : in out Explorer from BRepMAT2d;
LineIndex : Integer = 1;
aSide : Side from MAT = MAT_Left )
--- Purpose : Computation of the Bisector_Locus in a set of Lines
-- defined in <anExplo>.
-- The bisecting locus are computed on the side <aSide>
-- from the line <LineIndex> in <anExplo>.
is static;
---Category: Querying.
IsDone (me) returns Boolean from Standard
---Purpose: Returns True if Compute has succeeded.
is static;
Graph(me) returns Graph from MAT
--- Purpose : Returns <theGraph> of <me>.
is static;
NumberOfContours (me)
---Purpose: Returns the number of contours.
returns Integer from Standard
is static;
NumberOfElts( me ; IndLine : Integer)
---Purpose: Returns the number of BasicElts on the line
-- <IndLine>.
returns Integer from Standard
is static;
NumberOfSections (me; IndLine : Integer; Index : Integer)
---Purpose: Returns the number of sections of a curve.
-- this curve is the Indexth curve in the IndLineth contour
-- given by anExplo.
--
returns Integer from Standard
is static;
BasicElt ( me ; IndLine : Integer ; Index : Integer)
---Purpose: Returns the BasicElts located at the position
-- <Index> on the contour designed by <IndLine>.
-- Remark: the BasicElts on a contour are sorted.
--
returns BasicElt from MAT
is static;
GeomElt(me ; aBasicElt : BasicElt from MAT)
--- Purpose : Returns the geometry linked to the <BasicElt>.
returns Geometry from Geom2d
is static;
GeomElt(me ; aNode : Node from MAT)
--- Purpose : Returns the geometry of type <gp> linked to
-- the <Node>.
returns Pnt2d from gp
is static;
GeomBis(me ; anArc : Arc from MAT ; Reverse :in out Boolean from Standard)
--- Purpose : Returns the geometry of type <Bissec>
-- linked to the arc <ARC>.
-- <Reverse> is False when the FirstNode of <anArc>
-- correspond to the first point of geometry.
--
returns Bisec from Bisector
is static;
---Category: private methods.
Fusion(me : in out)
is static private;
RenumerationAndFusion
(me : in out;
IndexLine : Integer;
LengthLine : Integer;
IndexLast : in out Integer;
NewMap : in out DataMapOfIntegerBasicElt from MAT)
is static private;
fields
theGraph : Graph from MAT;
theTool : Tool2d from MAT2d;
isDone : Boolean from Standard;
nbSect : DataMapOfBiIntInteger from MAT2d;
nbContours : Integer from Standard;
end BisectingLocus;

View File

@@ -0,0 +1,342 @@
// Created on: 1993-07-13
// Created by: Yves FRICAUD
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-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.
# include <BRepMAT2d_BisectingLocus.ixx>
# include <MAT2d_Mat2d.hxx>
# include <MAT2d_Tool2d.hxx>
# include <MAT2d_Circuit.hxx>
# include <MAT2d_CutCurve.hxx>
# include <MAT2d_BiInt.hxx>
# include <MAT2d_SequenceOfSequenceOfGeometry.hxx>
# include <MAT_Graph.hxx>
# include <MAT_Arc.hxx>
# include <MAT_BasicElt.hxx>
# include <MAT_Node.hxx>
# include <MAT_Bisector.hxx>
# include <MAT_ListOfBisector.hxx>
# include <MAT_DataMapOfIntegerBasicElt.hxx>
# include <MAT_DataMapIteratorOfDataMapOfIntegerBasicElt.hxx>
# include <Geom2d_Curve.hxx>
# include <gp_Pnt2d.hxx>
# include <TColGeom2d_SequenceOfGeometry.hxx>
# include <Precision.hxx>
#include <Standard_OutOfRange.hxx>
static void CutSketch (MAT2d_SequenceOfSequenceOfGeometry& Figure,
MAT2d_DataMapOfBiIntInteger& NbSect);
//=============================================================================
//function : BRepMAT2d_BisectingLocus
//purpose : Constructeur vide.
//=============================================================================
BRepMAT2d_BisectingLocus::BRepMAT2d_BisectingLocus()
{
}
//=============================================================================
//function : Compute
//purpose : Calcul de la carte des lieux bisecteurs sur le contour defini par
// <anExplo>.
//=============================================================================
void BRepMAT2d_BisectingLocus::Compute( BRepMAT2d_Explorer& anExplo,
const Standard_Integer IndexLine,
const MAT_Side aSide )
{
MAT2d_Mat2d TheMAT;
Handle(MAT_ListOfBisector) TheRoots = new MAT_ListOfBisector();
MAT2d_SequenceOfSequenceOfGeometry Figure;
Standard_Integer i;
nbSect.Clear();
nbContours = anExplo.NumberOfContours();
//---------------------------------
// Lecture des donnees de anExplo.
//---------------------------------
for (i = 1; i <= anExplo.NumberOfContours(); i++) {
TColGeom2d_SequenceOfGeometry Line;
Figure.Append(Line);
for (anExplo.Init(i); anExplo.More(); anExplo.Next()) {
Figure.ChangeValue(i).Append(anExplo.Value());
}
}
//-----------------------
// Decoupage des courbes.
//-----------------------
CutSketch(Figure,nbSect);
//----------------------------------------------------------
// Construction du circuit sur lequel est calcule la carte.
//----------------------------------------------------------
Handle(MAT2d_Circuit) ACircuit = new MAT2d_Circuit();
// Modified by Sergey KHROMOV - Wed Mar 6 17:43:47 2002 Begin
// ACircuit->Perform(Figure,IndexLine,(aSide == MAT_Left));
ACircuit->Perform(Figure,anExplo.GetIsClosed(), IndexLine,(aSide == MAT_Left));
// Modified by Sergey KHROMOV - Wed Mar 6 17:43:48 2002 End
// -----------------------
// Initialistion du Tool.
// -----------------------
theTool.Sense(aSide);
theTool.InitItems(ACircuit);
// --------------------------------------------
// Initialisation et execution de l algorithme.
// --------------------------------------------
TheMAT.CreateMat(theTool);
isDone = TheMAT.IsDone(); if (!isDone) return;
// ----------------------------------------------------------------
// Recuperation du resultat de l algorithme et creation du graphe.
// ----------------------------------------------------------------
for (TheMAT.Init(); TheMAT.More(); TheMAT.Next()) {
TheRoots->BackAdd(TheMAT.Bisector());
}
theGraph = new MAT_Graph();
theGraph->Perform(TheMAT.SemiInfinite(),
TheRoots,
theTool.NumberOfItems(),
TheMAT.NumberOfBisectors());
//-----------------------------------------------------------------------
// Fusion des elements de base doubles si plusieurs lignes dans Exploset.
//-----------------------------------------------------------------------
if (anExplo.NumberOfContours() > 1) {
MAT_DataMapOfIntegerBasicElt NewMap;
Standard_Integer IndexLast = 1;
//-----------------------------------------------------------------------
// Construction de NewMap dont les elements sont ordonnes suivant les
// lignes du contour et qui ne contient pas d element dupliques.
// em meme temps fusion des arcs dupliques et mise a jour des noeuds.
//-----------------------------------------------------------------------
for ( i = 1; i <= anExplo.NumberOfContours(); i++) {
RenumerationAndFusion(i,
theTool.Circuit()->LineLength(i),
IndexLast,
NewMap);
}
//-----------------------------------------------------------------------
// Chargement dans le graph de la nouvelle map.
// et compactage de la map des Arcs (ie Elimination des trous du a la
// fusion d arcs ).et de celle des Nodes.
//-----------------------------------------------------------------------
theGraph->ChangeBasicElts(NewMap);
theGraph->CompactArcs();
theGraph->CompactNodes();
}
}
//=============================================================================
//function : RenumerationAndFusion
//purpose :
//=============================================================================
void BRepMAT2d_BisectingLocus::RenumerationAndFusion
(const Standard_Integer ILine,
const Standard_Integer LengthLine,
Standard_Integer& IndexLast,
MAT_DataMapOfIntegerBasicElt& NewMap)
{
Standard_Integer IndFirst;
Standard_Integer i,j;
Standard_Integer GeomIndexArc1,GeomIndexArc2,GeomIndexArc3,GeomIndexArc4;
Standard_Boolean MergeArc1,MergeArc2;
for ( i = 1; i <= LengthLine; i++) {
const TColStd_SequenceOfInteger& S = theTool.Circuit()->RefToEqui(ILine,i);
IndFirst = S.Value(1);
NewMap.Bind(IndexLast,theGraph->ChangeBasicElt(IndFirst));
IndexLast++;
for(j = 2; j <= S.Length(); j++){
theGraph->FusionOfBasicElts(IndFirst,
S.Value(j),
MergeArc1,
GeomIndexArc1,
GeomIndexArc2,
MergeArc2,
GeomIndexArc3,
GeomIndexArc4);
if(MergeArc1) {
theTool.BisecFusion(GeomIndexArc1,GeomIndexArc2);
}
if(MergeArc2) {
theTool.BisecFusion(GeomIndexArc3,GeomIndexArc4);
}
}
}
}
//=============================================================================
//function : IsDone
//Purpose :
//=============================================================================
Standard_Boolean BRepMAT2d_BisectingLocus::IsDone() const
{
return isDone;
}
//=============================================================================
//function : Graph
//
//=============================================================================
Handle(MAT_Graph) BRepMAT2d_BisectingLocus::Graph() const
{
return theGraph;
}
//=============================================================================
//function : NumberOfContours
//
//=============================================================================
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfContours () const
{
return nbContours;
}
//=============================================================================
//function : NumberOfElts
//
//=============================================================================
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfElts
(const Standard_Integer IndLine) const
{
return theTool.Circuit()->LineLength(IndLine);
}
//=============================================================================
//function : NumberOfSect
//
//=============================================================================
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfSections
(const Standard_Integer IndLine,
const Standard_Integer Index )
const
{
MAT2d_BiInt B(IndLine,Index);
return nbSect(B);
}
//=============================================================================
//function : BasicElt
//
//=============================================================================
Handle(MAT_BasicElt) BRepMAT2d_BisectingLocus::BasicElt
(const Standard_Integer IndLine,
const Standard_Integer Index )
const
{
Standard_Integer i;
Standard_Integer Ind = Index;
for (i = 1 ; i < IndLine ; i++){
Ind = Ind + theTool.Circuit()->LineLength(i);
}
return theGraph->BasicElt(Ind);
}
//=============================================================================
//function : GeomBis
//
//=============================================================================
Bisector_Bisec BRepMAT2d_BisectingLocus::GeomBis (const Handle(MAT_Arc)& anArc,
Standard_Boolean& Reverse)
const
{
Reverse = Standard_False;
Handle(Geom2d_Curve) Bis = theTool.GeomBis(anArc->GeomIndex()).Value();
if (Bis->FirstParameter() <= -Precision::Infinite()) {
Reverse = Standard_True;
}
else if (Bis->LastParameter() < Precision::Infinite()) {
gp_Pnt2d PF = Bis->Value(Bis->FirstParameter());
gp_Pnt2d PL = Bis->Value(Bis->LastParameter());
gp_Pnt2d PNode = GeomElt(anArc->FirstNode());
if (PNode.SquareDistance(PF) > PNode.SquareDistance(PL))
Reverse = Standard_True;
}
return theTool.GeomBis(anArc->GeomIndex());
}
//=============================================================================
//function : GeomElt
//
//=============================================================================
Handle(Geom2d_Geometry) BRepMAT2d_BisectingLocus::GeomElt
(const Handle(MAT_BasicElt)& aBasicElt) const
{
return theTool.GeomElt(aBasicElt->GeomIndex());
}
//=============================================================================
//function : GeomElt
//
//=============================================================================
gp_Pnt2d BRepMAT2d_BisectingLocus::GeomElt(const Handle(MAT_Node)& aNode) const
{
return theTool.GeomPnt(aNode->GeomIndex());
}
//=============================================================================
//function : CutSketch
//
//=============================================================================
static void CutSketch (MAT2d_SequenceOfSequenceOfGeometry& Figure,
MAT2d_DataMapOfBiIntInteger& NbSect)
{
MAT2d_CutCurve Cuter;
Standard_Integer i,j,k,ico;
Standard_Integer ICurveInit;
Standard_Integer NbSection;
for ( i = 1; i <= Figure.Length(); i++) {
TColGeom2d_SequenceOfGeometry& Contour = Figure.ChangeValue(i);
ICurveInit = 0;
for ( j = 1; j <= Contour.Length(); j++) {
ICurveInit++;
Cuter.Perform(Handle(Geom2d_Curve)::DownCast(Contour.ChangeValue(j)));
NbSection = 1;
if (!Cuter.UnModified()) {
ico = j;
NbSection = Cuter.NbCurves();
for ( k = 1; k <= NbSection; k++) {
Contour.InsertAfter(j,Cuter.Value(k));
j++;
}
Contour.Remove(ico);
j--;
}
MAT2d_BiInt B(i,ICurveInit);
NbSect.Bind(B,NbSection);
}
}
}