NRI : Bad merge

This commit is contained in:
nri 2003-07-09 08:17:18 +00:00
parent 7842cbd70a
commit 5f81252455
9 changed files with 0 additions and 6564 deletions

View File

@ -1,408 +0,0 @@
// GEOM ARCHIMEDE : algorithm implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : Archimede_VolumeSection.cxx
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
using namespace std;
#include "Archimede_VolumeSection.hxx"
#include "utilities.h"
#include <iostream.h>
#include <BRepMesh_IncrementalMesh.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <Poly_Triangulation.hxx>
#include <Poly_Array1OfTriangle.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <math_Matrix.hxx>
#include <math.h>
#include <GC_MakePlane.hxx>
#include <stdlib.h>
#include <gp_Trsf.hxx>
#include <gp_Dir.hxx>
#include <gp_Ax1.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pln.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
//-------------------------------------------------------------------------------------------------------
//----------------------------------- Methodes publiques -------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// Maillage de la shape
VolumeSection::VolumeSection(TopoDS_Shape S , Standard_Real Precision):myShape(S),Tolerance(Precision)
{
// Maillage de la shape myShape
BRepMesh_IncrementalMesh(myShape,Tolerance);
}
TopoDS_Shape VolumeSection::GetShape()
{
return myShape;
}
void VolumeSection::SetPlane(Handle (Geom_Plane) P)
{
myPlane = P;
}
void VolumeSection::CenterOfGravity()
{
Standard_Integer i;
Standard_Integer nbNodes;
TopExp_Explorer ex;
TopLoc_Location L;
// Boucle sur les faces de la shape
Xmin = 1000000000;
Ymin = 1000000000;
Zmin = 1000000000;
Xmax = -1000000000;
Ymax = -1000000000;
Zmax = -1000000000;
for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next())
{
TopoDS_Face F = TopoDS::Face(ex.Current());
Handle(Poly_Triangulation) Tr = BRep_Tool::Triangulation(F, L);
if(Tr.IsNull())
MESSAGE("Error, null layer" )
nbNodes = Tr->NbNodes();
const TColgp_Array1OfPnt& Nodes = Tr->Nodes();
// Calcul des dimensions de la boite englobante du solide
for(i=1;i<=nbNodes;i++)
{
InitPoint = Nodes(i).Transformed(L.Transformation());
if(InitPoint.X() < Xmin)
Xmin = InitPoint.X();
if(InitPoint.X() > Xmax)
Xmax = InitPoint.X();
if(InitPoint.Y() < Ymin)
Ymin = InitPoint.Y();
if(InitPoint.Y() > Ymax)
Ymax = InitPoint.Y();
if(InitPoint.Z() < Zmin)
Zmin = InitPoint.Z();
if(InitPoint.Z() > Zmax)
Zmax = InitPoint.Z();
}
}
// Creation du point d'initialisation, c'est à dire le centre de gravité
//géométrique de la boite englobante
InitPoint.SetX(0.5 * (Xmin + Xmax));
InitPoint.SetY(0.5 * (Ymin + Ymax));
InitPoint.SetZ(0);
}
Standard_Real VolumeSection::CalculateVolume(Standard_Real Elevation)
{
Standard_Integer i,noeud[3],flag[3];
Standard_Integer nbNodes;
TopExp_Explorer ex;
TopLoc_Location L;
Standard_Real z[3];
Standard_Real Volume=0;
Standard_Real Determinant=0;
gp_Pnt P[3];
// Projection du point d'initialisation sur le plan de section
InitPoint.SetZ(Elevation);
for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next())
{
TopoDS_Face F = TopoDS::Face(ex.Current());
Handle(Poly_Triangulation) Tr = BRep_Tool::Triangulation(F, L);
if(Tr.IsNull())
MESSAGE("Error, null layer" )
const Poly_Array1OfTriangle& triangles = Tr->Triangles();
Standard_Integer nbTriangles = Tr->NbTriangles();
nbNodes = Tr->NbNodes();
const TColgp_Array1OfPnt& Nodes = Tr->Nodes();
// Calcul des volumes de chaque triangle, de chaque face
//en tenant compte des triangles coupés par le plan de section
for (i=1;i<=nbTriangles;i++)
{
Determinant=0;
//Gardons la meme orientation des noeuds
if (F.Orientation() == TopAbs_REVERSED)
triangles(i).Get(noeud[0], noeud[2], noeud[1]);
else
triangles(i).Get(noeud[0], noeud[1], noeud[2]);
P[0] = Nodes(noeud[0]).Transformed(L.Transformation());
z[0] = P[0].Z();
P[1] = Nodes(noeud[1]).Transformed(L.Transformation());
z[1] = P[1].Z();
P[2] = Nodes(noeud[2]).Transformed(L.Transformation());
z[2] = P[2].Z();
// Determination des cas aux limites pour les triangles
Standard_Integer i,compteur=0;
for (i=0;i<=2;i++)
{
flag[i]=Standard_False;
if(z[i]>=Elevation)
{
flag[i]=Standard_True;
compteur++;
}
}
switch(compteur)
{
case 0:
Determinant = ElementaryVolume(P[0],P[1],P[2]);
break;
case 1:
for (i=0;i<=2;i++)
{
if (flag[i]==Standard_True)
{
gp_Pnt Result1 = Intersection(P[i],P[(i+1)%3],Elevation);
gp_Pnt Result2 = Intersection(P[i],P[(i+2)%3],Elevation);
Determinant = ElementaryVolume(Result1,P[(i+1)%3],P[(i+2)%3])
+ ElementaryVolume(Result1,P[(i+2)%3],Result2);
}
}
break;
case 2:
for (i=0;i<=2;i++)
{
if (flag[i]==Standard_False)
{
gp_Pnt Result1 = Intersection(P[i],P[(i+1)%3],Elevation);
gp_Pnt Result2 = Intersection(P[i],P[(i+2)%3],Elevation);
Determinant = ElementaryVolume(P[i],Result1,Result2);
}
}
break;
case 3:
break;
}
Volume += Determinant;
}
}
return Volume;
}
Standard_Real VolumeSection::Archimede(Standard_Real Constante , Standard_Real Epsilon)
{
// Resolution de l equation V(h) = Constante a l aide de l algorithme de dichotomie avec ponderation type
// Lagrange
Standard_Real c,Binf,Bsup;
Standard_Real tempBsupVolume=0;
Standard_Real tempBinfVolume=0;
Standard_Real tempCVolume = 0;
Binf = Zmin;
Bsup = Zmax;
if(Binf>Bsup)
{
MESSAGE("error, Bound + < Bound - in dichotomy")
return -1;
}
tempBsupVolume = CalculateVolume(Bsup);
tempBinfVolume = CalculateVolume(Binf);
if (Constante>tempBsupVolume || Constante<tempBinfVolume)
{
MESSAGE("error, algorithm start Impossible. Wrong constant value" )
return -1;
}
c = ((Binf*(tempBsupVolume-Constante))-(Bsup*(tempBinfVolume-Constante)))
/((tempBsupVolume-Constante)-(tempBinfVolume-Constante));
tempCVolume = CalculateVolume(c);
if(Abs(tempCVolume-Constante)<=Epsilon)
{
goto endMethod;
}
else
{
while((Bsup-Binf)>Epsilon)
{
if((tempBinfVolume-Constante)*(tempCVolume-Constante)>0 && Abs(tempCVolume-Constante)>Epsilon)
{
Binf = c;
tempBinfVolume=tempCVolume;
c = ((Binf*(tempBsupVolume-Constante))-(Bsup*(tempBinfVolume-Constante)))
/((tempBsupVolume-Constante)-(tempBinfVolume-Constante));
tempCVolume=CalculateVolume(c);
}
else if((tempBinfVolume-Constante)*(tempCVolume-Constante)<0 && Abs(tempCVolume-Constante)>Epsilon)
{
Bsup = c;
tempBsupVolume =tempCVolume;
c = ((Binf*(tempBsupVolume-Constante))-(Bsup*(tempBinfVolume-Constante)))
/((tempBsupVolume-Constante)-(tempBinfVolume-Constante));
tempCVolume=CalculateVolume(c);
}
else
{
goto endMethod;
}
}
goto endMethod;
}
endMethod:
MESSAGE("La ligne de flottaison correspondant a la constante :"<<Constante<<" est a la cote Z = "<<c)
return c;
}
void VolumeSection::MakeRotation(gp_Dir PlaneDirection)
{
gp_Dir Zdirection(0.0,0.0,1.0);
Standard_Real VariationAngle = 0;
gp_Pnt RotationAxeLocation(0.0,0.0,0.0);
gp_Dir RotationAxeDirection(1.0,1.0,1.0);
gp_Ax1 RotationAxe(RotationAxeLocation,RotationAxeDirection);
gp_Trsf Transformation;
VariationAngle = Zdirection.Angle(PlaneDirection);
RotationAxe.SetDirection(PlaneDirection.Crossed(Zdirection));
Transformation.SetRotation(RotationAxe,VariationAngle);
TopLoc_Location L(Transformation);
myShape.Move(L);
myPlane->Transform(Transformation);
}
Handle (Geom_RectangularTrimmedSurface) VolumeSection::TrimSurf()
{
Standard_Real Umin,Umax,Vmin,Vmax;
gp_Pnt Pmin(Xmin,Ymin,Zmin);
GeomAPI_ProjectPointOnSurf Projection(Pmin,myPlane);
Projection.Parameters(1,Umin,Vmin);
gp_Pnt Pmax(Xmax,Ymax,Zmax);
GeomAPI_ProjectPointOnSurf Projection2(Pmax,myPlane);
Projection2.Parameters(1,Umax,Vmax);
Handle (Geom_RectangularTrimmedSurface) Plane = new Geom_RectangularTrimmedSurface(myPlane,Umin,Umax,Vmin,Vmax);
return Plane;
}
Handle (Geom_RectangularTrimmedSurface) VolumeSection::InvMakeRotation(gp_Dir PlaneDirection, Handle (Geom_RectangularTrimmedSurface) SurfTrim)
{
gp_Dir Zdirection(0.0,0.0,1.0);
Standard_Real VariationAngle = 0;
gp_Pnt RotationAxeLocation(0.0,0.0,0.0);
gp_Dir RotationAxeDirection(1.0,1.0,1.0);
gp_Ax1 RotationAxe(RotationAxeLocation,RotationAxeDirection);
gp_Trsf Transformation;
VariationAngle = Zdirection.Angle(PlaneDirection);
RotationAxe.SetDirection(PlaneDirection.Crossed(Zdirection));
Transformation.SetRotation(RotationAxe,-VariationAngle);
SurfTrim->Transform(Transformation);
TopLoc_Location L(Transformation);
myShape.Move(L);
return SurfTrim;
}
Handle (Geom_RectangularTrimmedSurface) VolumeSection::AjustePlan(Handle (Geom_RectangularTrimmedSurface) SurfTrim, Standard_Real Cote, gp_Pnt PosPlan)
{
gp_Trsf Transformation;
gp_Pnt PosArchi(PosPlan.X(),PosPlan.Y(),Cote);
Transformation.SetTranslation(PosPlan,PosArchi);
SurfTrim->Transform(Transformation);
return SurfTrim;
}
//-------------------------------------------------------------------------------------------------------
//----------------------------------- Methodes privees ---------------------------------------------------
//-------------------------------------------------------------------------------------------------------
//Fonction calculant l'intersection de la droite passant par les points P1 et P2
//avec le plan horizontal Z=Hauteur
gp_Pnt VolumeSection::Intersection(gp_Pnt P1,gp_Pnt P2,Standard_Real Hauteur)
{
Standard_Real constante;
gp_Pnt Point;
constante = (Hauteur-P1.Z())/(P2.Z()-P1.Z());
Point.SetX(P1.X()*(1-constante) + constante*P2.X());
Point.SetY(P1.Y()*(1-constante) + constante*P2.Y());
Point.SetZ(Hauteur);
return Point;
}
//Fonction calculant le volume élémentaire de chaque tétraedre à partir de 3 points
Standard_Real VolumeSection::ElementaryVolume(gp_Pnt P1,gp_Pnt P2,gp_Pnt P3)
{
Standard_Real Determinant;
math_Matrix M(1,3,1,3);
M(1,1)=P1.X()-InitPoint.X();
M(1,2)=P2.X()-InitPoint.X();
M(1,3)=P3.X()-InitPoint.X();
M(2,1)=P1.Y()-InitPoint.Y();
M(2,2)=P2.Y()-InitPoint.Y();
M(2,3)=P3.Y()-InitPoint.Y();
M(3,1)=P1.Z()-InitPoint.Z();
M(3,2)=P2.Z()-InitPoint.Z();
M(3,3)=P3.Z()-InitPoint.Z();
Determinant = (1.0/6) * M.Determinant();
return Determinant;
}
void VolumeSection::getZ( double& min, double& max)
{
min = Zmin;
max = Zmax;
}

