Implementation of the issue "0021671: EDF 1829 GEOM : Bring to front selected objects (continuation)"

This commit is contained in:
rnv 2012-07-06 12:45:54 +00:00
parent 12efffce9b
commit 8002d3e86f
15 changed files with 651 additions and 72 deletions

View File

@ -50,6 +50,7 @@
<parameter name="point_color" value="255, 255, 0" />
<parameter name="isos_color" value="200, 200, 200" />
<parameter name="toplevel_color" value="170, 85, 0" />
<parameter name="toplevel_dm" value="0" />
<parameter name="type_of_marker" value="1" />
<parameter name="deflection_coeff" value="0.001" />
<parameter name="auto_create_base_objects" value="false" />

View File

@ -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());

View File

@ -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()->

View File

@ -39,6 +39,7 @@
#include <GEOM_Actor.h>
#include <GEOM_AISShape.hxx>
#include <GEOM_TopWireframeShape.hxx>
#include <GEOM_AISVector.hxx>
#include <GEOM_AISTrihedron.hxx>
#include <GEOM_VTKTrihedron.hxx>
@ -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<Standard_Boolean>() );
}
isTopLevel = aPropMap.value(TOP_LEVEL_PROP).value<Standard_Boolean>();
}
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

View File

@ -2962,6 +2962,18 @@ Please, select face, shell or solid and try again</translation>
<source>PREF_TOPLEVEL_COLOR</source>
<translation>Top level color</translation>
</message>
<message>
<source>PREF_TOPLEVEL_DM</source>
<translation>Top level display mode</translation>
</message>
<message>
<source>MEN_KEEP_CURRENT_DM</source>
<translation>Keep current display mode</translation>
</message>
<message>
<source>MEN_SHOW_ADD_WACTOR</source>
<translation>Show additional wireframe actor</translation>
</message>
<message>
<source>PREF_LINE_COLOR</source>
<translation>Color of edges, vectors, wires</translation>

View File

@ -61,6 +61,7 @@
#include <SalomeApp_Application.h>
#include <SalomeApp_DataObject.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_VTKSelector.h>
@ -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<QVariant> 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()

View File

@ -990,6 +990,7 @@ void GEOMToolsGUI::OnEdgeWidth()
if (isOCC) { // if is OCCViewer
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(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<SOCC_Prs*>(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;

View File

@ -73,11 +73,18 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <V3d_View.hxx>
#include <SalomeApp_Tools.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
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;
}
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);
void GEOM_AISShape::setPrevDisplayMode(const Standard_Integer mode) {
myPrevDisplayMode = mode;
}
Quantity_Color GEOM_AISShape::topLevelColor() {
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;
}

View File

@ -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;
};

View File

@ -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 <SALOME_InteractiveObject.hxx>
//Open CASCADE includes
#include <AIS_Drawer.hxx>
#include <TopoDS_Shape.hxx>
#include <Prs3d_IsoAspect.hxx>
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 );
}

View File

@ -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 <Standard.hxx>
#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 <Standard_Boolean.hxx>
#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

View File

@ -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 <Standard_TypeMismatch.hxx>
#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() {}

View File

@ -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 <TopoDS_Shape.hxx>
#endif
#ifndef _GEOM_TopWireframeShape_HeaderFile
#include "GEOM_TopWireframeShape.hxx"
#endif

View File

@ -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 <Standard_Macro.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#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

View File

@ -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 \