add XAO import and modify export

This commit is contained in:
fps 2013-04-25 14:49:48 +00:00
parent e2e1c99ebc
commit 243d3de586
34 changed files with 1411 additions and 814 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -1,29 +0,0 @@
/*!
\page create_exportxao_page ExportXAO
To create a \b ExportXAO in the <b>Main Menu</b> select <b>New Entity - >
ImportExport - > ExportXAO </b>
Specify the parameters of the ExportXAO object creation in the opened dialog
box and press "Apply" or "Apply & Close" button.
Result of each operation will be a GEOM_Object.
<b>TUI Command:</b> <em>geompy.MakeExportXAO(ExportingShape, FileName, lGroups, lFields)</em>
<b>Arguments:</b>
- \b ExportingShape - Shape to export
- \b FileName - The name of the exported file
- \b lGroups - List of groups to export
- \b lFields - List of fields to export
\image html exportxao_dlg.png
Example:
\image html exportxao.png
Our <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_exportxao "ImportExport objects".
*/

View File

@ -0,0 +1,21 @@
/*!
\page export_xao_page Export XAO
To export a shape in the \b XAO format, in the <b>Main Menu</b> select <b>New Entity ->
Import / Export -> Export XAO </b>
Specify the parameters of the Export XAO dialog box and press "Apply" or "Apply & Close" button.
<b>TUI Command:</b> <em>geompy.MakeExportXAO(Shape, FileName, Groups, Fields)</em>
<b>Arguments:</b>
- \b Shape - The shape to export
- \b FileName - The name of the file to create
- \b Groups - The list of groups to export
- \b Fields - The list of fields to export
\image html exportxao_dlg.png
*/

View File

@ -0,0 +1,8 @@
/*!
\page import_xao_page Import XAO
To import a shape in the \b XAO format, in the <b>Main Menu</b> select <b>New Entity ->
Import / Export -> Import XAO </b>
*/

View File

@ -4,19 +4,20 @@
\image html geomscreen.png
\b Geometry module of SALOME is destined for:
\b Geometry module of SALOME is destined for:
- \subpage import_export_geom_obj_page "import and export of geometrical models"
in IGES, BREP and STEP formats;
- \subpage create_geom_obj_page "construction of geometrical objects"
using a wide range of functions;
using a wide range of functions;
- \subpage view_geom_obj_page "viewing geometrical objects" in the OCC
viewer;
viewer;
- \subpage transform_geom_obj_page "transformation of geometrical objects"
using various algorithms;
- \subpage repairing_operations_page "optimization of geometrical objects";
- viewing \subpage geometrical_obj_prop_page "geometrical object properties"
and other information about geometrical objects using
and other information about geometrical objects using
\subpage using_measurement_tools_page "measurement tools";
- \subpage xao_format_page "The XAO format"
- \subpage pictures_page "designing shapes from pictures";
- easily setting parameters via the variables predefined in
\subpage using_notebook_geom_page "SALOME notebook".

View File

@ -0,0 +1,10 @@
/*!
\page xao_format_page The XAO format
XAO is a file format which describes a shape with its topology, groups and fields.
- \subpage export_xao_page "Export"
- \subpage import_xao_page "Import"
*/

View File

