From: rnv Date: Fri, 6 Jul 2012 12:45:54 +0000 (+0000) Subject: Implementation of the issue "0021671: EDF 1829 GEOM : Bring to front selected objects... X-Git-Tag: V6_6_0a1~97 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8002d3e86f36d12d97fc60e859d6230884803d75;p=modules%2Fgeom.git Implementation of the issue "0021671: EDF 1829 GEOM : Bring to front selected objects (continuation)" --- diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 058d0ebd6..dd0dfdfd2 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -50,6 +50,7 @@ + diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index e0e94a8ee..07613982f 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -386,7 +386,12 @@ void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow ) while( ite.More() ) { if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) { Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() ); - ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true ); + if(aSh->isTopLevel()) { + aSh->setPrevDisplayMode(Standard_Integer( newmode )); + } + else { + ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true ); + } } ite.Next(); } @@ -539,17 +544,21 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); AIS_ListIteratorOfListOfInteractive interIter( shapes ); for ( ; interIter.More(); interIter.Next() ) { - if ( mode == 0 ) - ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); - else if ( mode == 1 ) - ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); - else if ( mode == 2 ) - ic->SetDisplayMode( interIter.Value(), GEOM_AISShape::ShadingWithEdges, false ); - else if ( mode == 3 ) - ic->SetDisplayMode( interIter.Value(), AIS_ExactHLR, false ); - else if (mode == 4 ) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); - if ( !aSh.IsNull() ) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); + if ( !aSh.IsNull() ) { + if(!aSh->isTopLevel()) { + if ( mode == 0 ) + ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); + else if ( mode == 1 ) + ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); + else if ( mode == 2 ) + ic->SetDisplayMode( interIter.Value(), GEOM_AISShape::ShadingWithEdges, false ); + else if ( mode == 3 ) + ic->SetDisplayMode( interIter.Value(), AIS_ExactHLR, false ); + } else { + aSh->setPrevDisplayMode(mode); + } + if (mode == 4 ) { vectorMode = !aSh->isShowVectors(); aSh->SetDisplayVectors(vectorMode); ic->RecomputePrsOnly(interIter.Value()); diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index e0abcd4dc..734234269 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -311,7 +311,13 @@ QString GEOMGUI_Selection::displayMode( const int index ) const if ( lst.Extent() ) { Handle(AIS_InteractiveObject) io = lst.First(); if ( !io.IsNull() ) { - int dm = io->DisplayMode(); + int dm; + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io); + if(!aSh.IsNull()) { + dm = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode(); + } else { + dm = io->DisplayMode(); + } OCC_DISPLAY_MODE_TO_STRING( res, dm ); if ( res.isEmpty() ) { // return default display mode of AIS_InteractiveContext OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*)SUIT_Session::session()->activeApplication()-> diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 4e1011d69..197b32029 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -673,11 +674,14 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) } // Setup shape properties here ..., e.g. display mode, color, transparency, etc - AISShape->SetDisplayMode( aPropMap.value(DISPLAY_MODE_PROP).toInt() ); - AISShape->SetDisplayVectors(aPropMap.value(VECTOR_MODE_PROP).toInt()); + Standard_Boolean isTopLevel = Standard_False; if(aPropMap.contains(TOP_LEVEL_PROP)) { - AISShape->setTopLevel( aPropMap.value(TOP_LEVEL_PROP).value() ); - } + isTopLevel = aPropMap.value(TOP_LEVEL_PROP).value(); + } + AISShape->SetDisplayMode( aPropMap.value(DISPLAY_MODE_PROP).toInt() ); + AISShape->setTopLevel(isTopLevel); + + AISShape->SetDisplayVectors(aPropMap.value(VECTOR_MODE_PROP).toInt()); }else { MESSAGE("myDisplayMode = "<< myDisplayMode) AISShape->SetDisplayMode( myDisplayMode ); @@ -697,7 +701,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) QStringList uv = anIsos.split(DIGIT_SEPARATOR); anUIsoNumber = uv[0].toInt(); aVIsoNumber = uv[1].toInt(); - //AISShape->SetTransparency(aPropMap.value(TRANSPARENCY_PROP).toDouble()); + AISShape->SetTransparency(aPropMap.value(TRANSPARENCY_PROP).toDouble()); } else { anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1); aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1); @@ -757,8 +761,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) useObjMarker = true; } } - } - + } else { if ( onlyVertex ) @@ -968,30 +971,38 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) material.fromProperties( aPropMap.value(MATERIAL_PROP).toString() ); } else { // Get material property from study and construct material model - QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" ); + QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" ); material.fromResources( mname ); } aStudy->setObjectProperty( aMgrId, anIO->getEntry(), MATERIAL_PROP, material.toProperties() ); // Set material for the selected shape - AISShape->SetMaterial( material.getMaterialOCCAspect() ); - - if(HasWidth()) - aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() ); - - if(HasIsosWidth()) - aStudy->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() ); - - + AISShape->SetMaterial( material.getMaterialOCCAspect() ); + if(HasWidth()) + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() ); + if(HasIsosWidth()) + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() ); } // AISShape->SetName(???); ??? necessary to set name ??? occPrs->AddObject( AISShape ); - + // In accordance with ToActivate() value object will be activated/deactivated // when it will be displayed occPrs->SetToActivate( ToActivate() ); + + if( AISShape->isTopLevel() && AISShape->topLevelDisplayMode() == GEOM_AISShape::TopShowAdditionalWActor) { + //21671: EDF 1829 GEOM : Bring to front selected objects (continuation): + // Display wireframe presentation additionally + Handle(GEOM_TopWireframeShape) aWirePrs = new GEOM_TopWireframeShape(myShape); + aWirePrs->SetWidth(AISShape->Width()); + if ( !myIO.IsNull() ) { + aWirePrs->setIO( myIO ); + aWirePrs->SetOwner( myIO ); + } + occPrs->AddObject(aWirePrs); + } } } // if presentation is found -> set again shape for it diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 83b653889..912f58eea 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -2962,6 +2962,18 @@ Please, select face, shell or solid and try again PREF_TOPLEVEL_COLOR Top level color + + PREF_TOPLEVEL_DM + Top level display mode + + + MEN_KEEP_CURRENT_DM + Keep current display mode + + + MEN_SHOW_ADD_WACTOR + Show additional wireframe actor + PREF_LINE_COLOR Color of edges, vectors, wires diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 918a9f316..48157358b 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -61,6 +61,7 @@ #include #include #include +#include #include #include @@ -1338,6 +1339,14 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->setRule( action( GEOMOp::OpReimport ), QString("$imported in {'true'} and selcount>0"), QtxPopupMgr::VisibleRule ); mgr->hide( mgr->actionId( action( myEraseAll ) ) ); + + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if(resMgr) { + GEOM_AISShape::setTopLevelDisplayMode((GEOM_AISShape::TopLevelDispMode)resMgr->integerValue("Geometry", "toplevel_dm", 0)); + QColor c = resMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) ); + GEOM_AISShape::setTopLevelColor(SalomeApp_Tools::color(c)); + } } //======================================================================= @@ -1712,8 +1721,8 @@ void GeometryGUI::createPreferences() addPreference( tr( "PREF_TOPLEVEL_COLOR" ), genGroup, LightApp_Preferences::Color, "Geometry", "toplevel_color" ); - addPreference( "", genGroup, LightApp_Preferences::Space ); - + int top_lev_dm = addPreference( tr( "PREF_TOPLEVEL_DM" ), genGroup, + LightApp_Preferences::Selector, "Geometry", "toplevel_dm" ); int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); @@ -1800,6 +1809,25 @@ void GeometryGUI::createPreferences() setPreferenceProperty( dispmode, "strings", aModesList ); setPreferenceProperty( dispmode, "indexes", anIndexesList ); + + // Set property for top level display mode + QStringList aTopModesList; + aTopModesList.append( tr("MEN_KEEP_CURRENT_DM") ); + aTopModesList.append( tr("MEN_WIREFRAME") ); + aTopModesList.append( tr("MEN_SHADING") ); + aTopModesList.append( tr("MEN_SHADING_WITH_EDGES") ); + aTopModesList.append( tr("MEN_SHOW_ADD_WACTOR") ); + + QList aTopIndexesList; + aTopIndexesList.append(0); + aTopIndexesList.append(1); + aTopIndexesList.append(2); + aTopIndexesList.append(3); + aTopIndexesList.append(4); + + setPreferenceProperty( top_lev_dm, "strings", aTopModesList ); + setPreferenceProperty( top_lev_dm, "indexes", aTopIndexesList ); + // Set property for step value for spinboxes setPreferenceProperty( step, "min", 1 ); setPreferenceProperty( step, "max", 10000 ); @@ -1868,8 +1896,13 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par if (param == QString("SettingsGeomStep")) { double spin_step = aResourceMgr->doubleValue(section, param, 100.); EmitSignalDefaultStepValueChanged(spin_step); + } else if(param == QString("toplevel_color")) { + QColor c = aResourceMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) ); + GEOM_AISShape::setTopLevelColor(SalomeApp_Tools::color(c)); + } else if(param == QString("toplevel_dm")) { + GEOM_AISShape::setTopLevelDisplayMode((GEOM_AISShape::TopLevelDispMode)aResourceMgr->integerValue("Geometry", "toplevel_dm", 0)); } - } + } } LightApp_Displayer* GeometryGUI::displayer() diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index b0f0a1023..64983d176 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -990,6 +990,7 @@ void GEOMToolsGUI::OnEdgeWidth() if (isOCC) { // if is OCCViewer OCCViewer_Viewer* vm = dynamic_cast(window->getViewManager()->getViewModel()); Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + SALOME_View* view = GEOM_Displayer::GetActiveView(); ic->InitCurrent(); if (ic->MoreCurrent()) { Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); @@ -1001,17 +1002,26 @@ void GEOMToolsGUI::OnEdgeWidth() Dlg->setTheLW(aWidth); int aNewWidth = 0; if (Dlg->exec()) { - aNewWidth = Dlg->getTheLW(); - bool ok = (aNewWidth != aWidth && aNewWidth != 0 ); - if (ok) { - for(; ic->MoreCurrent(); ic->NextCurrent()) { - CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - CurObject->SetWidth(aNewWidth); - ic->Redisplay(CurObject); - appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP, aNewWidth); + aNewWidth = Dlg->getTheLW(); + bool ok = (aNewWidth != aWidth && aNewWidth != 0 ); + if (ok) { + for(; ic->MoreCurrent(); ic->NextCurrent()) { + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + SOCC_Prs* aPrs = dynamic_cast(view->CreatePrs(CurObject->getIO()->getEntry())); + AIS_ListOfInteractive anAISObjects; + aPrs->GetObjects( anAISObjects ); + AIS_ListIteratorOfListOfInteractive aIter( anAISObjects ); + for ( ; aIter.More(); aIter.Next() ) { + Handle(SALOME_AISShape) cur = Handle(SALOME_AISShape)::DownCast(aIter.Value()); + if ( !cur.IsNull() ) { + cur->SetWidth(aNewWidth); + ic->Redisplay(cur); + } + } + appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP, aNewWidth); + } + } } - } - } } else { return; diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index a50c92c23..7cba7edbe 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -73,11 +73,18 @@ #include #include +#include + +#include + #include #include #include +GEOM_AISShape::TopLevelDispMode GEOM_AISShape::myTopLevelDm = GEOM_AISShape::TopKeepCurrent; +Quantity_Color GEOM_AISShape::myTopLevelColor; + static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, const Handle(AIS_InteractiveContext)& theIC, @@ -138,9 +145,10 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape, : SALOME_AISShape(shape), myName(aName), myDisplayVectors(false) { myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); - + myPrevDisplayMode = 0; storeBoundaryColors(); + myEdgesInShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); myUIsoNumber = -1; @@ -158,7 +166,7 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape, myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect); myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect); } - myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); + myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); } void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){ @@ -196,46 +204,38 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent if (IsInfinite()) aPrs->SetInfiniteState(Standard_True); //pas de prise en compte lors du FITALL Handle(AIS_InteractiveContext) anIC = GetContext(); - + // StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode; + bool isTopLev = (isTopLevel() && topLevelDisplayMode() != TopShowAdditionalWActor); switch (aMode) { case 0://StdSelect_DM_Wireframe: { - restoreIsoNumbers(); - // Restore wireframe edges colors restoreBoundaryColors(); - - - if(isTopLevel()) { - SetColor(topLevelColor()); - Handle(Prs3d_LineAspect) anAspect = Attributes()->WireAspect(); - anAspect->SetColor( topLevelColor() ); - Attributes()->SetWireAspect( anAspect ); + if(isTopLev) { + SetColor(topLevelColor()); + Handle(Prs3d_LineAspect) anAspect = Attributes()->WireAspect(); + anAspect->SetColor( topLevelColor() ); + Attributes()->SetWireAspect( anAspect ); } - - StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer); - + StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer); break; } case 1://StdSelect_DM_Shading: { restoreIsoNumbers(); - shadingMode(aPresentationManager, aPrs, aMode); - // Store wireframe edges colors storeBoundaryColors(); - break; } case 3: //StdSelect_DM_HLR: { - if(!isTopLevel()) - AIS_TexturedShape::Compute(aPresentationManager, aPrs, aMode); + if(!isTopLev) + AIS_TexturedShape::Compute(aPresentationManager, aPrs, aMode); else - shadingMode(aPresentationManager, aPrs, AIS_Shaded); + shadingMode(aPresentationManager, aPrs, AIS_Shaded); break; } } @@ -396,7 +396,7 @@ void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPre // P->SetPrimitivesAspect(a4bis); // G->SetGroupPrimitivesAspect(a4bis); //a4bis->SetInteriorColor(myShadingColor); - if( isTopLevel() ) + if( isTopLevel() && topLevelDisplayMode() != TopShowAdditionalWActor ) myDrawer->ShadingAspect()->SetColor( topLevelColor() ); else { if(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().MaterialType( Graphic3d_MATERIAL_ASPECT )) @@ -470,12 +470,47 @@ Standard_Boolean GEOM_AISShape::isTopLevel() { } void GEOM_AISShape::setTopLevel(Standard_Boolean f) { + if(f) { + if(f != myTopLevel) + myPrevDisplayMode = DisplayMode(); + Standard_Integer dm; + switch(topLevelDisplayMode()) { + case TopKeepCurrent : dm = myPrevDisplayMode; break; + case TopWireFrame : dm = AIS_WireFrame; break; + case TopShadingWithEdges : dm = ShadingWithEdges; break; + default : dm = AIS_Shaded; break; + } + SetDisplayMode(dm); + } else { + if(f != myTopLevel) + SetDisplayMode(myPrevDisplayMode); + } myTopLevel = f; } +void GEOM_AISShape::setPrevDisplayMode(const Standard_Integer mode) { + myPrevDisplayMode = mode; +} + Quantity_Color GEOM_AISShape::topLevelColor() { - SUIT_Session* session = SUIT_Session::session(); - SUIT_ResourceMgr* resMgr = session->resourceMgr(); - QColor c = resMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) ); - return SalomeApp_Tools::color(c); + return myTopLevelColor; +} + +void GEOM_AISShape::setTopLevelColor(const Quantity_Color c) { + myTopLevelColor = c; +} + +GEOM_AISShape::TopLevelDispMode GEOM_AISShape::topLevelDisplayMode() { + return myTopLevelDm; +} +void GEOM_AISShape::setTopLevelDisplayMode(const GEOM_AISShape::TopLevelDispMode dm) { + myTopLevelDm = dm; } + +Standard_Boolean GEOM_AISShape::switchTopLevel() { + return myTopLevelDm != TopShowAdditionalWActor; +} + +Standard_Boolean GEOM_AISShape::toActivate() { + return Standard_True; +} \ No newline at end of file diff --git a/src/OBJECT/GEOM_AISShape.hxx b/src/OBJECT/GEOM_AISShape.hxx index 4dfe2c9a1..774bf1b2b 100644 --- a/src/OBJECT/GEOM_AISShape.hxx +++ b/src/OBJECT/GEOM_AISShape.hxx @@ -77,6 +77,16 @@ public: TexturedShape = ShadingWithEdges+1 //!< the same as AIS_ExactHLR } DispMode; + //! Enumeration of top level display modes + typedef enum { + TopKeepCurrent = 0 , //!< Keep current display mode + TopWireFrame, + TopShading, + TopShadingWithEdges, + TopShowAdditionalWActor + } TopLevelDispMode; + + inline void* operator new(size_t,void* anAddress) { return anAddress; @@ -116,6 +126,8 @@ public: const Standard_Integer aMode = 0) ; virtual bool isShowVectors () { return myDisplayVectors; } + virtual Standard_Boolean switchTopLevel(); + virtual Standard_Boolean toActivate(); // Type management // @@ -130,6 +142,14 @@ public: void storeBoundaryColors(); static Quantity_Color topLevelColor(); + static void setTopLevelColor(const Quantity_Color c); + + static TopLevelDispMode topLevelDisplayMode(); + static void setTopLevelDisplayMode(const TopLevelDispMode dm); + + void setPrevDisplayMode(const Standard_Integer mode); + Standard_Integer prevDisplayMode() const {return myPrevDisplayMode;} + protected: void shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, @@ -149,11 +169,14 @@ protected: int myVIsoNumber; private: - TCollection_AsciiString myName; + TCollection_AsciiString myName; bool myDisplayVectors; Standard_Boolean myTopLevel; Graphic3d_MaterialAspect myCurrentMaterial; + Standard_Integer myPrevDisplayMode; + static TopLevelDispMode myTopLevelDm; + static Quantity_Color myTopLevelColor; }; diff --git a/src/OBJECT/GEOM_TopWireframeShape.cxx b/src/OBJECT/GEOM_TopWireframeShape.cxx new file mode 100755 index 000000000..b3db3ddda --- /dev/null +++ b/src/OBJECT/GEOM_TopWireframeShape.cxx @@ -0,0 +1,102 @@ +// 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 +// + +// GEOM OBJECT : interactive object for Geometry entities visualization +// File : GEOM_TopWireframeShape.cxx +// Author : +// Module : GEOM + +/*! + \class GEOM_TopWireframeShape GEOM_TopWireframeShape.hxx + \brief This class designed for drawing special OCC wireframe + presentation on the top level of the viewer. +*/ + +//Local includes +#include "GEOM_TopWireframeShape.ixx" +#include "GEOM_AISShape.hxx" + +//GUI includes +#include + +//Open CASCADE includes +#include +#include +#include + +GEOM_TopWireframeShape::GEOM_TopWireframeShape(const TopoDS_Shape& shape) + : SALOME_AISShape(shape) +{ + SetDisplayMode(AIS_WireFrame); + Handle(Prs3d_IsoAspect) anAspect = Attributes()->UIsoAspect(); + anAspect->SetNumber( 0 ); + Attributes()->SetUIsoAspect( anAspect ); + anAspect = Attributes()->VIsoAspect(); + anAspect->SetNumber( 0 ); + Attributes()->SetVIsoAspect( anAspect ); + SetColor(GEOM_AISShape::topLevelColor()); +} + +Handle(SALOME_InteractiveObject) GEOM_TopWireframeShape::getIO(){ + Handle(SALOME_InteractiveObject) IO; + if ( !GetOwner().IsNull() ) + IO = Handle(SALOME_InteractiveObject)::DownCast( GetOwner() ); + return IO; +} + +Standard_Boolean GEOM_TopWireframeShape::hasIO(){ + return !getIO().IsNull(); +} + +void GEOM_TopWireframeShape::setName(const Standard_CString /*aName*/) +{ +} + +Standard_CString GEOM_TopWireframeShape::getName(){ + return ""; +} + + +void GEOM_TopWireframeShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& /*aIndexMap*/, + const Standard_Boolean /*aHighlight*/ ) +{ +} + +Standard_Boolean GEOM_TopWireframeShape::isTopLevel() { + return Standard_True; +} + +void GEOM_TopWireframeShape::setTopLevel(Standard_Boolean /*f*/) { + +} + +Standard_Boolean GEOM_TopWireframeShape::toActivate() { + return Standard_False; +} + +Standard_Boolean GEOM_TopWireframeShape::switchTopLevel() { + return Standard_True; +} + +void GEOM_TopWireframeShape::setIO(const Handle(SALOME_InteractiveObject)& io){ + SetOwner( io ); +} \ No newline at end of file diff --git a/src/OBJECT/GEOM_TopWireframeShape.hxx b/src/OBJECT/GEOM_TopWireframeShape.hxx new file mode 100755 index 000000000..b15f3c670 --- /dev/null +++ b/src/OBJECT/GEOM_TopWireframeShape.hxx @@ -0,0 +1,110 @@ +// 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 +// + +// GEOM OBJECT : interactive object for Geometry entities visualization +// File : GEOM_TopWireframeShape.hxx +// Module : GEOM +// +#ifndef _GEOM_TopWireframeShape_HeaderFile +#define _GEOM_TopWireframeShape_HeaderFile + +#include "GEOM_OBJECT_defs.hxx" + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOM_TopWireframeShape_HeaderFile +#include "Handle_GEOM_TopWireframeShape.hxx" +#endif + +#ifndef _SALOME_AISShape_HeaderFile +#include "SALOME_AISShape.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif + +class GEOM_OBJECT_EXPORT GEOM_TopWireframeShape : public SALOME_AISShape { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // inline void operator delete(void *anAddress, size_t size) + // { + // if (anAddress) Standard::Free((Standard_Address&)anAddress,size); + // } + + // Methods PUBLIC + // + GEOM_TopWireframeShape(const TopoDS_Shape& shape); + virtual Handle_SALOME_InteractiveObject getIO(); + virtual Standard_Boolean hasIO(); + virtual Standard_Boolean isTopLevel(); + virtual Standard_Boolean switchTopLevel(); + virtual Standard_Boolean toActivate(); + virtual void setTopLevel(Standard_Boolean); + virtual Standard_CString getName(); + virtual void setName(const Standard_CString aName); + virtual void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ); + ~GEOM_TopWireframeShape(); + + // Type management + // + friend Handle_Standard_Type& GEOM_TopWireframeShape_Type_(); + const Handle(Standard_Type)& DynamicType() const; + Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + + + void setIO(const Handle(SALOME_InteractiveObject)& io); + +protected: + + // Methods PROTECTED + // + + // Fields PROTECTED + // + +private: + + // Methods PRIVATE + // + + // Fields PRIVATE + // +}; + +// other inline functions and methods (like "C++: function call" methods) +// + +#endif \ No newline at end of file diff --git a/src/OBJECT/GEOM_TopWireframeShape.ixx b/src/OBJECT/GEOM_TopWireframeShape.ixx new file mode 100755 index 000000000..1fd891967 --- /dev/null +++ b/src/OBJECT/GEOM_TopWireframeShape.ixx @@ -0,0 +1,89 @@ +// 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 +// + +// GEOM OBJECT : interactive object for Geometry entities visualization +// File : GEOM_AISShape.ixx +// Module : GEOM +// +#include "GEOM_TopWireframeShape.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +GEOM_TopWireframeShape::~GEOM_TopWireframeShape() {} + +Standard_EXPORT Handle_Standard_Type& GEOM_TopWireframeShape_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_AISShape); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_AISShape); + static Handle_Standard_Type aType2 = STANDARD_TYPE(AIS_Shape); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(AIS_Shape); + static Handle_Standard_Type aType3 = STANDARD_TYPE(AIS_InteractiveObject); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(AIS_InteractiveObject); + static Handle_Standard_Type aType4 = STANDARD_TYPE(SelectMgr_SelectableObject); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(SelectMgr_SelectableObject); + static Handle_Standard_Type aType5 = STANDARD_TYPE(PrsMgr_PresentableObject); + if ( aType5.IsNull()) aType5 = STANDARD_TYPE(PrsMgr_PresentableObject); + static Handle_Standard_Type aType6 = STANDARD_TYPE(MMgt_TShared); + if ( aType6.IsNull()) aType6 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType7 = STANDARD_TYPE(Standard_Transient); + if ( aType7.IsNull()) aType7 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,aType6,aType7,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOM_TopWireframeShape", + sizeof(GEOM_TopWireframeShape), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOM_TopWireframeShape) Handle(GEOM_TopWireframeShape)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOM_TopWireframeShape) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOM_TopWireframeShape))) { + _anOtherObject = Handle(GEOM_TopWireframeShape)((Handle(GEOM_TopWireframeShape)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOM_TopWireframeShape::DynamicType() const +{ + return STANDARD_TYPE(GEOM_TopWireframeShape) ; +} +Standard_Boolean GEOM_TopWireframeShape::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(GEOM_TopWireframeShape) == AType || SALOME_AISShape::IsKind(AType)); +} +Handle_GEOM_TopWireframeShape::~Handle_GEOM_TopWireframeShape() {} + diff --git a/src/OBJECT/GEOM_TopWireframeShape.jxx b/src/OBJECT/GEOM_TopWireframeShape.jxx new file mode 100755 index 000000000..fade0ed1d --- /dev/null +++ b/src/OBJECT/GEOM_TopWireframeShape.jxx @@ -0,0 +1,33 @@ +// 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 +// + +// GEOM OBJECT : interactive object for Geometry entities visualization +// File : GEOM_AISShape.jxx +// Module : GEOM +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif + +#ifndef _GEOM_TopWireframeShape_HeaderFile +#include "GEOM_TopWireframeShape.hxx" +#endif diff --git a/src/OBJECT/Handle_GEOM_TopWireframeShape.hxx b/src/OBJECT/Handle_GEOM_TopWireframeShape.hxx new file mode 100755 index 000000000..d703c6869 --- /dev/null +++ b/src/OBJECT/Handle_GEOM_TopWireframeShape.hxx @@ -0,0 +1,100 @@ +// 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 +// + +// GEOM OBJECT : interactive object for Geometry entities visualization +// File : Handle_GEOM_TopWireframeShape.hxx +// Module : GEOM +// +#ifndef _Handle_GEOM_TopWireframeShape_HeaderFile +#define _Handle_GEOM_TopWireframeShape_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SALOME_AISShape_HeaderFile +#include "Handle_SALOME_AISShape.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SALOME_AISShape); +class GEOM_TopWireframeShape; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_TopWireframeShape); + +class Handle(GEOM_TopWireframeShape) : public Handle(SALOME_AISShape) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(GEOM_TopWireframeShape)():Handle(SALOME_AISShape)() {} + Handle(GEOM_TopWireframeShape)(const Handle(GEOM_TopWireframeShape)& aHandle) : Handle(SALOME_AISShape)(aHandle) + { + } + + Handle(GEOM_TopWireframeShape)(const GEOM_TopWireframeShape* anItem) : Handle(SALOME_AISShape)((SALOME_AISShape *)anItem) + { + } + + Handle(GEOM_TopWireframeShape)& operator=(const Handle(GEOM_TopWireframeShape)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOM_TopWireframeShape)& operator=(const GEOM_TopWireframeShape* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOM_TopWireframeShape* operator->() + { + return (GEOM_TopWireframeShape *)ControlAccess(); + } + + GEOM_TopWireframeShape* operator->() const + { + return (GEOM_TopWireframeShape *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOM_TopWireframeShape)(); + + Standard_EXPORT static const Handle(GEOM_TopWireframeShape) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/OBJECT/Makefile.am b/src/OBJECT/Makefile.am index d777e8dd1..ae48a97f8 100644 --- a/src/OBJECT/Makefile.am +++ b/src/OBJECT/Makefile.am @@ -32,6 +32,10 @@ salomeinclude_HEADERS = \ GEOM_AISShape.ixx \ GEOM_AISShape.jxx \ Handle_GEOM_AISShape.hxx \ + GEOM_TopWireframeShape.hxx \ + GEOM_TopWireframeShape.ixx \ + GEOM_TopWireframeShape.jxx \ + Handle_GEOM_TopWireframeShape.hxx \ GEOM_InteractiveObject.hxx \ GEOM_InteractiveObject.ixx \ GEOM_InteractiveObject.jxx \ @@ -54,6 +58,7 @@ dist_libGEOMObject_la_SOURCES = \ GEOM_Actor.cxx \ GEOM_OCCReader.cxx \ GEOM_AISShape.cxx \ + GEOM_TopWireframeShape.cxx \ GEOM_InteractiveObject.cxx \ GEOM_AISTrihedron.cxx \ GEOM_VTKTrihedron.cxx \