mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-05 17:44:17 +05:00
last changes from nge
This commit is contained in:
parent
5737c25f53
commit
e508f5a4cc
@ -372,7 +372,7 @@ else
|
||||
fi
|
||||
echo
|
||||
|
||||
obligatory_vars="cc_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok"
|
||||
obligatory_vars="cc_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok boost_ok libxml_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok"
|
||||
optional_vars="opencv_ok"
|
||||
gui_vars="OpenGL_ok qt_ok gui_ok"
|
||||
|
||||
@ -495,6 +495,7 @@ AC_OUTPUT([ \
|
||||
doc/salome/tui/static/header.html \
|
||||
src/Makefile \
|
||||
src/AdvancedGUI/Makefile \
|
||||
src/XAO/Makefile \
|
||||
src/ImportExportGUI/Makefile \
|
||||
src/ARCHIMEDE/Makefile \
|
||||
src/BREPExport/Makefile \
|
||||
|
@ -37,7 +37,7 @@
|
||||
//=======================================================================
|
||||
const Standard_GUID& GEOMImpl_ExportXAODriver::GetID()
|
||||
{
|
||||
static Standard_GUID aGUID("FF1BBB71-5D14-4df2-980B-3A668264EA16");
|
||||
static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
|
||||
return aGUID;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,10 @@
|
||||
#include "GEOM_Function.hxx"
|
||||
#include "GEOM_PythonDump.hxx"
|
||||
|
||||
#include "Xao.hxx"
|
||||
#include "Geometry.hxx"
|
||||
#include "Group.hxx"
|
||||
|
||||
#include <GEOMImpl_ExportXAODriver.hxx>
|
||||
#include <GEOMImpl_IExportXAO.hxx>
|
||||
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
|
||||
@ -51,10 +55,14 @@
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
@ -78,14 +86,16 @@ GEOMImpl_IImportExportOperations::GEOMImpl_IImportExportOperations(GEOM_Engine*
|
||||
GEOM_IOperations(theEngine, theDocID)
|
||||
{
|
||||
MESSAGE("GEOMImpl_IImportExportOperations::GEOMImpl_IImportExportOperations");
|
||||
myBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
|
||||
/*myBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
|
||||
myBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
|
||||
myShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
|
||||
myTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
|
||||
myBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
|
||||
my3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
|
||||
myLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
|
||||
myHealingOperations = new GEOMImpl_IHealingOperations(GetEngine(), GetDocID());
|
||||
myHealingOperations = new GEOMImpl_IHealingOperations(GetEngine(), GetDocID());*/
|
||||
myShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
|
||||
myGroupOperations = new GEOMImpl_IGroupOperations(GetEngine(), GetDocID());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -96,14 +106,16 @@ GEOMImpl_IImportExportOperations::GEOMImpl_IImportExportOperations(GEOM_Engine*
|
||||
GEOMImpl_IImportExportOperations::~GEOMImpl_IImportExportOperations()
|
||||
{
|
||||
MESSAGE("GEOMImpl_IImportExportOperations::~GEOMImpl_IImportExportOperations");
|
||||
delete myBasicOperations;
|
||||
/*delete myBasicOperations;
|
||||
delete myBooleanOperations;
|
||||
delete myShapesOperations;
|
||||
delete myTransformOperations;
|
||||
delete myBlocksOperations;
|
||||
delete my3DPrimOperations;
|
||||
delete myLocalOperations;
|
||||
delete myHealingOperations;
|
||||
delete myHealingOperations;*/
|
||||
delete myShapesOperations;
|
||||
delete myGroupOperations;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -121,6 +133,8 @@ bool GEOMImpl_IImportExportOperations::ExportXAO (Handle(GEOM_Object) theExporti
|
||||
SetErrorCode(KO);
|
||||
bool isGood = false;
|
||||
|
||||
//
|
||||
|
||||
//Add a new shape function with parameters
|
||||
Handle(GEOM_Function) aRefFunction = theExportingShape->GetLastFunction();
|
||||
if (aRefFunction.IsNull()) return false;
|
||||
@ -135,13 +149,13 @@ bool GEOMImpl_IImportExportOperations::ExportXAO (Handle(GEOM_Object) theExporti
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_ExportXAODriver::GetID()) return false;
|
||||
|
||||
GEOMImpl_IExportXAO aData (aRefFunction);
|
||||
/*GEOMImpl_IExportXAO aData (aRefFunction);
|
||||
|
||||
TCollection_AsciiString FileName = theFileName.c_str();
|
||||
aData.SetExportingShape(aRefFunction);
|
||||
aData.SetFileName(FileName);
|
||||
/* A MODIFIER aData.SetlGroups(thelGroups);
|
||||
aData.SetlFields(thelFields);*/
|
||||
aData.SetlGroups(thelGroups);
|
||||
aData.SetlFields(thelFields);
|
||||
|
||||
//Compute the resulting value
|
||||
try {
|
||||
@ -157,14 +171,81 @@ bool GEOMImpl_IImportExportOperations::ExportXAO (Handle(GEOM_Object) theExporti
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return false;
|
||||
}*/
|
||||
TCollection_AsciiString FileName = theFileName.c_str();
|
||||
XAO::Xao *myXao = new XAO::Xao();
|
||||
XAO::Geometry *myGeometry = new XAO::Geometry();
|
||||
myGeometry->setShape(theExportingShape->GetValue());
|
||||
myGeometry->setName(theExportingShape->GetName());
|
||||
Handle(TColStd_HSequenceOfTransient) subObjects = myShapesOperations->GetExistingSubObjects(theExportingShape, false);
|
||||
int nbSubObjects = subObjects->Length();
|
||||
for (int i = 1 ; i <= nbSubObjects ; i++) {
|
||||
Handle(Standard_Transient) anTransientSubObject = subObjects->Value(i);
|
||||
if (anTransientSubObject.IsNull())
|
||||
continue;
|
||||
Handle(GEOM_Object) asubObject = Handle(GEOM_Object)::DownCast(anTransientSubObject);
|
||||
if (asubObject->GetType() != GEOM_GROUP)
|
||||
{
|
||||
int index = myShapesOperations->GetSubShapeIndex(theExportingShape,asubObject);
|
||||
switch (asubObject->GetValue().ShapeType() )
|
||||
{
|
||||
case TopAbs_SOLID:
|
||||
break;
|
||||
case TopAbs_FACE:
|
||||
break;
|
||||
case TopAbs_EDGE:
|
||||
break;
|
||||
case TopAbs_VERTEX:
|
||||
myGeometry->setVertexName(index,asubObject->GetName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
myXao->setGeometry(myGeometry);
|
||||
|
||||
// Adding groups
|
||||
std::list<Handle(GEOM_Object)>::iterator itG1 = thelGroups.begin();
|
||||
while (itG1 != thelGroups.end()) {
|
||||
Handle(GEOM_Object) itGroup = (*itG1++);
|
||||
XAO::Group *Group = new XAO::Group();
|
||||
Group->setName(itGroup->GetName());
|
||||
Handle(TColStd_HArray1OfInteger) groupIds = myGroupOperations->GetObjects(itGroup);
|
||||
TopAbs_ShapeEnum shapeGroup = myGroupOperations->GetType(itGroup);
|
||||
if (shapeGroup == TopAbs_VERTEX)
|
||||
{
|
||||
Group->setType(0);
|
||||
for (int i = 1; i <= groupIds->Length(); i++)
|
||||
{
|
||||
int index = myGeometry->findVertex(groupIds->Value(i));
|
||||
Group->addValue(index);
|
||||
}
|
||||
}
|
||||
myXao->addGroup(Group);
|
||||
/*{
|
||||
case TopAbs_SOLID:
|
||||
Group->setType(3);
|
||||
break;
|
||||
case TopAbs_FACE:
|
||||
Group->setType(2);
|
||||
break;
|
||||
case TopAbs_EDGE:
|
||||
Group->setType(1);
|
||||
break;
|
||||
case TopAbs_VERTEX:
|
||||
Group->setType(0);
|
||||
break;
|
||||
} */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pd (aFunction);
|
||||
std::list<Handle(GEOM_Object)>::iterator itG = thelGroups.begin();
|
||||
std::list<Handle(GEOM_Object)>::iterator itF = thelFields.begin();
|
||||
pd << /*isGood <<*/ " = geompy.ExportXAO(" << theExportingShape << ", " << FileName.ToCString() << ", [";
|
||||
//itG = thePoints.begin();
|
||||
|
||||
pd << (*itG++);
|
||||
while (itG != thelGroups.end()) {
|
||||
pd << ", " << (*itG++);
|
||||
|
@ -29,26 +29,30 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
class GEOMImpl_IBasicOperations;
|
||||
/*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_IHealingOperations;*/
|
||||
class GEOMImpl_IShapesOperations;
|
||||
class GEOMImpl_IGroupOperations;
|
||||
|
||||
class GEOMImpl_IImportExportOperations: public GEOM_IOperations {
|
||||
|
||||
private:
|
||||
GEOMImpl_IBasicOperations* myBasicOperations;
|
||||
/*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_IHealingOperations* myHealingOperations;*/
|
||||
GEOMImpl_IShapesOperations* myShapesOperations;
|
||||
GEOMImpl_IGroupOperations* myGroupOperations;
|
||||
|
||||
public:
|
||||
Standard_EXPORT GEOMImpl_IImportExportOperations(GEOM_Engine* theEngine, int theDocID);
|
||||
|
@ -80,6 +80,8 @@
|
||||
|
||||
#define GEOM_GROUP 37
|
||||
|
||||
#define GEOM_FIELD 370
|
||||
|
||||
#define GEOM_BLOCK 38
|
||||
|
||||
#define GEOM_MARKER 39
|
||||
|
@ -249,6 +249,7 @@ libGEOMimpl_la_CPPFLAGS = \
|
||||
-I$(srcdir)/../GEOMAlgo \
|
||||
-I$(srcdir)/../SKETCHER \
|
||||
-I$(srcdir)/../ARCHIMEDE \
|
||||
-I$(srcdir)/../XAO \
|
||||
-I$(top_builddir)/idl
|
||||
|
||||
libGEOMimpl_la_LDFLAGS = \
|
||||
@ -257,6 +258,7 @@ libGEOMimpl_la_LDFLAGS = \
|
||||
../ShHealOper/libShHealOper.la \
|
||||
../ARCHIMEDE/libGEOMArchimede.la \
|
||||
../SKETCHER/libGEOMSketcher.la \
|
||||
../XAO/libXAO.la \
|
||||
$(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \
|
||||
$(STDLIB) \
|
||||
$(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lTKFeat \
|
||||
|
@ -736,6 +736,7 @@ private:
|
||||
GEOM::GEOM_ILocalOperations_var myLocalOp;
|
||||
GEOM::GEOM_IGroupOperations_var myGroupOp;
|
||||
GEOM::GEOM_IAdvancedOperations_var myAdvancedOp;
|
||||
GEOM::GEOM_IImportExportOperations_var myImportExportOp;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -25,13 +25,17 @@
|
||||
#include "GeometryGUI.h"
|
||||
#include "GeometryGUI_Operations.h"
|
||||
|
||||
#include <GEOMBase.h>
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_MessageBox.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
|
||||
#include "ImportExportGUI_ExportXAODlg.h"
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
|
||||
|
||||
#include <QDialog>
|
||||
#include <iostream>
|
||||
|
||||
//=======================================================================
|
||||
// function : ImportExportGUI()
|
||||
@ -62,7 +66,9 @@ bool ImportExportGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
||||
|
||||
QDialog* aDlg = NULL;
|
||||
|
||||
switch ( theCommandID ) { case GEOMOp::OpExportXAO:
|
||||
switch ( theCommandID ) {
|
||||
case GEOMOp::OpExportXAO:
|
||||
cout << "test" << endl;
|
||||
aDlg = new ImportExportGUI_ExportXAODlg( getGeometryGUI(), parent );
|
||||
break;
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
|
||||
|
@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ImportExportGUI_1Sel1LineEdit2ListWidget_QTD</class>
|
||||
<widget class="QWidget" name="ImportExportGUI_1Sel1LineEdit2ListWidget_QTD">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>222</width>
|
||||
<height>178</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="GroupBox1">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="LineEdit2"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="TextLabel2">
|
||||
<property name="text">
|
||||
<string>TL2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="PushButton1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="TextLabel1">
|
||||
<property name="text">
|
||||
<string>TL1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="LineEdit1">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="TextLabel3">
|
||||
<property name="text">
|
||||
<string>TL3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="TextLabel4">
|
||||
<property name="text">
|
||||
<string>TL4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QListWidget" name="listWidget1"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QListWidget" name="listWidget2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>PushButton1</tabstop>
|
||||
<tabstop>LineEdit1</tabstop>
|
||||
<tabstop>LineEdit2</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -20,7 +20,7 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
#include "ImportExportGUI_ExportXAODlg.h"
|
||||
#include "ImportExportGUI_Widgets.h"
|
||||
//#include "ImportExportGUI_Widgets.h"
|
||||
|
||||
#include <DlgRef.h>
|
||||
#include <GeometryGUI.h>
|
||||
@ -29,10 +29,13 @@
|
||||
#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 <QMap>
|
||||
//#include <ui_ImportExportGUI_1Sel1LineEdit2ListWidget_QTD.h>
|
||||
|
||||
@ -51,9 +54,11 @@
|
||||
ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg (GeometryGUI* theGeometryGUI, QWidget* parent)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, false)
|
||||
{
|
||||
myMainObj = GEOM::GEOM_Object::_nil();
|
||||
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
QPixmap imageOp (resMgr->loadPixmap("GEOM", tr("ICON_DLG_EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS")));
|
||||
QPixmap imageSel (resMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
QPixmap iconSelect (resMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle(tr("GEOM_EXPORTXAO_TITLE"));
|
||||
|
||||
@ -65,13 +70,57 @@ ImportExportGUI_ExportXAODlg::ImportExportGUI_ExportXAODlg (GeometryGUI* theGeom
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
myGrp = new ImportExportGUI_1Sel1LineEdit2ListWidget( centralWidget() );
|
||||
myGrp->GroupBox1->setTitle( tr( "GEOM_EXPORTXAO" ) );
|
||||
myGrp->TextLabel1->setText( tr( "GEOM_EXPORTXAO_EXPORTINGSHAPE" ) );
|
||||
myGrp->TextLabel2->setText( tr( "GEOM_EXPORTXAO_FILENAME" ) );
|
||||
myGrp->TextLabel3->setText( tr( "GEOM_EXPORTXAO_LGROUPS" ) );
|
||||
myGrp->TextLabel4->setText( tr( "GEOM_EXPORTXAO_LFIELDS" ) );
|
||||
myGrp->PushButton1->setIcon( imageSel );
|
||||
|
||||
QGroupBox *GroupBoxExport = new QGroupBox(parent);
|
||||
|
||||
QGridLayout *gridLayoutExport = new QGridLayout(GroupBoxExport);
|
||||
#ifndef Q_OS_MAC
|
||||
gridLayoutExport->setSpacing(6);
|
||||
#endif
|
||||
#ifndef Q_OS_MAC
|
||||
gridLayoutExport->setContentsMargins(9, 9, 9, 9);
|
||||
#endif
|
||||
gridLayoutExport->setObjectName(QString::fromUtf8("gridLayoutExport"));
|
||||
|
||||
//****************************
|
||||
QLabel *TextLabel1 = new QLabel(tr( "GEOM_EXPORTXAO_EXPORTINGSHAPE" ),GroupBoxExport);
|
||||
gridLayoutExport->addWidget(TextLabel1, 0, 0, 1, 1);
|
||||
|
||||
mySelBtn = new QPushButton(GroupBoxExport);
|
||||
mySelBtn->setIcon(iconSelect);
|
||||
gridLayoutExport->addWidget(mySelBtn, 0, 1, 1, 1);
|
||||
|
||||
myMainShape = new QLineEdit(GroupBoxExport);
|
||||
myMainShape->setMinimumSize(QSize(100, 0));
|
||||
gridLayoutExport->addWidget(myMainShape, 0, 2, 1, 1);
|
||||
|
||||
//****************************
|
||||
QLabel *TextLabel2 = new QLabel(tr( "GEOM_EXPORTXAO_FILENAME" ),GroupBoxExport);
|
||||
gridLayoutExport->addWidget(TextLabel2, 1, 0, 1, 1);
|
||||
|
||||
myMainFile = new QLineEdit(GroupBoxExport);
|
||||
gridLayoutExport->addWidget(myMainFile, 1, 1, 1, 2);
|
||||
|
||||
//****************************
|
||||
QLabel *TextLabel3 = new QLabel(tr( "GEOM_EXPORTXAO_LGROUPS" ),GroupBoxExport);
|
||||
gridLayoutExport->addWidget(TextLabel3, 2, 0, 1, 2);
|
||||
|
||||
myListGroups = new QListWidget(GroupBoxExport);
|
||||
gridLayoutExport->addWidget(myListGroups, 3, 0, 1, 2);
|
||||
|
||||
QLabel *TextLabel4 = new QLabel(tr( "GEOM_EXPORTXAO_LFIELDS" ),GroupBoxExport);
|
||||
gridLayoutExport->addWidget(TextLabel4, 2, 2, 1, 1);
|
||||
|
||||
myListFields = new QListWidget(GroupBoxExport);
|
||||
gridLayoutExport->addWidget(myListFields, 3, 2, 1, 1);
|
||||
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupBoxExport);
|
||||
|
||||
//QWidget::setTabOrder(PushButton1, LineEdit1);
|
||||
//QWidget::setTabOrder(LineEdit1, LineEdit2);
|
||||
|
||||
setHelpFileName("create_exportxao_page.html");
|
||||
|
||||
@ -93,12 +142,14 @@ ImportExportGUI_ExportXAODlg::~ImportExportGUI_ExportXAODlg()
|
||||
void ImportExportGUI_ExportXAODlg::Init()
|
||||
{
|
||||
// Get setting of step value from file configuration
|
||||
myGroups.clear();
|
||||
myFields.clear();
|
||||
|
||||
// Signal/slot connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( mySelBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
@ -113,14 +164,18 @@ void ImportExportGUI_ExportXAODlg::Init()
|
||||
void ImportExportGUI_ExportXAODlg::processObject()
|
||||
{
|
||||
if ( myMainObj->_is_nil() ) {
|
||||
myGrp->LineEdit1->setText( "" );
|
||||
myGrp->LineEdit2->setText( "" );
|
||||
erasePreview();
|
||||
myMainShape->setText( "" );
|
||||
myMainFile->setText( "" );
|
||||
}
|
||||
else {
|
||||
myGrp->LineEdit1->setText( GEOMBase::GetName( myMainObj ) );
|
||||
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
myMainShape->setText( GEOMBase::GetName( myMainObj ) );
|
||||
GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
GEOM::ListOfGO_var Groups = aShOp->GetExistingSubObjects(myMainObj, true);
|
||||
// Affichage des noms des groupes
|
||||
for ( int i = 0, n = Groups->length(); i < n; i++ )
|
||||
{
|
||||
myListGroups->addItem( GEOMBase::GetName( Groups[i] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,7 +209,6 @@ bool ImportExportGUI_ExportXAODlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void ImportExportGUI_ExportXAODlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myMainObj = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
@ -166,15 +220,15 @@ void ImportExportGUI_ExportXAODlg::SelectionIntoArgument()
|
||||
return;
|
||||
}
|
||||
|
||||
GEOM::GEOM_Object_var aSelectedObject =
|
||||
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
/*GEOM::GEOM_Object_var aSelectedObject*/myMainObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
|
||||
if ( aSelectedObject->_is_nil() ) {
|
||||
/*if ( aSelectedObject->_is_nil() ) {
|
||||
processObject();
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
//myMainObj = aSelectedObject;
|
||||
|
||||
myMainObj = aSelectedObject;
|
||||
processObject();
|
||||
}
|
||||
|
||||
@ -184,8 +238,8 @@ void ImportExportGUI_ExportXAODlg::SelectionIntoArgument()
|
||||
//=================================================================================
|
||||
void ImportExportGUI_ExportXAODlg::SetEditCurrentArgument()
|
||||
{
|
||||
myGrp->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = myGrp->LineEdit1;
|
||||
myMainShape->setFocus();
|
||||
myEditCurrentArgument = myMainShape;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
//=================================================================================
|
||||
@ -240,29 +294,20 @@ bool ImportExportGUI_ExportXAODlg::execute (ObjectList& objects)
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_IImportExportOperations_var anOper = GEOM::GEOM_IImportExportOperations::_narrow(getOperation());
|
||||
GEOM::GEOM_IShapesOperations_var anShapesOper = getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
GEOM::ListOfGO_var mylGroups = anShapesOper->GetExistingSubObjects(myMainObj, true);
|
||||
GEOM::ListOfGO_var mylFields = new GEOM::ListOfGO();
|
||||
|
||||
/*//@@ retrieve input values from the widgets here @@//
|
||||
CORBA::Double theExportingShape = @@ init parameter value from dialog box @@;
|
||||
CORBA::String_var theFileName = @@ init parameter value from dialog box @@;
|
||||
CORBA::Boolean thelGroups = @@ init parameter value from dialog box @@;
|
||||
CORBA::Boolean thelFields = @@ init parameter value from dialog box @@;
|
||||
mylGroups->length( myGroups.count() );
|
||||
for ( int i = 0; i < myGroups.count(); i++ )
|
||||
mylGroups[i] = myGroups[i].copy();
|
||||
|
||||
mylFields->length( myFields.count() );
|
||||
for ( int i = 0; i < myFields.count(); i++ )
|
||||
mylFields[i] = myFields[i].copy();
|
||||
|
||||
// call engine function
|
||||
anObj = anOper->ExportXAO(theExportingShape, theFileName, thelGroups, thelFields);
|
||||
res = !anObj->_is_nil();
|
||||
if (res && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
//@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
|
||||
aParameters << @@ stringified parameter value @@; // ExportingShape parameter
|
||||
aParameters << @@ stringified parameter value @@; // FileName parameter
|
||||
aParameters << @@ stringified parameter value @@; // lGroups parameter
|
||||
aParameters << @@ stringified parameter value @@; // lFields parameter
|
||||
if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
|
||||
if (res)
|
||||
objects.push_back(anObj._retn());*/
|
||||
res = anOper->ExportXAO(myMainObj, myMainFile->text().toStdString().c_str(), mylGroups, mylFields);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -23,11 +23,13 @@
|
||||
#define IMPORTEXPORTGUI_EXPORTXAODLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class QGroupBox;
|
||||
class QLineEdit;
|
||||
class QButtonGroup;
|
||||
class ImportExportGUI_1Sel1LineEdit2ListWidget;
|
||||
class QListWidget;
|
||||
|
||||
//class ImportExportGUI_1Sel1LineEdit2ListWidget;
|
||||
|
||||
//=================================================================================
|
||||
// class : ImportExportGUI_ExportXAODlg
|
||||
@ -54,12 +56,20 @@ private:
|
||||
|
||||
private:
|
||||
GEOM::GEOM_Object_var myMainObj;
|
||||
ImportExportGUI_1Sel1LineEdit2ListWidget* myGrp;
|
||||
QList<GEOM::GeomObjPtr> myGroups;
|
||||
QList<GEOM::GeomObjPtr> myFields;
|
||||
//ImportExportGUI_1Sel1LineEdit2ListWidget* myGrp;
|
||||
QLineEdit *myMainShape;
|
||||
QLineEdit *myMainFile;
|
||||
QListWidget *myListGroups;
|
||||
QListWidget *myListFields;
|
||||
QPushButton *mySelBtn;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
//void ValueChangedInSpinBox();
|
||||
|
@ -1,37 +0,0 @@
|
||||
// Copyright (C) 2007-2012 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
|
||||
//
|
||||
|
||||
// File : ImportExportGUI_Widgets.cxx
|
||||
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
|
||||
//
|
||||
#include "ImportExportGUI_Widgets.h"
|
||||
|
||||
//////////////////////////////////////////
|
||||
// ImportExportGUI_1Sel1LineEdit2ListWidget
|
||||
//////////////////////////////////////////
|
||||
|
||||
ImportExportGUI_1Sel1LineEdit2ListWidget::ImportExportGUI_1Sel1LineEdit2ListWidget( QWidget* parent, Qt::WindowFlags f )
|
||||
: QWidget( parent, f )
|
||||
{
|
||||
setupUi( this );
|
||||
}
|
||||
ImportExportGUI_1Sel1LineEdit2ListWidget::~ImportExportGUI_1Sel1LineEdit2ListWidget()
|
||||
{
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
// Copyright (C) 2007-2012 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
|
||||
//
|
||||
|
||||
// File : IMPORTEXPORTGUI_Widgets.h
|
||||
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
|
||||
//
|
||||
#ifndef IMPORTEXPORTGUI_WIDGETS_H
|
||||
#define IMPORTEXPORTGUI_WIDGETS_H
|
||||
|
||||
//////////////////////////////////////////
|
||||
// ImportExportGUI_1Sel1LineEdit2ListWidget
|
||||
//////////////////////////////////////////
|
||||
|
||||
#include "ui_ImportExportGUI_1Sel1LineEdit2ListWidget_QTD.h"
|
||||
|
||||
class ImportExportGUI_1Sel1LineEdit2ListWidget : public QWidget,
|
||||
public Ui::ImportExportGUI_1Sel1LineEdit2ListWidget_QTD
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ImportExportGUI_1Sel1LineEdit2ListWidget( QWidget* = 0, Qt::WindowFlags = 0 );
|
||||
~ImportExportGUI_1Sel1LineEdit2ListWidget();
|
||||
};
|
||||
|
||||
#endif // MEASUREGUI_WIDGETS_H
|
@ -22,33 +22,35 @@
|
||||
#
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
# header files
|
||||
salomeinclude_HEADERS = \
|
||||
ImportExportGUI.h \
|
||||
ImportExportGUI_Widgets.h
|
||||
|
||||
IMPORTEXPORT_INCLUDES =
|
||||
IMPORTEXPORT_INCLUDES += ImportExportGUI_ExportXAODlg.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)
|
||||
|
||||
# Libraries targets
|
||||
lib_LTLIBRARIES = libImportExportGUI.la
|
||||
|
||||
dist_libImportExportGUI_la_SOURCES = \
|
||||
ImportExportGUI.cxx \
|
||||
ImportExportGUI_Widgets.cxx
|
||||
# header files
|
||||
salomeinclude_HEADERS = \
|
||||
ImportExportGUI.h \
|
||||
ImportExportGUI_ExportXAODlg.h
|
||||
|
||||
IMPORTEXPORT_SOURCES =
|
||||
IMPORTEXPORT_SOURCES += ImportExportGUI_ExportXAODlg.h ImportExportGUI_ExportXAODlg.cxx
|
||||
#IMPORTEXPORT_INCLUDES =
|
||||
#IMPORTEXPORT_INCLUDES += ImportExportGUI_ExportXAODlg.h
|
||||
##@@ 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)
|
||||
#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
|
||||
##@@ 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 =
|
||||
IMPORTEXPORT_MOC_FILES = ImportExportGUI_moc.cxx
|
||||
IMPORTEXPORT_MOC_FILES += ImportExportGUI_ExportXAODlg_moc.cxx
|
||||
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
|
||||
|
||||
@ -57,10 +59,6 @@ MOC_FILES += $(IMPORTEXPORT_MOC_FILES)
|
||||
nodist_libImportExportGUI_la_SOURCES = \
|
||||
$(MOC_FILES)
|
||||
|
||||
UIC_FILES = \
|
||||
ui_ImportExportGUI_1Sel1LineEdit2ListWidget_QTD.h
|
||||
|
||||
BUILT_SOURCES = $(UIC_FILES)
|
||||
# additional information to compile and link file
|
||||
|
||||
libImportExportGUI_la_CPPFLAGS = \
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER OCC2VTK GEOM \
|
||||
BREPExport BREPImport IGESExport IGESImport STEPExport \
|
||||
STEPImport STLExport VTKExport ShHealOper GEOMImpl GEOM_I \
|
||||
STEPImport STLExport VTKExport ShHealOper XAO GEOMImpl GEOM_I \
|
||||
GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY
|
||||
|
||||
if WITH_OPENCV
|
||||
@ -40,9 +40,9 @@ endif
|
||||
DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo \
|
||||
SKETCHER OCC2VTK GEOM BREPExport \
|
||||
BREPImport IGESExport IGESImport STEPExport STEPImport STLExport \
|
||||
VTKExport ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv \
|
||||
VTKExport ShHealOper XAO GEOMImpl GEOM_I GEOMClient GEOM_I_Superv \
|
||||
GEOM_SWIG OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \
|
||||
GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \
|
||||
EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \
|
||||
RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \
|
||||
RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI ImportExportGUI \
|
||||
GEOM_SWIG_WITHIHM GEOM_PY ShapeRecognition
|
||||
|
@ -30,6 +30,18 @@
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <list>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace XAO;
|
||||
@ -78,47 +90,161 @@ Geometry::~Geometry()
|
||||
delete _myIdsSolids;
|
||||
}
|
||||
|
||||
Geometry *Geometry::New()
|
||||
void Geometry::setShape(TopoDS_Shape Shape)
|
||||
{
|
||||
return new Geometry;
|
||||
_myShape = Shape;
|
||||
|
||||
// intialization of Ids
|
||||
initListIds(TopAbs_VERTEX);
|
||||
initListIds(TopAbs_EDGE);
|
||||
initListIds(TopAbs_FACE);
|
||||
initListIds(TopAbs_SOLID);
|
||||
}
|
||||
|
||||
void Geometry::initShapeFromBREP(const char * brep )
|
||||
void Geometry::setShape(const char * brep )
|
||||
{
|
||||
istringstream streamBrep(brep);
|
||||
BRep_Builder aBuilder;
|
||||
BRepTools::Read(_myShape, streamBrep, aBuilder);
|
||||
|
||||
// intialization of Ids
|
||||
initListIds(TopAbs_VERTEX);
|
||||
initListIds(TopAbs_EDGE);
|
||||
initListIds(TopAbs_FACE);
|
||||
initListIds(TopAbs_SOLID);
|
||||
}
|
||||
|
||||
const char * Geometry::convertShapeToBREP()
|
||||
const char * Geometry::getBREP()
|
||||
{
|
||||
ostringstream streamShape;
|
||||
BRepTools::Write(_myShape, streamShape);
|
||||
return streamShape.str().c_str();
|
||||
}
|
||||
|
||||
void Geometry::setNameVerticesAt(int i, const char *myName)
|
||||
void Geometry::setVertexName(int index, const char *myName)
|
||||
{
|
||||
if (_myNbVertices == 0 || i > _myNbVertices)
|
||||
if (_myNbVertices == 0 || index > _myNbVertices)
|
||||
Standard_TypeMismatch::Raise("Problem with number of vertices");
|
||||
|
||||
if (_myNamesVertices == NULL)
|
||||
_myNamesVertices = new std::string[_myNbVertices];
|
||||
|
||||
_myNamesVertices[i] = myName;
|
||||
_myNamesVertices[index] = myName;
|
||||
}
|
||||
|
||||
void Geometry::setNamesVertices(const char **myNames)
|
||||
void Geometry::changeVertexName(int id, const char *myName)
|
||||
{
|
||||
if (_myNbVertices == 0)
|
||||
Standard_TypeMismatch::Raise("Problem with number of vertices");
|
||||
|
||||
if (_myNamesVertices == NULL)
|
||||
_myNamesVertices = new std::string[_myNbVertices];
|
||||
|
||||
for (int i = 0;i < _myNbVertices; i++)
|
||||
_myNamesVertices[i] = * myNames[i];
|
||||
int index = findVertex(id);
|
||||
|
||||
if (index == -1)
|
||||
Standard_TypeMismatch::Raise("Problem with the id of the vertex");
|
||||
|
||||
_myNamesVertices[index] = myName;
|
||||
}
|
||||
|
||||
void Geometry::initIdsVertices()
|
||||
const char * Geometry::findVertexName(int id)
|
||||
{
|
||||
//TopTools_ListOfShape listShape;
|
||||
if (_myNbVertices == 0) {
|
||||
Standard_TypeMismatch::Raise("Problem with number of vertices");
|
||||
return "";
|
||||
}
|
||||
|
||||
int index = findVertex(id);
|
||||
|
||||
if (index == -1) {
|
||||
Standard_TypeMismatch::Raise("Problem with the id of the vertex");
|
||||
return "";
|
||||
}
|
||||
|
||||
return _myNamesVertices[index].c_str();
|
||||
}
|
||||
|
||||
int Geometry::findVertex(int id)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0, n = _myNbVertices; i < n; i++)
|
||||
{
|
||||
if (_myIdsVertices[i] == id)
|
||||
return i;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
void Geometry::initListIds(const Standard_Integer theShapeType)
|
||||
{
|
||||
std::list<int> aList;
|
||||
|
||||
TopTools_MapOfShape mapShape;
|
||||
TopTools_ListOfShape listShape;
|
||||
|
||||
TopExp_Explorer exp (_myShape, TopAbs_ShapeEnum(theShapeType));
|
||||
for (; exp.More(); exp.Next())
|
||||
if (mapShape.Add(exp.Current()))
|
||||
listShape.Append(exp.Current());
|
||||
|
||||
if (listShape.IsEmpty()) {
|
||||
return ;
|
||||
}
|
||||
|
||||
TopTools_IndexedMapOfShape anIndices;
|
||||
TopExp::MapShapes(_myShape, anIndices);
|
||||
Handle(TColStd_HArray1OfInteger) anArray;
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itSub (listShape);
|
||||
for (int index = 1; itSub.More(); itSub.Next(), ++index) {
|
||||
TopoDS_Shape aValue = itSub.Value();
|
||||
aList.push_back(anIndices.FindIndex(aValue));
|
||||
}
|
||||
|
||||
std::list<int>::iterator it = aList.begin();
|
||||
switch ( theShapeType ) {
|
||||
case TopAbs_VERTEX: /* Fill vertices ids */
|
||||
{
|
||||
_myNbVertices = aList.size();
|
||||
if (_myIdsVertices != NULL)
|
||||
delete _myIdsVertices;
|
||||
_myIdsVertices = new int[_myNbVertices];
|
||||
for (int i = 0; it != aList.end(); it++, i++)
|
||||
_myIdsVertices[i] = (*it);
|
||||
break;
|
||||
}
|
||||
case TopAbs_EDGE: /* Fill edges ids */
|
||||
{
|
||||
_myNbEdges = aList.size();
|
||||
if (_myIdsEdges != NULL)
|
||||
delete _myIdsEdges;
|
||||
_myIdsEdges = new int[_myNbEdges];
|
||||
for (int i = 0; it != aList.end(); it++, i++)
|
||||
_myIdsEdges[i] = (*it);
|
||||
break;
|
||||
}
|
||||
case TopAbs_FACE: /* Fill faces ids */
|
||||
{
|
||||
_myNbFaces = aList.size();
|
||||
if (_myIdsFaces != NULL)
|
||||
delete _myIdsFaces;
|
||||
_myIdsFaces = new int[_myNbFaces];
|
||||
for (int i = 0; it != aList.end(); it++, i++)
|
||||
_myIdsFaces[i] = (*it);
|
||||
break;
|
||||
}
|
||||
case TopAbs_SOLID: /* Fill solids ids */
|
||||
{
|
||||
_myNbSolids = aList.size();
|
||||
if (_myIdsSolids != NULL)
|
||||
delete _myIdsSolids;
|
||||
_myIdsSolids = new int[_myNbSolids];
|
||||
for (int i = 0; it != aList.end(); it++, i++)
|
||||
_myIdsSolids[i] = (*it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,36 +31,35 @@ namespace XAO
|
||||
class Geometry
|
||||
{
|
||||
public:
|
||||
static Geometry *New();
|
||||
Geometry();
|
||||
~Geometry();
|
||||
|
||||
void setName(const char *name) { _myName=name; }
|
||||
const char *getName() const { return _myName.c_str(); }
|
||||
|
||||
void setFormat(const char *format) { _myFormat=format; }
|
||||
const char *getFormat() const { return _myFormat.c_str(); }
|
||||
|
||||
void setShape(TopoDS_Shape &Shape) { _myShape=Shape; }
|
||||
void setShape(TopoDS_Shape Shape);
|
||||
TopoDS_Shape getShape() { return _myShape; }
|
||||
|
||||
void initShapeFromBREP(const char * brep );
|
||||
const char * convertShapeToBREP();
|
||||
void setShape(const char * brep );
|
||||
const char * getBREP();
|
||||
|
||||
void setNbVertices(int nb) { _myNbVertices=nb; }
|
||||
int getNbVertices() { return _myNbVertices; }
|
||||
void setNameVerticesAt(int i, const char *myName);
|
||||
void setNamesVertices(const char **myNames);
|
||||
const char * getNameVerticesAt(int i) { return _myNamesVertices[i].c_str(); }
|
||||
void initIdsVertices();
|
||||
int * getIdsVertices();
|
||||
int countVertices() { return _myNbVertices; }
|
||||
int findVertex(int id);
|
||||
void setVertexName(int index, const char *myName);
|
||||
const char * getVertexName(int index) { return _myNamesVertices[index].c_str(); }
|
||||
void changeVertexName(int id, const char *myName);
|
||||
const char * findVertexName(int id);
|
||||
|
||||
int countEdges() { return _myNbEdges; }
|
||||
int countFaces() { return _myNbFaces; }
|
||||
int countSolids() { return _myNbSolids; }
|
||||
|
||||
void setNbEdges(int nb) { _myNbEdges=nb; }
|
||||
int getNbEdges() { return _myNbEdges; }
|
||||
void setNbFaces(int nb) { _myNbFaces=nb; }
|
||||
int getNbFaces() { return _myNbFaces; }
|
||||
void setNbSolids(int nb) { _myNbSolids=nb; }
|
||||
int getNbSolids() { return _myNbSolids; }
|
||||
|
||||
private:
|
||||
Geometry();
|
||||
~Geometry();
|
||||
void initListIds(const Standard_Integer theShapeType);
|
||||
|
||||
private:
|
||||
TopoDS_Shape _myShape;
|
||||
|
@ -26,17 +26,10 @@ Group::Group()
|
||||
{
|
||||
_myType = 0;
|
||||
_myCount = 0;
|
||||
_myValues = NULL;
|
||||
}
|
||||
|
||||
Group::~Group()
|
||||
{
|
||||
if (_myValues != NULL)
|
||||
delete _myValues;
|
||||
}
|
||||
|
||||
Group *Group::New()
|
||||
{
|
||||
return new Group;
|
||||
}
|
||||
|
||||
|
@ -22,29 +22,35 @@
|
||||
#define __XAO_GROUP_HXX__
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
namespace XAO
|
||||
{
|
||||
class Group
|
||||
{
|
||||
public:
|
||||
static Group *New();
|
||||
void setName(const char *name) { _myName=name; }
|
||||
const char *getName() const { return _myName.c_str(); }
|
||||
void setType(int type) { _myType=type; }
|
||||
int getType() { return _myType; }
|
||||
void setCount(int nb) { _myCount=nb; }
|
||||
int getCount() { return _myCount; }
|
||||
|
||||
private:
|
||||
Group();
|
||||
~Group();
|
||||
|
||||
void setName(const char *name) { _myName=name; }
|
||||
const char *getName() const { return _myName.c_str(); }
|
||||
|
||||
void setType(int type) { _myType=type; }
|
||||
int getType() { return _myType; }
|
||||
|
||||
int getCount() { return _myValues.size(); }
|
||||
|
||||
void addValue(int value) {_myValues.push_back(value);}
|
||||
//int getValue(int index) { return _myValues[index]; }
|
||||
|
||||
private:
|
||||
std::string _myName;
|
||||
int _myType;
|
||||
int _myCount;
|
||||
int *_myValues;
|
||||
void sort() {_myValues.sort();}
|
||||
|
||||
private:
|
||||
std::string _myName;
|
||||
int _myType;
|
||||
int _myCount;
|
||||
std::list<int> _myValues;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -44,15 +44,14 @@ dist_libXAO_la_SOURCES = \
|
||||
|
||||
|
||||
libXAO_la_CPPFLAGS = \
|
||||
$(CORBA_CXXFLAGS) \
|
||||
$(CORBA_INCLUDES) \
|
||||
$(KERNEL_CXXFLAGS) \
|
||||
$(GEOM_CXXFLAGS) \
|
||||
$(CAS_CPPFLAGS) \
|
||||
-I$(top_builddir) \
|
||||
$(GEOM_CXXFLAGS) \
|
||||
$(CAS_CPPFLAGS) \
|
||||
$(LIBXML_INCLUDES) \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_builddir)/idl
|
||||
|
||||
libXAO_la_LDFLAGS = \
|
||||
$(CAS_LDPATH) \
|
||||
$(CAS_LDPATH) \
|
||||
$(LIBXML_LIBS) \
|
||||
$(GEOM_LDFLAGS)
|
||||
|
||||
|
@ -23,21 +23,71 @@
|
||||
#include "Group.hxx"
|
||||
#include "Field.hxx"
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
using namespace XAO;
|
||||
|
||||
Xao::Xao()
|
||||
{
|
||||
_myAuthor = "Nathalie Gore";
|
||||
_myVersion = "1.0";
|
||||
_myGeometry = NULL;
|
||||
_myNbGroups = 0;
|
||||
}
|
||||
|
||||
Xao::Xao(const char *author, const char *version)
|
||||
{
|
||||
_myAuthor = author;
|
||||
_myVersion = version;
|
||||
_myGeometry = NULL;
|
||||
_myNbGroups = 0;
|
||||
}
|
||||
|
||||
|
||||
Xao::~Xao()
|
||||
{
|
||||
if (_myGeometry != NULL)
|
||||
{
|
||||
delete _myGeometry;
|
||||
_myGeometry = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Xao *Xao::New()
|
||||
bool Xao::Export(const char* fileName)
|
||||
{
|
||||
return new Xao;
|
||||
if (_myGeometry == NULL)
|
||||
return false;
|
||||
|
||||
xmlDocPtr master_doc = 0;
|
||||
xmlNodePtr xao_node = 0;
|
||||
|
||||
//Creating the Xml document
|
||||
master_doc = xmlNewDoc(BAD_CAST "1.0");
|
||||
xao_node = xmlNewNode(0, BAD_CAST "XAO");
|
||||
xmlDocSetRootElement(master_doc,xao_node);
|
||||
|
||||
xmlNodePtr version_node = xmlNewChild(xao_node,0, BAD_CAST "version", BAD_CAST _myVersion.c_str());
|
||||
xmlNodePtr author_node = xmlNewChild(xao_node,0, BAD_CAST "author", BAD_CAST _myAuthor.c_str());
|
||||
|
||||
// Geometric part
|
||||
xmlNodePtr geom_node = xmlNewChild(xao_node,0, BAD_CAST "geometry",0);
|
||||
xmlNodePtr name_geom_node = xmlNewChild(geom_node,0, BAD_CAST "name",BAD_CAST _myGeometry->getName());
|
||||
xmlNodePtr format_geom_node = xmlNewChild(geom_node,0, BAD_CAST "name",BAD_CAST _myGeometry->getFormat());
|
||||
xmlNodePtr shape_geom_node = xmlNewChild(geom_node,0, BAD_CAST "shape",BAD_CAST _myGeometry->getBREP());
|
||||
|
||||
/*xmlNodePtr topo_geom_node = xmlNewChild(geom_node,0, BAD_CAST "topology",0);
|
||||
ostringstream stream;
|
||||
stream << _myGeometry->countVertices();
|
||||
xmlNodePtr count_topo_geom_node = xmlNewChild(count_topo_geom_node,0, BAD_CAST "topology", BAD_CAST stream.str().c_str());*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,9 +22,17 @@
|
||||
#define __XAO_XAO_HXX__
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
namespace XAO
|
||||
{
|
||||
enum Kind{
|
||||
VERTEX,
|
||||
EDGE,
|
||||
FACE,
|
||||
SOLID
|
||||
};
|
||||
|
||||
class Geometry;
|
||||
class Group;
|
||||
class Field;
|
||||
@ -32,28 +40,36 @@ namespace XAO
|
||||
class Xao
|
||||
{
|
||||
public:
|
||||
static Xao *New();
|
||||
void setAuthor(const char *author) { _myAuthor=author; }
|
||||
const char *getAuthor() const { return _myAuthor.c_str(); }
|
||||
void setVersion(const char *version) { _myVersion=version; }
|
||||
const char *getVersion() const { return _myVersion.c_str(); }
|
||||
void setNbGroups(int nb) { _myNbGroups=nb; }
|
||||
int getNbGroups() { return _myNbGroups; }
|
||||
void setNbFields(int nb) { _myNbFields=nb; }
|
||||
int getNbFields() { return _myNbFields; }
|
||||
|
||||
private:
|
||||
Xao();
|
||||
Xao(const char *author, const char *version);
|
||||
~Xao();
|
||||
|
||||
void setAuthor(const char *author) { _myAuthor=author; }
|
||||
const char *getAuthor() const { return _myAuthor.c_str(); }
|
||||
|
||||
void setVersion(const char *version) { _myVersion=version; }
|
||||
const char *getVersion() const { return _myVersion.c_str(); }
|
||||
|
||||
void setGeometry(Geometry *myGeometry) { _myGeometry=myGeometry; }
|
||||
const Geometry *getGeometry() const { return _myGeometry; }
|
||||
|
||||
int getNbGroups() { return _myGroups.size(); }
|
||||
void addGroup(Group *myGroup) { _myGroups.push_back(myGroup); }
|
||||
void removeGroup(Group *myGroup) { _myGroups.remove(myGroup); }
|
||||
|
||||
int getNbFields() { return _myNbFields; }
|
||||
|
||||
bool Export(const char* fileName);
|
||||
|
||||
|
||||
private:
|
||||
Geometry *_myGeom;
|
||||
int _myNbGroups;
|
||||
Group *_myGroups;
|
||||
int _myNbFields;
|
||||
Field *_myFields;
|
||||
std::string _myAuthor;
|
||||
std::string _myVersion;
|
||||
std::string _myAuthor;
|
||||
std::string _myVersion;
|
||||
Geometry *_myGeometry;
|
||||
int _myNbGroups;
|
||||
std::list<Group *> _myGroups;
|
||||
int _myNbFields;
|
||||
//std::list<Field *> _myFields;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
# Copyright (C) 2007-2012 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
|
||||
#
|
||||
|
||||
# File : Makefile.in
|
||||
# Author : Nathalie Gore
|
||||
# Modified by : Nathalie Gore (OCN) - autotools usage
|
||||
# Module : GEOM
|
||||
# $Header: /home/server/cvs/GEOM/GEOM_SRC/src/XAOExport/Makefile.am,v 1.4 2012-08-09 07:43:00 vsr Exp $
|
||||
#
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
# Libraries targets
|
||||
lib_LTLIBRARIES = libXAOExport.la
|
||||
|
||||
# Sources files
|
||||
dist_libXAOExport_la_SOURCES = \
|
||||
XAOExport.cxx
|
||||
|
||||
# additional information to compile and link file
|
||||
|
||||
libXAOExport_la_CPPFLAGS = \
|
||||
$(CORBA_CXXFLAGS) \
|
||||
$(CORBA_INCLUDES) \
|
||||
$(QT_INCLUDES) \
|
||||
$(LIBXML_INCLUDES) \
|
||||
$(CAS_CPPFLAGS) \
|
||||
$(GUI_CXXFLAGS) \
|
||||
$(KERNEL_CXXFLAGS) \
|
||||
$(BOOST_CPPFLAGS) \
|
||||
-I$(srcdir)/../GEOMBase \
|
||||
-I$(srcdir)/../GEOMClient \
|
||||
-I$(srcdir)/../OBJECT \
|
||||
-I$(srcdir)/../GEOMImpl \
|
||||
-I$(srcdir)/../GEOM \
|
||||
-I$(srcdir)/../GEOMGUI \
|
||||
-I$(srcdir)/../GEOMAlgo \
|
||||
-I$(top_builddir)/idl
|
||||
|
||||
libXAOExport_la_LDFLAGS = \
|
||||
$(LIBXML_LIBS) \
|
||||
$(KERNEL_LDFLAGS) -lSALOMELocalTrace \
|
||||
$(GUI_LDFLAGS) -lsuit -lSalomeApp -lSVTK \
|
||||
../GEOMBase/libGEOMBase.la \
|
||||
../GEOMGUI/libGEOM.la \
|
||||
../GEOMImpl/libGEOMimpl.la \
|
||||
../GEOMAlgo/libGEOMAlgo.la \
|
||||
../../idl/libSalomeIDLGEOM.la \
|
||||
$(STDLIB) \
|
||||
$(CAS_LDPATH) -lTKBRep
|
@ -1,174 +0,0 @@
|
||||
// Copyright (C) 2007-2012 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
|
||||
//
|
||||
|
||||
// File: XAOExport.cxx
|
||||
// Created: Thu Dec 04 08:00:00 2012
|
||||
// Author: Nathalie Gore
|
||||
// <nathalie.gore@opencascade.com>
|
||||
//
|
||||
#include "utilities.h"
|
||||
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
using namespace std;
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_MessageBox.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_ViewManager.h>
|
||||
#include <SUIT_OverrideCursor.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <SalomeApp_Study.h>
|
||||
#include <LightApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
#include <SALOME_ListIO.hxx>
|
||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
#include <GEOMBase_Helper.h>
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
#include <GEOM_Engine.hxx>
|
||||
|
||||
#include <GEOMImpl_Gen.hxx>
|
||||
#include <GEOMImpl_IShapesOperations.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
#if defined XAOEXPORT_EXPORTS || defined XAOExport_EXPORTS
|
||||
#if defined WIN32
|
||||
#define XAOEXPORT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define XAOEXPORT_EXPORT
|
||||
#endif
|
||||
#else
|
||||
#if defined WIN32
|
||||
#define XAOEXPORT_EXPORT __declspec( dllimport )
|
||||
#else
|
||||
#define XAOEXPORT_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define XAOEXPORT_EXPORT
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
extern "C"
|
||||
{
|
||||
XAOEXPORT_EXPORT
|
||||
int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
|
||||
{
|
||||
MESSAGE("Export XAO into file " << theFileName.ToCString());
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
|
||||
if (!app)
|
||||
return 0;
|
||||
|
||||
//SalomeApp_Study* anActiveStudy = ( SalomeApp_Study* ) app->activeStudy();
|
||||
SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||
if (!anActiveStudy)
|
||||
return 0;
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||
if (!aSelMgr)
|
||||
return 0;
|
||||
|
||||
// get selection
|
||||
SALOME_ListIO aList;
|
||||
aSelMgr->selectedObjects(aList, "ObjectBrowser", false);
|
||||
SALOME_ListIteratorOfListIO It (aList);
|
||||
|
||||
SUIT_OverrideCursor();
|
||||
|
||||
QString nameShape;
|
||||
GEOM::ListOfLong_var aSubShapesId;
|
||||
for (; It.More(); It.Next())
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) anIObject = It.Value();
|
||||
if (anIObject->hasEntry())
|
||||
{
|
||||
_PTR(SObject) SO (anActiveStudy->studyDS()->FindObjectID(anIObject->getEntry()));
|
||||
if (!SO)
|
||||
return 0;
|
||||
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(SO));
|
||||
if (CORBA::is_nil(anObj))
|
||||
return 0;
|
||||
//nameShape = GEOMBase::GetName( anObj.get() );
|
||||
nameShape = anObj->GetName();
|
||||
|
||||
GEOM::GEOM_IShapesOperations_var aShOp = GeometryGUI::GetGeomGen()->GetIShapesOperations(anObj->GetStudyID());
|
||||
aSubShapesId = aShOp->SubShapeAllIDs(anObj, TopAbs_VERTEX, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ostringstream streamShape;
|
||||
BRepTools::Write(theShape, streamShape);
|
||||
|
||||
xmlDocPtr master_doc = 0;
|
||||
xmlNodePtr geometry_node = 0;
|
||||
|
||||
//Creating the Xml document
|
||||
master_doc = xmlNewDoc(BAD_CAST "1.0");
|
||||
geometry_node = xmlNewNode(0, BAD_CAST "geometry");
|
||||
xmlDocSetRootElement(master_doc,geometry_node);
|
||||
|
||||
// Creating child nodes
|
||||
xmlNodePtr version_geom_node = xmlNewChild(geometry_node, 0, BAD_CAST "version",BAD_CAST "1.0");
|
||||
xmlNodePtr name_geom_node = xmlNewChild(geometry_node, 0, BAD_CAST "name",BAD_CAST nameShape.toStdString().c_str());
|
||||
xmlNodePtr format_geom_node = xmlNewChild(geometry_node, 0, BAD_CAST "format",BAD_CAST "BREP");
|
||||
xmlNodePtr shape_geom_node = xmlNewChild(geometry_node, 0, BAD_CAST "shape",BAD_CAST streamShape.str().c_str());
|
||||
xmlNodePtr topo_geom_node = xmlNewChild(geometry_node, 0, BAD_CAST "shape",BAD_CAST streamShape.str().c_str());
|
||||
|
||||
// Topomogy description
|
||||
xmlNodePtr vertices_topo_geom_node = xmlNewChild(topo_geom_node,0, BAD_CAST "vertices",0);
|
||||
xmlNodePtr count_vertices_topo_geom_node = xmlNewChild(vertices_topo_geom_node,0, BAD_CAST "count",BAD_CAST "12");
|
||||
|
||||
//std::string myfile(theFileName);
|
||||
xmlSaveFormatFileEnc(theFileName.ToCString(), master_doc, "UTF-8", 1);
|
||||
|
||||
xmlFreeDoc(master_doc);
|
||||
|
||||
xmlCleanupParser();
|
||||
return 1;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
# Copyright (C) 2007-2012 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
|
||||
#
|
||||
|
||||
# File : Makefile.in
|
||||
# Author : Nathalie Gore
|
||||
# Modified by : Nathalie Gore (OCN) - autotools usage
|
||||
# Module : GEOM
|
||||
# $Header: /home/server/cvs/GEOM/GEOM_SRC/src/XAOImport/Makefile.am,v 1.4 2012-08-09 07:43:02 vsr Exp $
|
||||
#
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
# Libraries targets
|
||||
lib_LTLIBRARIES = libXAOImport.la
|
||||
|
||||
# Sources files
|
||||
dist_libXAOImport_la_SOURCES = \
|
||||
XAOImport.cxx
|
||||
|
||||
# additional information to compile and link file
|
||||
|
||||
libXAOImport_la_CPPFLAGS = \
|
||||
$(LIBXML_INCLUDES) \
|
||||
$(KERNEL_CXXFLAGS) \
|
||||
$(CAS_CPPFLAGS)
|
||||
|
||||
libXAOImport_la_LDFLAGS = \
|
||||
$(LIBXML_LIBS) \
|
||||
$(KERNEL_LDFLAGS) -lSALOMELocalTrace \
|
||||
$(CAS_LDPATH) -lTKBRep \
|
||||
$(STDLIB)
|
@ -1,112 +0,0 @@
|
||||
// Copyright (C) 2007-2012 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
|
||||
//
|
||||
|
||||
// File: XAOImport.cxx
|
||||
// Created: Thu Dec 04 08:00:00 2012
|
||||
// Author: Nathalie Gore
|
||||
// <nathalie.gore@opencascade.com>
|
||||
//
|
||||
#include "utilities.h"
|
||||
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#ifdef WNT
|
||||
#if defined XAOIMPORT_EXPORTS || defined XAOImport_EXPORTS
|
||||
#if defined WIN32
|
||||
#define XAOIMPORT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define XAOIMPORT_EXPORT
|
||||
#endif
|
||||
#else
|
||||
#if defined WIN32
|
||||
#define XAOIMPORT_EXPORT __declspec( dllimport )
|
||||
#else
|
||||
#define XAOIMPORT_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define XAOIMPORT_EXPORT
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
extern "C"
|
||||
{
|
||||
XAOIMPORT_EXPORT
|
||||
TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
|
||||
const TCollection_AsciiString& /*theFormatName*/,
|
||||
TCollection_AsciiString& theError,
|
||||
const TDF_Label&)
|
||||
{
|
||||
MESSAGE("Import XAO from file " << theFileName);
|
||||
|
||||
// Read file
|
||||
ifstream is;
|
||||
is.open (theFileName.ToCString(), ios::binary );
|
||||
|
||||
// ***** get length of file:
|
||||
is.seekg (0, std::ios::end);
|
||||
long length = is.tellg();
|
||||
is.seekg (0, std::ios::beg);
|
||||
|
||||
// ***** allocate memory:
|
||||
char *buffer = new char [length];
|
||||
|
||||
// ***** read data as a block:
|
||||
is.read (buffer,length);
|
||||
|
||||
// ***** create string stream of memory contents
|
||||
// NOTE: this ends up copying the buffer!!!
|
||||
istringstream streamBrep( buffer );
|
||||
|
||||
// ***** delete temporary buffer
|
||||
delete [] buffer;
|
||||
|
||||
// ***** close filestream
|
||||
is.close();
|
||||
|
||||
// Import file
|
||||
TopoDS_Shape aShape;
|
||||
BRep_Builder B;
|
||||
BRepTools::Read(aShape, streamBrep, B);
|
||||
if (aShape.IsNull()) {
|
||||
theError = "XAO Import failed";
|
||||
}
|
||||
return aShape;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user