archimede.png \
axisinertia.png \
basicproperties.png \
+bezier.png \
bounding.png \
box.png \
box2points.png \
boxdxyz.png \
+bspline.png \
build_compound.png \
build_edge.png \
build_face.png \
sphere.png \
spheredxyz.png \
spherepoint.png \
+spline.png \
subshape.png \
supressHolesOnFaceShell.png \
supressface.png \
in double WaterDensity,
in double MeshingDeflection) raises (SALOME::SALOME_Exception);
+ //-----------------------------------------------------------//
+ // Splines //
+ //-----------------------------------------------------------//
+ GEOM_Shape MakeBezier (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ;
+ GEOM_Shape MakeBSpline(in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ;
+
//-----------------------------------------------------------//
// Build //
//-----------------------------------------------------------//
<endsubmenu />
<separator pos-id=""/>
<popup-item item-id="404" pos-id="" label-id="Sketch" icon-id="sketch.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="406" pos-id="" label-id="Spline" icon-id="spline.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="407" pos-id="" label-id="Explode" icon-id="subshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<submenu label-id="Build" item-id="408" pos-id="">
<menu-item label-id="Tools" item-id="5" pos-id="">
<separator pos-id=""/>
<popup-item item-id="5103" pos-id="" label-id="Check Geometry" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="5104" pos-id="" label-id="Load Script" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ********************************* Settings (menubar) ********************************* -->
<!-- ################################# POPUP MENU ################################# -->
<popupmenu label-id="Popup for Viewer" context-id="" parent-id="Viewer" object-id="">
<submenu label-id="Properties" item-id="803" pos-id="6">
- <popup-item item-id="8031" pos-id="" label-id="Wireframe - Shading" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="8031" pos-id="" label-id="Wireframe - Shading" icon-id="" tooltip-id="" accel-id="Ctrl+D" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="8032" pos-id="" label-id="Color" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="8033" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
void BasicGUI_VectorDlg::Init()
{
/* init variables */
+ myConstructorId = 0;
myEditCurrentArgument = GroupPoints->LineEdit1;
myDx = 0.0;
/* Vertices Filter for all arguments */
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
- myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom);
mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */
double step;
int myConstructorId;
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
- Handle(GEOM_ShapeTypeFilter) myEdgeFilter;
gp_Pnt myPoint1; /* Points containing the vector */
gp_Pnt myPoint2;
#include <BRep_Builder.hxx>
#include "BuildGUI_SubShapeDlg.h" // Method SUBSHAPE
+#include "BuildGUI_SplineDlg.h" // Method SPLINE
#include "BuildGUI_EdgeDlg.h" // Method EDGE
#include "BuildGUI_WireDlg.h" // Method WIRE
#include "BuildGUI_FaceDlg.h" // Method FACE
switch (theCommandID)
{
+ case 406: // GEOM::SPLINE
+ {
+ BuildGUI_SplineDlg *aDlg = new BuildGUI_SplineDlg(parent, "", myBuildGUI, Sel);
+ break;
+ }
case 407: // EXPLODE : use ic
{
Handle(AIS_InteractiveContext) ic;
}
+//=====================================================================================
+// function : MakeBSplineAndDisplay()
+// purpose :
+//=====================================================================================
+void BuildGUI::MakeBSplineAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
+{
+ try {
+ GEOM::GEOM_Shape_var result = myGeom->MakeBSpline(listShapesIOR);
+ if(result->_is_nil()) {
+ QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
+ return;
+ }
+ result->NameType(tr("GEOM_WIRE"));
+ if(myGeomBase->Display(result))
+ QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch(const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ return;
+}
+
+
+//=====================================================================================
+// function : MakeBSplineAndDisplay()
+// purpose :
+//=====================================================================================
+void BuildGUI::MakeBezierAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
+{
+ try {
+ GEOM::GEOM_Shape_var result = myGeom->MakeBezier(listShapesIOR);
+ if(result->_is_nil()) {
+ QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
+ return;
+ }
+ result->NameType(tr("GEOM_WIRE"));
+ if(myGeomBase->Display(result))
+ QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+ }
+ catch(const SALOME::SALOME_Exception& S_ex) {
+ QtCatchCorbaException(S_ex);
+ }
+ return;
+}
+
+
//=====================================================================================
// function : MakeLinearEdgeAndDisplay()
// purpose :
void MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
+ void MakeBSplineAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
+ void MakeBezierAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
+
/* Methods for sub shapes explode */
bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR);
bool OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType);
--- /dev/null
+// GEOM GEOMGUI : GUI for Geometry component
+//
+// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : BuildGUI_SplineDlg.cxx
+// Author : Lucien PIGNOLONI
+// Module : GEOM
+// $Header$
+
+using namespace std;
+#include "BuildGUI_SplineDlg.h"
+
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <Geom_BezierCurve.hxx>
+#include <GeomAPI_PointsToBSpline.hxx>
+#include <BRep_Tool.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
+
+//=================================================================================
+// class : BuildGUI_SplineDlg()
+// purpose : Constructs a BuildGUI_SplineDlg which is a child of 'parent', with the
+// name 'name' and widget flags set to 'f'.
+// The dialog will by default be modeless, unless you set 'modal' to
+// TRUE to construct a modal dialog.
+//=================================================================================
+BuildGUI_SplineDlg::BuildGUI_SplineDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
+ :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+ QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BEZIER")));
+ QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BSPLINE")));
+ QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+
+ setCaption(tr("GEOM_SPLINE_TITLE"));
+
+ /***************************************************************/
+ GroupConstructors->setTitle(tr("GEOM_SPLINE"));
+ RadioButton1->setPixmap(image0);
+ RadioButton2->setPixmap(image1);
+ RadioButton3->close(TRUE);
+
+ GroupBezier = new DlgRef_1Sel_QTD(this, "GroupBezier");
+ GroupBezier->GroupBox1->setTitle(tr("GEOM_BEZIER"));
+ GroupBezier->TextLabel1->setText(tr("GEOM_POINTS"));
+ GroupBezier->PushButton1->setPixmap(image2);
+
+ GroupBSpline = new DlgRef_1Sel_QTD(this, "GroupBSpline");
+ GroupBSpline->GroupBox1->setTitle(tr("GEOM_BSPLINE"));
+ GroupBSpline->TextLabel1->setText(tr("GEOM_POINTS"));
+ GroupBSpline->PushButton1->setPixmap(image2);
+
+ Layout1->addWidget(GroupBezier, 1, 0);
+ Layout1->addWidget(GroupBSpline, 1, 0);
+ /***************************************************************/
+
+ /* Initialisations */
+ myBuildGUI = theBuildGUI;
+ Init();
+}
+
+
+//=================================================================================
+// function : ~BuildGUI_SplineDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+BuildGUI_SplineDlg::~BuildGUI_SplineDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void BuildGUI_SplineDlg::Init()
+{
+ /* init variables */
+ myConstructorId = 0;
+ myEditCurrentArgument = GroupBezier->LineEdit1;
+ myOkListShapes = false;
+
+ /* Vertices Filter for all arguments */
+ myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
+ mySelection->AddFilter(myVertexFilter);
+
+ /* signals and slots connections */
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
+
+ connect(GroupBezier->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupBSpline->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+ /* displays Dialog */
+ GroupBSpline->hide();
+ GroupBezier->show();
+ this->show();
+
+ return;
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void BuildGUI_SplineDlg::ConstructorsClicked(int constructorId)
+{
+ myConstructorId = constructorId;
+ mySelection->ClearFilters();
+ myGeomBase->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+ disconnect(mySelection, 0, this, 0);
+ myOkListShapes = false;
+
+ switch (constructorId)
+ {
+ case 0:
+ {
+ GroupBSpline->hide();
+ resize(0, 0);
+ GroupBezier->show();
+
+ myEditCurrentArgument = GroupBezier->LineEdit1;
+ GroupBezier->LineEdit1->setText("");
+ break;
+ }
+ case 1:
+ {
+ GroupBezier->hide();
+ resize(0, 0);
+ GroupBSpline->show();
+
+ myEditCurrentArgument = GroupBSpline->LineEdit1;
+ GroupBSpline->LineEdit1->setText("");
+ break;
+ }
+ }
+ /* filter for next selection */
+ mySelection->AddFilter(myVertexFilter);
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ return;
+}
+
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void BuildGUI_SplineDlg::ClickOnOk()
+{
+ this->ClickOnApply();
+ ClickOnCancel();
+ return;
+}
+
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+void BuildGUI_SplineDlg::ClickOnApply()
+{
+ QAD_Application::getDesktop()->putInfo(tr(""));
+ if (mySimulationTopoDs.IsNull())
+ return;
+ myGeomBase->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+
+ switch(myConstructorId)
+ {
+ case 0 :
+ {
+ if(myOkListShapes)
+ myBuildGUI->MakeBezierAndDisplay(myListShapes);
+ break;
+ }
+ case 1 :
+ {
+ if(myOkListShapes)
+ myBuildGUI->MakeBSplineAndDisplay(myListShapes);
+ break;
+ }
+ }
+ return;
+}
+
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void BuildGUI_SplineDlg::SelectionIntoArgument()
+{
+ myGeomBase->EraseSimulationShape();
+ myEditCurrentArgument->setText("");
+ QString aString = ""; /* name of selection */
+
+ int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
+ if(nbSel < 2) {
+ myOkListShapes = false;
+ return;
+ }
+
+ myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
+ myEditCurrentArgument->setText(aString);
+ myOkListShapes = true;
+
+ this->MakeSplineSimulationAndDisplay();
+ return;
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void BuildGUI_SplineDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if(send == GroupBezier->PushButton1) {
+ GroupBezier->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupBezier->LineEdit1;
+ }
+ else if(send == GroupBSpline->PushButton1) {
+ GroupBSpline->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupBSpline->LineEdit1;
+ }
+ mySelection->AddFilter(myVertexFilter);
+ this->SelectionIntoArgument();
+
+ return;
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void BuildGUI_SplineDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ mySelection->AddFilter(myVertexFilter);
+ if(!mySimulationTopoDs.IsNull())
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
+ return;
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void BuildGUI_SplineDlg::enterEvent(QEvent* e)
+{
+ if (GroupConstructors->isEnabled())
+ return;
+ this->ActivateThisDialog();
+ return;
+}
+
+
+//=================================================================================
+// function : MakeSplineSimulationAndDisplay()
+// purpose :
+//=================================================================================
+void BuildGUI_SplineDlg::MakeSplineSimulationAndDisplay()
+{
+ myGeomBase->EraseSimulationShape();
+ mySimulationTopoDs.Nullify();
+
+ if(!myOkListShapes)
+ return;
+
+ try {
+ TColgp_Array1OfPnt CurvePoints(1, myListShapes.length());
+ SALOME_ListIteratorOfListIO It(mySelection->StoredIObjects());
+ int i = 1;
+ for(;It.More(); It.Next()) {
+ Standard_Boolean found;
+ Handle(GEOM_AISShape) AISShape = myGeomBase->ConvertIOinGEOMAISShape(It.Value(), found);
+ if(!found)
+ return;
+ TopoDS_Shape Shape = AISShape->Shape();
+ if(Shape.IsNull())
+ return;
+ if(Shape.ShapeType() == TopAbs_VERTEX) {
+ const gp_Pnt& P = BRep_Tool::Pnt(TopoDS::Vertex(Shape));
+ CurvePoints.SetValue(i, P);
+ }
+ i++;
+ }
+ switch(myConstructorId)
+ {
+ case 0 :
+ {
+ Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints);
+ mySimulationTopoDs = BRepBuilderAPI_MakeEdge(GBC);
+ break;
+ }
+ case 1 :
+ {
+ GeomAPI_PointsToBSpline GBC(CurvePoints);
+ mySimulationTopoDs = BRepBuilderAPI_MakeEdge(GBC);
+ break;
+ }
+ }
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
+ }
+ catch(Standard_Failure) {
+ MESSAGE("Exception catched in MakeSplineSimulationAndDisplay");
+ return;
+ }
+ return;
+}
--- /dev/null
+// GEOM GEOMGUI : GUI for Geometry component
+//
+// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : BuildGUI_SplineDlg.h
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header:
+
+#ifndef DIALOGBOX_SPLINE_H
+#define DIALOGBOX_SPLINE_H
+
+#include "GEOMBase_Skeleton.h"
+#include "DlgRef_1Sel_QTD.h"
+
+#include "BuildGUI.h"
+
+#include "GEOM_ShapeTypeFilter.hxx"
+
+//=================================================================================
+// class : BuildGUI_WireDlg
+// purpose :
+//=================================================================================
+class BuildGUI_SplineDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+ BuildGUI_SplineDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
+ ~BuildGUI_SplineDlg();
+
+private:
+ void Init();
+ void enterEvent(QEvent* e);
+ void MakeSplineSimulationAndDisplay();
+
+ BuildGUI* myBuildGUI;
+
+ int myConstructorId;
+ Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
+
+ GEOM::GEOM_Gen::ListOfIOR myListShapes;
+ bool myOkListShapes; /* to check when arguments is defined */
+
+ DlgRef_1Sel_QTD* GroupBezier;
+ DlgRef_1Sel_QTD* GroupBSpline;
+
+private slots:
+ void ClickOnOk();
+ void ClickOnApply();
+ void ActivateThisDialog();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ConstructorsClicked(int constructorId);
+
+};
+
+#endif // DIALOGBOX_SPLINE_H
LIB_SRC = BuildGUI.cxx \
BuildGUI_SubShapeDlg.cxx \
+ BuildGUI_SplineDlg.cxx \
BuildGUI_EdgeDlg.cxx \
BuildGUI_WireDlg.cxx \
BuildGUI_FaceDlg.cxx \
LIB_MOC = \
BuildGUI.h \
BuildGUI_SubShapeDlg.h \
+ BuildGUI_SplineDlg.h \
BuildGUI_EdgeDlg.h \
BuildGUI_WireDlg.h \
BuildGUI_FaceDlg.h \
}
case 212: // MENU VIEW - DISPLAY ALL
{
- if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
- ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll();
- else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
- myDisplayGUI->OnDisplayAll();
+// if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
+// ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll();
+// else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
+ myDisplayGUI->OnDisplayAll();
break;
}
case 213: // MENU VIEW - DISPLAY ONLY
//=====================================================================================
void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject)
{
- if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
- return;
+ if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
+ OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+ Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
-
- myContext->Display(v3d->getTrihedron());
-
- if(!onlyPreviousDisplayedObject) {
- AIS_ListOfInteractive List1;
- myContext->ObjectsInCollector(List1);
- AIS_ListIteratorOfListOfInteractive ite1(List1);
- while(ite1.More()) {
- if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
- if(aSh->hasIO()) {
- Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
- if(v3d->isInViewer(GIO, true)) {
+ //myContext->Display(v3d->getTrihedron());
+
+ if(!onlyPreviousDisplayedObject) {
+ SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
+ SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
+ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC);
+ for(; it->More();it->Next()) {
+ SALOMEDS::SObject_var CSO = it->Value();
+ SALOMEDS::AttributeIOR_var anIOR;
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(CSO->FindAttribute(anAttr, "AttributeIOR")) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ Standard_Boolean testResult;
+ Handle(GEOM_AISShape) aSh = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), testResult);
+ if(testResult)
myContext->Display(aSh);
+ else {
+ GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value());
+ bool AddInSt = myGeomBase->mySettings_AddInStudy;
+ myGeomBase->mySettings_AddInStudy = false;
+ myGeomBase->Display(aShape);
+ myGeomBase->mySettings_AddInStudy = AddInSt;
}
}
}
- ite1.Next();
+// AIS_ListOfInteractive List1;
+// myContext->ObjectsInCollector(List1);
+// AIS_ListIteratorOfListOfInteractive ite1(List1);
+// while(ite1.More()) {
+// cout<<"DCQ 1"<<endl;
+// if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
+// Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
+// if(aSh->hasIO()) {
+// Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
+// if(v3d->isInViewer(GIO, true)) {
+// myContext->Display(aSh);
+// }
+// }
+// }
+// ite1.Next();
+// }
}
- }
- else {
- AIS_ListOfInteractive aListDisplayedObject;
- myContext->DisplayedObjects(aListDisplayedObject);
- AIS_ListIteratorOfListOfInteractive ite(aListDisplayedObject);
- while(ite.More()) {
- if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
- if (aSh->hasIO()) {
- Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
- if (v3d->isInViewer(GIO,true)) {
- myContext->Display(aSh);
+ else {
+ AIS_ListOfInteractive aListDisplayedObject;
+ myContext->DisplayedObjects(aListDisplayedObject);
+ AIS_ListIteratorOfListOfInteractive ite(aListDisplayedObject);
+ while(ite.More()) {
+ if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
+ if (aSh->hasIO()) {
+ Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
+ if (v3d->isInViewer(GIO,true))
+ myContext->Display(aSh);
}
}
+ ite.Next();
+ }
+ }
+ }
+ else if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
+ SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
+ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC);
+ for(; it->More();it->Next()) {
+ SALOMEDS::SObject_var CSO = it->Value();
+ SALOMEDS::AttributeIOR_var anIOR;
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(CSO->FindAttribute(anAttr, "AttributeIOR")) {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ Standard_Boolean testResult;
+ GEOM_Actor* aSh = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), testResult);
+ if(testResult) {
+ Handle(SALOME_InteractiveObject) IObject = aSh->getIO();
+ // if(myRenderInter->isInViewer(IObject)) {
+ ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->Display(IObject);
+ //}
+ }
+ else {
+ GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value());
+ bool AddInSt = myGeomBase->mySettings_AddInStudy;
+ myGeomBase->mySettings_AddInStudy = false;
+ myGeomBase->Display(aShape);
+ myGeomBase->mySettings_AddInStudy = AddInSt;
+ }
}
- ite.Next();
}
+// ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll();
}
return;
}
#include <gp_Elips.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Line.hxx>
+#include <Geom_BezierCurve.hxx>
+#include <Geom_BSplineCurve.hxx>
#include <GeomFill_Line.hxx>
#include <GeomFill_AppSurf.hxx>
#include <GeomFill_SectionGenerator.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GC_MakeArcOfCircle.hxx>
+#include <GeomAPI_PointsToBSpline.hxx>
#include <GC_Root.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TCollection_ExtendedString.hxx>
+#include <TColgp_Array1OfPnt.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
}
+//=================================================================================
+// function : MakeBezier()
+// purpose : Make a wire from a list containing many points
+//=================================================================================
+GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBezier( const GEOM::GEOM_Gen::ListOfIOR& ListShapes )
+ throw (SALOME::SALOME_Exception)
+{
+ GEOM::GEOM_Shape_var result;
+ TopoDS_Shape tds, Shape;
+ TColgp_Array1OfPnt CurvePoints(1, ListShapes.length());
+
+ try {
+ for(unsigned int i = 0; i < ListShapes.length(); i++) {
+ GEOM::GEOM_Shape_var aShape = GetIORFromString(ListShapes[i]);
+ Shape = GetTopoShape(aShape);
+ if(Shape.IsNull()) {
+ THROW_SALOME_CORBA_EXCEPTION("MakeBezier aborted : null shape during operation", SALOME::BAD_PARAM);
+ }
+ if(Shape.ShapeType() == TopAbs_VERTEX) {
+ const gp_Pnt& P = BRep_Tool::Pnt(TopoDS::Vertex(Shape));
+ CurvePoints.SetValue(i + 1, P);
+ }
+ }
+ Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints);
+ tds = BRepBuilderAPI_MakeEdge(GBC);
+ }
+ catch(Standard_Failure) {
+ THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeBezier", SALOME::BAD_PARAM);
+ }
+
+ if( tds.IsNull() ) {
+ THROW_SALOME_CORBA_EXCEPTION("Make Bezier operation aborted : null result", SALOME::BAD_PARAM);
+ }
+ else {
+ result = CreateObject(tds);
+ InsertInLabelMoreArguments(tds, result, ListShapes, myCurrentOCAFDoc);
+ }
+ return result;
+}
+
+
+//=================================================================================
+// function : MakeBSpline()
+// purpose : Make a wire from a list containing many points
+//=================================================================================
+GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBSpline( const GEOM::GEOM_Gen::ListOfIOR& ListShapes )
+ throw (SALOME::SALOME_Exception)
+{
+ GEOM::GEOM_Shape_var result;
+ TopoDS_Shape tds, Shape;
+ TColgp_Array1OfPnt CurvePoints(1, ListShapes.length());
+
+ try {
+ for(unsigned int i = 0; i < ListShapes.length(); i++) {
+ GEOM::GEOM_Shape_var aShape = GetIORFromString(ListShapes[i]);
+ Shape = GetTopoShape(aShape);
+ if(Shape.IsNull()) {
+ THROW_SALOME_CORBA_EXCEPTION("MakeBSpline aborted : null shape during operation", SALOME::BAD_PARAM);
+ }
+ if(Shape.ShapeType() == TopAbs_VERTEX) {
+ const gp_Pnt& P = BRep_Tool::Pnt(TopoDS::Vertex(Shape));
+ CurvePoints.SetValue(i + 1, P);
+ }
+ }
+ GeomAPI_PointsToBSpline GBC(CurvePoints);
+ tds = BRepBuilderAPI_MakeEdge(GBC);
+ }
+ catch(Standard_Failure) {
+ THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeBSpline", SALOME::BAD_PARAM);
+ }
+
+ if( tds.IsNull() ) {
+ THROW_SALOME_CORBA_EXCEPTION("Make BSpline operation aborted : null result", SALOME::BAD_PARAM);
+ }
+ else {
+ result = CreateObject(tds) ;
+ InsertInLabelMoreArguments(tds, result, ListShapes, myCurrentOCAFDoc) ;
+ }
+ return result;
+}
+
//=================================================================================
// function : MakeRevolution()
GEOM::GEOM_Shape_ptr MakeSolid (const GEOM::GEOM_Gen::ListOfIOR& ListShapes)
throw (SALOME::SALOME_Exception) ;
+ GEOM::GEOM_Shape_ptr MakeBezier (const GEOM::GEOM_Gen::ListOfIOR& ListShapes)
+ throw (SALOME::SALOME_Exception) ;
+ GEOM::GEOM_Shape_ptr MakeBSpline (const GEOM::GEOM_Gen::ListOfIOR& ListShapes)
+ throw (SALOME::SALOME_Exception) ;
+
//-------------------------------------------------------------------//
// Speciic method Archimede //
ic->Display(theResult);
}
- Sel->AddIObject(IO, false);
+ // DCQ Sel->AddIObject(IO, false);
QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint();
if(mySettings_AddInStudy)
AddInStudy(false, IO);
QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
else {
QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(false);
- Sel->AddIObject(GIO);
+ // DCQ Sel->AddIObject(GIO);
}
return true;
}
theCommandID == 413 || // MENU SETTINGS - ISOS
theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES
theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY
+ theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT
theCommandID == 8032 || // POPUP VIEWER - COLOR
theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY
theCommandID == 8034 || // POPUP VIEWER - ISOS
if(!GeomGUI->LoadLibrary("libSketcherGUI.so"))
return false;
}
- else if(theCommandID == 407 || // MENU BUILD - EXPLODE
+ else if(theCommandID == 406 || // MENU BUILD - SPLINE
+ theCommandID == 407 || // MENU BUILD - EXPLODE
theCommandID == 4081 || // MENU BUILD - EDGE
theCommandID == 4082 || // MENU BUILD - WIRE
theCommandID == 4083 || // MENU BUILD - FACE
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_IsoAspect.hxx>
+#include <vtkBMPReader.h>
+#include <vtkTexture.h>
+#include <vtkTextureMapToPlane.h>
+#include <vtkTransformTextureCoords.h>
+#include <vtkDataSetMapper.h>
+
+#include <qfileinfo.h>
#include <qcolordialog.h>
#include <qspinbox.h>
PyEditor->handleReturn();
break;
}
+ case 5104: // LOAD SCRIPT
+ {
+ QStringList filtersList;
+ filtersList.append(tr("GEOM_MEN_LOAD_SCRIPT"));
+ filtersList.append(tr("GEOM_MEN_ALL_FILES"));
+
+ QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), true);
+ if(!aFile.isEmpty()) {
+ QFileInfo file = aFile;
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor();
+
+ PyEditor->setText("import geompy\n");
+ PyEditor->handleReturn();
+
+ QStringList aTextList = QStringList::split(".", file.fileName());
+ PyEditor->setText("geompy.Path('" + file.dirPath() + "')\n");
+ PyEditor->handleReturn();
+
+ PyEditor->setText("from " + aTextList.first() + " import *\n");
+ PyEditor->handleReturn();
+ }
+ QApplication::restoreOverrideCursor();
+ break;
+ }
case 8032: // COLOR - POPUP VIEWER
{
if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
GEOMBase_NbIsosDlg * NbIsosDlg =
new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE);
-
+
NbIsosDlg->SpinBoxU->setValue(IsoU.toInt());
NbIsosDlg->SpinBoxV->setValue(IsoV.toInt());
QApplication::setOverrideCursor(Qt::waitCursor);
for(; ic->MoreCurrent(); ic->NextCurrent()) {
Handle(AIS_Drawer) CurDrawer;
-
+
CurDrawer = ic->Current()->Attributes();
CurDrawer->UIsoAspect()->SetNumber(NbIsosDlg->SpinBoxU->text().toInt());
CurDrawer->VIsoAspect()->SetNumber(NbIsosDlg->SpinBoxV->text().toInt());
//===============================================================================
void GEOMToolsGUI::OnEditDelete()
{
- if ( QAD_MessageBox::warn2
- ( QAD_Application::getDesktop(),
- tr ("GEOM_WRN_WARNING"),
- tr ("GEOM_REALLY_DELETE"),
- tr ("GEOM_BUT_YES"), tr ("GEOM_BUT_NO"), 1, 0, 0) != 1 )
+ SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
+ if(Sel->IObjectCount() == 0)
+ return;
+
+ if(QAD_MessageBox::warn2(QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_REALLY_DELETE"), tr("GEOM_BUT_YES"), tr("GEOM_BUT_NO"), 1, 0, 0) != 1)
return;
int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount();
SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
+ SALOMEDS::AttributeIOR_var anIOR;
- SALOME_Selection* Sel = SALOME_Selection::Selection( QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
for(;It.More();It.Next()) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
- if ( IObject->hasEntry() ) {
+ if(IObject->hasEntry()) {
SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() );
+ SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry());
/* Erase child graphical objects */
SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
- for (; it->More();it->Next()) {
+ for(; it->More();it->Next()) {
SALOMEDS::SObject_var CSO= it->Value();
- if (CSO->FindAttribute(anAttr, "AttributeIOR") ) {
+ if(CSO->FindAttribute(anAttr, "AttributeIOR") ) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
/* Delete child(s) shape in Client : */
const TCollection_AsciiString ASCior(anIOR->Value()) ;
- myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCior ) ;
+ myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(ASCior);
- for ( int i = 0; i < nbSf; i++ ) {
+ for(int i = 0; i < nbSf; i++) {
QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_OCC ) {
+ if(sf->getTypeView() == VIEW_OCC) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
Handle(GEOM_AISShape) Result = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), found);
- if ( found )
- myContext->Erase( Result, true, false );
- } else if ( sf->getTypeView() == VIEW_VTK ) {
+ if(found)
+ myContext->Erase(Result, true, false);
+ }
+ else if(sf->getTypeView() == VIEW_VTK) {
//vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer();
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
+ VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
GEOM_Actor* ac = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), found);
- if ( found ) {
+ if(found) {
//Renderer->RemoveActor(ac);
- if ( ac->hasIO() )
- myRenderInter->Remove( ac->getIO() );
+ if(ac->hasIO())
+ myRenderInter->Remove(ac->getIO());
}
}
}
}
/* Erase main graphical object */
- for ( int i = 0; i < nbSf; i++ ) {
+ for(int i = 0; i < nbSf; i++) {
QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_OCC ) {
+ if(sf->getTypeView() == VIEW_OCC) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
- Handle(GEOM_AISShape) Result = myGeomBase->ConvertIOinGEOMAISShape( IObject, found );
- if ( found )
- myContext->Erase( Result, true, false );
- } else if ( sf->getTypeView() == VIEW_VTK ) {
+ Handle(AIS_InteractiveContext) myContext = v3d->getAISContext();
+ Handle(GEOM_AISShape) Result = myGeomBase->ConvertIOinGEOMAISShape(IObject, found );
+ if(found)
+ myContext->Erase(Result, true, false);
+ }
+ else if(sf->getTypeView() == VIEW_VTK) {
VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
myRenderInter->Remove( IObject );
}
}
/* Delete main shape in Client : */
- if (SO->FindAttribute(anAttr, "AttributeIOR") ) {
+ if(SO->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
const TCollection_AsciiString ASCIor(anIOR->Value()) ;
- myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCIor ) ;
+ myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(ASCIor);
}
/* Erase objects in Study */
- SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
- if ( !obj->_is_nil() ) {
+ SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
+ if(!obj->_is_nil()) {
QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
op->start();
aStudyBuilder->RemoveObject(obj);
} /* more/next */
/* Clear any previous selection */
- Sel->ClearIObjects() ;
+ Sel->ClearIObjects();
QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
}
import salome
import SALOMEDS
+import sys
#import SALOMEDS_Attributes_idl
#NRI : BugID 1682 : from libSALOME_Swig import *
def CheckShape(aShape):
Status = geom.CheckShape(aShape)
return Status
+
+def Path(aPath):
+ paths = sys.path
+ if not aPath in paths:
+ sys.path.append(aPath)
GroupDimensions = new DlgRef_2Spin(this, "GroupDimensions");
GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
- GroupDimensions->TextLabel1->setText(tr("GEOM_HEIGHT"));
- GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS"));
+ GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS"));
+ GroupDimensions->TextLabel2->setText(tr("GEOM_HEIGHT"));
Layout1->addWidget(GroupPoints, 1, 0);
Layout1->addWidget(GroupDimensions, 1, 0);