improve export dialog and start import

This commit is contained in:
fps 2013-04-11 15:50:20 +00:00
parent c79ce12152
commit 587e24773a
22 changed files with 379 additions and 195 deletions

View File

@ -4013,14 +4013,25 @@ module GEOM
{ {
/*! /*!
* Export a shape to XAO Format * Export a shape to XAO Format
* \param exportingShape Shape to export
* \param fileName The name of the exported file * \param fileName The name of the exported file
* \param groups List of groups to export * \param shape The shape to export
* \param fields List of fields to export * \param groups The list of groups to export
* \param fields The list of fields to export
* \return boolean indicating if export was succeful. * \return boolean indicating if export was succeful.
*/ */
boolean ExportXAO(in GEOM_Object shape, in string fileName, in ListOfGO groups, in ListOfGO fields); boolean ExportXAO(in string fileName, in GEOM_Object shape, in ListOfGO groups, in ListOfGO fields);
/*!
* Import a shape from XAO Format
* \param fileName The name of the imported file
* \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 fileName, out GEOM_Object shape, out ListOfGO groups, out ListOfGO fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/ /*@@ insert new functions before this line @@ do not remove this line @@*/
}; };

View File

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

View File

@ -5312,16 +5312,16 @@
<service-comment>unknown</service-comment> <service-comment>unknown</service-comment>
<service-by-default>0</service-by-default> <service-by-default>0</service-by-default>
<inParameter-list> <inParameter-list>
<inParameter>
<inParameter-name>theExportingShape</inParameter-name>
<inParameter-type>GEOM_Object</inParameter-type>
<inParameter-comment>Shape to export</inParameter-comment>
</inParameter>
<inParameter> <inParameter>
<inParameter-name>theFileName</inParameter-name> <inParameter-name>theFileName</inParameter-name>
<inParameter-type>string</inParameter-type> <inParameter-type>string</inParameter-type>
<inParameter-comment>The name of the exported file</inParameter-comment> <inParameter-comment>The name of the exported file</inParameter-comment>
</inParameter> </inParameter>
<inParameter>
<inParameter-name>theExportingShape</inParameter-name>
<inParameter-type>GEOM_Object</inParameter-type>
<inParameter-comment>Shape to export</inParameter-comment>
</inParameter>
<inParameter> <inParameter>
<inParameter-name>thelGroups</inParameter-name> <inParameter-name>thelGroups</inParameter-name>
<inParameter-type>GEOM_List</inParameter-type> <inParameter-type>GEOM_List</inParameter-type>

View File

@ -256,8 +256,8 @@ ADVANCED_RESOURCES += dlg_pipetshapefilletl2.png dlg_pipetshapefilletr2.png dlg_
ADVANCED_RESOURCES += dlg_pipetshapefilletrf.png ADVANCED_RESOURCES += dlg_pipetshapefilletrf.png
# ADVANCED_RESOURCES += divideddisk.png divideddisk_r_ratio.png tree_divideddisk.png # ADVANCED_RESOURCES += divideddisk.png divideddisk_r_ratio.png tree_divideddisk.png
ADVANCED_RESOURCES += dividedcylinder.png dividedcylinder_r_h.png ADVANCED_RESOURCES += dividedcylinder.png dividedcylinder_r_h.png
ADVANCED_RESOURCES += exportxao.png importxao.png
# tree_dividedcylinder.png # tree_dividedcylinder.png
#IMPORTEXPORT_RESOURCES += exportxao.png exportxao_exportingshape_filename_lgroups_lfields.png tree_exportxao.png
##@@ insert new functions before this line @@ do not remove this line @@## ##@@ insert new functions before this line @@ do not remove this line @@##
dist_salomeres_DATA += $(ADVANCED_RESOURCES) dist_salomeres_DATA += $(ADVANCED_RESOURCES)

BIN
resources/exportxao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

BIN
resources/importxao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

View File

@ -1337,15 +1337,23 @@
<translation>dividedcylinder.png</translation> <translation>dividedcylinder.png</translation>
</message> </message>
<message> <message>
<source>ICON_DLG_EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS</source> <source>ICON_DLG_EXPORTXAO</source>
<translation>exportxao_exportingshape_filename_lgroups_lfields.png</translation> <translation>exportxao.png</translation>
</message> </message>
<message> <message>
<source>ICO_EXPORTXAO</source> <source>ICO_EXPORTXAO</source>
<translation>exportxao.png</translation> <translation>exportxao.png</translation>
</message> </message>
<message> <message>
<source>ICON_OBJBROWSER_IMPORTEXPORT_200</source> <source>ICON_DLG_IMPORTXAO</source>
<translation>importxao.png</translation>
</message>
<message>
<source>ICO_IMPORTXAO</source>
<translation>importxao.png</translation>
</message>
<message>
<source>ICON_OBJBROWSER_IMPORTEXPORT_204</source>
<translation>tree_exportxao.png</translation> <translation>tree_exportxao.png</translation>
</message> </message>
<!-- @@ insert new functions before this line @@ do not remove this line @@ --> <!-- @@ insert new functions before this line @@ do not remove this line @@ -->

View File