@ -4012,26 +4012,30 @@ module GEOM
interface GEOM_IImportExportOperations : GEOM_IOperations
{
/*!
* Export a shape to XAO Format
* Export a shape to XAO format
* \param shape The shape to export
* \param groups The list of groups to export
* \param fields The list of fields to export
* \param xao The exported XAO
* \param author The author of the export
* \param fileName The name of the file to export
* \return boolean indicating if export was succeful.
*/
boolean ExportXAO(in GEOM_Object shape, in ListOfGO groups, in ListOfGO fields, out string xao);
boolean ExportXAO(in GEOM_Object shape,
in ListOfGO groups, in ListOfGO fields,
in string author, in string fileName);
/*!
* Import a shape from XAO Format
* \param xao The XAO data to import
* Import a shape from XAO format
* \param xao The name of the file to import
* \param shape The imported shape
* \param groups The list of imported groups
* \param fields The list of imported fields
* \return boolean indicating if import was succeful.
*/
//boolean ImportXAO(in string xao, out GEOM_Object shape, out ListOfGO groups, out ListOfGO fields);
boolean ImportXAO(in string fileName,
out GEOM_Object shape, out ListOfGO groups, out ListOfGO fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};

View File

@ -626,10 +626,11 @@ module GEOM
//-----------------------------------------------------------//
// ImportExportOperations //
//-----------------------------------------------------------//
boolean ExportXAO(in GEOM_Object exportingShape,
in GEOM_List groups, in GEOM_List fields, out string xao);
// boolean ImportXAO(in string fileName, out GEOM_Object exportingShape,
// out GEOM_List groups, out GEOM_List fields);
boolean ExportXAO(in GEOM_Object shape,
in GEOM_List groups, in GEOM_List fields,
in string author, in string fileName);
boolean ImportXAO(in string fileName, out GEOM_Object shape,
out GEOM_List groups, out GEOM_List fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};

View File

@ -75,7 +75,7 @@
<component-comment>Geometry component</component-comment>
<component-multistudy>1</component-multistudy>
<component-icone>ModuleGeom.png</component-icone>
<component-impltype>1</component-impltype>
<component-impltype>1</component-impltype>
<!-- component interface list -->
<component-interface-list>
@ -620,44 +620,44 @@
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>GetDumpName</service-name>
<service-author></service-author>
<service-version></service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<inParameter>
<inParameter-name>theStudyEntry</inParameter-name>
<inParameter-type>string</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
</inParameter-list>
<outParameter-list>
<outParameter>
<outParameter-name>return</outParameter-name>
<outParameter-type>string</outParameter-type>
<outParameter-comment>unknown</outParameter-comment>
</outParameter>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>GetAllDumpNames</service-name>
<service-author></service-author>
<service-version></service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list></inParameter-list>
<outParameter-list>
<outParameter>
<outParameter-name>return</outParameter-name>
<outParameter-type>string_array</outParameter-type>
<outParameter-comment>unknown</outParameter-comment>
</outParameter>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>GetDumpName</service-name>
<service-author></service-author>
<service-version></service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<inParameter>
<inParameter-name>theStudyEntry</inParameter-name>
<inParameter-type>string</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
</inParameter-list>
<outParameter-list>
<outParameter>
<outParameter-name>return</outParameter-name>
<outParameter-type>string</outParameter-type>
<outParameter-comment>unknown</outParameter-comment>
</outParameter>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>GetAllDumpNames</service-name>
<service-author></service-author>
<service-version></service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list></inParameter-list>
<outParameter-list>
<outParameter>
<outParameter-name>return</outParameter-name>
<outParameter-type>string_array</outParameter-type>
<outParameter-comment>unknown</outParameter-comment>
</outParameter>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
</component-service-list>
</component-interface-list>
<constraint>hostname = localhost</constraint>

View File

@ -5785,7 +5785,7 @@ Do you want to create new material?</translation>
</message>
<message>
<source>GEOM_EXPORTXAO</source>
<translation>ExportXAO</translation>
<translation>Export XAO</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_EXPORTINGSHAPE</source>
@ -5795,13 +5795,44 @@ Do you want to create new material?</translation>
<source>GEOM_EXPORTXAO_FILENAME</source>
<translation>File Name</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_AUTHOR</source>
<translation>Author</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_LGROUPS</source>
<translation>List of groups</translation>
<translation>Groups</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_LFIELDS</source>
<translation>List of fields</translation>
<translation>Fields</translation>
</message>
</context>
<context>
<name>ImportExportGUI_ImportXAODlg</name>
<message>
<source>GEOM_IMPORTXAO_TITLE</source>
<translation>Import XAO</translation>
</message>
<message>
<source>GEOM_IMPORTXAO</source>
<translation>Import XAO</translation>
</message>
<message>
<source>GEOM_IMPORTXAO_IMPORTINGSHAPE</source>
<translation>Shape</translation>
</message>
<message>
<source>GEOM_IMPORTXAO_FILENAME</source>
<translation>File Name</translation>
</message>
<message>
<source>GEOM_IMPORTXAO_LGROUPS</source>
<translation>Groups</translation>
</message>
<message>
<source>GEOM_IMPORTXAO_LFIELDS</source>
<translation>Fields</translation>
</message>
</context>
</TS>

View File

@ -5775,4 +5775,62 @@ Voulez-vous en créer un nouveau ?</translation>
<translation>P&amp;ublier et fermer</translation>
</message>
</context>
<context>
<name>ImportExportGUI_ExportXAODlg</name>
<message>
<source>GEOM_EXPORTXAO_TITLE</source>
<translation>Export XAO</translation>
</message>
<message>
<source>GEOM_EXPORTXAO</source>
<translation>Export XAO</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_EXPORTINGSHAPE</source>
<translation>Objet</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_FILENAME</source>
<translation>Fichier</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_AUTHOR</source>
<translation>Auteur</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_LGROUPS</source>
<translation>Groupes</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_LFIELDS</source>
<translation>Champs</translation>
</message>
</context>
<context>
<name>ImportExportGUI_ImportXAODlg</name>
<message>
<source>GEOM_IMPORTXAO_TITLE</source>
<translation>Import XAO</translation>
</message>
<message>
<source>GEOM_IMPORTXAO</source>
<translation>Import XAO</translation>
</message>
<message>
<source>GEOM_IMPORTXAO_IMPORTINGSHAPE</source>
<translation>Objet</translation>
</message>
<message>
<source>GEOM_IMPORTXAO_FILENAME</source>
<translation>Fichier</translation>
</message>
<message>
<source>GEOM_IMPORTXAO_LGROUPS</source>
<translation>Groupes</translation>
</message>
<message>
<source>GEOM_IMPORTXAO_LFIELDS</source>
<translation>Champs</translation>
</message>
</context>
</TS>

View File

@ -1,120 +0,0 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <Standard_Stream.hxx>
#include <GEOMImpl_ExportXAODriver.hxx>
#include <GEOMImpl_IExportXAO.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
#include <TFunction_Logbook.hxx>
#include <StdFail_NotDone.hxx>
//@@ include required header files here @@//
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& GEOMImpl_ExportXAODriver::GetID()
{
static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
return aGUID;
}
//=======================================================================
//function : GEOMImpl_ExportXAODriver
//purpose :
//=======================================================================
GEOMImpl_ExportXAODriver::GEOMImpl_ExportXAODriver()
{
}
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_ExportXAODriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IExportXAO aData (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if (aType == EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS) {
//@@ add implementation of the operation driver here to initialize aShape variable @@//
//aShape = @...@
}
else {
// other construction modes here
}
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
//=======================================================================
//function : GEOMImpl_ExportXAODriver_Type_
//purpose :
//=======================================================================
Standard_EXPORT Handle_Standard_Type& GEOMImpl_ExportXAODriver_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ExportXAODriver",
sizeof(GEOMImpl_ExportXAODriver),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
//=======================================================================
//function : DownCast
//purpose :
//=======================================================================
const Handle(GEOMImpl_ExportXAODriver) Handle(GEOMImpl_ExportXAODriver)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(GEOMImpl_ExportXAODriver) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ExportXAODriver))) {
_anOtherObject = Handle(GEOMImpl_ExportXAODriver)((Handle(GEOMImpl_ExportXAODriver)&)AnObject);
}
}
return _anOtherObject;
}

View File

@ -1,121 +0,0 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef _GEOMImpl_ExportXAODriver_HXX
#define _GEOMImpl_ExportXAODriver_HXX
#include <TFunction_Driver.hxx>
class Handle_Standard_Type;
class GEOMImpl_ExportXAODriver;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ExportXAODriver);
class Handle(GEOMImpl_ExportXAODriver) : public Handle(TFunction_Driver) {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
Handle(GEOMImpl_ExportXAODriver)():Handle(TFunction_Driver)() {}
Handle(GEOMImpl_ExportXAODriver)(const Handle(GEOMImpl_ExportXAODriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
{}
Handle(GEOMImpl_ExportXAODriver)(const GEOMImpl_ExportXAODriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
{}
Handle(GEOMImpl_ExportXAODriver)& operator=(const Handle(GEOMImpl_ExportXAODriver)& aHandle)
{
Assign(aHandle.Access());
return *this;
}
Handle(GEOMImpl_ExportXAODriver)& operator=(const GEOMImpl_ExportXAODriver* anItem)
{
Assign((Standard_Transient *)anItem);
return *this;
}
GEOMImpl_ExportXAODriver* operator->()
{
return (GEOMImpl_ExportXAODriver *)ControlAccess();
}
GEOMImpl_ExportXAODriver* operator->() const
{
return (GEOMImpl_ExportXAODriver *)ControlAccess();
}
Standard_EXPORT ~Handle(GEOMImpl_ExportXAODriver)() {};
Standard_EXPORT static const Handle(GEOMImpl_ExportXAODriver) DownCast(const Handle(Standard_Transient)& AnObject);
};
class GEOMImpl_ExportXAODriver : public TFunction_Driver {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMImpl_ExportXAODriver();
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
{
return Standard_True;
}
Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT ~GEOMImpl_ExportXAODriver() {};
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ExportXAODriver_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
{
return STANDARD_TYPE(GEOMImpl_ExportXAODriver);
}
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(GEOMImpl_ExportXAODriver) == AType || TFunction_Driver::IsKind(AType));
}
};
#endif // _GEOMImpl_ExportXAODriver_HXX

View File

@ -85,7 +85,7 @@
#include <GEOMImpl_PipeTShapeDriver.hxx>
#include <GEOMImpl_DividedDiskDriver.hxx>
// #include <GEOMImpl_DividedCylinderDriver.hxx>
#include <GEOMImpl_ExportXAODriver.hxx>
#include <GEOMImpl_XAODriver.hxx>
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
//=============================================================================
@ -174,8 +174,8 @@ GEOMImpl_Gen::GEOMImpl_Gen()
// TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedCylinderDriver::GetID(), new GEOMImpl_DividedCylinderDriver());
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
// ImportExport operations
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ExportXAODriver::GetID(), new GEOMImpl_ExportXAODriver());
// XAO operations
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_XAODriver::GetID(), new GEOMImpl_XAODriver());
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
SetEngine(this);