View File

@ -1,85 +0,0 @@
// GEOM ARCHIMEDE : algorithm implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : Archimede_VolumeSection.hxx
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
#ifndef ARCHIMEDE_VOLUMESECTION_HXX
#define ARCHIMEDE_VOLUMESECTION_HXX
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <TopoDS_Shape.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
class VolumeSection{
public:
// Constructeur effectuant le maillage de peau de la shape
VolumeSection(TopoDS_Shape , Standard_Real);
//Methode qui affecte à un point,les coordonnées de centre de la boite englobante de la shape
void CenterOfGravity();
// Methode qui calcule le volume sous un plan Z = h
Standard_Real CalculateVolume(Standard_Real);
// Methode qui resout l'equation V(h)=constante
Standard_Real Archimede(Standard_Real , Standard_Real);
// Methode permettant de "setter" un plan afin de l'utiliser à l'interieur de la classe
void SetPlane(Handle (Geom_Plane));
// Methode permettant de récupérer la shape modifiée à l'extérieur de la classe
TopoDS_Shape GetShape();
// Methode effectuant la rotation du plan et de la shape
void MakeRotation(gp_Dir);
// Methode effectuant la rotation inverse du plan et de la shape
Handle (Geom_RectangularTrimmedSurface) InvMakeRotation(gp_Dir,Handle(Geom_RectangularTrimmedSurface));
// Methode permettant de découper le plan selon une projection de la Shape
Handle (Geom_RectangularTrimmedSurface) TrimSurf();
// Methode permmettant de deplacer le plan jusqu'a la position donnée par Archimède
Handle (Geom_RectangularTrimmedSurface) AjustePlan(Handle(Geom_RectangularTrimmedSurface),Standard_Real,gp_Pnt);
void getZ( double& min, double& max);
private:
TopoDS_Shape myShape;
Standard_Real Tolerance;
gp_Pnt InitPoint;
Standard_Real Zmin,Zmax,Ymin,Ymax,Xmin,Xmax;
Handle(Geom_Plane) myPlane;
Standard_Real ElementaryVolume(gp_Pnt,gp_Pnt,gp_Pnt);
gp_Pnt Intersection(gp_Pnt,gp_Pnt,Standard_Real);
};
#endif