@ -4856,6 +4856,42 @@ be specified in meters).</translation>
<source>GEOM_SELECT_IMAGE</source> <source>GEOM_SELECT_IMAGE</source>
<translation>Select image...</translation> <translation>Select image...</translation>
</message> </message>
<message>
<source>MEN_IMPORTEXPORT</source>
<translation>Import / Export</translation>
</message>
<message>
<source>TOP_EXPORTXAO</source>
<translation>Export to XAO</translation>
</message>
<message>
<source>MEN_EXPORTXAO</source>
<translation>Export XAO</translation>
</message>
<message>
<source>STB_EXPORTXAO</source>
<translation>Export shape to XAO format</translation>
</message>
<message>
<source>TOP_IMPORTXAO</source>
<translation>Import from XAO</translation>
</message>
<message>
<source>MEN_IMPORTXAO</source>
<translation>Import XAO</translation>
</message>
<message>
<source>STB_IMPORTXAO</source>
<translation>Import shape from XAO format</translation>
</message>
<message>
<source>GEOM_IMPORTEXPORT_204</source>
<translation>Export XAO</translation>
</message>
<message>
<source>XAO_FILES</source>
<translation>XAO files (*.xao)</translation>
</message>
</context> </context>
<context> <context>
<name>BasicGUI_CurveDlg</name> <name>BasicGUI_CurveDlg</name>
@ -5745,7 +5781,7 @@ Do you want to create new material?</translation>
</message> </message>
<message> <message>
<source>GEOM_EXPORTXAO_EXPORTINGSHAPE</source> <source>GEOM_EXPORTXAO_EXPORTINGSHAPE</source>
<translation>Exporting Shape</translation> <translation>Shape</translation>
</message> </message>
<message> <message>
<source>GEOM_EXPORTXAO_FILENAME</source> <source>GEOM_EXPORTXAO_FILENAME</source>
@ -5760,27 +5796,4 @@ Do you want to create new material?</translation>
<translation>List of fields</translation> <translation>List of fields</translation>
</message> </message>
</context> </context>
<context>
<name>@default</name>
<message>
<source>MEN_IMPORTEXPORT</source>
<translation>Import / Export</translation>
</message>
<message>
<source>TOP_EXPORTXAO</source>
<translation>Export to XAO</translation>
</message>
<message>
<source>MEN_EXPORTXAO</source>
<translation>Export XAO</translation>
</message>
<message>
<source>STB_EXPORTXAO</source>
<translation>Export shape to XAO format</translation>
</message>
<message>
<source>GEOM_IMPORTEXPORT_204</source>
<translation>Export XAO</translation>
</message>
</context>
</TS> </TS>

View File

@ -4855,6 +4855,42 @@ le paramètre &apos;%1&apos; aux préférences du module Géométrie.</translati
<source>GEOM_SELECT_IMAGE</source> <source>GEOM_SELECT_IMAGE</source>
<translation>Sélectionner une image...</translation> <translation>Sélectionner une image...</translation>
</message> </message>
<message>
<source>MEN_IMPORTEXPORT</source>
<translation>Import / Export</translation>
</message>
<message>
<source>TOP_EXPORTXAO</source>
<translation>Export XAO</translation>
</message>
<message>
<source>MEN_EXPORTXAO</source>
<translation>Export XAO</translation>
</message>
<message>
<source>STB_EXPORTXAO</source>
<translation>Exporter une forme au format XAO</translation>
</message>
<message>
<source>TOP_IMPORTXAO</source>
<translation>Import XAO</translation>
</message>
<message>
<source>MEN_IMPORTXAO</source>
<translation>Import XAO</translation>
</message>
<message>
<source>STB_IMPORTXAO</source>
<translation>Importer une forme au format XAO</translation>
</message>
<message>
<source>GEOM_IMPORTEXPORT_204</source>
<translation>Export XAO</translation>
</message>
<message>
<source>XAO_FILES</source>
<translation>Fichiers XAO (*.xao)</translation>
</message>
</context> </context>
<context> <context>
<name>BasicGUI_CurveDlg</name> <name>BasicGUI_CurveDlg</name>

View File

