00001 00002 // exotkAIS.cxx 00004 // Copyright (C) 2001 Stephane Routelous 00005 // 00006 // This file is part of exoTK. 00007 // 00008 // exoTK is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // exoTK is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with exoTK; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00029 #include <exotkAIS.hxx> 00030 00031 #ifndef _exotkAIS_InteractiveObjectPopup_HeaderFile 00032 #include <exotkAIS_InteractiveObjectPopup.hxx> 00033 #endif 00034 00035 #ifndef _AIS_Shape_HeaderFile 00036 #include <AIS_Shape.hxx> 00037 #endif 00038 #ifndef _exotkAIS_DisplayMode_HeaderFile 00039 #include <exotkAIS_DisplayMode.hxx> 00040 #endif 00041 #ifndef _exotkAIS_DisplayModeMenuNode_HeaderFile 00042 #include <exotkAIS_DisplayModeMenuNode.hxx> 00043 #endif 00044 #ifndef _AIS_InteractiveContext_HeaderFile 00045 #include <AIS_InteractiveContext.hxx> 00046 #endif 00047 #ifndef _exotkAIS_MaterialMenuNode_HeaderFile 00048 #include <exotkAIS_MaterialMenuNode.hxx> 00049 #endif 00050 #ifndef _exotkAIS_TransparencyMenuNode_HeaderFile 00051 #include <exotkAIS_TransparencyMenuNode.hxx> 00052 #endif 00053 00054 00055 //================================================================================== 00056 // Function name : exotkAIS::CreatePopupMenu 00057 //================================================================================== 00058 // Written by : Stephane Routelous - 2001-11-19 16:04:19 00059 // Description : 00060 // Return type : Handle_exotkAIS_InteractiveObjectPopup 00061 //================================================================================== 00062 // Argument : const Handle_AIS_InteractiveObject &anInteractiveObject 00063 Handle_exotkAIS_InteractiveObjectPopup exotkAIS::CreatePopupMenu(const Handle_AIS_InteractiveObject &anInteractiveObject) 00064 { 00065 Handle_exotkAIS_InteractiveObjectPopup theMenu; 00066 00067 if ( anInteractiveObject->IsKind(STANDARD_TYPE(AIS_Shape))) 00068 { 00069 Handle_AIS_Shape theAISShape = Handle_AIS_Shape::DownCast(anInteractiveObject); 00070 theMenu = CreatePopupMenuAISShape(theAISShape); 00071 } 00072 00073 return theMenu; 00074 } 00075 00076 //================================================================================== 00077 // Function name : CreatePopupMenuAISShape 00078 //================================================================================== 00079 // Written by : Stephane Routelous - 2001-11-19 16:08:11 00080 // Description : 00081 // Return type : Handle_exotkAIS_InteractiveObjectPopup 00082 //================================================================================== 00083 // Argument : const Handle_AIS_Shape& anAISShape 00084 Handle_exotkAIS_InteractiveObjectPopup exotkAIS::CreatePopupMenuAISShape(const Handle_AIS_Shape& anAISShape) 00085 { 00086 Handle_exotkAIS_InteractiveObjectPopup theMenu; 00087 00088 if ( !anAISShape.IsNull() ) 00089 { 00090 Standard_Integer theDisplayMode = anAISShape->DisplayMode(); 00091 theMenu = new exotkAIS_InteractiveObjectPopup(); 00092 Handle_exotkTree_MenuNode theRoot = new exotkTree_MenuNode(); 00093 theMenu->SetRoot(theRoot); 00094 Handle_exotkAIS_DisplayModeMenuNode theWireframeMode = new exotkAIS_DisplayModeMenuNode(anAISShape,exotkAIS_dmWireframe); 00095 theWireframeMode->SetName("Wireframe"); 00096 theRoot->AppendChild(theWireframeMode); 00097 Handle_exotkAIS_DisplayModeMenuNode theShadingMode = new exotkAIS_DisplayModeMenuNode(anAISShape,exotkAIS_dmShading); 00098 theShadingMode->SetName("Shading"); 00099 theRoot->AppendChild(theShadingMode); 00100 Handle_exotkAIS_DisplayModeMenuNode theBoxMode = new exotkAIS_DisplayModeMenuNode(anAISShape,exotkAIS_dmBox); 00101 theBoxMode->SetName("Box"); 00102 theRoot->AppendChild(theBoxMode); 00103 theRoot->AddSeparator(); 00104 Handle_exotkAIS_MaterialMenuNode theMaterialMenuNode = new exotkAIS_MaterialMenuNode(anAISShape); 00105 theMaterialMenuNode->SetName("Material..."); 00106 theRoot->AppendChild(theMaterialMenuNode); 00107 Handle_exotkAIS_TransparencyMenuNode theTransparencyMenuNode = new exotkAIS_TransparencyMenuNode(anAISShape); 00108 theTransparencyMenuNode->SetName("Transparency..."); 00109 theRoot->AppendChild(theTransparencyMenuNode); 00110 } 00111 00112 return theMenu; 00113 }
1.2.12 written by Dimitri van Heesch,
© 1997-2001