// File : StdMeshers_ProjectionSource1D_i.cxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#include "StdMeshers_ProjectionSource1D_i.hxx"
ASSERT( myBaseImpl );
try {
this->GetImpl()->SetSourceEdge( StdMeshers_ObjRefUlils::GeomObjectToShape( edge ));
+ CORBA::String_var entry = edge->GetStudyEntry();
+ myShapeEntries[ SRC_EDGE ] = entry.in();
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
TopoDS_Shape v1 = StdMeshers_ObjRefUlils::GeomObjectToShape( sourceVertex );
TopoDS_Shape v2 = StdMeshers_ObjRefUlils::GeomObjectToShape( targetVertex );
this->GetImpl()->SetVertexAssociation( v1, v2 );
+
+ CORBA::String_var entry;
+ entry = sourceVertex->GetStudyEntry();
+ myShapeEntries[ SRC_VERTEX ] = entry.in();
+ entry = targetVertex->GetStudyEntry();
+ myShapeEntries[ TGT_VERTEX ] = entry.in();
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource1D_i::GetSourceEdge()
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetSourceEdge() );
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ SRC_EDGE ],
+ this->GetImpl()->GetSourceEdge() );
}
//=============================================================================
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource1D_i::GetSourceVertex()
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetSourceVertex() );
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ SRC_VERTEX ],
+ this->GetImpl()->GetSourceVertex() );
}
//=============================================================================
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource1D_i::GetTargetVertex()
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetTargetVertex() );
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ TGT_VERTEX ],
+ this->GetImpl()->GetTargetVertex() );
}
//=============================================================================
ASSERT( myBaseImpl );
std::ostringstream os;
- TopoDS_Shape s1, s2, s3;
- GetImpl()->GetStoreParams( s1, s2, s3 );
-
- StdMeshers_ObjRefUlils::SaveToStream( s1, os );
- StdMeshers_ObjRefUlils::SaveToStream( s2, os );
- StdMeshers_ObjRefUlils::SaveToStream( s3, os );
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ StdMeshers_ObjRefUlils::SaveToStream( myShapeEntries[ i ], os );
StdMeshers_ObjRefUlils::SaveToStream( GetSourceMesh(), os );
myBaseImpl->SaveTo( os );
ASSERT( myBaseImpl );
std::istringstream is( theStream );
- TopoDS_Shape s1 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s2 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s3 = StdMeshers_ObjRefUlils::LoadFromStream( is );
+ TopoDS_Shape shapes[ NB_SHAPES ];
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ shapes[ i ] = StdMeshers_ObjRefUlils::LoadFromStream( is );
SMESH::SMESH_Mesh_var mesh =
StdMeshers_ObjRefUlils::LoadObjectFromStream< SMESH::SMESH_Mesh >( is );
}
myCorbaMesh = SMESH::SMESH_Mesh::_duplicate( mesh );
- GetImpl()->RestoreParams( s1, s2, s3, meshImpl );
+ GetImpl()->SetSourceMesh ( meshImpl );
+ GetImpl()->SetSourceEdge ( shapes[ SRC_EDGE ] );
+ GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX ],
+ shapes[ TGT_VERTEX ]);
myBaseImpl->LoadFrom( is );
+
+ std::istringstream str( theStream );
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ str >> myShapeEntries[ i ];
}
virtual void LoadFrom( const char* theStream );
private:
+ // keep entries because the same shape can be published several times with
+ // different names and in this case a correct name can't be restored by a TopoDS_Shape
+ // kept by ::StdMeshers_ProjectionSource1D
+ enum { SRC_EDGE=0, SRC_VERTEX, TGT_VERTEX, NB_SHAPES };
+ std::string myShapeEntries[NB_SHAPES];
SMESH::SMESH_Mesh_var myCorbaMesh;
};
// File : StdMeshers_ProjectionSource2D_i.cxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#include "StdMeshers_ProjectionSource2D_i.hxx"
ASSERT( myBaseImpl );
try {
this->GetImpl()->SetSourceFace( StdMeshers_ObjRefUlils::GeomObjectToShape( face ));
+ CORBA::String_var entry = face->GetStudyEntry();
+ myShapeEntries[ SRC_FACE ] = entry.in();
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
TopoDS_Shape v3 = StdMeshers_ObjRefUlils::GeomObjectToShape( targetVertex1 );
TopoDS_Shape v4 = StdMeshers_ObjRefUlils::GeomObjectToShape( targetVertex2 );
this->GetImpl()->SetVertexAssociation( v1, v2, v3, v4 );
+
+ CORBA::String_var entry;
+ entry = sourceVertex1->GetStudyEntry();
+ myShapeEntries[ SRC_VERTEX1 ] = entry.in();
+ entry = sourceVertex2->GetStudyEntry();
+ myShapeEntries[ SRC_VERTEX2 ] = entry.in();
+ entry = targetVertex1->GetStudyEntry();
+ myShapeEntries[ TGT_VERTEX1 ] = entry.in();
+ entry = targetVertex2->GetStudyEntry();
+ myShapeEntries[ TGT_VERTEX2 ] = entry.in();
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource2D_i::GetSourceFace()
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetSourceFace() );
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ SRC_FACE ],
+ this->GetImpl()->GetSourceFace() );
}
//=============================================================================
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource2D_i::GetSourceVertex(CORBA::Long i)
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetSourceVertex((int) i ));
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ i == 1 ? SRC_VERTEX1 : SRC_VERTEX2 ],
+ this->GetImpl()->GetSourceVertex((int) i ));
}
//=============================================================================
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource2D_i::GetTargetVertex(CORBA::Long i)
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetTargetVertex( (int)i ));
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ i == 1 ? TGT_VERTEX1 : TGT_VERTEX2 ],
+ this->GetImpl()->GetTargetVertex( (int)i ));
}
//=============================================================================
ASSERT( myBaseImpl );
std::ostringstream os;
- TopoDS_Shape s1, s2, s3, s4, s5;
- GetImpl()->GetStoreParams( s1, s2, s3, s4, s5 );
-
- StdMeshers_ObjRefUlils::SaveToStream( s1, os );
- StdMeshers_ObjRefUlils::SaveToStream( s2, os );
- StdMeshers_ObjRefUlils::SaveToStream( s3, os );
- StdMeshers_ObjRefUlils::SaveToStream( s4, os );
- StdMeshers_ObjRefUlils::SaveToStream( s5, os );
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ StdMeshers_ObjRefUlils::SaveToStream( myShapeEntries[ i ], os );
StdMeshers_ObjRefUlils::SaveToStream( GetSourceMesh(), os );
myBaseImpl->SaveTo( os );
ASSERT( myBaseImpl );
std::istringstream is( theStream );
- TopoDS_Shape s1 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s2 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s3 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s4 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s5 = StdMeshers_ObjRefUlils::LoadFromStream( is );
+ TopoDS_Shape shapes[ NB_SHAPES ];
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ shapes[ i ] = StdMeshers_ObjRefUlils::LoadFromStream( is );
SMESH::SMESH_Mesh_var mesh =
StdMeshers_ObjRefUlils::LoadObjectFromStream< SMESH::SMESH_Mesh >( is );
}
myCorbaMesh = SMESH::SMESH_Mesh::_duplicate( mesh );
- GetImpl()->RestoreParams( s1, s2, s3, s4, s5, meshImpl );
+ GetImpl()->SetSourceMesh ( meshImpl );
+ GetImpl()->SetSourceFace ( shapes[ SRC_FACE ] );
+ GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX1 ],
+ shapes[ SRC_VERTEX2 ],
+ shapes[ TGT_VERTEX1 ],
+ shapes[ TGT_VERTEX2 ]);
myBaseImpl->LoadFrom( is );
+
+ std::istringstream str( theStream );
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ str >> myShapeEntries[ i ];
}
// File : StdMeshers_ProjectionSource2D_i.hxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_ProjectionSource2D_I_HXX_
#define _SMESH_ProjectionSource2D_I_HXX_
/*!
* Returns the <i>-th source vertex associated with the <i>-th target vertex.
* Result may be nil if association not set.
+ * Valid indices are 1 and 2
*/
GEOM::GEOM_Object_ptr GetSourceVertex(CORBA::Long i);
virtual void LoadFrom( const char* theStream );
private:
+ // keep entries because the same shape can be published several times with
+ // different names and in this case a correct name can't be restored by a TopoDS_Shape
+ // kept by ::StdMeshers_ProjectionSource2D
+ enum { SRC_FACE=0, SRC_VERTEX1, SRC_VERTEX2, TGT_VERTEX1, TGT_VERTEX2, NB_SHAPES };
+ std::string myShapeEntries[NB_SHAPES];
SMESH::SMESH_Mesh_var myCorbaMesh;
};
#endif
-
// File : StdMeshers_ProjectionSource3D_i.cxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#include "StdMeshers_ProjectionSource3D_i.hxx"
ASSERT( myBaseImpl );
try {
this->GetImpl()->SetSource3DShape( StdMeshers_ObjRefUlils::GeomObjectToShape( shape ));
+
+ CORBA::String_var entry = shape->GetStudyEntry();
+ myShapeEntries[ SRC_SHAPE3D ] = entry.in();
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
TopoDS_Shape v3 = StdMeshers_ObjRefUlils::GeomObjectToShape( targetVertex1 );
TopoDS_Shape v4 = StdMeshers_ObjRefUlils::GeomObjectToShape( targetVertex2 );
this->GetImpl()->SetVertexAssociation( v1, v2, v3, v4 );
+
+ CORBA::String_var entry;
+ entry = sourceVertex1->GetStudyEntry();
+ myShapeEntries[ SRC_VERTEX1 ] = entry.in();
+ entry = sourceVertex2->GetStudyEntry();
+ myShapeEntries[ SRC_VERTEX2 ] = entry.in();
+ entry = targetVertex1->GetStudyEntry();
+ myShapeEntries[ TGT_VERTEX1 ] = entry.in();
+ entry = targetVertex2->GetStudyEntry();
+ myShapeEntries[ TGT_VERTEX2 ] = entry.in();
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource3D_i::GetSource3DShape()
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetSource3DShape() );
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ SRC_SHAPE3D ],
+ this->GetImpl()->GetSource3DShape() );
}
//=============================================================================
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource3D_i::GetSourceVertex(CORBA::Long i)
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetSourceVertex((int) i ));
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ i == 1 ? SRC_VERTEX1 : SRC_VERTEX2 ],
+ this->GetImpl()->GetSourceVertex((int) i ));
}
//=============================================================================
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource3D_i::GetTargetVertex(CORBA::Long i)
{
ASSERT( myBaseImpl );
- return StdMeshers_ObjRefUlils::ShapeToGeomObject( this->GetImpl()->GetTargetVertex( (int)i ));
+ return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
+ ( myShapeEntries[ i == 1 ? TGT_VERTEX1 : TGT_VERTEX2 ],
+ this->GetImpl()->GetTargetVertex( (int)i ));
}
//=============================================================================
ASSERT( myBaseImpl );
std::ostringstream os;
- TopoDS_Shape s1, s2, s3, s4, s5;
- GetImpl()->GetStoreParams( s1, s2, s3, s4, s5 );
-
- StdMeshers_ObjRefUlils::SaveToStream( s1, os );
- StdMeshers_ObjRefUlils::SaveToStream( s2, os );
- StdMeshers_ObjRefUlils::SaveToStream( s3, os );
- StdMeshers_ObjRefUlils::SaveToStream( s4, os );
- StdMeshers_ObjRefUlils::SaveToStream( s5, os );
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ StdMeshers_ObjRefUlils::SaveToStream( myShapeEntries[ i ], os );
StdMeshers_ObjRefUlils::SaveToStream( GetSourceMesh(), os );
myBaseImpl->SaveTo( os );
ASSERT( myBaseImpl );
std::istringstream is( theStream );
- TopoDS_Shape s1 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s2 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s3 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s4 = StdMeshers_ObjRefUlils::LoadFromStream( is );
- TopoDS_Shape s5 = StdMeshers_ObjRefUlils::LoadFromStream( is );
+ TopoDS_Shape shapes[ NB_SHAPES ];
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ shapes[ i ] = StdMeshers_ObjRefUlils::LoadFromStream( is );
SMESH::SMESH_Mesh_var mesh =
StdMeshers_ObjRefUlils::LoadObjectFromStream< SMESH::SMESH_Mesh >( is );
}
myCorbaMesh = SMESH::SMESH_Mesh::_duplicate( mesh );
- GetImpl()->RestoreParams( s1, s2, s3, s4, s5, meshImpl );
+
+ GetImpl()->SetSourceMesh ( meshImpl );
+ GetImpl()->SetSource3DShape ( shapes[ SRC_SHAPE3D ] );
+ GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX1 ],
+ shapes[ SRC_VERTEX2 ],
+ shapes[ TGT_VERTEX1 ],
+ shapes[ TGT_VERTEX2 ]);
+
myBaseImpl->LoadFrom( is );
+
+ std::istringstream str( theStream );
+ for ( int i = 0; i < NB_SHAPES; ++i )
+ str >> myShapeEntries[ i ];
}
/*!
* Returns the <i>-th source vertex associated with the <i>-th target vertex.
* Result may be nil if association not set.
+ * Valid indices are 1 and 2
*/
GEOM::GEOM_Object_ptr GetSourceVertex(CORBA::Long i);
virtual void LoadFrom( const char* theStream );
private:
+ // keep entries because the same shape can be published several times with
+ // different names and in this case a correct name can't be restored by a TopoDS_Shape
+ // kept by ::StdMeshers_ProjectionSource3D
+ enum { SRC_SHAPE3D=0, SRC_VERTEX1, SRC_VERTEX2, TGT_VERTEX1, TGT_VERTEX2, NB_SHAPES };
+ std::string myShapeEntries[NB_SHAPES];
SMESH::SMESH_Mesh_var myCorbaMesh;
};