@ -580,6 +580,7 @@ void GeometryGUI::OnGUIEvent( int id )
libName = "AdvancedGUI"; libName = "AdvancedGUI";
break; break;
case GEOMOp::OpExportXAO: // MENU NEW ENTITY - IMPORTEXPORT - EXPORTXAO case GEOMOp::OpExportXAO: // MENU NEW ENTITY - IMPORTEXPORT - EXPORTXAO
case GEOMOp::OpImportXAO: // MENU NEW ENTITY - IMPORTEXPORT - IMPORTXAO
libName = "ImportExportGUI"; libName = "ImportExportGUI";
break; break;
default: default:
@ -910,6 +911,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" ); createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" );
createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" ); createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" );
createGeomAction( GEOMOp::OpExportXAO, "EXPORTXAO" ); createGeomAction( GEOMOp::OpExportXAO, "EXPORTXAO" );
createGeomAction( GEOMOp::OpImportXAO, "IMPORTXAO" );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create menus -------------------------- // ---- create menus --------------------------
@ -962,6 +964,7 @@ void GeometryGUI::initialize( CAM_Application* app )
int impexpId = createMenu( tr( "MEN_IMPORTEXPORT" ), newEntId, -1 ); int impexpId = createMenu( tr( "MEN_IMPORTEXPORT" ), newEntId, -1 );
createMenu( GEOMOp::OpExportXAO, impexpId, -1 ); createMenu( GEOMOp::OpExportXAO, impexpId, -1 );
createMenu( GEOMOp::OpImportXAO, impexpId, -1 );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
createMenu( separator(), newEntId, -1 ); createMenu( separator(), newEntId, -1 );
@ -1235,6 +1238,7 @@ void GeometryGUI::initialize( CAM_Application* app )
int impexpTbId = createTool( tr( "TOOL_IMPORTEXPORT" ) ); int impexpTbId = createTool( tr( "TOOL_IMPORTEXPORT" ) );
createTool( GEOMOp::OpExportXAO, impexpTbId ); createTool( GEOMOp::OpExportXAO, impexpTbId );
createTool( GEOMOp::OpImportXAO, impexpTbId );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create popup menus -------------------------- // ---- create popup menus --------------------------

View File

@ -194,6 +194,7 @@ namespace GEOMOp {
OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
// ImportExport ----------------//-------------------------------- // ImportExport ----------------//--------------------------------
OpExportXAO = 10005, // MENU NEW ENTITY - IMPORTEXPORT - EXPORTXAO OpExportXAO = 10005, // MENU NEW ENTITY - IMPORTEXPORT - EXPORTXAO
OpImportXAO = 10006, // MENU NEW ENTITY - IMPORTEXPORT - IMPORTXAO
//@@ insert new functions before this line @@ do not remove this line @@// //@@ insert new functions before this line @@ do not remove this line @@//
}; };
} }

View File

@ -111,15 +111,15 @@ GEOMImpl_IImportExportOperations::~GEOMImpl_IImportExportOperations()
//============================================================================= //=============================================================================
/*! /*!
* Export a shape to XAO Format * Export a shape to XAO Format
* \param shape The shape to export
* \param fileName The name of the exported file * \param fileName The name of the exported file
* \param groupList The list of groups to export * \param shape The shape to export
* \param fieldList The list of fields to export * \param groups The list of groups to export
* \return New GEOM_Object, containing the created shape. * \param fields The list of fields to export
* \return boolean indicating if export was succeful.
*/ */
//============================================================================= //=============================================================================
bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape, bool GEOMImpl_IImportExportOperations::ExportXAO(const std::string fileName,
const std::string fileName, Handle(GEOM_Object) shape,
std::list<Handle(GEOM_Object)> groupList, std::list<Handle(GEOM_Object)> groupList,
std::list<Handle(GEOM_Object)> fieldList) std::list<Handle(GEOM_Object)> fieldList)
{ {
@ -271,4 +271,25 @@ bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape,
return true; return true;
} }
//=============================================================================
/*!
* Import a shape from XAO Format
* \param fileName The name of the imported file
* \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;
//}
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/

View File

@ -29,14 +29,6 @@
#include <list> #include <list>
/*class GEOMImpl_IBasicOperations;
class GEOMImpl_IBooleanOperations;
class GEOMImpl_IShapesOperations;
class GEOMImpl_ITransformOperations;
class GEOMImpl_IBlocksOperations;
class GEOMImpl_I3DPrimOperations;
class GEOMImpl_ILocalOperations;
class GEOMImpl_IHealingOperations;*/
class GEOMImpl_IShapesOperations; class GEOMImpl_IShapesOperations;
class GEOMImpl_IGroupOperations; class GEOMImpl_IGroupOperations;
@ -44,14 +36,7 @@ class GEOMImpl_IImportExportOperations: public GEOM_IOperations
{ {
private: private:
/*GEOMImpl_IBasicOperations* myBasicOperations;
GEOMImpl_IBooleanOperations* myBooleanOperations;
GEOMImpl_IShapesOperations* myShapesOperations;
GEOMImpl_ITransformOperations* myTransformOperations;
GEOMImpl_IBlocksOperations* myBlocksOperations;
GEOMImpl_I3DPrimOperations* my3DPrimOperations;
GEOMImpl_ILocalOperations* myLocalOperations;
GEOMImpl_IHealingOperations* myHealingOperations;*/
GEOMImpl_IShapesOperations* m_shapesOperations; GEOMImpl_IShapesOperations* m_shapesOperations;
GEOMImpl_IGroupOperations* m_groupOperations; GEOMImpl_IGroupOperations* m_groupOperations;
@ -59,10 +44,14 @@ public:
Standard_EXPORT GEOMImpl_IImportExportOperations(GEOM_Engine* engine, int docID); Standard_EXPORT GEOMImpl_IImportExportOperations(GEOM_Engine* engine, int docID);
Standard_EXPORT ~GEOMImpl_IImportExportOperations(); Standard_EXPORT ~GEOMImpl_IImportExportOperations();
Standard_EXPORT bool ExportXAO (Handle(GEOM_Object) shape, Standard_EXPORT bool ExportXAO (const std::string fileName,
const std::string fileName, Handle(GEOM_Object) shape,
std::list<Handle(GEOM_Object)> groupList, std::list<Handle(GEOM_Object)> groupList,
std::list<Handle(GEOM_Object)> fieldList); std::list<Handle(GEOM_Object)> fieldList);
// Standard_EXPORT bool ImportXAO (const std::string fileName,
// Handle(GEOM_Object) shape,
// std::list<Handle(GEOM_Object)> groupList,
// std::list<Handle(GEOM_Object)> fieldList);
/*@@ insert new functions before this line @@ do not remove this line @@*/ /*@@ insert new functions before this line @@ do not remove this line @@*/
}; };
#endif #endif