View File

@ -1,57 +0,0 @@
# GEOM ARCHIMEDE : algorithm implementation
#
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#
#
#
# File : Makefile.in
# Author : Nicolas REJNERI
# Module : GEOM
# $Header$
top_srcdir=@top_srcdir@
top_builddir=../../..
srcdir=@srcdir@
VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@
# Libraries targets
LIB = libGeometryArchimede.la
LIB_SRC = Archimede_VolumeSection.cxx
LIB_CLIENT_IDL =
# header files
EXPORT_HEADERS = Archimede_VolumeSection.hxx
# additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES)
CXXFLAGS += $(OCC_CXXFLAGS)
LDFLAGS += $(OCC_LIBS)
# additional file to be cleaned
MOSTLYCLEAN =
CLEAN =
DISTCLEAN =
@CONCLUDE@

File diff suppressed because it is too large Load Diff

View File

@ -1,597 +0,0 @@
// GEOM GEOM : implementaion of GEOM_Gen.idl and GEOM_Shape.idl
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOM_GEN_i.h file
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef __GEOM_GEN_I_H__
#define __GEOM_GEN_I_H__
// standard C++ headers
#include <TDocStd_Document.hxx>
#include "GEOMDS_DataMapOfIntegerTransient.hxx"
#include "GEOMDS_Application.hxx"
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
#include CORBA_SERVER_HEADER(GEOM_Shape)
#include CORBA_SERVER_HEADER(SALOMEDS)
#include "SALOME_Component_i.hxx"
#include "GEOM_Shape_i.hh"
#include "SALOME_NamingService.hxx"
#include <iostream.h>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
//=====================================================================
// GEOM_Gen_i : class definition
//=====================================================================
class GEOM_Gen_i: public POA_GEOM::GEOM_Gen,
public Engines_Component_i
{
private:
SALOME_NamingService * name_service;
char * _name;
Handle(GEOMDS_Application) myOCAFApp; /* geom/OCAF Application */
Handle(TDocStd_Document) myCurrentOCAFDoc; /* Current geom/OCAF Document */
GEOMDS_DataMapOfIntegerTransient myStudyIDToDoc; /* Map to bind a Study to a Document */
int myStudyID;
GEOM::GEOM_Shape_ptr CreateObject(TopoDS_Shape& tds) ;
GEOM::GEOM_Shape_ptr CreateSubObject(const TopoDS_Shape& SubShape,
const GEOM::GEOM_Shape_ptr MainShape,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID);
// Create and insert(!) SubShape of MainShape
GEOM::GEOM_Shape_ptr GEOM_Gen_i::SubShapesOne( GEOM::GEOM_Shape_ptr shape,
const TopAbs_ShapeEnum ShapeType,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID,
const Standard_Boolean sorted=Standard_False)
throw (SALOME::SALOME_Exception);
// return all listed subshapes as one shape
GEOM::GEOM_Gen::ListOfGeomShapes* SubShapesAll(GEOM::GEOM_Shape_ptr shape,
const TopAbs_ShapeEnum type,
const Standard_Boolean sorted=Standard_False)
throw (SALOME::SALOME_Exception);
// return all subshapes by type
TopoDS_Face FindSameFace(const TopoDS_Shape& aShape,
const TopoDS_Face& F,
double tol3d);
TopoDS_Edge FindSameEdge(const TopoDS_Face& newFace,
TopoDS_Edge& Eold,
double tol3d);
public:
//-----------------------------------------------------------------------//
// Constructor / Destructor //
//-----------------------------------------------------------------------//
// constructor to be called for servant creation.
GEOM_Gen_i();
GEOM_Gen_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
const char *interfaceName);
// destructor, doing nothing (for now)
virtual ~GEOM_Gen_i();
// generic method to be put in a super class
void register_name(char * name);
//-----------------------------------------------------------------------//
// Studies Management //
//-----------------------------------------------------------------------//
void GetCurrentStudy (CORBA::Long StudyID);
CORBA::Short NbLabels();
// inherited methods from SALOMEDS::Driver
SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
bool isMultiFile);
SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
bool isMultiFile);
CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream,
const char* theURL,
bool isMultiFile);
CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream,
const char* theURL,
bool isMultiFile);
void Close(SALOMEDS::SComponent_ptr theComponent);
char* ComponentDataType();
char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
const char* IORString,
CORBA::Boolean isMultiFile,
CORBA::Boolean isASCII);
char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
const char* aLocalPersistentID,
CORBA::Boolean isMultiFile,
CORBA::Boolean isASCII);
bool CanPublishInStudy(CORBA::Object_ptr theIOR);
SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject,
CORBA::Object_ptr theObject,
const char* theName) throw (SALOME::SALOME_Exception) ;
CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject);
//-----------------------------------------------------------------------//
// Shapes Management //
//-----------------------------------------------------------------------//
const char* InsertInLabel(TopoDS_Shape S,
const char *nameIor,
Handle(TDocStd_Document) OCAFDoc) ;
const char* InsertInLabelDependentShape(TopoDS_Shape S,
const char *nameIor,
GEOM::GEOM_Shape_ptr mainshape_ptr,
Handle(TDocStd_Document) OCAFDoc) ;
void InsertInLabelOneArgument(TopoDS_Shape main_topo,
GEOM::GEOM_Shape_ptr shape_ptr,
TopoDS_Shape result_topo,
GEOM::GEOM_Shape_ptr result,
Handle(TDocStd_Document) OCAFDoc) ;
void InsertInLabelMoreArguments(TopoDS_Shape main_topo,
GEOM::GEOM_Shape_ptr result,
const GEOM::GEOM_Gen::ListOfIOR& ListShapes,
Handle(TDocStd_Document) OCAFDoc) ;
// Methods used by SuppressFaces
int SuppressFacesGlue( const TopoDS_Shape& S,
const TopTools_MapOfShape& mapFaces,
TopoDS_Shape& aCompoundOfShells ) throw (SALOME::SALOME_Exception) ;
// various services
int GetIndexTopology( const TopoDS_Shape& subshape,
const TopoDS_Shape& mainShape ) ;
bool GetShapeFromIndex( const TopoDS_Shape& aShape,
const TopAbs_ShapeEnum aType,
const int index,
TopoDS_Shape& tds) ;
GEOM::GEOM_Shape::ListOfSubShapeID* IndexOfFacesOfSubShell( const TopoDS_Shape& S,
const TopoDS_Shape subShell )
throw (SALOME::SALOME_Exception) ;
bool ListOfIDIntoMapOfShapes( const TopoDS_Shape& S,
const GEOM::GEOM_Shape::ListOfSubShapeID& L,
const int subShapeType,
TopTools_MapOfShape& aMap ) ;
bool ListOfIDIntoSequenceOfShapes( const TopoDS_Shape& S,
const GEOM::GEOM_Shape::ListOfSubShapeID& L,
const int subShapeType,
TopTools_SequenceOfShape& aSequenceOfShapes ) ;
// Returns a TopoDS_Shape from a GEOM::GEOM_Shape_ptr
TopoDS_Shape GetTopoShape(GEOM::GEOM_Shape_ptr shape_ptr) ;
// Define a sequence of shapes from 'listShapes' and return its length
int SequenceOfShapeFromListOfGeomShape( const GEOM::GEOM_Gen::ListOfGeomShapes& listShapes,
TopTools_SequenceOfShape& SS ) ;
// Get a string representing a shape ref IOR
const char* GetStringFromIOR(GEOM::GEOM_Shape_var shapeIOR);
// Return the shape ref represented by a string of IOR
GEOM::GEOM_Shape_ptr GetIORFromString(const char* stringIOR);
GEOM::GEOM_Gen::ListOfIOR* GetReferencedObjects(GEOM::GEOM_Shape_ptr shape);
GEOM::GEOM_Gen::ListOfIOR* GetObjects(GEOM::GEOM_Shape_ptr shape);
//-----------------------------------------------------------------------//
// Internal structure of shapes //
//-----------------------------------------------------------------------//
// Explode SubShape
GEOM::GEOM_Shape_ptr SubShape(GEOM::GEOM_Shape_ptr shape,
CORBA::Short ShapeType,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID)
throw (SALOME::SALOME_Exception) ;
// Explode SubShape in predictable order
GEOM::GEOM_Shape_ptr SubShapeSorted(GEOM::GEOM_Shape_ptr shape,
CORBA::Short ShapeType,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID)
throw (SALOME::SALOME_Exception) ;
// Explode SubShape
GEOM::GEOM_Gen::ListOfGeomShapes* SubShapeAll(GEOM::GEOM_Shape_ptr shape,
CORBA::Short ShapeType)
throw (SALOME::SALOME_Exception) ;
// Explode SubShape in predictable order for TUI or GUI
GEOM::GEOM_Gen::ListOfGeomShapes* SubShapeAllSorted(GEOM::GEOM_Shape_ptr shape,
CORBA::Short ShapeType)
throw (SALOME::SALOME_Exception) ;
// Suppress faces in a shape
GEOM::GEOM_Gen::ListOfGeomShapes* SuppressFaces( GEOM::GEOM_Shape_ptr shape,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID )
throw (SALOME::SALOME_Exception) ;
// Suppress one or more holes in a face or shell independant topology
GEOM::GEOM_Shape_ptr SuppressHolesInFaceOrShell( GEOM::GEOM_Shape_ptr shapeFaceShell,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires)
throw (SALOME::SALOME_Exception) ;
// Suppress a single hole in a topology (face) shell or solid with/without hole traversing
GEOM::GEOM_Shape_ptr SuppressHole( GEOM::GEOM_Shape_ptr shape,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListIdFace,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListIdWire,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListIdEndFace )
throw (SALOME::SALOME_Exception) ;
bool RebuildFaceRemovingHoles( const TopoDS_Face& aFace,
const TopTools_MapOfShape& mapHoles,
TopoDS_Shape& resultFace ) ;
void SuppressHoleSubRoutine( const TopoDS_Shape& mainShape,
const TopoDS_Face& aFace,
const TopTools_SequenceOfShape& SSedgesOfWire,
const TopTools_IndexedDataMapOfShapeListOfShape& aMapEdgesFaces,
const TopTools_MapOfShape& MSfaces,
TopTools_MapOfShape& MSfacesSuppress,
const Standard_Boolean withEndFace,
const TopoDS_Face& endFace,
TopTools_MapOfShape& MSwireEndEdges )
throw (SALOME::SALOME_Exception ) ;
bool BuildShapeHoleNotTraversing( const TopoDS_Shape& aShape,
const TopoDS_Face& aFace,
const TopoDS_Wire& aWire,
const TopTools_MapOfShape& MFSuppress,
TopoDS_Shape& resultTds )
throw (SALOME::SALOME_Exception) ;
bool BuildShapeHoleTraversing( const TopoDS_Shape& aShape,
const TopoDS_Face& aFace,
const TopoDS_Wire& aWire,
const TopTools_MapOfShape& MFSuppress,
const TopoDS_Face& endFace,
const TopoDS_Wire& endWire,
TopoDS_Shape& resultTds )
throw (SALOME::SALOME_Exception) ;
bool FindCompareWireHoleOnFace( const TopoDS_Face& F,
const TopTools_MapOfShape& MSwireEdges,
TopoDS_Wire& aFoundWire ) ;
bool IsShapeInSequence( const TopTools_SequenceOfShape& SS, const TopoDS_Shape& aShape ) ;
void FreeEdgesFromMapOfFace(const TopTools_MapOfShape& MSfaces, TopTools_MapOfShape& MS ) ;
void MapRemoveSequence( const TopTools_MapOfShape& MS,
const TopTools_SequenceOfShape& SSRemove,
TopTools_SequenceOfShape& ST) ;
bool BuildShellWithFaceCompound( const TopoDS_Compound Comp,
TopoDS_Shell& resultShell ) ;
//-----------------------------------------------------------------------//
// Basic structures //
//-----------------------------------------------------------------------//
GEOM::PointStruct MakePointStruct(CORBA::Double x,
CORBA::Double y,
CORBA::Double z) ;
GEOM::DirStruct MakeDirection(const GEOM::PointStruct& p) ;
GEOM::AxisStruct MakeAxisStruct(CORBA::Double x,
CORBA::Double y,
CORBA::Double z,
CORBA::Double vx,
CORBA::Double vy,
CORBA::Double vz) ;
//----------------------------------------------------------------------//
// Boolean Operations //
//----------------------------------------------------------------------//
GEOM::GEOM_Shape_ptr MakeBoolean(GEOM::GEOM_Shape_ptr shape1,
GEOM::GEOM_Shape_ptr shape2,
CORBA::Long operation)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeFuse(GEOM::GEOM_Shape_ptr shape1,
GEOM::GEOM_Shape_ptr shape2)
throw (SALOME::SALOME_Exception) ;
//----------------------------------------------------------------------//
// Advanced Operations //
//----------------------------------------------------------------------//
GEOM::GEOM_Shape_ptr Partition(const GEOM::GEOM_Gen::ListOfIOR& ListShapes,
const GEOM::GEOM_Gen::ListOfIOR& ListTools,
const GEOM::GEOM_Gen::ListOfIOR& ListKeepInside,
const GEOM::GEOM_Gen::ListOfIOR& ListRemoveInside,
const CORBA::Short Limit)
throw (SALOME::SALOME_Exception) ;
// Filling a surface with section curves
GEOM::GEOM_Shape_ptr MakeFilling(GEOM::GEOM_Shape_ptr shape,
CORBA::Short mindeg,
CORBA::Short maxdeg,
CORBA::Double tol3d,
CORBA::Double tol2d,
CORBA::Short nbiter)
throw (SALOME::SALOME_Exception) ;
// Sewing of shapes
GEOM::GEOM_Shape_ptr MakeSewing(const GEOM::GEOM_Gen::ListOfIOR& ListShapes,
CORBA::Double precision)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeSewingShape( GEOM::GEOM_Shape_ptr aShape,
CORBA::Double precision )
throw (SALOME::SALOME_Exception);
GEOM::GEOM_Shape_ptr MakeGlueFaces(GEOM::GEOM_Shape_ptr myShape,
double tol3d)
throw (SALOME::SALOME_Exception);
// Change the orientation of a (new) shape
GEOM::GEOM_Shape_ptr OrientationChange(GEOM::GEOM_Shape_ptr shape)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakePlacedBox(CORBA::Double x1, CORBA::Double y1, CORBA::Double z1,
CORBA::Double delta1, CORBA::Double delta2, CORBA::Double delta3)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakePanel(GEOM::GEOM_Shape_ptr shape,
CORBA::Short directiontype,
CORBA::Double delta)
throw (SALOME::SALOME_Exception) ;
//---------------------------------------------------------------------//
// Transformations Operations //
//---------------------------------------------------------------------//
// Copy
GEOM::GEOM_Shape_ptr MakeCopy( GEOM::GEOM_Shape_ptr shape)
throw (SALOME::SALOME_Exception) ;
// Translation
GEOM::GEOM_Shape_ptr MakeTranslation( GEOM::GEOM_Shape_ptr shape,
CORBA::Double x,
CORBA::Double y,
CORBA::Double z)
throw (SALOME::SALOME_Exception) ;
// Rotation
GEOM::GEOM_Shape_ptr MakeRotation( GEOM::GEOM_Shape_ptr shape,
const GEOM::AxisStruct& axis,
CORBA::Double angle)
throw (SALOME::SALOME_Exception) ;
// Create a shape using a scale factor
GEOM::GEOM_Shape_ptr MakeScaleTransform(GEOM::GEOM_Shape_ptr shape,
const GEOM::PointStruct& theCenterOfScale,
CORBA::Double factor)
throw (SALOME::SALOME_Exception) ;
// Mirror of a shape by a plane
GEOM::GEOM_Shape_ptr MakeMirrorByPlane(GEOM::GEOM_Shape_ptr shape,
GEOM::GEOM_Shape_ptr shapePlane)
throw (SALOME::SALOME_Exception) ;
// Shape by revolution of another around an axis
GEOM::GEOM_Shape_ptr MakeRevolution(GEOM::GEOM_Shape_ptr shape,
const GEOM::AxisStruct& axis,
CORBA::Double angle)
throw (SALOME::SALOME_Exception) ;
// Create a prism with a base shape along a vector P1 to P2
GEOM::GEOM_Shape_ptr MakePrism(GEOM::GEOM_Shape_ptr baseShape,
const GEOM::PointStruct& P1,
const GEOM::PointStruct& P2)
throw (SALOME::SALOME_Exception) ;
// Create a shape by sweeping a baseShape along a pathShape
GEOM::GEOM_Shape_ptr MakePipe(GEOM::GEOM_Shape_ptr pathShape,
GEOM::GEOM_Shape_ptr baseShape)
throw (SALOME::SALOME_Exception) ;
//---------------------------------------------------------------------//
// Patterns Operations //
//---------------------------------------------------------------------//
// Multi Translation 1D
GEOM::GEOM_Shape_ptr MakeMultiTranslation1D( GEOM::GEOM_Shape_ptr shape,
const GEOM::DirStruct& dir,
CORBA::Double step,
CORBA::Short nbtimes)
throw (SALOME::SALOME_Exception) ;
// Multi Translation 2D
GEOM::GEOM_Shape_ptr MakeMultiTranslation2D( GEOM::GEOM_Shape_ptr shape,
const GEOM::DirStruct& dir1,
CORBA::Double step1,
CORBA::Short nbtimes1,
const GEOM::DirStruct& dir2,
CORBA::Double step2,
CORBA::Short nbtimes2)
throw (SALOME::SALOME_Exception) ;
// Multi Rotation 1D
GEOM::GEOM_Shape_ptr MakeMultiRotation1D( GEOM::GEOM_Shape_ptr shape,
const GEOM::DirStruct& dir,
const GEOM::PointStruct& loc,
CORBA::Short nbtimes)
throw (SALOME::SALOME_Exception) ;
// Multi Rotation 2D
GEOM::GEOM_Shape_ptr MakeMultiRotation2D( GEOM::GEOM_Shape_ptr shape,
const GEOM::DirStruct& dir,
const GEOM::PointStruct& loc,
CORBA::Double ang,
CORBA::Short nbtimes1,
CORBA::Double step,
CORBA::Short nbtimes2)
throw (SALOME::SALOME_Exception) ;
//--------------------------------------------------------------------//
// Primitives Construction //
//--------------------------------------------------------------------//
GEOM::GEOM_Shape_ptr MakeBox(CORBA::Double x1,
CORBA::Double y1,
CORBA::Double z1,
CORBA::Double x2,
CORBA::Double y2,
CORBA::Double z2)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeSphere(CORBA::Double x1,
CORBA::Double y1,
CORBA::Double z1,
CORBA::Double radius)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeCylinder(const GEOM::PointStruct& pstruct,
const GEOM::DirStruct& dstruct,
CORBA::Double radius,
CORBA::Double height)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeTorus(const GEOM::PointStruct& pstruct,
const GEOM::DirStruct& dstruct,
CORBA::Double major_radius,
CORBA::Double minor_radius)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeCone(const GEOM::PointStruct& pstruct,
const GEOM::DirStruct& dstruct,
CORBA::Double radius1,
CORBA::Double radius2,
CORBA::Double height)
throw (SALOME::SALOME_Exception) ;
//-------------------------------------------------------------------//
// Import/Export //
//-------------------------------------------------------------------//
GEOM::GEOM_Shape_ptr ImportIGES(const char* filename) throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr ImportBREP(const char* filename) throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr ImportSTEP(const char* filename) throw (SALOME::SALOME_Exception) ;
void ExportIGES(const char* filename,GEOM::GEOM_Shape_ptr theShape) throw (SALOME::SALOME_Exception) ;
void ExportBREP(const char* filename,GEOM::GEOM_Shape_ptr theShape) throw (SALOME::SALOME_Exception) ;
void ExportSTEP(const char* filename,GEOM::GEOM_Shape_ptr theShape) throw (SALOME::SALOME_Exception) ;
//-------------------------------------------------------------------//
// Fillet and Chamfer construction //
//-------------------------------------------------------------------//
GEOM::GEOM_Shape_ptr MakeFillet (GEOM::GEOM_Shape_ptr shape,
CORBA::Double radius,
CORBA::Short ShapeType,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeChamfer(GEOM::GEOM_Shape_ptr shape,
CORBA::Double d1,
CORBA::Double d2,
CORBA::Short ShapeType,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID)
throw (SALOME::SALOME_Exception) ;
//-------------------------------------------------------------------//
// Mesures Construction //
//-------------------------------------------------------------------//
GEOM::GEOM_Shape_ptr MakeCDG(GEOM::GEOM_Shape_ptr shape)
throw (SALOME::SALOME_Exception) ;
//-------------------------------------------------------------------//
// Check Shape //
//-------------------------------------------------------------------//
CORBA::Boolean CheckShape(GEOM::GEOM_Shape_ptr shape)
throw (SALOME::SALOME_Exception) ;
//-------------------------------------------------------------------//
// Primitives Construction //
//-------------------------------------------------------------------//
GEOM::GEOM_Shape_ptr MakeVertex(CORBA::Double x,
CORBA::Double y,
CORBA::Double z)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeVector(const GEOM::PointStruct& pstruct1,
const GEOM::PointStruct& pstruct2)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeLine (const GEOM::PointStruct& pstruct,
const GEOM::DirStruct& dstruc)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakePlane (const GEOM::PointStruct& pstruct,
const GEOM::DirStruct& dstruc,
CORBA::Double trimsize)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeCircle(const GEOM::PointStruct& pstruct,
const GEOM::DirStruct& dstruct,
CORBA::Double radius)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeArc (const GEOM::PointStruct& pInit,
const GEOM::PointStruct& pCircle,
const GEOM::PointStruct& pEnd)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeCompound (const GEOM::GEOM_Gen::ListOfIOR& ListShapes)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeWire (const GEOM::GEOM_Gen::ListOfIOR& ListShapes)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeEdge (const GEOM::PointStruct& pstruct1,
const GEOM::PointStruct& pstruct2)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeFace (GEOM::GEOM_Shape_ptr wire, CORBA::Boolean wantplanarface)
throw (SALOME::SALOME_Exception) ;
//-------------------------------------------------------------------//
// Speciic method Archimede //
//-------------------------------------------------------------------//
GEOM::GEOM_Shape_ptr Archimede(GEOM::GEOM_Shape_ptr aShape,
CORBA::Double aWeight,
CORBA::Double aWaterDensity,
CORBA::Double aMeshingDeflection)
throw (SALOME::SALOME_Exception) ;
};
#endif