View File

@ -1,53 +0,0 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef _GEOMImpl_IExportXAO_HXX_
#define _GEOMImpl_IExportXAO_HXX_
#include "GEOM_Function.hxx"
#define EXPORTXAO_ARG_EXPORTINGSHAPE 1
#define EXPORTXAO_ARG_FILENAME 2
#define EXPORTXAO_ARG_LGROUPS 3
#define EXPORTXAO_ARG_LFIELDS 4
class GEOMImpl_IExportXAO
{
public:
GEOMImpl_IExportXAO(Handle(GEOM_Function) theFunction): _func(theFunction) {}
void SetExportingShape(Handle(GEOM_Function) theExportingShape) { _func->SetReference(EXPORTXAO_ARG_EXPORTINGSHAPE, theExportingShape); }
Handle(GEOM_Function) GetExportingShape() { return _func->GetReference(EXPORTXAO_ARG_EXPORTINGSHAPE); }
void SetFileName(const TCollection_AsciiString& theFileName) { _func->SetString(EXPORTXAO_ARG_FILENAME, theFileName); }
const TCollection_AsciiString GetFileName() { return _func->GetString(EXPORTXAO_ARG_FILENAME); }
void SetGroup(int theId, Handle(GEOM_Function) theGroup) { _func->SetReference(EXPORTXAO_ARG_LGROUPS+theId, theGroup); }
Handle(GEOM_Function) GetGroup(int theId) { return _func->GetReference(EXPORTXAO_ARG_LGROUPS+theId); }
void SetField(int theId, Handle(GEOM_Function) theField) { _func->SetReference(EXPORTXAO_ARG_LFIELDS+theId, theField); }
Handle(GEOM_Function) GetField(int theId) { return _func->GetReference(EXPORTXAO_ARG_LFIELDS+theId); }
private:
Handle(GEOM_Function) _func;
};
#endif // _GEOMImpl_IExportXAO_HXX_

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -15,9 +15,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMImpl_IImportExportOperations.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
#include <cmath>
#include <iostream>
@ -52,13 +49,14 @@
#include "Group.hxx"
#include "XaoUtils.hxx"
#include <GEOMImpl_ExportXAODriver.hxx>
#include <GEOMImpl_IExportXAO.hxx>
#include <GEOMImpl_XAODriver.hxx>
#include <GEOMImpl_IImportExportXAO.hxx>
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopAbs.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
@ -80,6 +78,7 @@
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
#include <TDataStd_Integer.hxx>
#include <TDF_Tool.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
@ -108,51 +107,66 @@ GEOMImpl_IImportExportOperations::~GEOMImpl_IImportExportOperations()
delete m_groupOperations;
}
TopAbs_ShapeEnum getGroupDimension(XAO::Group* group)
{
XAO::Dimension dim = group->getDimension();
if (dim == XAO::VERTEX)
return TopAbs_VERTEX;
if (dim == XAO::EDGE)
return TopAbs_EDGE;
if (dim == XAO::FACE)
return TopAbs_FACE;
if (dim == XAO::SOLID)
return TopAbs_SOLID;
return TopAbs_COMPOUND;
}
//=============================================================================
/*!
* Export a shape to XAO Format
* Export a shape to XAO format
* \param shape The shape to export
* \param groups The list of groups to export
* \param fields The list of fields to export
* \param xao The exported XAO.
* \param fileName The name of the file to exported
* \return boolean indicating if export was succeful.
*/
//=============================================================================
bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape,
std::list<Handle(GEOM_Object)> groupList,
std::list<Handle(GEOM_Object)> fieldList,
char*& xao)
const char* author,
const char* fileName)
{
SetErrorCode(KO);
if (shape.IsNull()) return false;
// add a new shape function with parameters
Handle(GEOM_Function) lastFunction = shape->GetLastFunction();
if (lastFunction.IsNull())
return false;
if (lastFunction.IsNull()) return false;
// add a new result object
Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT);
// add an Export function
Handle(GEOM_Function) exportFunction = result->AddFunction(GEOMImpl_ExportXAODriver::GetID(),
EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS);
if (exportFunction.IsNull())
return false;
// check if the function is set correctly
if (exportFunction->GetDriverGUID() != GEOMImpl_ExportXAODriver::GetID())
return false;
Handle(GEOM_Function) exportFunction = result->AddFunction(GEOMImpl_XAODriver::GetID(), IMPORTEXPORT_EXPORTXAO);
if (exportFunction.IsNull()) return false;
if (exportFunction->GetDriverGUID() != GEOMImpl_XAODriver::GetID()) return false;
// Build the XAO
XAO::Xao* xaoObject = new XAO::Xao();
xaoObject->setAuthor(author);
XAO::Geometry* geometry = new XAO::Geometry();
TopoDS_Shape topoShape = shape->GetValue();
exportFunction->SetValue(topoShape);
geometry->setShape(topoShape);
geometry->setName(shape->GetName());
Handle(TColStd_HSequenceOfTransient) subObjects = m_shapesOperations->GetExistingSubObjects(shape, false);
int nbSubObjects = subObjects->Length();
// set the names of the sub shapes
int tmpIndex;
for (int i = 1; i <= nbSubObjects; i++)
{
@ -192,20 +206,20 @@ bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape,
}
xaoObject->setGeometry(geometry);
// adding groups
std::list<Handle(GEOM_Object)>::iterator itG1 = groupList.begin();
while (itG1 != groupList.end())
// add the groups
std::list<Handle(GEOM_Object)>::iterator groupIterator = groupList.begin();
while (groupIterator != groupList.end())
{
Handle(GEOM_Object) itGroup = (*itG1++);
Handle(TColStd_HArray1OfInteger) groupIds = m_groupOperations->GetObjects(itGroup);
TopAbs_ShapeEnum shapeGroup = m_groupOperations->GetType(itGroup);
Handle(GEOM_Object) currGroup = (*groupIterator++);
Handle(TColStd_HArray1OfInteger) groupIds = m_groupOperations->GetObjects(currGroup);
XAO::Group* group = new XAO::Group();
group->setName(itGroup->GetName());
group->setName(currGroup->GetName());
TopAbs_ShapeEnum shapeGroup = m_groupOperations->GetType(currGroup);
switch (shapeGroup)
{
case TopAbs_VERTEX:
group->setDimension(0);
group->setDimension(XAO::VERTEX);
for (int i = 1; i <= groupIds->Length(); i++)
{
const char* ref = XAO::XaoUtils::intToString(groupIds->Value(i));
@ -214,7 +228,7 @@ bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape,
}
break;
case TopAbs_EDGE:
group->setDimension(1);
group->setDimension(XAO::EDGE);
for (int i = 1; i <= groupIds->Length(); i++)
{
const char* ref = XAO::XaoUtils::intToString(groupIds->Value(i));
@ -223,16 +237,16 @@ bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape,
}
break;
case TopAbs_FACE:
group->setDimension(2);
group->setDimension(XAO::FACE);
for (int i = 1; i <= groupIds->Length(); i++)
{
const char* ref = XAO::XaoUtils::intToString((int)(groupIds->Value(i)));
const char* ref = XAO::XaoUtils::intToString(groupIds->Value(i));
const int index = geometry->getFaceIndexByReference(ref);
group->addElement(index);
}
break;
case TopAbs_SOLID:
group->setDimension(3);
group->setDimension(XAO::SOLID);
for (int i = 1; i <= groupIds->Length(); i++)
{
const char* ref = XAO::XaoUtils::intToString(groupIds->Value(i));
@ -245,32 +259,40 @@ bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape,
xaoObject->addGroup(group);
}
const char* data = xaoObject->getXML();
xao = new char[strlen(data)];
strcpy(xao, data);
delete data;
// TODO: add the fields
// export the XAO to the file
xaoObject->exportXAO(fileName);
delete xaoObject;
// make a Python command
GEOM::TPythonDump pd(exportFunction);
pd << "exported = geompy.ExportXAO(";
pd << shape << "shpae, [], [], xao";
pd << ")";
pd << shape;
pd << ", [";
// std::list<Handle(GEOM_Object)>::iterator itG = groupList.begin();
// pd << (*itG++);
// while (itG != groupList.end())
// {
// pd << ", " << (*itG++);
// }
// pd << "], [";
// std::list<Handle(GEOM_Object)>::iterator itF = fieldList.begin();
// pd << (*itF++);
// while (itF != fieldList.end())
// {
// pd << ", " << (*itF++);
// }
// pd << "])";
if (groupList.size() > 0)
{
std::list<Handle(GEOM_Object)>::iterator itG = groupList.begin();
pd << (*itG++);
while (itG != groupList.end())
{
pd << ", " << (*itG++);
}
}
pd << "], [";
if (fieldList.size() > 0)
{
std::list<Handle(GEOM_Object)>::iterator itF = fieldList.begin();
pd << (*itF++);
while (itF != fieldList.end())
{
pd << ", " << (*itF++);
}
}
pd << "], ";
pd << author << ", \"" << fileName << "\")";
SetErrorCode(OK);
@ -279,22 +301,98 @@ bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape,
//=============================================================================
/*!
* Import a shape from XAO Format
* \param fileName The name of the imported file
* Import a shape from XAO format
* \param fileName The name of the file to import
* \param shape The imported shape
* \param groups The list of imported groups
* \param fields The list of imported fields
* \return boolean indicating if import was succeful.
*/
//=============================================================================
//bool GEOMImpl_IImportExportOperations::ImportXAO(const std::string fileName,
// Handle(GEOM_Object) shape,
// std::list<Handle(GEOM_Object)> groupList,
// std::list<Handle(GEOM_Object)> fieldList)
//{
// SetErrorCode(KO);
// return true;
//}
bool GEOMImpl_IImportExportOperations::ImportXAO(const char* fileName,
Handle(GEOM_Object)& shape,
Handle(TColStd_HSequenceOfTransient)& groupList,
Handle(TColStd_HSequenceOfTransient)& fieldList)
{
SetErrorCode(KO);
if (fileName == NULL || groupList.IsNull() || fieldList.IsNull())
return false;
// Read the XAO
XAO::Xao* xaoObject = new XAO::Xao();
xaoObject->importXAO(fileName);
XAO::Geometry* xaoGeometry = xaoObject->getGeometry();
if (xaoGeometry == NULL)
return false;
// create the shape
shape = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT);
Handle(GEOM_Function) function = shape->AddFunction(GEOMImpl_XAODriver::GetID(), IMPORTEXPORT_EXPORTXAO);
if (function.IsNull()) return false;
if (function->GetDriverGUID() != GEOMImpl_XAODriver::GetID()) return false;
// set the geometry
TopoDS_Shape geomShape = xaoGeometry->getShape();
function->SetValue(geomShape);
shape->SetName(xaoGeometry->getName());
// TODO: create sub shapes with names
// create groups
int nbGroups = xaoObject->countGroups();
for (int i = 0; i < nbGroups; ++i)
{
XAO::Group* xaoGroup = xaoObject->getGroup(i);
// build an array with the indexes of the sub shapes
int nbElt = xaoGroup->getCount();
Handle(TColStd_HArray1OfInteger) array = new TColStd_HArray1OfInteger(1, nbElt);
for (int j = 0; j < nbElt; j++)
{
int index = xaoGroup->getElement(j);
const char* ref = xaoGeometry->getElementReference(xaoGroup->getDimension(), index);
array->SetValue(j + 1, atoi(ref));
}
// create the group with the array of sub shapes indexes
Handle(GEOM_Object) group = GetEngine()->AddSubShape(shape, array);
group->SetType(GEOM_GROUP);
group->SetName(xaoGroup->getName());
// Set a sub-shape type
TDF_Label freeLabel = group->GetFreeLabel();
TDataStd_Integer::Set(freeLabel, (Standard_Integer) getGroupDimension(xaoGroup));
groupList->Append(group);
function = group->GetLastFunction();
}
// TODO: create the fields
// make a Python command
GEOM::TPythonDump pd(function);
pd << "(imported, " << shape << ", ";
pd << "[";
if (nbGroups > 0)
{
for (int i = 1; i <= nbGroups; i++)
{
Handle(GEOM_Object) obj = Handle(GEOM_Object)::DownCast(groupList->Value(i));
pd << obj << ((i < nbGroups) ? ", " : "");
}
}
pd << "], []";
pd << ") = geompy.ImportXAO(\"" << fileName << "\")";
delete xaoObject;
SetErrorCode(OK);
return true;
}
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -15,9 +15,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMImpl_IImportExportOperations.hxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
#ifndef _GEOMImpl_IImportExportOperations_HXX_
#define _GEOMImpl_IImportExportOperations_HXX_
@ -47,11 +44,12 @@ public:
Standard_EXPORT bool ExportXAO(Handle(GEOM_Object) shape,
std::list<Handle(GEOM_Object)> groupList,
std::list<Handle(GEOM_Object)> fieldList,
char*& xao);
// Standard_EXPORT bool ImportXAO (const std::string fileName,
// Handle(GEOM_Object) shape,
// std::list<Handle(GEOM_Object)> groupList,
// std::list<Handle(GEOM_Object)> fieldList);
const char* author,
const char* fileName);
Standard_EXPORT bool ImportXAO(const char* fileName,
Handle(GEOM_Object)& shape,
Handle(TColStd_HSequenceOfTransient)& groupList,
Handle(TColStd_HSequenceOfTransient)& fieldList);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
#endif