View File

@ -36,8 +36,10 @@
* constructor: * constructor:
*/ */
//============================================================================= //=============================================================================
GEOM_IImportExportOperations_i::GEOM_IImportExportOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IImportExportOperations* theImpl) GEOM_IImportExportOperations_i::GEOM_IImportExportOperations_i(PortableServer::POA_ptr thePOA,
:GEOM_IOperations_i(thePOA, theEngine, theImpl) GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IImportExportOperations* theImpl)
:
GEOM_IOperations_i(thePOA, theEngine, theImpl)
{ {
MESSAGE("GEOM_IImportExportOperations_i::GEOM_IImportExportOperations_i"); MESSAGE("GEOM_IImportExportOperations_i::GEOM_IImportExportOperations_i");
} }
@ -55,49 +57,68 @@ GEOM_IImportExportOperations_i::~GEOM_IImportExportOperations_i()
//============================================================================= //=============================================================================
/*! /*!
* Export a shape to XAO Format * Export a shape to XAO Format
* \param theExportingShape Shape to export * \param fileName The name of the exported file
* \param theFileName The name of the exported file * \param shape The shape to export
* \param thelGroups List of groups to export * \param groups The list of groups to export
* \param thelFields List of fields to export * \param fields The list of fields to export
* \return New GEOM_Object, containing the created shape. * \return boolean indicating if export was succeful.
*/ */
//============================================================================= //=============================================================================
CORBA::Boolean GEOM_IImportExportOperations_i::ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, const GEOM::ListOfGO& thelGroups, const GEOM::ListOfGO& thelFields) CORBA::Boolean GEOM_IImportExportOperations_i::ExportXAO(const char* fileName,
GEOM::GEOM_Object_ptr shape, const GEOM::ListOfGO& groups, const GEOM::ListOfGO& fields)
{ {
bool isGood = false; bool isGood = false;
//Set a not done flag //Set a not done flag
GetOperations()->SetNotDone(); GetOperations()->SetNotDone();
// Get the reference shape // Get the reference shape
Handle(GEOM_Object) aReference = GetObjectImpl(theExportingShape); Handle(GEOM_Object) reference = GetObjectImpl(shape);
//Get the reference groups //Get the reference groups
int ind = 0; int ind = 0;
int aLenGroup = thelGroups.length(); std::list<Handle(GEOM_Object)> groupsObj;
std::list<Handle(GEOM_Object)> aGroups; for (; ind < groups.length(); ind++)
for (; ind < aLenGroup; ind++) { {
Handle(GEOM_Object) aGroup = GetObjectImpl(thelGroups[ind]); Handle(GEOM_Object) gobj = GetObjectImpl(groups[ind]);
if (aGroup.IsNull()) return false; if (gobj.IsNull()) return false;
aGroups.push_back(aGroup); groupsObj.push_back(gobj);
} }
//Get the reference point //Get the reference point
ind = 0; ind = 0;
int aLenField = thelFields.length(); std::list<Handle(GEOM_Object)> fieldsObj;
std::list<Handle(GEOM_Object)> aFields; for (; ind < fields.length(); ind++)
for (; ind < aLenField; ind++) { {
Handle(GEOM_Object) aField = GetObjectImpl(thelFields[ind]); Handle(GEOM_Object) fobj = GetObjectImpl(fields[ind]);
if (aField.IsNull()) return false; if (fobj.IsNull()) return false;
aFields.push_back(aField); fieldsObj.push_back(fobj);
} }
if (!aReference.IsNull()) if (!reference.IsNull())
{ {
// Export XAO // Export XAO
isGood = GetOperations()->ExportXAO(aReference, theFileName, aGroups, aFields); isGood = GetOperations()->ExportXAO(fileName, reference, groupsObj, fieldsObj);
} }
return isGood; return isGood;
} }
//=============================================================================
/*!
* Import a shape from XAO Format
* \param fileName The name of the imported file
* \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),
// std::list<Handle_GEOM_Object, std::allocator<Handle_GEOM_Object> > groups,
// std::list<Handle_GEOM_Object, std::allocator<Handle_GEOM_Object> > fields)
//{
// return true;
//}
/*@@ insert new functions before this line @@ do not remove this line @@*/ /*@@ insert new functions before this line @@ do not remove this line @@*/

View File