View File

@ -1,248 +0,0 @@
// GEOM GEOM : implementaion of GEOM_Gen.idl and GEOM_Shape.idl
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOM_Shape_i.cc
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include <BRepTools_ShapeSet.hxx>
#include "GEOM_Shape_i.hh"
#include "SALOME_NamingService.hxx"
#include <fstream.h>
#include <BRepTools.hxx>
//=================================================================================
// function : GEOM_Shape_i() constructor (no arguments)
// purpose : for what now ?
//=================================================================================
GEOM_Shape_i::GEOM_Shape_i() { }
//=================================================================================
// function : constructor
// purpose : constructor for servant creation
//=================================================================================
GEOM_Shape_i::GEOM_Shape_i(TopoDS_Shape geom,
CORBA::ORB_ptr orb,
GEOM::GEOM_Gen_ptr engine,
const GEOM::GEOM_Shape::ListOfSubShapeID& index,
GEOM::shape_type sht,
bool ismain) {
_geom = geom;
_orb = orb;
_engine = engine;
_shapetype = sht ;
_ismain = ismain;
_index = index ;
_shapeid = "";
_studyshapeid = "";
_name = "";
_mainname ="";
_nametype ="";
}
//=================================================================================
// function : destructor
// purpose : deleting the internal geometry structure
//=================================================================================
GEOM_Shape_i::~GEOM_Shape_i() { delete &_geom; }
//=================================================================================
// function : Name (set method)
// purpose : to set the attribute 'name' of this shape.
// : WARNING : Register to naming service actually removed !
//=================================================================================
void GEOM_Shape_i::Name(const char* name) {
_name = strdup(name);
GEOM::GEOM_Shape_ptr g = GEOM::GEOM_Shape::_narrow(_this());
// Removed declaration of shapes to naming service
//SALOME_NamingService * ns = new SALOME_NamingService(_orb);
//ns->Register(g, _name);
}
//=================================================================================
// function : Name (get method)
// purpose : to get the attribute 'name' of this shape
//=================================================================================
char* GEOM_Shape_i::Name() { return strdup(_name); }
//=================================================================================
// function : MainName (set method)
// purpose : to set the attribute 'name' of this mainshape.
//=================================================================================
void GEOM_Shape_i::MainName(const char* name) {
_mainname = strdup(name);
}
//=================================================================================
// function : MainName (get method)
// purpose : to get the attribute 'name' of this shape
//=================================================================================
char* GEOM_Shape_i::MainName() { return strdup(_mainname); }
//=================================================================================
// function : IsMainShape (get method)
// purpose : return 'true' if this is a main shape (not a sub shape)
//=================================================================================
bool GEOM_Shape_i::IsMainShape() { return _ismain ; }
//=================================================================================
// function : IsMainShape (set method)
// purpose : to set the property 'ismain' true or false of this shape
//=================================================================================
void GEOM_Shape_i::IsMainShape(const bool abool) { _ismain = abool ; }
//=================================================================================
// function : ShapeId
// purpose : to get the id of this shape from GEOM (OCAF entry)
//=================================================================================
char* GEOM_Shape_i::ShapeId() { return strdup(_shapeid) ; }
//=================================================================================
// function : ShapeId (set method)
// purpose : to set the id of this shape in GEOM/OCAF doc
//=================================================================================
void GEOM_Shape_i::ShapeId(const char * shapeid) { _shapeid = strdup(shapeid) ; }
//=================================================================================
// function : StudyShapeId (get method)
// purpose : to get the id of this shape from the study document (OCAF entry)
//=================================================================================
char* GEOM_Shape_i::StudyShapeId() { return strdup(_studyshapeid) ; }
//=================================================================================
// function : StudyShapeId (set method)
// purpose : to set the id of this shape in the Study document (OCAF entry)
//=================================================================================
void GEOM_Shape_i::StudyShapeId(const char * studyshapeid)
{ _studyshapeid = strdup(studyshapeid) ; }
//=================================================================================
// function : Index (get method)
// purpose : to get the index of this sub shape in its main shape
//=================================================================================
GEOM::GEOM_Shape::ListOfSubShapeID* GEOM_Shape_i::Index() {
unsigned int _length = _index.length();
GEOM::GEOM_Shape::ListOfSubShapeID_var _list = new GEOM::GEOM_Shape::ListOfSubShapeID;
_list->length(_length);
for (unsigned int ind = 0; ind < _length; ind++) {
_list[ind] = _index[ind];
}
return _list._retn() ;
}
//=================================================================================
// function : Index (set method)
// purpose : to set the index of this sub shape (in a main shape)
//=================================================================================
void GEOM_Shape_i::Index(const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSubShapeID)
{ _index = ListOfSubShapeID ; }
//=================================================================================
// function : ShapeType (get method)
// purpose : to get the topological type of this shape as defined in enum of IDL file
//=================================================================================
GEOM::shape_type GEOM_Shape_i::ShapeType() { return _shapetype ; }
//=================================================================================
// function : SetType (set method)
// purpose : to set the topological type of this shape (see GetType)
//=================================================================================
void GEOM_Shape_i::ShapeType(GEOM::shape_type sht) { _shapetype = sht ; }
//=================================================================================
// function : NameType (set method)
// purpose : to set the attribute 'nametype' of this shape.
//=================================================================================
void GEOM_Shape_i::NameType(const char* name) {
}
//=================================================================================
// function : NameType (get method)
// purpose : to get the attribute 'nametype' of this shape
//=================================================================================
char* GEOM_Shape_i::NameType() { return strdup(_nametype); }
//=================================================================================
// function : GetShapeStream
// Transfer resulting shape to client as sequence of bytes
//client can extract shape from stream using BrepTools::Read function
//=================================================================================
GEOM::GEOM_Shape::TMPFile* GEOM_Shape_i::GetShapeStream()
{
ostrstream streamShape;
//Write TopoDS_Shape in ASCII format to the stream
BRepTools::Write(_geom, streamShape);
//Returns the number of bytes that have been stored in the stream's buffer.
int size = streamShape.pcount();
char* buf = new char [size];
//Get pointer on internal character array in ostrstream
char* valueOfStream = streamShape.str();
//Create copy of ostrstream content
memcpy(buf, valueOfStream, size);
//Allow automatic deletion of ostrstream content
streamShape.rdbuf()->freeze(0);
CORBA::Octet* OctetBuf = (CORBA::Octet*)buf;
GEOM::GEOM_Shape::TMPFile_var SeqFile = new GEOM::GEOM_Shape::TMPFile(size,size,OctetBuf,1);
return SeqFile._retn();
}
//=======================================================================
//function : Engine
//purpose : return generator engine
//=======================================================================
GEOM::GEOM_Gen_ptr GEOM_Shape_i::Engine()
{
return _engine;
}

