+// Copyright (C) 2014-2015 EDF-R&D
+// 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, or (at your option) any later version.
+//
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include "HYDROData_Obstacle.h"
#include "HYDROData_ShapesGroup.h"
#include "HYDROData_ShapesTool.h"
#include "HYDROData_Tool.h"
+#include "HYDROData_GeomTool.h"
#include <Basics_Utils.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
-#include <GEOMBase.h>
-
#include <IGESControl_Reader.hxx>
#include <IGESData_IGESModel.hxx>
#include <HYDROData_Projection.h>
-#include <SALOMEDSClient.hxx>
-#include <SALOME_NamingService.hxx>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
IMPLEMENT_STANDARD_HANDLE(HYDROData_Obstacle,HYDROData_ArtificialObject)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Obstacle,HYDROData_ArtificialObject)
HYDROData_Obstacle::HYDROData_Obstacle()
-: HYDROData_ArtificialObject()
+: HYDROData_ArtificialObject( Geom_3d )
{
}
bool HYDROData_Obstacle::ImportFromGeomIOR( const TCollection_AsciiString& theIOR )
{
- if ( theIOR.IsEmpty() )
- return false;
+ bool aRes = false;
- TopoDS_Shape aShape = GEOMBase::GetShapeFromIOR( theIOR.ToCString() );
- if ( aShape.IsNull() )
- return false;
+ if ( theIOR.IsEmpty() ) {
+ return aRes;
+ }
+
+ int aDocId = -1;
+ if ( !HYDROData_Document::DocumentId( HYDROData_Document::Document( myLab ), aDocId ) || aDocId < 0 ) {
+ return aRes;
+ }
+
+ // TopoDS_Shape aShape = GEOMBase::GetShapeFromIOR( theIOR.ToCString() );
+ TopoDS_Shape aShape = HYDROData_GeomTool::GetShapeFromIOR( aDocId, theIOR.ToCString() );
- SetShape3D( aShape );
+ if ( !aShape.IsNull() ) {
+ SetShape3D( aShape );
+ aRes = true;
+ }
- return true;
+ return aRes;
}
void HYDROData_Obstacle::SetGeomObjectEntry( const TCollection_AsciiString& theEntry )
return aRes;
}
- int argc = 0;
- char** argv = 0;
- CORBA::ORB_var anORB = CORBA::ORB_init( argc, argv, "omniORB4"/*CORBA::ORB_ID*/ );
- SALOME_NamingService aNameService( anORB );
-
- CORBA::Object_var aSMObject = aNameService.Resolve("/myStudyManager");
- SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
- SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID( aDocId );
-
- TCollection_AsciiString anEntry = GetGeomObjectEntry();
- SALOMEDS::SObject_var aSObject = aDSStudy->FindObjectID( anEntry.ToCString() );
- if ( !aSObject->_is_nil() ) {
- aRes = TCollection_AsciiString( aSObject->GetName() );
+ SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( aDocId );
+
+ if ( !aDSStudy->_is_nil() ) {
+ TCollection_AsciiString anEntry = GetGeomObjectEntry();
+ SALOMEDS::SObject_var aSObject = aDSStudy->FindObjectID( anEntry.ToCString() );
+ if ( !aSObject->_is_nil() ) {
+ aRes = TCollection_AsciiString( aSObject->GetName() );
+ }
}
return aRes;
ObjectKind HYDROData_Obstacle::getAltitudeObjectType() const
{
+ DEBTRACE("HYDROData_Obstacle::getAltitudeObjectType");
return KIND_OBSTACLE_ALTITUDE;
}