@ -34,19 +34,25 @@
#include "GEOMImpl_IImportExportOperations.hxx" #include "GEOMImpl_IImportExportOperations.hxx"
class GEOM_I_EXPORT GEOM_IImportExportOperations_i : class GEOM_I_EXPORT GEOM_IImportExportOperations_i :
public virtual POA_GEOM::GEOM_IImportExportOperations, public virtual POA_GEOM::GEOM_IImportExportOperations,
public virtual GEOM_IOperations_i public virtual GEOM_IOperations_i
{ {
public: public:
GEOM_IImportExportOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, GEOM_IImportExportOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
::GEOMImpl_IImportExportOperations* theImpl); ::GEOMImpl_IImportExportOperations* theImpl);
~GEOM_IImportExportOperations_i(); ~GEOM_IImportExportOperations_i();
CORBA::Boolean ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, const GEOM::ListOfGO& thelGroups, const GEOM::ListOfGO& thelFields); CORBA::Boolean ExportXAO (const char* fileName,
GEOM::GEOM_Object_ptr shape,
const GEOM::ListOfGO& groups,
const GEOM::ListOfGO& fields);
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 @@*/ /*@@ insert new functions before this line @@ do not remove this line @@*/
::GEOMImpl_IImportExportOperations* GetOperations() ::GEOMImpl_IImportExportOperations* GetOperations()
{ return (::GEOMImpl_IImportExportOperations*)GetImpl(); } { return (::GEOMImpl_IImportExportOperations*)GetImpl();}
}; };
#endif #endif

View File

@ -3451,18 +3451,19 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedCylinder (CORBA::Double theR,
//============================================================================= //=============================================================================
// ExportXAO // ExportXAO
//============================================================================= //=============================================================================
CORBA::Boolean GEOM_Superv_i::ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, GEOM::GEOM_List_ptr thelGroups, GEOM::GEOM_List_ptr thelFields) CORBA::Boolean GEOM_Superv_i::ExportXAO (const char* fileName, GEOM::GEOM_Object_ptr shape,
GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields)
{ {
beginService( " GEOM_Superv_i::ExportXAO" ); beginService( " GEOM_Superv_i::ExportXAO" );
MESSAGE("GEOM_Superv_i::ExportXAO"); MESSAGE("GEOM_Superv_i::ExportXAO");
getImportExportOp(); getImportExportOp();
if (GEOM_List_i<GEOM::ListOfGO>* aListImplG = if (GEOM_List_i<GEOM::ListOfGO>* groupList =
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(thelGroups, myPOA).in())) dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(groups, myPOA).in()))
{ {
if (GEOM_List_i<GEOM::ListOfGO>* aListImplF = if (GEOM_List_i<GEOM::ListOfGO>* fieldList =
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(thelFields, myPOA).in())) dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(fields, myPOA).in()))
{ {
CORBA::Boolean isGood = myImportExportOp->ExportXAO(theExportingShape, theFileName, aListImplG->GetList(), aListImplF->GetList()); CORBA::Boolean isGood = myImportExportOp->ExportXAO(fileName, shape, groupList->GetList(), fieldList->GetList());
endService( " GEOM_Superv_i::ExportXAO" ); endService( " GEOM_Superv_i::ExportXAO" );
return isGood; return isGood;
} }
@ -3470,6 +3471,15 @@ CORBA::Boolean GEOM_Superv_i::ExportXAO (GEOM::GEOM_Object_ptr theExportingShape
endService( " GEOM_Superv_i::ExportXAO" ); endService( " GEOM_Superv_i::ExportXAO" );
return false; return false;
} }
//=============================================================================
// 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;
//}
/*@@ insert new functions before this line @@ do not remove this line @@*/ /*@@ insert new functions before this line @@ do not remove this line @@*/
//===================================================================================== //=====================================================================================

View File

@ -715,7 +715,10 @@ public:
//-----------------------------------------------------------// //-----------------------------------------------------------//
// ImportExport Operations // // ImportExport Operations //
//-----------------------------------------------------------// //-----------------------------------------------------------//
CORBA::Boolean ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, GEOM::GEOM_List_ptr thelGroups, GEOM::GEOM_List_ptr thelFields); CORBA::Boolean ExportXAO(const char* fileName,
GEOM::GEOM_Object_ptr shape, GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields);
// 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 @@*/ /*@@ insert new functions before this line @@ do not remove this line @@*/
private: private:

View File

@ -9074,16 +9074,16 @@ class geompyDC(GEOM._objref_GEOM_Gen):
return anObj return anObj
## Export a shape to XAO Format ## Export a shape to XAO Format
# @param theExportingShape Shape to export # @param shape Shape to export
# @param theFileName The name of the exported file # @param fileName The name of the exported file
# @param thelGroups List of groups to export # @param groups List of groups to export
# @param thelFields List of fields to export # @param fields List of fields to export
# @return New GEOM_Object, containing the created shape. # @return boolean
# #
# @ref tui_creation_exportxao "Example" # @ref tui_creation_exportxao "Example"
def ExportXAO(self, theExportingShape, theFileName, thelGroups, thelFields): def ExportXAO(self, fileName, shape, groups, fields):
theExportingShape, theFileName, thelGroups, thelFields, Parameters = ParseParameters(theExportingShape, theFileName, thelGroups, thelFields) fileName, shape, groups, fields, Parameters = ParseParameters(fileName, shape, groups, fields)
isGood = self.ImpExpOp.ExportXAO(theExportingShape, theFileName, thelGroups, thelFields) isGood = self.ImpExpOp.ExportXAO(fileName, shape, groups, fields)
RaiseIfFailed("ExportXAO", self.ImpExpOp) RaiseIfFailed("ExportXAO", self.ImpExpOp)
#if Parameters: anObj.SetParameters(Parameters) #if Parameters: anObj.SetParameters(Parameters)
return isGood return isGood