View File

@ -1,117 +0,0 @@
// GEOM GEOM : implementaion of GEOM_Gen.idl and GEOM_Shape.idl
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOM_Shape_i.hh
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef __GEOM_SHAPE_I_H__
#define __GEOM_SHAPE_I_H__
// SALOME config header
#include <SALOMEconfig.h>
// Standard C++ headers
#include <iostream.h>
// IDL headers
#include CORBA_SERVER_HEADER(GEOM_Gen)
#include CORBA_SERVER_HEADER(GEOM_Shape)
// Cascade headers
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS.hxx>
//=====================================================================
// GEOM_Shape_i : class definition
//=====================================================================
class GEOM_Shape_i: public POA_GEOM::GEOM_Shape,
public PortableServer::RefCountServantBase {
private:
TopoDS_Shape _geom;
CORBA::ORB_ptr _orb;
GEOM::GEOM_Gen_ptr _engine;
GEOM::shape_type _shapetype ; // enum defined in the IDL file (Occ topol. type of a shape)
bool _ismain;
GEOM::GEOM_Shape::ListOfSubShapeID _index;
char* _name;
char* _mainname;
char* _shapeid;
char* _studyshapeid; // exists only if added in the study document
char* _nametype;
public:
// no-arg constructor, doing nothing (for now ?)
GEOM_Shape_i();
// constructor to be called for servant creation
GEOM_Shape_i(TopoDS_Shape geom,
CORBA::ORB_ptr orb,
GEOM::GEOM_Gen_ptr engine,
const GEOM::GEOM_Shape::ListOfSubShapeID& index,
GEOM::shape_type sht = GEOM::SHAPE,
bool ismain = true);
// destructor deleting the internal geometry structure
~GEOM_Shape_i();
char* Name();
void Name(const char* name);
char* MainName();
void MainName(const char* name);
char* NameType();
void NameType(const char* name);
bool IsMainShape();
void IsMainShape(const bool abool);
char* ShapeId();
void ShapeId(const char* shapeid);
char* StudyShapeId();
void StudyShapeId(const char* studyshapeid);
GEOM::GEOM_Shape::ListOfSubShapeID* Index();
void Index(const GEOM::GEOM_Shape::ListOfSubShapeID&);
GEOM::shape_type ShapeType();
void ShapeType(GEOM::shape_type sht);
GEOM::GEOM_Shape::TMPFile* GetShapeStream();
GEOM::GEOM_Gen_ptr Engine();
};
#endif