View File

@ -0,0 +1,41 @@
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef _GEOMImpl_IImportExportXAO_HXX_
#define _GEOMImpl_IImportExportXAO_HXX_
#include "GEOM_Function.hxx"
#define IMPORTEXPORTXAO_ARG_DATA 1
class GEOMImpl_IImportExportXAO
{
public:
GEOMImpl_IImportExportXAO(Handle(GEOM_Function) theFunction): _func(theFunction) {}
void SetData(const TCollection_AsciiString& data) { _func->SetString(IMPORTEXPORTXAO_ARG_DATA, data); }
const TCollection_AsciiString GetData() { return _func->GetString(IMPORTEXPORTXAO_ARG_DATA); }
private:
Handle(GEOM_Function) _func;
};
#endif // _GEOMImpl_IExportXAO_HXX_

View File

@ -352,5 +352,7 @@
#define DIVIDEDDISK_R_RATIO 1
#define DIVIDEDDISK_R_VECTOR_PNT 2
#define DIVIDEDCYLINDER_R_H 1
#define EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS 1
#define IMPORTEXPORT_EXPORTXAO 1
#define IMPORTEXPORT_IMPORTXAO 2
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/

View File

@ -0,0 +1,128 @@
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <Standard_Stream.hxx>
#include <GEOMImpl_XAODriver.hxx>
#include <GEOMImpl_IImportExportXAO.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
#include <TFunction_Logbook.hxx>
#include <StdFail_NotDone.hxx>
#include "Xao.hxx"
#include "Geometry.hxx"
#include "Group.hxx"
#include "XaoUtils.hxx"
//@@ include required header files here @@//
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& GEOMImpl_XAODriver::GetID()
{
static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
return aGUID;
}
//=======================================================================
//function : GEOMImpl_XAODriver
//purpose :
//=======================================================================
GEOMImpl_XAODriver::GEOMImpl_XAODriver()
{
}
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_XAODriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
GEOMImpl_IImportExportXAO iexao(function);
TCollection_AsciiString xao = iexao.GetData();
TopoDS_Shape shape;
Standard_Integer functionType = function->GetType();
if (functionType == IMPORTEXPORT_EXPORTXAO)
{
}
else if (functionType == IMPORTEXPORT_IMPORTXAO)
{
}
else
{
// other construction modes here
}
if (shape.IsNull()) return 0;
function->SetValue(shape);
log.SetTouched(Label());
return 1;
}
//=======================================================================
//function : GEOMImpl_XAODriver_Type_
//purpose :
//=======================================================================
Standard_EXPORT Handle_Standard_Type& GEOMImpl_XAODriver_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[] = { aType1, aType2, aType3, NULL };
static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_XAODriver",
sizeof(GEOMImpl_XAODriver),
1,
(Standard_Address) _Ancestors,
(Standard_Address) NULL);
return _aType;
}
//=======================================================================
//function : DownCast
//purpose :
//=======================================================================
const Handle(GEOMImpl_XAODriver) Handle(GEOMImpl_XAODriver)::DownCast(
const Handle(Standard_Transient)& AnObject)
{
Handle(GEOMImpl_XAODriver) _anOtherObject;
if (!AnObject.IsNull())
{
if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_XAODriver)))
{
_anOtherObject = Handle(GEOMImpl_XAODriver)((Handle(GEOMImpl_XAODriver)&) AnObject);
}
}
return _anOtherObject;
}