View File

@ -71,6 +71,8 @@ bool ImportExportGUI::OnGUIEvent(int commandId, SUIT_Desktop* parent)
case GEOMOp::OpExportXAO: case GEOMOp::OpExportXAO:
dialog = new ImportExportGUI_ExportXAODlg(getGeometryGUI(), parent); dialog = new ImportExportGUI_ExportXAODlg(getGeometryGUI(), parent);
break; break;
case GEOMOp::OpImportXAO:
break;
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@// //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
default: default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(commandId)); app->putInfo(tr("GEOM_PRP_COMMAND").arg(commandId));

View File

@ -30,6 +30,7 @@
#include <QLineEdit> #include <QLineEdit>
#include <QButtonGroup> #include <QButtonGroup>
#include <QListWidget> #include <QListWidget>
#include <QFileDialog>
#include <QMap> #include <QMap>
//#include <ui_ImportExportGUI_1Sel1LineEdit2ListWidget_QTD.h> //#include <ui_ImportExportGUI_1Sel1LineEdit2ListWidget_QTD.h>
@ -54,7 +55,7 @@ ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg(GeometryGUI* geometry
m_mainObj = GEOM::GEOM_Object::_nil(); m_mainObj = GEOM::GEOM_Object::_nil();
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
QPixmap imageOp(resMgr->loadPixmap("GEOM", tr("ICON_DLG_EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS"))); QPixmap imageOp(resMgr->loadPixmap("GEOM", tr("ICON_DLG_EXPORTXAO")));
QPixmap iconSelect(resMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap iconSelect(resMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle(tr("GEOM_EXPORTXAO_TITLE")); setWindowTitle(tr("GEOM_EXPORTXAO_TITLE"));
@ -67,57 +68,76 @@ ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg(GeometryGUI* geometry
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close(); mainFrame()->RadioButton3->close();
// hide name
mainFrame()->GroupBoxName->hide();
//****************************
// Selection Group box
QGroupBox* gbxExport = new QGroupBox(parent); QGroupBox* gbxExport = new QGroupBox(parent);
QGridLayout *gridLayoutExport = new QGridLayout(gbxExport); QGridLayout* gridLayoutExport = new QGridLayout(gbxExport);
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
gridLayoutExport->setSpacing(6); gridLayoutExport->setSpacing(6);
#endif
#ifndef Q_OS_MAC
gridLayoutExport->setContentsMargins(9, 9, 9, 9); gridLayoutExport->setContentsMargins(9, 9, 9, 9);
#endif #endif
gridLayoutExport->setObjectName(QString::fromUtf8("gridLayoutExport")); gridLayoutExport->setObjectName(QString::fromUtf8("gridLayoutExport"));
//**************************** // Line 0
QLabel* txtLabel1 = new QLabel(tr("GEOM_EXPORTXAO_EXPORTINGSHAPE"), gbxExport); QLabel* lblShape = new QLabel(tr("GEOM_EXPORTXAO_EXPORTINGSHAPE"), gbxExport);
gridLayoutExport->addWidget(txtLabel1, 0, 0, 1, 1); btnShapeSelect = new QPushButton(gbxExport);
btnShapeSelect->setIcon(iconSelect);
btnSelect = new QPushButton(gbxExport);
btnSelect->setIcon(iconSelect);
gridLayoutExport->addWidget(btnSelect, 0, 1, 1, 1);
ledShape = new QLineEdit(gbxExport); ledShape = new QLineEdit(gbxExport);
ledShape->setMinimumSize(QSize(100, 0)); 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); gridLayoutExport->addWidget(ledShape, 0, 2, 1, 1);
//**************************** // Line 1
QLabel* txtLabel2 = new QLabel(tr("GEOM_EXPORTXAO_FILENAME"), gbxExport); QLabel* lblFileName = new QLabel(tr("GEOM_EXPORTXAO_FILENAME"), gbxExport);
gridLayoutExport->addWidget(txtLabel2, 1, 0, 1, 1); btnFileSelect = new QPushButton(gbxExport);
ledFileName = new QLineEdit(gbxExport); ledFileName = new QLineEdit(gbxExport);
gridLayoutExport->addWidget(ledFileName, 1, 1, 1, 2); btnFileSelect->setText("...");
gridLayoutExport->addWidget(lblFileName, 1, 0, 1, 1);
gridLayoutExport->addWidget(btnFileSelect, 1, 1, 1, 1);
gridLayoutExport->addWidget(ledFileName, 1, 2, 1, 1);
//**************************** //****************************
QLabel* txtLabel3 = new QLabel(tr("GEOM_EXPORTXAO_LGROUPS"), gbxExport); // Filter Group box
gridLayoutExport->addWidget(txtLabel3, 2, 0, 1, 2); QGroupBox* gbxFilter = new QGroupBox(parent);
lstGroups = new QListWidget(gbxExport); QGridLayout* gridLayoutFilter = new QGridLayout(gbxFilter);
gridLayoutExport->addWidget(lstGroups, 3, 0, 1, 2); #ifndef Q_OS_MAC
gridLayoutFilter->setSpacing(6);
gridLayoutFilter->setContentsMargins(9, 9, 9, 9);
#endif
gridLayoutFilter->setObjectName(QString::fromUtf8("gbxFilter"));
QLabel* txtLabel4 = new QLabel(tr("GEOM_EXPORTXAO_LFIELDS"), gbxExport); // Line 0
gridLayoutExport->addWidget(txtLabel4, 2, 2, 1, 1); QLabel* lblGroups = new QLabel(tr("GEOM_EXPORTXAO_LGROUPS"), gbxFilter);
QLabel* lblFields = new QLabel(tr("GEOM_EXPORTXAO_LFIELDS"), gbxFilter);
lstFields = new QListWidget(gbxExport); gridLayoutFilter->addWidget(lblGroups, 0, 0, 1, 1);
gridLayoutExport->addWidget(lstFields, 3, 2, 1, 1); gridLayoutFilter->addWidget(lblFields, 0, 1, 1, 1);
// Line 1
lstGroups = new QListWidget(gbxFilter);
lstGroups->setSelectionMode(QAbstractItemView::ExtendedSelection);
lstFields = new QListWidget(gbxFilter);
lstFields ->setSelectionMode(QAbstractItemView::ExtendedSelection);
gridLayoutFilter->addWidget(lstGroups, 1, 0, 1, 1);
gridLayoutFilter->addWidget(lstFields, 1, 1, 1, 1);
//****************************
QVBoxLayout* layout = new QVBoxLayout(centralWidget()); QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setMargin(0);
layout->setSpacing(6); layout->setSpacing(6);
layout->addWidget(gbxExport); layout->addWidget(gbxExport);
layout->addWidget(gbxFilter);
//QWidget::setTabOrder(PushButton1, LineEdit1); // set help
//QWidget::setTabOrder(LineEdit1, LineEdit2);
setHelpFileName("create_exportxao_page.html"); setHelpFileName("create_exportxao_page.html");
Init(); Init();
@ -145,10 +165,13 @@ void ImportExportGUI_ExportXAODlg::Init()
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(btnSelect, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(btnShapeSelect, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(((SalomeApp_Application*) (SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(((SalomeApp_Application*) (SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect(btnFileSelect, SIGNAL(clicked()), this, SLOT(btnFileSelectClicked()));
initName(tr("GEOM_EXPORTXAO")); initName(tr("GEOM_EXPORTXAO"));
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -159,22 +182,33 @@ void ImportExportGUI_ExportXAODlg::Init()
//================================================================================= //=================================================================================
void ImportExportGUI_ExportXAODlg::processObject() void ImportExportGUI_ExportXAODlg::processObject()
{ {
lstGroups->clear();
lstFields->clear();
m_groups.clear();
m_fields.clear();
if (m_mainObj->_is_nil()) if (m_mainObj->_is_nil())
{ {
ledShape->setText(""); ledShape->setText("");
ledFileName->setText("");
} }
else else
{ {
ledShape->setText(GEOMBase::GetName(m_mainObj)); ledShape->setText(GEOMBase::GetName(m_mainObj));
GEOM::GEOM_IShapesOperations_var shapeOp = getGeomEngine()->GetIShapesOperations(getStudyId()); GEOM::GEOM_IShapesOperations_var shapeOp = getGeomEngine()->GetIShapesOperations(getStudyId());
GEOM::ListOfGO_var groups = shapeOp->GetExistingSubObjects(m_mainObj, true);
// add groups names // add groups names
GEOM::ListOfGO_var groups = shapeOp->GetExistingSubObjects(m_mainObj, true);
for (int i = 0, n = groups->length(); i < n; i++) for (int i = 0, n = groups->length(); i < n; i++)
{ {
lstGroups->addItem(GEOMBase::GetName(groups[i])); QListWidgetItem* item = new QListWidgetItem();
item->setData(Qt::UserRole, QVariant(i));
item->setText(GEOMBase::GetName(groups[i]));
lstGroups->addItem(item);
m_groups.append(GEOM::GeomObjPtr(groups[i].in())); m_groups.append(GEOM::GeomObjPtr(groups[i].in()));
} }
lstGroups->sortItems(Qt::AscendingOrder);
// TODO: add fields
} }
} }
@ -214,20 +248,11 @@ void ImportExportGUI_ExportXAODlg::SelectionIntoArgument()
SALOME_ListIO selList; SALOME_ListIO selList;
selMgr->selectedObjects(selList); selMgr->selectedObjects(selList);
if (selList.Extent() != 1) if (selList.Extent() == 1)
{ {
processObject(); m_mainObj = GEOMBase::ConvertIOinGEOMObject(selList.First());
return;
} }
/*GEOM::GEOM_Object_var aSelectedObject*/m_mainObj = GEOMBase::ConvertIOinGEOMObject(selList.First());
/*if ( aSelectedObject->_is_nil() ) {
processObject();
return;
}*/
//myMainObj = aSelectedObject;
processObject(); processObject();
} }
@ -241,6 +266,20 @@ void ImportExportGUI_ExportXAODlg::SetEditCurrentArgument()
myEditCurrentArgument = ledShape; myEditCurrentArgument = ledShape;
SelectionIntoArgument(); SelectionIntoArgument();
} }
//=================================================================================
// function : btnFileSelectClicked()
// purpose :
//=================================================================================
void ImportExportGUI_ExportXAODlg::btnFileSelectClicked()
{
QString selFile = QFileDialog::getSaveFileName(this, tr("GEOM_SELECT_XAO"), QString(), tr("XAO_FILES"));
if (!selFile.isEmpty())
{
ledFileName->setText(selFile);
}
}
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
@ -275,11 +314,15 @@ GEOM::GEOM_IOperations_ptr ImportExportGUI_ExportXAODlg::createOperation()
//================================================================================= //=================================================================================
bool ImportExportGUI_ExportXAODlg::isValid(QString& msg) bool ImportExportGUI_ExportXAODlg::isValid(QString& msg)
{ {
bool ok = true; // check shape
if (ledShape->text().isEmpty())
return false;
//@@ add custom validation actions here @@// // check file name
if (ledFileName->text().isEmpty())
return false;
return ok; return true;
} }
//================================================================================= //=================================================================================
@ -290,23 +333,33 @@ bool ImportExportGUI_ExportXAODlg::execute(ObjectList& objects)
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var obj; // get selected groups
QList<QListWidgetItem*> selGroups = lstGroups->selectedItems();
GEOM::ListOfGO_var groups = new GEOM::ListOfGO();
groups->length(selGroups.count());
int i = 0;
for (QList<QListWidgetItem*>::iterator it = selGroups.begin(); it != selGroups.end(); ++it)
{
QListWidgetItem* item = (*it);
int index = item->data(Qt::UserRole).toInt();
groups[i++] = m_groups[index].copy();
}
GEOM::GEOM_IImportExportOperations_var ieOp = GEOM::GEOM_IImportExportOperations::_narrow(getOperation()); // get selected fields
GEOM::GEOM_IShapesOperations_var shapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); QList<QListWidgetItem*> selFields = lstFields->selectedItems();
GEOM::ListOfGO_var groups = shapesOp->GetExistingSubObjects(m_mainObj, true);
GEOM::ListOfGO_var fields = new GEOM::ListOfGO(); GEOM::ListOfGO_var fields = new GEOM::ListOfGO();
groups->length(m_groups.count());
for (int i = 0; i < m_groups.count(); i++)
groups[i] = m_groups[i].copy();
fields->length(m_fields.count()); fields->length(m_fields.count());
for (int i = 0; i < m_fields.count(); i++) for (QList<QListWidgetItem*>::iterator it = selFields.begin(); it != selFields.end(); ++it)
fields[i] = m_fields[i].copy(); {
QListWidgetItem* item = (*it);
int index = item->data(Qt::UserRole).toInt();
fields[i++] = m_fields[index].copy();
}
// call engine function // call engine function
res = ieOp->ExportXAO(m_mainObj, ledFileName->text().toStdString().c_str(), groups, fields); GEOM::GEOM_IImportExportOperations_var ieOp = GEOM::GEOM_IImportExportOperations::_narrow(getOperation());
res = ieOp->ExportXAO(ledFileName->text().toStdString().c_str(),
m_mainObj, groups, fields);
return res; return res;
} }

View File

@ -59,7 +59,8 @@ private:
QLineEdit* ledFileName; QLineEdit* ledFileName;
QListWidget* lstGroups; QListWidget* lstGroups;
QListWidget* lstFields; QListWidget* lstFields;
QPushButton* btnSelect; QPushButton* btnShapeSelect;
QPushButton* btnFileSelect;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -68,6 +69,7 @@ private slots:
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void btnFileSelectClicked();
}; };
#endif // IMPORTEXPORTGUI_EXPORTXAODLG_H #endif // IMPORTEXPORTGUI_EXPORTXAODLG_H

View File

@ -35,12 +35,13 @@ if GEOM_ENABLE_GUI
DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI \ DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI \
BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI \ BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI \
GroupGUI BlocksGUI AdvancedGUI ImportExportGUI GEOM_SWIG_WITHIHM GroupGUI BlocksGUI AdvancedGUI ImportExportGUI GEOM_SWIG_WITHIHM
endif
if CPPUNIT_IS_OK if CPPUNIT_IS_OK
SUBDIRS += XAO/tests SUBDIRS += XAO/tests
endif endif
endif
DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo \ DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo \
SKETCHER OCC2VTK GEOM BREPExport \ SKETCHER OCC2VTK GEOM BREPExport \
BREPImport IGESExport IGESImport STEPExport STEPImport STLExport \ BREPImport IGESExport IGESImport STEPExport STEPImport STLExport \