View File

@ -1,62 +0,0 @@
# GEOM GEOM : implementaion of GEOM_Gen.idl and GEOM_Shape.idl
#
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#
#
#
# File : Makefile.in
# Author : Patrick GOLDBRONN (CEA)
# Module : GEOM
# $Header$
top_srcdir=@top_srcdir@
top_builddir=../../..
srcdir=@srcdir@
VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@
# Libraries targets
LIB = libGeometryEngine.la
LIB_SRC = GEOM_Shape_i.cc GEOM_Gen_i.cc
LIB_SERVER_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl GEOM_Gen.idl GEOM_Shape.idl
# Executables targets
BIN =
BIN_SRC =
BIN_CLIENT_IDL =
BIN_SERVER_IDL =
EXPORT_HEADERS =
# additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES)
CXXFLAGS += $(OCC_CXXFLAGS)
LDFLAGS += $(OCC_LIBS) -lGeometryDS -lTOOLSDS -lSalomeNS -lSalomeContainer -lGeometryPartition -lGeometryArchimede
# additional file to be cleaned
MOSTLYCLEAN =
CLEAN =
DISTCLEAN =
@CONCLUDE@

View File

@ -1,82 +0,0 @@
// GEOM GEOM : implementaion of GEOM_Gen.idl and GEOM_Shape.idl
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : geom.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GEOM_Gen_i.hh"
#include "SALOME_NamingService.hxx"
//==================================================================================
// function : main() MAIN
// purpose :
//==================================================================================
int main(int argc, char** argv)
{
try {
// Create and initialise the ORB.
// CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4");
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
// Obtain a reference to the root POA.
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
// We allocate the objects on the heap. Since these are reference
// counted objects, they will be deleted by the POA when they are no
// longer needed.
GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb);
// Activate the objects. This tells the POA that the objects are
// ready to accept requests.
PortableServer::ObjectId_var myGEOM_Gen_iid = poa->activate_object(myGEOM_Gen_i);
myGEOM_Gen_i->register_name("/myGEOM_Gen");
// Obtain a POAManager, and tell the POA to start accepting
// requests on its objects.
PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();
orb->run();
orb->destroy();
}
catch(CORBA::SystemException&) {
cerr << "Caught CORBA::SystemException." << endl;
}
catch(CORBA::Exception&) {
cerr << "Caught CORBA::Exception." << endl;
}
catch(omniORB::fatalException& fe) {
cerr << "Caught omniORB::fatalException:" << endl;
cerr << " file: " << fe.file() << endl;
cerr << " line: " << fe.line() << endl;
cerr << " msg: " << fe.errmsg() << endl;
}
catch(...) {
cerr << "Caught unknown exception." << endl;
}
return 0;
}