View File

@ -0,0 +1,147 @@
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef _GEOMImpl_XAODriver_HXX
#define _GEOMImpl_XAODriver_HXX
#include <TFunction_Driver.hxx>
class Handle_Standard_Type;
class GEOMImpl_XAODriver;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_XAODriver);
class Handle(GEOMImpl_XAODriver): public Handle(TFunction_Driver)
{
public:
inline void* operator new(size_t, void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&) anAddress);
}
Handle(GEOMImpl_XAODriver) () :
Handle(TFunction_Driver)()
{
}
Handle(GEOMImpl_XAODriver) (const Handle(GEOMImpl_XAODriver)& aHandle) :
Handle(TFunction_Driver)(aHandle)
{
}
Handle(GEOMImpl_XAODriver) (const GEOMImpl_XAODriver* anItem) :
Handle(TFunction_Driver)((TFunction_Driver *) anItem)
{
}
Handle(GEOMImpl_XAODriver)& operator=(const Handle(GEOMImpl_XAODriver)& aHandle)
{
Assign(aHandle.Access());
return *this;
}
Handle(GEOMImpl_XAODriver)& operator=(const GEOMImpl_XAODriver* anItem)
{
Assign((Standard_Transient *) anItem);
return *this;
}
GEOMImpl_XAODriver* operator->()
{
return (GEOMImpl_XAODriver *) ControlAccess();
}
GEOMImpl_XAODriver* operator->() const
{
return (GEOMImpl_XAODriver *) ControlAccess();
}
Standard_EXPORT
~Handle(GEOMImpl_XAODriver)()
{
}
Standard_EXPORT
static const Handle(GEOMImpl_XAODriver) DownCast(const Handle(Standard_Transient)& AnObject);
};
class GEOMImpl_XAODriver: public TFunction_Driver
{
public:
inline void* operator new(size_t, void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&) anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT
GEOMImpl_XAODriver();
Standard_EXPORT
virtual Standard_Integer Execute(TFunction_Logbook& log) const;
Standard_EXPORT
virtual void Validate(TFunction_Logbook&) const
{
}
Standard_EXPORT
Standard_Boolean MustExecute(const TFunction_Logbook&) const
{
return Standard_True;
}
Standard_EXPORT
static const Standard_GUID& GetID();
Standard_EXPORT
~GEOMImpl_XAODriver()
{
}
// Type management
//
Standard_EXPORT
friend Handle_Standard_Type& GEOMImpl_ExportXAODriver_Type_();
Standard_EXPORT
const Handle(Standard_Type)& DynamicType() const
{
return STANDARD_TYPE(GEOMImpl_XAODriver);
}
Standard_EXPORT
Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(GEOMImpl_XAODriver) == AType || TFunction_Driver::IsKind(AType));
}
};
#endif // _GEOMImpl_XAODriver_HXX

View File

@ -150,7 +150,7 @@ ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx
ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx
##ADVANCED_INCLUDES += GEOMImpl_IDividedCylinder.hxx GEOMImpl_DividedCylinderDriver.hxx
IMPORTEXPORT_INCLUDES =
IMPORTEXPORT_INCLUDES += GEOMImpl_IExportXAO.hxx GEOMImpl_ExportXAODriver.hxx
IMPORTEXPORT_INCLUDES += GEOMImpl_IImportExportXAO.hxx GEOMImpl_XAODriver.hxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
@ -227,7 +227,7 @@ ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx
ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx
##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx
IMPORTEXPORT_SOURCES =
IMPORTEXPORT_SOURCES += GEOMImpl_ExportXAODriver.cxx
IMPORTEXPORT_SOURCES += GEOMImpl_XAODriver.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES)

View File

