1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File : DisplayGUI.cxx
25 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
27 #include "DisplayGUI.h"
28 #include <GeometryGUI.h>
29 #include "GeometryGUI_Operations.h"
30 #include <GEOM_Constants.h>
31 #include <GEOM_Displayer.h>
32 #include <GEOM_AISShape.hxx>
33 #include <GEOM_Actor.h>
35 #include <SUIT_Desktop.h>
36 #include <SUIT_ViewWindow.h>
37 #include <SUIT_OverrideCursor.h>
39 #include <OCCViewer_ViewManager.h>
40 #include <OCCViewer_ViewModel.h>
42 #include <SALOME_ListIO.hxx>
44 #include <SVTK_ViewWindow.h>
45 #include <SVTK_View.h>
46 #include <SVTK_ViewModel.h>
47 #include <SOCC_ViewModel.h>
51 #include <QtxActionMenuMgr.h>
53 #include <SalomeApp_Application.h>
54 #include <LightApp_SelectionMgr.h>
55 #include <SalomeApp_Study.h>
57 #include <AIS_ListIteratorOfListOfInteractive.hxx>
59 #include <vtkActorCollection.h>
60 #include <vtkRenderer.h>
64 //=======================================================================
65 // function : DisplayGUI::DisplayGUI()
66 // purpose : Constructor
67 //=======================================================================
68 DisplayGUI::DisplayGUI( GeometryGUI* parent ) : GEOMGUI( parent )
72 //=======================================================================
73 // function : DisplayGUI::~DisplayGUI()
74 // purpose : Destructor
75 //=======================================================================
76 DisplayGUI::~DisplayGUI()
81 //=======================================================================
82 // function : DisplayGUI::OnGUIEvent()
83 // purpose : Dispatch menu command
84 //=======================================================================
85 bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
87 SalomeApp_Application* app = getGeometryGUI()->getApp();
88 if (!app) return false;
90 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
91 if ( !appStudy ) return false;
93 LightApp_SelectionMgr *Sel = app->selectionMgr();
94 SALOME_ListIO selected;
95 Sel->selectedObjects( selected );
97 switch ( theCommandID ) {
98 case GEOMOp::OpDMWireframe: // MENU VIEW - DISPLAY MODE - WIREFRAME
101 case GEOMOp::OpDMShading: // MENU VIEW - DISPLAY MODE - SHADING
104 case GEOMOp::OpDMShadingWithEdges: // MENU VIEW - DISPLAY MODE - SHADING WITH EDGES
107 case GEOMOp::OpDMTexture: // MENU VIEW - DISPLAY MODE - TEXTURE
110 case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL
111 getGeometryGUI()->EmitSignalDeactivateDialog();
114 case GEOMOp::OpShowOnly: // POPUP MENU - SHOW ONLY
115 getGeometryGUI()->EmitSignalDeactivateDialog();
118 case GEOMOp::OpShowOnlyChildren: // POPUP MENU - SHOW ONLY CHILDREN
119 getGeometryGUI()->EmitSignalDeactivateDialog();
120 DisplayOnlyChildren();
122 case GEOMOp::OpHideAll: // MENU VIEW - HIDE ALL
125 case GEOMOp::OpHide: // POPUP MENU - HIDE
128 case GEOMOp::OpShow: // POPUP MENU - SHOW
129 getGeometryGUI()->EmitSignalDeactivateDialog();
132 case GEOMOp::OpSwitchVectors: // MENU VIEW - DISPLAY MODE - SHOW EDGE DIRECTION
133 SetVectorMode(!GetVectorMode());
134 getGeometryGUI()->action( GEOMOp::OpSwitchVectors )->setText
135 ( GetVectorMode() ? tr("MEN_VECTOR_MODE_ON") : tr( "MEN_VECTOR_MODE_OFF" ) );
136 getGeometryGUI()->menuMgr()->update();
138 case GEOMOp::OpSwitchVertices: // MENU VIEW - DISPLAY MODE - SHOW/HIDE VERTICES
139 SetVerticesMode(!GetVerticesMode());
140 getGeometryGUI()->action( GEOMOp::OpSwitchVertices )->setText
141 ( GetVerticesMode() ? tr("MEN_VERTICES_MODE_ON") : tr( "MEN_VERTICES_MODE_OFF" ) );
142 getGeometryGUI()->menuMgr()->update();
144 case GEOMOp::OpSwitchName: // MENU VIEW - DISPLAY MODE - SHOW/HIDE NAME
145 SetNameMode(!GetNameMode());
146 getGeometryGUI()->action( GEOMOp::OpSwitchName )->setText
147 ( GetNameMode() ? tr("MEN_NAME_MODE_ON") : tr( "MEN_NAME_MODE_OFF" ) );
148 getGeometryGUI()->menuMgr()->update();
150 case GEOMOp::OpWireframe: // POPUP MENU - DISPLAY MODE - WIREFRAME
151 ChangeDisplayMode( 0 );
153 case GEOMOp::OpShading: // POPUP MENU - DISPLAY MODE - SHADING
154 ChangeDisplayMode( 1 );
156 case GEOMOp::OpShadingWithEdges: // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES
157 ChangeDisplayMode( 2 );
159 case GEOMOp::OpTexture: // POPUP MENU - DISPLAY MODE - TEXTURE
160 ChangeDisplayMode( 3 );
162 case GEOMOp::OpVectors: // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
163 ChangeDisplayMode( 4 );
165 case GEOMOp::OpVertices: // POPUP MENU - DISPLAY MODE - SHOW VERTICES
166 ChangeDisplayMode( 5 );
167 case GEOMOp::OpShowName: // POPUP MENU - DISPLAY MODE - SHOW NAME
168 ChangeDisplayMode( 6 );
171 app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
174 Sel->setSelectedObjects( selected );
175 GEOM_Displayer( appStudy ).UpdateColorScale();
179 //=====================================================================================
180 // function : DisplayGUI::DisplayAll()
181 // purpose : Display all GEOM objects
182 //=====================================================================================
183 void DisplayGUI::DisplayAll()
185 SalomeApp_Application* app = getGeometryGUI()->getApp();
188 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
189 if ( !appStudy ) return;
190 _PTR(Study) aStudy = appStudy->studyDS();
191 if ( !aStudy ) return;
192 _PTR(SComponent) SC ( aStudy->FindComponent( "GEOM" ) );
196 SALOME_ListIO listIO;
197 _PTR(ChildIterator) anIter ( aStudy->NewChildIterator( SC ) );
198 anIter->InitEx( true );
200 SUIT_OverrideCursor wc;
202 while( anIter->More() ) {
203 _PTR(SObject) valSO ( anIter->Value() );
205 if ( !valSO->ReferencedObject( refSO ) ) {
206 listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
207 SC->ComponentDataType().c_str(),
208 valSO->GetName().c_str()) );
212 GEOM_Displayer( appStudy ).Display( listIO, true );
215 //=====================================================================================
216 // function : DisplayGUI::EraseAll()
217 // purpose : Erase all GEOM objects
218 //=====================================================================================
219 void DisplayGUI::EraseAll()
221 SUIT_OverrideCursor wc;
223 SUIT_Application* app = getGeometryGUI()->getApp();
225 SUIT_ViewWindow* vw = app->desktop()->activeWindow();
227 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
228 SUIT_ViewManager* vman = vw->getViewManager();
229 if ( vman->getType() == OCCViewer_Viewer::Type() ||
230 vman->getType() == SVTK_Viewer::Type() ) {
231 GEOM_Displayer( appStudy ).EraseAll(true);
237 //=====================================================================================
238 // function : DisplayGUI::DisplayOnly()
239 // purpose : Display selected GEOM objects and erase other
240 //=====================================================================================
241 void DisplayGUI::DisplayOnly()
247 //=====================================================================================
248 // function : DisplayGUI::DisplayOnlyChildren()
249 // purpose : Display only children of selected GEOM objects and erase other
250 //=====================================================================================
251 void DisplayGUI::DisplayOnlyChildren()
255 SALOME_ListIO listIO;
257 SalomeApp_Application* app = getGeometryGUI()->getApp();
260 SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
261 if (!anActiveStudy) return;
263 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
264 if (!aSelMgr) return;
268 //aSelMgr->selectedObjects(aList);
269 aSelMgr->selectedObjects(aList, "ObjectBrowser", false);
270 SALOME_ListIteratorOfListIO It (aList);
272 SUIT_OverrideCursor wc;
274 for (; It.More(); It.Next()) {
275 Handle(SALOME_InteractiveObject) anIObject = It.Value();
276 if (anIObject->hasEntry()) {
277 _PTR(SObject) SO (anActiveStudy->studyDS()->FindObjectID(anIObject->getEntry()));
279 _PTR(SComponent) SC (SO->GetFatherComponent());
280 if (QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str())) {
281 // if component is selected, pass it
284 _PTR(ChildIterator) anIter (anActiveStudy->studyDS()->NewChildIterator(SO));
285 anIter->InitEx(true);
286 while (anIter->More()) {
287 _PTR(SObject) valSO (anIter->Value());
289 if (!valSO->ReferencedObject(refSO)) {
290 listIO.Append(new SALOME_InteractiveObject(valSO->GetID().c_str(),
291 SC->ComponentDataType().c_str(),
292 valSO->GetName().c_str()));
300 GEOM_Displayer(anActiveStudy).Display(listIO, true);
303 //=====================================================================================
304 // function : DisplayGUI::Display()
305 // purpose : Display selected GEOM objects
306 //=====================================================================================
307 void DisplayGUI::Display()
309 SALOME_ListIO listIO;
311 SalomeApp_Application* app = getGeometryGUI()->getApp();
314 SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
315 if ( !anActiveStudy ) return;
317 //get SalomeApp selection manager
318 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
319 if ( !aSelMgr ) return;
322 aSelMgr->selectedObjects( aList );
323 SALOME_ListIteratorOfListIO It( aList );
325 SUIT_OverrideCursor wc;
327 for( ;It.More();It.Next() ) {
328 Handle(SALOME_InteractiveObject) anIObject = It.Value();
329 if ( anIObject->hasEntry() ) {
330 _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) );
331 if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
332 _PTR(SComponent) SC ( SO->GetFatherComponent() );
333 // if component is selected
335 _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) );
336 anIter->InitEx( true );
337 while( anIter->More() ) {
338 _PTR(SObject) valSO ( anIter->Value() );
340 if ( !valSO->ReferencedObject( refSO ) ) {
341 listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
342 SC->ComponentDataType().c_str(),
343 valSO->GetName().c_str()) );
350 listIO.Append( anIObject );
354 listIO.Append( anIObject );
357 GEOM_Displayer( anActiveStudy ).Display( listIO, true );
361 //=====================================================================================
362 // function : DisplayGUI::Erase()
363 // purpose : Erase selected GEOM objects
364 //=====================================================================================
365 void DisplayGUI::Erase()
367 SALOME_ListIO listIO;
369 SalomeApp_Application* app = getGeometryGUI()->getApp();
372 SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
373 if ( !anActiveStudy ) return;
375 //get SalomeApp selection manager
376 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
377 if ( !aSelMgr ) return;
380 aSelMgr->selectedObjects( aList );
381 SALOME_ListIteratorOfListIO It( aList );
383 SUIT_OverrideCursor wc;
385 for( ; It.More(); It.Next() ) {
386 Handle(SALOME_InteractiveObject) anIObject = It.Value();
387 if ( anIObject->hasEntry() ) {
388 _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) );
389 if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
390 _PTR(SComponent) SC ( SO->GetFatherComponent() );
391 // if component is selected
393 _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) );
394 anIter->InitEx( true );
395 while( anIter->More() ) {
396 _PTR(SObject) valSO ( anIter->Value() );
398 if ( !valSO->ReferencedObject( refSO ) ) {
399 listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
400 SC->ComponentDataType().c_str(),
401 valSO->GetName().c_str()) );
408 listIO.Append( anIObject );
412 listIO.Append( anIObject );
416 SUIT_ViewWindow* viewWindow = app->desktop()->activeWindow();
417 bool aIsForced = true;
418 if(viewWindow->getViewManager()->getType() == SVTK_Viewer::Type())
421 GEOM_Displayer(anActiveStudy).Erase( listIO, aIsForced);
422 getGeometryGUI()->getApp()->selectionMgr()->clearSelected();
425 //=====================================================================================
426 // function : DisplayGUI::SetDisplayMode()
427 // purpose : Set display mode for the viewer (current viewer if <viewWindow> - 0 )
428 //=====================================================================================
429 void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
431 SUIT_OverrideCursor wc;
433 SalomeApp_Application* app = getGeometryGUI()->getApp();
437 viewWindow = app->desktop()->activeWindow();
439 SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
440 if ( !aStudy ) return;
442 GEOM_Displayer displayer( aStudy );
444 int mgrId = viewWindow->getViewManager()->getGlobalId();
446 SALOME_ListIO anIOlst;
447 displayer.GetActiveView()->GetVisible( anIOlst );
449 for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
450 Handle( SALOME_InteractiveObject ) io = It.Value();
451 aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), mode );
452 displayer.Redisplay( io, false );
454 displayer.UpdateViewer();
455 GeometryGUI::Modified();
458 //=====================================================================================
459 // function : DisplayGUI::SetVectorsMode()
460 // purpose : Set vector mode for the viewer
461 //=====================================================================================
462 void DisplayGUI::SetVectorMode( const bool mode, SUIT_ViewWindow* viewWindow )
464 SUIT_OverrideCursor wc;
466 SalomeApp_Application* app = getGeometryGUI()->getApp();
469 SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
470 if ( !aStudy ) return;
473 viewWindow = app->desktop()->activeWindow();
475 GEOM_Displayer displayer( aStudy );
477 viewWindow->setProperty( "VectorsMode", mode );
479 int aMgrId = viewWindow->getViewManager()->getGlobalId();
481 SALOME_ListIO anIOlst;
482 displayer.GetActiveView()->GetVisible( anIOlst );
484 for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
485 Handle( SALOME_InteractiveObject ) io = It.Value();
486 aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), mode );
487 displayer.Redisplay( io, false );
489 displayer.UpdateViewer();
490 GeometryGUI::Modified();
493 //=====================================================================================
494 // function : DisplayGUI::GetVectorMode()
495 // purpose : Get the "show edge direction" mode of the viewer
496 //=====================================================================================
497 int DisplayGUI::GetVectorMode( SUIT_ViewWindow* viewWindow )
500 viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
501 return viewWindow->property( "VectorsMode" ).toBool();
504 //=====================================================================================
505 // function : DisplayGUI::SetVerticesMode()
506 // purpose : Set vertices mode for the viewer
507 //=====================================================================================
508 void DisplayGUI::SetVerticesMode( const bool mode, SUIT_ViewWindow* viewWindow )
510 SUIT_OverrideCursor wc;
512 SalomeApp_Application* app = getGeometryGUI()->getApp();
515 SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
516 if ( !aStudy ) return;
519 viewWindow = app->desktop()->activeWindow();
521 GEOM_Displayer displayer( aStudy );
523 viewWindow->setProperty( "VerticesMode", mode );
525 int aMgrId = viewWindow->getViewManager()->getGlobalId();
527 SALOME_ListIO anIOlst;
528 displayer.GetActiveView()->GetVisible( anIOlst );
530 for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
531 Handle( SALOME_InteractiveObject ) io = It.Value();
532 aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Vertices ), mode );
533 displayer.Redisplay( io, false );
535 displayer.UpdateViewer();
536 GeometryGUI::Modified();
539 //=====================================================================================
540 // function : DisplayGUI::GetVerticesMode()
541 // purpose : Get the "show vertices" mode of the viewer
542 //=====================================================================================
543 int DisplayGUI::GetVerticesMode( SUIT_ViewWindow* viewWindow )
546 viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
547 return viewWindow->property( "VerticesMode" ).toBool();
550 //=====================================================================================
551 // function : DisplayGUI::SetNameMode()
552 // purpose : Set name mode for the viewer
553 //=====================================================================================
554 void DisplayGUI::SetNameMode( const bool mode, SUIT_ViewWindow* viewWindow )
556 SUIT_OverrideCursor();
558 SalomeApp_Application* app = getGeometryGUI()->getApp();
561 SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
562 if ( !aStudy ) return;
565 viewWindow = app->desktop()->activeWindow();
567 viewWindow->setProperty( "NameMode", mode );
569 GEOM_Displayer displayer( aStudy );
571 int aMgrId = viewWindow->getViewManager()->getGlobalId();
573 SALOME_ListIO anIOlst;
574 displayer.GetActiveView()->GetVisible( anIOlst );
576 for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
577 Handle( SALOME_InteractiveObject ) io = It.Value();
578 aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::ShowName ), mode );
579 displayer.Redisplay( io, false );
581 displayer.UpdateViewer();
582 GeometryGUI::Modified();
585 //=====================================================================================
586 // function : DisplayGUI::GetNameMode()
587 // purpose : Get the "show name" mode of the viewer
588 //=====================================================================================
589 int DisplayGUI::GetNameMode( SUIT_ViewWindow* viewWindow )
592 viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
593 return viewWindow->property( "NameMode" ).toBool();
596 //=====================================================================================
597 // function : DisplayGUI::ChangeDisplayMode()
598 // purpose : Set display mode for selected objects in the viewer given
599 // (current viewer if <viewWindow> = 0 )
600 //=====================================================================================
601 void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
603 SalomeApp_Application* app = getGeometryGUI()->getApp();
607 viewWindow = app->desktop()->activeWindow();
609 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
610 if ( !aSelMgr ) return;
612 SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
613 if ( !aStudy ) return;
615 SUIT_OverrideCursor wc;
617 SALOME_ListIO selected;
618 aSelMgr->selectedObjects( selected );
619 if ( selected.IsEmpty() ) return;
621 GEOM_Displayer displayer( aStudy );
623 int mgrId = viewWindow->getViewManager()->getGlobalId();
625 QVariant v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), QVariant() );
626 bool vectorMode = v.isValid() ? !v.toBool() : false;
627 v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Vertices ), QVariant() );
628 bool verticesMode = v.isValid() ? !v.toBool() : false;
629 v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::ShowName ), QVariant() );
630 bool nameMode = v.isValid() ? !v.toBool() : false;
632 for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
633 Handle( SALOME_InteractiveObject ) io = It.Value();
634 if ( mode == 0 || mode == 1 || mode == 2 || mode == 3 ) {
635 aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), mode );
637 else if ( mode == 4 ) {
638 aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), vectorMode );
640 else if ( mode == 5 ) {
641 aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::Vertices ), verticesMode );
643 else if ( mode == 6 ) {
644 aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::ShowName ), nameMode );
646 displayer.Redisplay( io, false );
648 displayer.UpdateViewer();
649 GeometryGUI::Modified();
652 //=====================================================================================
654 //=====================================================================================
658 __declspec( dllexport )
660 GEOMGUI* GetLibGUI( GeometryGUI* parent )
662 return new DisplayGUI( parent );