@ -2311,7 +2311,7 @@ GEOM::GEOM_IImportExportOperations_ptr GEOM_Gen_i::GetIImportExportOperations(CO
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIAdvancedOperations" );
MESSAGE( "GEOM_Gen_i::GetIImportExportOperations" );
GEOM::GEOM_Gen_ptr engine = _this();

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -15,11 +15,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOM_IImportExportOperations.cc
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#include <Standard_Stream.hxx>
#include "GEOM_IImportExportOperations_i.hh"
@ -56,16 +52,18 @@ GEOM_IImportExportOperations_i::~GEOM_IImportExportOperations_i()
//=============================================================================
/*!
* Export a shape to XAO Format
* \param fileName The name of the exported file
* Export a shape to XAO format
* \param shape The shape to export
* \param groups The list of groups to export
* \param fields The list of fields to export
* \param author The author of the export
* \param fileName The name of the exported file
* \return boolean indicating if export was succeful.
*/
//=============================================================================
CORBA::Boolean GEOM_IImportExportOperations_i::ExportXAO(GEOM::GEOM_Object_ptr shape,
const GEOM::ListOfGO& groups, const GEOM::ListOfGO& fields, CORBA::String_out xao)
const GEOM::ListOfGO& groups, const GEOM::ListOfGO& fields,
const char* author, const char* fileName)
{
bool isGood = false;
// Set a not done flag
@ -97,10 +95,7 @@ CORBA::Boolean GEOM_IImportExportOperations_i::ExportXAO(GEOM::GEOM_Object_ptr s
if (!reference.IsNull())
{
// Export XAO
char* data;
isGood = GetOperations()->ExportXAO(reference, groupsObj, fieldsObj, data);
xao = CORBA::string_dup(data);
delete data;
isGood = GetOperations()->ExportXAO(reference, groupsObj, fieldsObj, author, fileName);
}
return isGood;
@ -108,20 +103,55 @@ CORBA::Boolean GEOM_IImportExportOperations_i::ExportXAO(GEOM::GEOM_Object_ptr s
//=============================================================================
/*!
* Import a shape from XAO Format
* \param xao The XAO data to import
* Import a shape from XAO format
* \param fileName The name of the file to import
* \param shape The imported shape
* \param groups The list of imported groups
* \param fields The list of imported fields
* \return boolean indicating if import was succeful.
*/
//=============================================================================
//bool GEOMImpl_IImportExportOperations::ImportXAO(const std::xao fileName,
// Handle(GEOM_Object),
// std::list<Handle_GEOM_Object, std::allocator<Handle_GEOM_Object> > groups,
// std::list<Handle_GEOM_Object, std::allocator<Handle_GEOM_Object> > fields)
//{
// return true;
//}
CORBA::Boolean GEOM_IImportExportOperations_i::ImportXAO(const char* fileName,
GEOM::GEOM_Object_out shape,
GEOM::ListOfGO_out groups,
GEOM::ListOfGO_out fields)
{
GEOM::GEOM_Object_var vshape;
shape = vshape._retn();
groups = new GEOM::ListOfGO;
fields = new GEOM::ListOfGO;
// Set a not done flag
GetOperations()->SetNotDone();
Handle(TColStd_HSequenceOfTransient) importedGroups = new TColStd_HSequenceOfTransient();
Handle(TColStd_HSequenceOfTransient) importedFields = new TColStd_HSequenceOfTransient();
Handle(GEOM_Object) hshape;
bool res = GetOperations()->ImportXAO(fileName, hshape, importedGroups, importedFields);
if (!GetOperations()->IsDone() || !res)
return false;
// parse groups
int n = importedGroups->Length();
groups->length(n);
for (int i = 1; i <= n; i++)
{
(*groups)[i - 1] = GetObject(Handle(GEOM_Object)::DownCast(importedGroups->Value(i)));
}
// parse fields
n = importedFields->Length();
fields->length(n);
for (int i = 1; i <= n; i++)
{
(*fields)[i - 1] = GetObject(Handle(GEOM_Object)::DownCast(importedFields->Value(i)));
}
shape = GetObject(hshape);
return res;
}
/*@@ insert new functions before this line @@ do not remove this line @@*/

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -15,11 +15,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOM_IImportExportOperations.hh
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#ifndef _GEOM_IImportExportOperations_i_HeaderFile
#define _GEOM_IImportExportOperations_i_HeaderFile
@ -45,8 +41,10 @@ public:
CORBA::Boolean ExportXAO (GEOM::GEOM_Object_ptr shape,
const GEOM::ListOfGO& groups,
const GEOM::ListOfGO& fields,
CORBA::String_out xao);
CORBA::Boolean ImportXAO (const char* xao, GEOM::GEOM_Object_out shape,
const char* author,
const char* fileName);
CORBA::Boolean ImportXAO (const char* fileName,
GEOM::GEOM_Object_out shape,
GEOM::ListOfGO_out groups,
GEOM::ListOfGO_out fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/

View File

@ -3452,7 +3452,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedCylinder (CORBA::Double theR,
// ExportXAO
//=============================================================================
CORBA::Boolean GEOM_Superv_i::ExportXAO (GEOM::GEOM_Object_ptr shape,
GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields, CORBA::String_out xao)
GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields,
const char* author, const char* fileName)
{
beginService( " GEOM_Superv_i::ExportXAO" );
MESSAGE("GEOM_Superv_i::ExportXAO");
@ -3463,7 +3464,8 @@ CORBA::Boolean GEOM_Superv_i::ExportXAO (GEOM::GEOM_Object_ptr shape,
if (GEOM_List_i<GEOM::ListOfGO>* fieldList =
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(fields, myPOA).in()))
{
CORBA::Boolean isGood = myImportExportOp->ExportXAO(shape, groupList->GetList(), fieldList->GetList(), xao);
CORBA::Boolean isGood = myImportExportOp->ExportXAO(shape,
groupList->GetList(), fieldList->GetList(), author, fileName);
endService( " GEOM_Superv_i::ExportXAO" );
return isGood;
}
@ -3475,11 +3477,11 @@ CORBA::Boolean GEOM_Superv_i::ExportXAO (GEOM::GEOM_Object_ptr shape,
//=============================================================================
// ImportXAO
//=============================================================================
//CORBA::Boolean GEOM_Superv_i::ImportXAO (const char* fileName, GEOM::GEOM_Object_out shape,
// GEOM::GEOM_List_out groups, GEOM::GEOM_List_out fields)
//{
// return false;
//}
CORBA::Boolean GEOM_Superv_i::ImportXAO (const char* fileName, GEOM::GEOM_Object_out shape,
GEOM::GEOM_List_out groups, GEOM::GEOM_List_out fields)
{
return false;
}
/*@@ insert new functions before this line @@ do not remove this line @@*/
//=====================================================================================

View File

@ -716,9 +716,10 @@ public:
// ImportExport Operations //
//-----------------------------------------------------------//
CORBA::Boolean ExportXAO(GEOM::GEOM_Object_ptr shape,
GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields, CORBA::String_out xao);
// CORBA::Boolean ImportXAO(const char* fileName, GEOM::GEOM_Object_out shape,
// GEOM::GEOM_List_out groups, GEOM::GEOM_List_out fields);
GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields,
const char* author, const char* fileName);
CORBA::Boolean ImportXAO(const char* fileName, GEOM::GEOM_Object_out shape,
GEOM::GEOM_List_out groups, GEOM::GEOM_List_out fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/
private:

File diff suppressed because it is too large Load Diff

View File

@ -15,12 +15,9 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : ImportExportGUI.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#include "ImportExportGUI.h"
#include <iostream>
#include <QDialog>
#include "GeometryGUI.h"
#include "GeometryGUI_Operations.h"
@ -32,10 +29,10 @@
#include <SalomeApp_Application.h>
#include "ImportExportGUI_ExportXAODlg.h"
#include "ImportExportGUI_ImportXAODlg.h"
#include "ImportExportGUI.h"
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
#include <QDialog>
#include <iostream>
//=======================================================================
// function : ImportExportGUI()
@ -72,6 +69,7 @@ bool ImportExportGUI::OnGUIEvent(int commandId, SUIT_Desktop* parent)
dialog = new ImportExportGUI_ExportXAODlg(getGeometryGUI(), parent);
break;
case GEOMOp::OpImportXAO:
dialog = new ImportExportGUI_ImportXAODlg(getGeometryGUI(), parent);
break;
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
default:

View File

@ -89,9 +89,10 @@ ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg(GeometryGUI* geometry
ledShape = new QLineEdit(gbxExport);
ledShape->setMinimumSize(QSize(100, 0));
gridLayoutExport->addWidget(lblShape, 0, 0, 1, 1);
gridLayoutExport->addWidget(btnShapeSelect, 0, 1, 1, 1);
gridLayoutExport->addWidget(ledShape, 0, 2, 1, 1);
int line = 0, col = 0;
gridLayoutExport->addWidget(lblShape, line, col++, 1, 1);
gridLayoutExport->addWidget(btnShapeSelect, line, col++, 1, 1);
gridLayoutExport->addWidget(ledShape, line, col++, 1, 1);
// Line 1
QLabel* lblFileName = new QLabel(tr("GEOM_EXPORTXAO_FILENAME"), gbxExport);
@ -99,9 +100,19 @@ ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg(GeometryGUI* geometry
ledFileName = new QLineEdit(gbxExport);
btnFileSelect->setText("...");
gridLayoutExport->addWidget(lblFileName, 1, 0, 1, 1);
gridLayoutExport->addWidget(btnFileSelect, 1, 1, 1, 1);
gridLayoutExport->addWidget(ledFileName, 1, 2, 1, 1);
line++; col = 0;
gridLayoutExport->addWidget(lblFileName, line, col++, 1, 1);
gridLayoutExport->addWidget(btnFileSelect, line, col++, 1, 1);
gridLayoutExport->addWidget(ledFileName, line, col++, 1, 1);
// Line 2
QLabel* lblAuthor = new QLabel(tr("GEOM_EXPORTXAO_AUTHOR"), gbxExport);
ledAuthor = new QLineEdit(gbxExport);
line++; col = 0;
gridLayoutExport->addWidget(lblAuthor, line, col++, 2, 1);
col++; // span
gridLayoutExport->addWidget(ledAuthor, line, col++, 1, 1);
//****************************
// Filter Group box
@ -118,8 +129,9 @@ ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg(GeometryGUI* geometry
QLabel* lblGroups = new QLabel(tr("GEOM_EXPORTXAO_LGROUPS"), gbxFilter);
QLabel* lblFields = new QLabel(tr("GEOM_EXPORTXAO_LFIELDS"), gbxFilter);
gridLayoutFilter->addWidget(lblGroups, 0, 0, 1, 1);
gridLayoutFilter->addWidget(lblFields, 0, 1, 1, 1);
line = 0, col = 0;
gridLayoutFilter->addWidget(lblGroups, line, col++, 1, 1);
gridLayoutFilter->addWidget(lblFields, line, col++, 1, 1);
// Line 1
lstGroups = new QListWidget(gbxFilter);
@ -127,8 +139,9 @@ ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg(GeometryGUI* geometry
lstFields = new QListWidget(gbxFilter);
lstFields ->setSelectionMode(QAbstractItemView::ExtendedSelection);
gridLayoutFilter->addWidget(lstGroups, 1, 0, 1, 1);
gridLayoutFilter->addWidget(lstFields, 1, 1, 1, 1);
line++; col = 0;
gridLayoutFilter->addWidget(lstGroups, line, col++, 1, 1);
gridLayoutFilter->addWidget(lstFields, line, col++, 1, 1);
//****************************
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
@ -334,6 +347,9 @@ bool ImportExportGUI_ExportXAODlg::execute(ObjectList& objects)
{
bool res = false;
QString author = ledAuthor->text();
QString fileName = ledFileName->text();
// get selected groups
QList<QListWidgetItem*> selGroups = lstGroups->selectedItems();
GEOM::ListOfGO_var groups = new GEOM::ListOfGO();
@ -359,15 +375,9 @@ bool ImportExportGUI_ExportXAODlg::execute(ObjectList& objects)
// call engine function
GEOM::GEOM_IImportExportOperations_var ieOp = GEOM::GEOM_IImportExportOperations::_narrow(getOperation());
char* xao;
res = ieOp->ExportXAO(m_mainObj, groups, fields, xao);
// dump xao to file
ofstream exportFile;
exportFile.open(ledFileName->text().toStdString().c_str());
exportFile << xao;
exportFile.close();
delete xao;
res = ieOp->ExportXAO(m_mainObj, groups, fields,
author.toStdString().c_str(),
fileName.toStdString().c_str());
return res;
}

View File

@ -57,6 +57,7 @@ private:
QList<GEOM::GeomObjPtr> m_fields;
QLineEdit* ledShape;
QLineEdit* ledFileName;
QLineEdit* ledAuthor;
QListWidget* lstGroups;
QListWidget* lstFields;
QPushButton* btnShapeSelect;

View File

@ -0,0 +1,251 @@
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <LightApp_SelectionMgr.h>
#include <QLabel>
#include <QLineEdit>
#include <QButtonGroup>
#include <QListWidget>
#include <QFileDialog>
#include <QMap>
// OCCT Includes
#include <TopoDS_Shape.hxx>
#include <TopoDS.hxx>
#include <TopExp.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <GEOMImpl_Types.hxx>
#include "ImportExportGUI_ImportXAODlg.h"
//=================================================================================
// Constructor
//=================================================================================
ImportExportGUI_ImportXAODlg::ImportExportGUI_ImportXAODlg(GeometryGUI* geometryGUI, QWidget* parent)
:
GEOMBase_Skeleton(geometryGUI, parent, false)
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
QPixmap imageOp(resMgr->loadPixmap("GEOM", tr("ICON_DLG_IMPORTXAO")));
QPixmap iconSelect(resMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle(tr("GEOM_IMPORTXAO_TITLE"));
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_IMPORTXAO_TITLE"));
mainFrame()->RadioButton1->setIcon(imageOp);
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
// hide name
mainFrame()->GroupBoxName->hide();
//****************************
// Selection Group box
QGroupBox* gbxExport = new QGroupBox(parent);
QGridLayout* gridLayoutExport = new QGridLayout(gbxExport);
#ifndef Q_OS_MAC
gridLayoutExport->setSpacing(6);
gridLayoutExport->setContentsMargins(9, 9, 9, 9);
#endif
gridLayoutExport->setObjectName(QString::fromUtf8("gridLayoutExport"));
int line = 0, col = 0;
QLabel* lblFileName = new QLabel(tr("GEOM_IMPORTXAO_FILENAME"), gbxExport);
btnFileSelect = new QPushButton(gbxExport);
ledFileName = new QLineEdit(gbxExport);
btnFileSelect->setText("...");
line++; col = 0;
gridLayoutExport->addWidget(lblFileName, line, col++, 1, 1);
gridLayoutExport->addWidget(btnFileSelect, line, col++, 1, 1);
gridLayoutExport->addWidget(ledFileName, line, col++, 1, 1);
//****************************
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0);
layout->setSpacing(6);
layout->addWidget(gbxExport);
// set help
setHelpFileName("create_importxao_page.html");
Init();
}
//=================================================================================
// Destructor
//=================================================================================
ImportExportGUI_ImportXAODlg::~ImportExportGUI_ImportXAODlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void ImportExportGUI_ImportXAODlg::Init()
{
// Signal/slot connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(btnFileSelect, SIGNAL(clicked()), this, SLOT(btnFileSelectClicked()));
initName(tr("GEOM_IMPORTXAO"));
//SelectionIntoArgument();
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void ImportExportGUI_ImportXAODlg::ClickOnOk()
{
if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool ImportExportGUI_ImportXAODlg::ClickOnApply()
{
if (!onAccept())
return false;
initName();
return true;
}
//=================================================================================
// function : btnFileSelectClicked()
// purpose :
//=================================================================================
void ImportExportGUI_ImportXAODlg::btnFileSelectClicked()
{
QString selFile = QFileDialog::getOpenFileName(this, tr("GEOM_SELECT_EXPORT_XAO"),
QString(), tr("XAO_FILES"));
if (!selFile.isEmpty())
{
ledFileName->setText(selFile);
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void ImportExportGUI_ImportXAODlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
}
//=================================================================================
// function : enterEvent [REDEFINED]
// purpose :
//=================================================================================
void ImportExportGUI_ImportXAODlg::enterEvent(QEvent*)
{
if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr ImportExportGUI_ImportXAODlg::createOperation()
{
return getGeomEngine()->GetIImportExportOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool ImportExportGUI_ImportXAODlg::isValid(QString& msg)
{
// check file name
if (ledFileName->text().isEmpty())
return false;
return true;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool ImportExportGUI_ImportXAODlg::execute(ObjectList& objects)
{
bool res = false;
QString fileName = ledFileName->text();
GEOM::GEOM_Object_var shape;
GEOM::ListOfGO_var groups, fields;
GEOM::GEOM_IImportExportOperations_var ieOp = GEOM::GEOM_IImportExportOperations::_narrow(getOperation());
res = ieOp->ImportXAO(fileName.toStdString().c_str(), shape, groups, fields);
if (!shape->_is_nil())
{
objects.push_back(shape._retn());
}
for (int i = 0; i < groups->length(); i++)
{
objects.push_back(GEOM::GEOM_Object::_duplicate(groups[i]));
}
return res;
}
GEOM::GEOM_Object_ptr ImportExportGUI_ImportXAODlg::getFather(GEOM::GEOM_Object_ptr object)
{
GEOM::GEOM_Object_var fatherObj;
if (object->GetType() == GEOM_GROUP)
{
GEOM::GEOM_IGroupOperations_var groupOper = getGeomEngine()->GetIGroupOperations(getStudyId());
fatherObj = groupOper->GetMainShape(object);
}
return fatherObj._retn();
}
QString ImportExportGUI_ImportXAODlg::getObjectName(GEOM::GEOM_Object_ptr object) const
{
if (object->_is_nil())
return QString::null;
return object->GetName();
}

View File

@ -0,0 +1,65 @@
// Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef IMPORTEXPORTGUI_IMPORTXAODLG_H
#define IMPORTEXPORTGUI_IMPORTXAODLG_H
#include <GEOMBase_Skeleton.h>
#include <GEOM_GenericObjPtr.h>
class QLineEdit;
class QButtonGroup;
class QListWidget;
//=================================================================================
// class : ImportExportGUI_ImportXAODlg
// purpose :
//=================================================================================
class ImportExportGUI_ImportXAODlg: public GEOMBase_Skeleton
{
Q_OBJECT
public:
ImportExportGUI_ImportXAODlg(GeometryGUI*, QWidget* = 0);
~ImportExportGUI_ImportXAODlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid(QString&);
virtual bool execute(ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr object);
virtual QString getObjectName(GEOM::GEOM_Object_ptr object) const;
private:
void Init();
void enterEvent(QEvent*);
private:
QLineEdit* ledFileName;
QPushButton* btnFileSelect;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void btnFileSelectClicked();
};
#endif // IMPORTEXPORTGUI_EXPORTXAODLG_H

View File

@ -27,31 +27,31 @@ lib_LTLIBRARIES = libImportExportGUI.la
# header files
salomeinclude_HEADERS = \
ImportExportGUI.h \
ImportExportGUI_ExportXAODlg.h
ImportExportGUI.h
#IMPORTEXPORT_INCLUDES =
#IMPORTEXPORT_INCLUDES += ImportExportGUI_ExportXAODlg.h
libImportExportGUI_la_INCLUDES =
libImportExportGUI_la_INCLUDES += ImportExportGUI_ExportXAODlg.h
libImportExportGUI_la_INCLUDES += ImportExportGUI_ImportXAODlg.h
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
#salomeinclude_HEADERS += $(IMPORTEXPORT_INCLUDES)
dist_libImportExportGUI_la_SOURCES = \
ImportExportGUI_ExportXAODlg.h \
ImportExportGUI.h \
ImportExportGUI_ExportXAODlg.cxx \
ImportExportGUI.cxx
#IMPORTEXPORT_SOURCES =
#IMPORTEXPORT_SOURCES += ImportExportGUI_ExportXAODlg.h ImportExportGUI_ExportXAODlg.cxx
libImportExportGUI_la_SOURCES =
libImportExportGUI_la_SOURCES += ImportExportGUI_ExportXAODlg.h ImportExportGUI_ExportXAODlg.cxx
libImportExportGUI_la_SOURCES += ImportExportGUI_ImportXAODlg.h ImportExportGUI_ImportXAODlg.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
#dist_libImportExportGUI_la_SOURCES += $(IMPORTEXPORT_SOURCES)
MOC_FILES =
IMPORTEXPORT_MOC_FILES = ImportExportGUI_moc.cxx
IMPORTEXPORT_MOC_FILES += ImportExportGUI_ExportXAODlg_moc.cxx
MOC_FILES = ImportExportGUI_moc.cxx
MOC_FILES += ImportExportGUI_ExportXAODlg_moc.cxx
MOC_FILES += ImportExportGUI_ImportXAODlg_moc.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
MOC_FILES += $(IMPORTEXPORT_MOC_FILES)