SoFCSelectionAction.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  * 
00003  *   Copyright (c) 2005 Jürgen Riegel <juergen.riegel@web.de>              *
00004  *                                                                         *
00005  *   This file is part of the FreeCAD CAx development system.              *
00006  *                                                                         *
00007  *   This library is free software; you can redistribute it and/or         *
00008  *   modify it under the terms of the GNU Library General Public           *
00009  *   License as published by the Free Software Foundation; either          *
00010  *   version 2 of the License, or (at your option) any later version.      *
00011  *                                                                         *
00012  *   This library  is distributed in the hope that it will be useful,      *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU Library General Public License for more details.                  *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU Library General Public     *
00018  *   License along with this library; see the file COPYING.LIB. If not,    *
00019  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00020  *   Suite 330, Boston, MA  02111-1307, USA                                *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #include "PreCompiled.h"
00025 
00026 #ifndef _PreComp_
00027 #  include <cassert>
00028 #  include <float.h>
00029 #  include <Inventor/actions/SoSearchAction.h>
00030 #  include <Inventor/actions/SoGetBoundingBoxAction.h>
00031 #  include <Inventor/nodes/SoCallback.h>
00032 #  include <Inventor/nodes/SoComplexity.h>
00033 #  include <Inventor/nodes/SoCube.h>
00034 #  include <Inventor/nodes/SoCamera.h>
00035 #  include <Inventor/nodes/SoCoordinate3.h>
00036 #  include <Inventor/nodes/SoCoordinate4.h>
00037 #  include <Inventor/nodes/SoFont.h>
00038 #  include <Inventor/nodes/SoMatrixTransform.h>
00039 #  include <Inventor/nodes/SoProfile.h>
00040 #  include <Inventor/nodes/SoProfileCoordinate2.h>
00041 #  include <Inventor/nodes/SoProfileCoordinate3.h>
00042 #  include <Inventor/nodes/SoSwitch.h>
00043 #  include <Inventor/nodes/SoTransformation.h>
00044 #  include <Inventor/nodes/SoIndexedLineSet.h>
00045 #  include <Inventor/nodes/SoIndexedFaceSet.h>
00046 #  include <Inventor/nodes/SoPointSet.h>
00047 #  include <Inventor/nodes/SoDrawStyle.h>
00048 #  include <Inventor/nodes/SoComplexity.h>
00049 #  include <Inventor/nodes/SoLightModel.h>
00050 #  include <Inventor/nodes/SoBaseColor.h>
00051 #endif
00052 
00053 #include <Base/Console.h>
00054 
00055 #include "SoFCSelectionAction.h"
00056 #include "SoFCSelection.h"
00057 #include <Inventor/bundles/SoMaterialBundle.h>
00058 #include <Inventor/elements/SoSwitchElement.h>
00059 #include "Selection.h"
00060 
00061 #include <Inventor/elements/SoComplexityElement.h>
00062 #include <Inventor/elements/SoComplexityTypeElement.h>
00063 #include <Inventor/elements/SoCoordinateElement.h>
00064 #include <Inventor/elements/SoElements.h>
00065 #include <Inventor/elements/SoFontNameElement.h>
00066 #include <Inventor/elements/SoFontSizeElement.h>
00067 #include <Inventor/elements/SoModelMatrixElement.h>
00068 #include <Inventor/elements/SoShapeStyleElement.h>
00069 #include <Inventor/elements/SoProfileCoordinateElement.h>
00070 #include <Inventor/elements/SoProfileElement.h>
00071 #include <Inventor/elements/SoSwitchElement.h>
00072 #include <Inventor/elements/SoUnitsElement.h>
00073 #include <Inventor/elements/SoViewVolumeElement.h>
00074 #include <Inventor/elements/SoViewingMatrixElement.h>
00075 #include <Inventor/elements/SoViewportRegionElement.h>
00076 #include <Inventor/nodes/SoCamera.h>
00077 #include <Inventor/nodes/SoComplexity.h>
00078 #include <Inventor/nodes/SoCoordinate3.h>
00079 #include <Inventor/nodes/SoCoordinate4.h>
00080 #include <Inventor/nodes/SoCube.h>
00081 #include <Inventor/nodes/SoFont.h>
00082 #include <Inventor/nodes/SoGroup.h>
00083 #include <Inventor/nodes/SoSeparator.h>
00084 #include <Inventor/nodes/SoProfile.h>
00085 #include <Inventor/nodes/SoProfileCoordinate2.h>
00086 #include <Inventor/nodes/SoProfileCoordinate3.h>
00087 #include <Inventor/nodes/SoSphere.h>
00088 #include <Inventor/nodes/SoTransformation.h>
00089 
00090 
00091 
00092 
00093 
00094 using namespace Gui;
00095 
00096 
00097 SO_ACTION_SOURCE(SoFCSelectionAction);
00098 
00107 void SoFCSelectionAction::initClass()
00108 {
00109   SO_ACTION_INIT_CLASS(SoFCSelectionAction,SoAction);
00110 
00111   SO_ENABLE(SoFCSelectionAction, SoSwitchElement);
00112 
00113   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00114 
00115   SO_ENABLE(SoFCSelectionAction, SoModelMatrixElement);
00116   SO_ENABLE(SoFCSelectionAction, SoShapeStyleElement);
00117   SO_ENABLE(SoFCSelectionAction, SoComplexityElement);
00118   SO_ENABLE(SoFCSelectionAction, SoComplexityTypeElement);
00119   SO_ENABLE(SoFCSelectionAction, SoCoordinateElement);
00120   SO_ENABLE(SoFCSelectionAction, SoFontNameElement);
00121   SO_ENABLE(SoFCSelectionAction, SoFontSizeElement);
00122   SO_ENABLE(SoFCSelectionAction, SoProfileCoordinateElement);
00123   SO_ENABLE(SoFCSelectionAction, SoProfileElement);
00124   SO_ENABLE(SoFCSelectionAction, SoSwitchElement);
00125   SO_ENABLE(SoFCSelectionAction, SoUnitsElement);
00126   SO_ENABLE(SoFCSelectionAction, SoViewVolumeElement);
00127   SO_ENABLE(SoFCSelectionAction, SoViewingMatrixElement);
00128   SO_ENABLE(SoFCSelectionAction, SoViewportRegionElement);
00129 
00130 
00131 
00132 
00133   SO_ACTION_ADD_METHOD(SoCallback,callDoAction);
00134   SO_ACTION_ADD_METHOD(SoComplexity,callDoAction);
00135   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00136   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00137   SO_ACTION_ADD_METHOD(SoFont,callDoAction);
00138   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00139   SO_ACTION_ADD_METHOD(SoProfile,callDoAction);
00140   SO_ACTION_ADD_METHOD(SoProfileCoordinate2,callDoAction);
00141   SO_ACTION_ADD_METHOD(SoProfileCoordinate3,callDoAction);
00142   SO_ACTION_ADD_METHOD(SoTransformation,callDoAction);
00143   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00144 
00145   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00146   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00147 
00148   SO_ACTION_ADD_METHOD(SoIndexedLineSet,callDoAction);
00149   SO_ACTION_ADD_METHOD(SoIndexedFaceSet,callDoAction);
00150   SO_ACTION_ADD_METHOD(SoPointSet,callDoAction);
00151 }
00152 
00153 void SoFCSelectionAction::finish()
00154 {
00155   atexit_cleanup();
00156 }
00157 
00158 
00159 SoFCSelectionAction::SoFCSelectionAction (const SelectionChanges &SelCh)
00160 :SelChange(SelCh)
00161 {
00162   SO_ACTION_CONSTRUCTOR(SoFCSelectionAction);
00163 }
00164 
00165 
00166 SoFCSelectionAction::~SoFCSelectionAction()
00167 {
00168 }
00169 
00170  
00171 void SoFCSelectionAction::beginTraversal(SoNode *node)
00172 {
00173   traverse(node);
00174 }
00175 
00176 void SoFCSelectionAction::callDoAction(SoAction *action,SoNode *node)
00177 {
00178   node->doAction(action);
00179 }
00180 
00181 // ---------------------------------------------------------------
00182 
00183 SO_ACTION_SOURCE(SoFCEnableSelectionAction);
00184 
00193 void SoFCEnableSelectionAction::initClass()
00194 {
00195   SO_ACTION_INIT_CLASS(SoFCEnableSelectionAction,SoAction);
00196 
00197   SO_ENABLE(SoFCEnableSelectionAction, SoSwitchElement);
00198 
00199   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00200 
00201   SO_ENABLE(SoFCEnableSelectionAction, SoModelMatrixElement);
00202   SO_ENABLE(SoFCEnableSelectionAction, SoShapeStyleElement);
00203   SO_ENABLE(SoFCEnableSelectionAction, SoComplexityElement);
00204   SO_ENABLE(SoFCEnableSelectionAction, SoComplexityTypeElement);
00205   SO_ENABLE(SoFCEnableSelectionAction, SoCoordinateElement);
00206   SO_ENABLE(SoFCEnableSelectionAction, SoFontNameElement);
00207   SO_ENABLE(SoFCEnableSelectionAction, SoFontSizeElement);
00208   SO_ENABLE(SoFCEnableSelectionAction, SoProfileCoordinateElement);
00209   SO_ENABLE(SoFCEnableSelectionAction, SoProfileElement);
00210   SO_ENABLE(SoFCEnableSelectionAction, SoSwitchElement);
00211   SO_ENABLE(SoFCEnableSelectionAction, SoUnitsElement);
00212   SO_ENABLE(SoFCEnableSelectionAction, SoViewVolumeElement);
00213   SO_ENABLE(SoFCEnableSelectionAction, SoViewingMatrixElement);
00214   SO_ENABLE(SoFCEnableSelectionAction, SoViewportRegionElement);
00215 
00216 
00217 
00218 
00219   SO_ACTION_ADD_METHOD(SoCallback,callDoAction);
00220   SO_ACTION_ADD_METHOD(SoComplexity,callDoAction);
00221   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00222   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00223   SO_ACTION_ADD_METHOD(SoFont,callDoAction);
00224   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00225   SO_ACTION_ADD_METHOD(SoProfile,callDoAction);
00226   SO_ACTION_ADD_METHOD(SoProfileCoordinate2,callDoAction);
00227   SO_ACTION_ADD_METHOD(SoProfileCoordinate3,callDoAction);
00228   SO_ACTION_ADD_METHOD(SoTransformation,callDoAction);
00229   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00230 
00231   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00232   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00233 }
00234 
00235 void SoFCEnableSelectionAction::finish()
00236 {
00237   atexit_cleanup();
00238 }
00239 
00240 
00241 SoFCEnableSelectionAction::SoFCEnableSelectionAction (const SbBool& sel)
00242   : selection(sel)
00243 {
00244   SO_ACTION_CONSTRUCTOR(SoFCEnableSelectionAction);
00245 }
00246 
00247 
00248 SoFCEnableSelectionAction::~SoFCEnableSelectionAction()
00249 {
00250 }
00251 
00252  
00253 void SoFCEnableSelectionAction::beginTraversal(SoNode *node)
00254 {
00255   traverse(node);
00256 }
00257 
00258 void SoFCEnableSelectionAction::callDoAction(SoAction *action,SoNode *node)
00259 {
00260   node->doAction(action);
00261 }
00262 
00263 // ---------------------------------------------------------------
00264 
00265 SO_ACTION_SOURCE(SoFCEnableHighlightAction);
00266 
00275 void SoFCEnableHighlightAction::initClass()
00276 {
00277   SO_ACTION_INIT_CLASS(SoFCEnableHighlightAction,SoAction);
00278 
00279   SO_ENABLE(SoFCEnableHighlightAction, SoSwitchElement);
00280 
00281   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00282 
00283   SO_ENABLE(SoFCEnableHighlightAction, SoModelMatrixElement);
00284   SO_ENABLE(SoFCEnableHighlightAction, SoShapeStyleElement);
00285   SO_ENABLE(SoFCEnableHighlightAction, SoComplexityElement);
00286   SO_ENABLE(SoFCEnableHighlightAction, SoComplexityTypeElement);
00287   SO_ENABLE(SoFCEnableHighlightAction, SoCoordinateElement);
00288   SO_ENABLE(SoFCEnableHighlightAction, SoFontNameElement);
00289   SO_ENABLE(SoFCEnableHighlightAction, SoFontSizeElement);
00290   SO_ENABLE(SoFCEnableHighlightAction, SoProfileCoordinateElement);
00291   SO_ENABLE(SoFCEnableHighlightAction, SoProfileElement);
00292   SO_ENABLE(SoFCEnableHighlightAction, SoSwitchElement);
00293   SO_ENABLE(SoFCEnableHighlightAction, SoUnitsElement);
00294   SO_ENABLE(SoFCEnableHighlightAction, SoViewVolumeElement);
00295   SO_ENABLE(SoFCEnableHighlightAction, SoViewingMatrixElement);
00296   SO_ENABLE(SoFCEnableHighlightAction, SoViewportRegionElement);
00297 
00298 
00299 
00300 
00301   SO_ACTION_ADD_METHOD(SoCallback,callDoAction);
00302   SO_ACTION_ADD_METHOD(SoComplexity,callDoAction);
00303   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00304   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00305   SO_ACTION_ADD_METHOD(SoFont,callDoAction);
00306   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00307   SO_ACTION_ADD_METHOD(SoProfile,callDoAction);
00308   SO_ACTION_ADD_METHOD(SoProfileCoordinate2,callDoAction);
00309   SO_ACTION_ADD_METHOD(SoProfileCoordinate3,callDoAction);
00310   SO_ACTION_ADD_METHOD(SoTransformation,callDoAction);
00311   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00312 
00313   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00314   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00315 }
00316 
00317 void SoFCEnableHighlightAction::finish()
00318 {
00319   atexit_cleanup();
00320 }
00321 
00322 
00323 SoFCEnableHighlightAction::SoFCEnableHighlightAction (const SbBool& sel)
00324   : highlight(sel)
00325 {
00326   SO_ACTION_CONSTRUCTOR(SoFCEnableHighlightAction);
00327 }
00328 
00329 
00330 SoFCEnableHighlightAction::~SoFCEnableHighlightAction()
00331 {
00332 }
00333 
00334  
00335 void SoFCEnableHighlightAction::beginTraversal(SoNode *node)
00336 {
00337   traverse(node);
00338 }
00339 
00340 void SoFCEnableHighlightAction::callDoAction(SoAction *action,SoNode *node)
00341 {
00342   node->doAction(action);
00343 }
00344 
00345 // ---------------------------------------------------------------
00346 
00347 SO_ACTION_SOURCE(SoFCSelectionColorAction);
00348 
00357 void SoFCSelectionColorAction::initClass()
00358 {
00359   SO_ACTION_INIT_CLASS(SoFCSelectionColorAction,SoAction);
00360 
00361   SO_ENABLE(SoFCSelectionColorAction, SoSwitchElement);
00362 
00363   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00364 
00365   SO_ENABLE(SoFCSelectionColorAction, SoModelMatrixElement);
00366   SO_ENABLE(SoFCSelectionColorAction, SoShapeStyleElement);
00367   SO_ENABLE(SoFCSelectionColorAction, SoComplexityElement);
00368   SO_ENABLE(SoFCSelectionColorAction, SoComplexityTypeElement);
00369   SO_ENABLE(SoFCSelectionColorAction, SoCoordinateElement);
00370   SO_ENABLE(SoFCSelectionColorAction, SoFontNameElement);
00371   SO_ENABLE(SoFCSelectionColorAction, SoFontSizeElement);
00372   SO_ENABLE(SoFCSelectionColorAction, SoProfileCoordinateElement);
00373   SO_ENABLE(SoFCSelectionColorAction, SoProfileElement);
00374   SO_ENABLE(SoFCSelectionColorAction, SoSwitchElement);
00375   SO_ENABLE(SoFCSelectionColorAction, SoUnitsElement);
00376   SO_ENABLE(SoFCSelectionColorAction, SoViewVolumeElement);
00377   SO_ENABLE(SoFCSelectionColorAction, SoViewingMatrixElement);
00378   SO_ENABLE(SoFCSelectionColorAction, SoViewportRegionElement);
00379 
00380 
00381 
00382 
00383   SO_ACTION_ADD_METHOD(SoCallback,callDoAction);
00384   SO_ACTION_ADD_METHOD(SoComplexity,callDoAction);
00385   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00386   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00387   SO_ACTION_ADD_METHOD(SoFont,callDoAction);
00388   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00389   SO_ACTION_ADD_METHOD(SoProfile,callDoAction);
00390   SO_ACTION_ADD_METHOD(SoProfileCoordinate2,callDoAction);
00391   SO_ACTION_ADD_METHOD(SoProfileCoordinate3,callDoAction);
00392   SO_ACTION_ADD_METHOD(SoTransformation,callDoAction);
00393   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00394 
00395   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00396   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00397 }
00398 
00399 void SoFCSelectionColorAction::finish()
00400 {
00401   atexit_cleanup();
00402 }
00403 
00404 
00405 SoFCSelectionColorAction::SoFCSelectionColorAction (const SoSFColor& col)
00406   : selectionColor(col)
00407 {
00408   SO_ACTION_CONSTRUCTOR(SoFCSelectionColorAction);
00409 }
00410 
00411 
00412 SoFCSelectionColorAction::~SoFCSelectionColorAction()
00413 {
00414 }
00415 
00416  
00417 void SoFCSelectionColorAction::beginTraversal(SoNode *node)
00418 {
00419   traverse(node);
00420 }
00421 
00422 void SoFCSelectionColorAction::callDoAction(SoAction *action,SoNode *node)
00423 {
00424   node->doAction(action);
00425 }
00426 
00427 // ---------------------------------------------------------------
00428 
00429 SO_ACTION_SOURCE(SoFCHighlightColorAction);
00430 
00439 void SoFCHighlightColorAction::initClass()
00440 {
00441   SO_ACTION_INIT_CLASS(SoFCHighlightColorAction,SoAction);
00442 
00443   SO_ENABLE(SoFCHighlightColorAction, SoSwitchElement);
00444 
00445   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00446 
00447   SO_ENABLE(SoFCHighlightColorAction, SoModelMatrixElement);
00448   SO_ENABLE(SoFCHighlightColorAction, SoShapeStyleElement);
00449   SO_ENABLE(SoFCHighlightColorAction, SoComplexityElement);
00450   SO_ENABLE(SoFCHighlightColorAction, SoComplexityTypeElement);
00451   SO_ENABLE(SoFCHighlightColorAction, SoCoordinateElement);
00452   SO_ENABLE(SoFCHighlightColorAction, SoFontNameElement);
00453   SO_ENABLE(SoFCHighlightColorAction, SoFontSizeElement);
00454   SO_ENABLE(SoFCHighlightColorAction, SoProfileCoordinateElement);
00455   SO_ENABLE(SoFCHighlightColorAction, SoProfileElement);
00456   SO_ENABLE(SoFCHighlightColorAction, SoSwitchElement);
00457   SO_ENABLE(SoFCHighlightColorAction, SoUnitsElement);
00458   SO_ENABLE(SoFCHighlightColorAction, SoViewVolumeElement);
00459   SO_ENABLE(SoFCHighlightColorAction, SoViewingMatrixElement);
00460   SO_ENABLE(SoFCHighlightColorAction, SoViewportRegionElement);
00461 
00462 
00463 
00464 
00465   SO_ACTION_ADD_METHOD(SoCallback,callDoAction);
00466   SO_ACTION_ADD_METHOD(SoComplexity,callDoAction);
00467   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00468   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00469   SO_ACTION_ADD_METHOD(SoFont,callDoAction);
00470   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00471   SO_ACTION_ADD_METHOD(SoProfile,callDoAction);
00472   SO_ACTION_ADD_METHOD(SoProfileCoordinate2,callDoAction);
00473   SO_ACTION_ADD_METHOD(SoProfileCoordinate3,callDoAction);
00474   SO_ACTION_ADD_METHOD(SoTransformation,callDoAction);
00475   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00476 
00477   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00478   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00479 }
00480 
00481 void SoFCHighlightColorAction::finish()
00482 {
00483   atexit_cleanup();
00484 }
00485 
00486 
00487 SoFCHighlightColorAction::SoFCHighlightColorAction (const SoSFColor& col)
00488   : highlightColor(col)
00489 {
00490   SO_ACTION_CONSTRUCTOR(SoFCHighlightColorAction);
00491 }
00492 
00493 
00494 SoFCHighlightColorAction::~SoFCHighlightColorAction()
00495 {
00496 }
00497 
00498  
00499 void SoFCHighlightColorAction::beginTraversal(SoNode *node)
00500 {
00501   traverse(node);
00502 }
00503 
00504 void SoFCHighlightColorAction::callDoAction(SoAction *action,SoNode *node)
00505 {
00506   node->doAction(action);
00507 }
00508 
00509 // ---------------------------------------------------------------
00510 
00511 SO_ACTION_SOURCE(SoFCDocumentAction);
00512 
00521 void SoFCDocumentAction::initClass()
00522 {
00523   SO_ACTION_INIT_CLASS(SoFCDocumentAction,SoAction);
00524 
00525   SO_ENABLE(SoFCDocumentAction, SoSwitchElement);
00526 
00527   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00528 
00529   SO_ENABLE(SoFCDocumentAction, SoModelMatrixElement);
00530   SO_ENABLE(SoFCDocumentAction, SoShapeStyleElement);
00531   SO_ENABLE(SoFCDocumentAction, SoComplexityElement);
00532   SO_ENABLE(SoFCDocumentAction, SoComplexityTypeElement);
00533   SO_ENABLE(SoFCDocumentAction, SoCoordinateElement);
00534   SO_ENABLE(SoFCDocumentAction, SoFontNameElement);
00535   SO_ENABLE(SoFCDocumentAction, SoFontSizeElement);
00536   SO_ENABLE(SoFCDocumentAction, SoProfileCoordinateElement);
00537   SO_ENABLE(SoFCDocumentAction, SoProfileElement);
00538   SO_ENABLE(SoFCDocumentAction, SoSwitchElement);
00539   SO_ENABLE(SoFCDocumentAction, SoUnitsElement);
00540   SO_ENABLE(SoFCDocumentAction, SoViewVolumeElement);
00541   SO_ENABLE(SoFCDocumentAction, SoViewingMatrixElement);
00542   SO_ENABLE(SoFCDocumentAction, SoViewportRegionElement);
00543 
00544 
00545 
00546 
00547   SO_ACTION_ADD_METHOD(SoCallback,callDoAction);
00548   SO_ACTION_ADD_METHOD(SoComplexity,callDoAction);
00549   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00550   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00551   SO_ACTION_ADD_METHOD(SoFont,callDoAction);
00552   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00553   SO_ACTION_ADD_METHOD(SoProfile,callDoAction);
00554   SO_ACTION_ADD_METHOD(SoProfileCoordinate2,callDoAction);
00555   SO_ACTION_ADD_METHOD(SoProfileCoordinate3,callDoAction);
00556   SO_ACTION_ADD_METHOD(SoTransformation,callDoAction);
00557   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00558 
00559   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00560   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00561 }
00562 
00563 void SoFCDocumentAction::finish()
00564 {
00565   atexit_cleanup();
00566 }
00567 
00568 
00569 SoFCDocumentAction::SoFCDocumentAction (const SoSFString& docName)
00570   : documentName(docName)
00571 {
00572   SO_ACTION_CONSTRUCTOR(SoFCDocumentAction);
00573 }
00574 
00575 
00576 SoFCDocumentAction::~SoFCDocumentAction()
00577 {
00578 }
00579 
00580  
00581 void SoFCDocumentAction::beginTraversal(SoNode *node)
00582 {
00583   traverse(node);
00584 }
00585 
00586 void SoFCDocumentAction::callDoAction(SoAction *action,SoNode *node)
00587 {
00588   node->doAction(action);
00589 }
00590 
00591 
00592 // ---------------------------------------------------------------
00593 
00594 SO_ACTION_SOURCE(SoFCDocumentObjectAction);
00595 
00604 void SoFCDocumentObjectAction::initClass()
00605 {
00606   SO_ACTION_INIT_CLASS(SoFCDocumentObjectAction,SoAction);
00607 
00608   SO_ENABLE(SoFCDocumentObjectAction, SoSwitchElement);
00609 
00610   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00611 
00612   SO_ENABLE(SoFCDocumentObjectAction, SoModelMatrixElement);
00613   SO_ENABLE(SoFCDocumentObjectAction, SoShapeStyleElement);
00614   SO_ENABLE(SoFCDocumentObjectAction, SoComplexityElement);
00615   SO_ENABLE(SoFCDocumentObjectAction, SoComplexityTypeElement);
00616   SO_ENABLE(SoFCDocumentObjectAction, SoCoordinateElement);
00617   SO_ENABLE(SoFCDocumentObjectAction, SoFontNameElement);
00618   SO_ENABLE(SoFCDocumentObjectAction, SoFontSizeElement);
00619   SO_ENABLE(SoFCDocumentObjectAction, SoProfileCoordinateElement);
00620   SO_ENABLE(SoFCDocumentObjectAction, SoProfileElement);
00621   SO_ENABLE(SoFCDocumentObjectAction, SoSwitchElement);
00622   SO_ENABLE(SoFCDocumentObjectAction, SoUnitsElement);
00623   SO_ENABLE(SoFCDocumentObjectAction, SoViewVolumeElement);
00624   SO_ENABLE(SoFCDocumentObjectAction, SoViewingMatrixElement);
00625   SO_ENABLE(SoFCDocumentObjectAction, SoViewportRegionElement);
00626 
00627   SO_ACTION_ADD_METHOD(SoCallback,callDoAction);
00628   SO_ACTION_ADD_METHOD(SoComplexity,callDoAction);
00629   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00630   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00631   SO_ACTION_ADD_METHOD(SoFont,callDoAction);
00632   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00633   SO_ACTION_ADD_METHOD(SoProfile,callDoAction);
00634   SO_ACTION_ADD_METHOD(SoProfileCoordinate2,callDoAction);
00635   SO_ACTION_ADD_METHOD(SoProfileCoordinate3,callDoAction);
00636   SO_ACTION_ADD_METHOD(SoTransformation,callDoAction);
00637   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00638 
00639   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00640   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00641 }
00642 
00643 void SoFCDocumentObjectAction::finish()
00644 {
00645   atexit_cleanup();
00646 }
00647 
00648 SoFCDocumentObjectAction::SoFCDocumentObjectAction () : _handled(FALSE)
00649 {
00650   SO_ACTION_CONSTRUCTOR(SoFCDocumentObjectAction);
00651 }
00652 
00653 SoFCDocumentObjectAction::~SoFCDocumentObjectAction()
00654 {
00655 }
00656 
00657 void SoFCDocumentObjectAction::beginTraversal(SoNode *node)
00658 {
00659   traverse(node);
00660 }
00661 
00662 void SoFCDocumentObjectAction::callDoAction(SoAction *action,SoNode *node)
00663 {
00664   node->doAction(action);
00665 }
00666 
00667 void SoFCDocumentObjectAction::setHandled()
00668 {
00669   this->_handled = TRUE;
00670 }
00671 
00672 SbBool SoFCDocumentObjectAction::isHandled() const
00673 {
00674   return this->_handled;
00675 }
00676 
00677 // ---------------------------------------------------------------
00678 
00679 SO_ACTION_SOURCE(SoGLSelectAction);
00680 
00689 void SoGLSelectAction::initClass()
00690 {
00691   SO_ACTION_INIT_CLASS(SoGLSelectAction,SoAction);
00692 
00693   SO_ENABLE(SoGLSelectAction, SoSwitchElement);
00694 
00695   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00696 
00697   SO_ENABLE(SoGLSelectAction, SoModelMatrixElement);
00698   SO_ENABLE(SoGLSelectAction, SoProjectionMatrixElement);
00699   SO_ENABLE(SoGLSelectAction, SoCoordinateElement);
00700   SO_ENABLE(SoGLSelectAction, SoViewVolumeElement);
00701   SO_ENABLE(SoGLSelectAction, SoViewingMatrixElement);
00702   SO_ENABLE(SoGLSelectAction, SoViewportRegionElement);
00703 
00704   SO_ACTION_ADD_METHOD(SoCamera,callDoAction);
00705   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00706   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00707   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00708   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00709   SO_ACTION_ADD_METHOD(SoShape,callDoAction);
00710   SO_ACTION_ADD_METHOD(SoIndexedFaceSet,callDoAction);
00711 
00712   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00713   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00714 }
00715 
00716 SoGLSelectAction::SoGLSelectAction (const SbViewportRegion& region,
00717                                     const SbViewportRegion& select)
00718   : vpregion(region), vpselect(select), _handled(FALSE)
00719 {
00720   SO_ACTION_CONSTRUCTOR(SoGLSelectAction);
00721 }
00722 
00723 SoGLSelectAction::~SoGLSelectAction()
00724 {
00725 }
00726 
00727 const SbViewportRegion& SoGLSelectAction::getViewportRegion () const
00728 {
00729   return this->vpselect;
00730 }
00731 
00732 void SoGLSelectAction::beginTraversal(SoNode *node)
00733 {
00734   SoViewportRegionElement::set(this->getState(), this->vpregion);
00735   traverse(node);
00736 }
00737 
00738 void SoGLSelectAction::callDoAction(SoAction *action,SoNode *node)
00739 {
00740   node->doAction(action);
00741 }
00742 
00743 void SoGLSelectAction::setHandled()
00744 {
00745   this->_handled = TRUE;
00746 }
00747 
00748 SbBool SoGLSelectAction::isHandled() const
00749 {
00750   return this->_handled;
00751 }
00752 
00753 // ---------------------------------------------------------------
00754 
00755 SO_ACTION_SOURCE(SoVisibleFaceAction);
00756 
00765 void SoVisibleFaceAction::initClass()
00766 {
00767   SO_ACTION_INIT_CLASS(SoVisibleFaceAction,SoAction);
00768 
00769   SO_ENABLE(SoVisibleFaceAction, SoSwitchElement);
00770 
00771   SO_ACTION_ADD_METHOD(SoNode,nullAction);
00772 
00773   SO_ENABLE(SoVisibleFaceAction, SoModelMatrixElement);
00774   SO_ENABLE(SoVisibleFaceAction, SoProjectionMatrixElement);
00775   SO_ENABLE(SoVisibleFaceAction, SoCoordinateElement);
00776   SO_ENABLE(SoVisibleFaceAction, SoViewVolumeElement);
00777   SO_ENABLE(SoVisibleFaceAction, SoViewingMatrixElement);
00778   SO_ENABLE(SoVisibleFaceAction, SoViewportRegionElement);
00779 
00780 
00781   SO_ACTION_ADD_METHOD(SoCamera,callDoAction);
00782   SO_ACTION_ADD_METHOD(SoCoordinate3,callDoAction);
00783   SO_ACTION_ADD_METHOD(SoCoordinate4,callDoAction);
00784   SO_ACTION_ADD_METHOD(SoGroup,callDoAction);
00785   SO_ACTION_ADD_METHOD(SoSwitch,callDoAction);
00786   SO_ACTION_ADD_METHOD(SoShape,callDoAction);
00787   SO_ACTION_ADD_METHOD(SoIndexedFaceSet,callDoAction);
00788 
00789   SO_ACTION_ADD_METHOD(SoSeparator,callDoAction);
00790   SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
00791 }
00792 
00793 SoVisibleFaceAction::SoVisibleFaceAction () : _handled(FALSE)
00794 {
00795   SO_ACTION_CONSTRUCTOR(SoVisibleFaceAction);
00796 }
00797 
00798 SoVisibleFaceAction::~SoVisibleFaceAction()
00799 {
00800 }
00801 
00802 void SoVisibleFaceAction::beginTraversal(SoNode *node)
00803 {
00804   traverse(node);
00805 }
00806 
00807 void SoVisibleFaceAction::callDoAction(SoAction *action,SoNode *node)
00808 {
00809   node->doAction(action);
00810 }
00811 
00812 void SoVisibleFaceAction::setHandled()
00813 {
00814   this->_handled = TRUE;
00815 }
00816 
00817 SbBool SoVisibleFaceAction::isHandled() const
00818 {
00819   return this->_handled;
00820 }
00821 
00822 // ---------------------------------------------------------------
00823 
00824 namespace Gui {
00825 class SoBoxSelectionRenderActionP {
00826 public:
00827     SoBoxSelectionRenderActionP(SoBoxSelectionRenderAction * master) 
00828       : master(master) { }
00829 
00830     SoBoxSelectionRenderAction * master;
00831     SoSearchAction * searchaction;
00832     SoSearchAction * selectsearch;
00833     SoSearchAction * camerasearch;
00834     SoGetBoundingBoxAction * bboxaction;
00835     SoBaseColor * basecolor;
00836     SoTempPath * postprocpath;
00837     SoPath * highlightPath;
00838     SoSeparator * localRoot;
00839     SoMatrixTransform * xform;
00840     SoCube * cube;
00841     SoDrawStyle * drawstyle;
00842     SoColorPacker colorpacker;
00843 
00844     void initBoxGraph();
00845     void updateBbox(const SoPath * path);
00846 };
00847 
00848 }
00849 
00850 #undef PRIVATE
00851 #define PRIVATE(p) ((p)->pimpl)
00852 #undef PUBLIC
00853 #define PUBLIC(p) ((p)->master)
00854 
00855 // used to initialize the internal storage class with variables
00856 void
00857 SoBoxSelectionRenderActionP::initBoxGraph() 
00858 {
00859     this->localRoot = new SoSeparator;
00860     this->localRoot->ref();
00861     this->localRoot->renderCaching = SoSeparator::OFF;
00862     this->localRoot->boundingBoxCaching = SoSeparator::OFF;
00863 
00864     this->xform = new SoMatrixTransform;
00865     this->cube = new SoCube;
00866 
00867     this->drawstyle = new SoDrawStyle;
00868     this->drawstyle->style = SoDrawStyleElement::LINES;
00869     this->basecolor = new SoBaseColor;
00870 
00871     SoLightModel * lightmodel = new SoLightModel;
00872     lightmodel->model = SoLightModel::BASE_COLOR;
00873 
00874     SoComplexity * complexity = new SoComplexity;
00875     complexity->textureQuality = 0.0f;
00876     complexity->type = SoComplexityTypeElement::BOUNDING_BOX;
00877 
00878     this->localRoot->addChild(this->drawstyle);
00879     this->localRoot->addChild(this->basecolor);
00880 
00881     this->localRoot->addChild(lightmodel);
00882     this->localRoot->addChild(complexity);
00883 
00884     this->localRoot->addChild(this->xform);
00885     this->localRoot->addChild(this->cube);
00886 }
00887 
00888 
00889 // used to render shape and non-shape nodes (usually SoGroup or SoSeparator). 
00890 void 
00891 SoBoxSelectionRenderActionP::updateBbox(const SoPath * path)
00892 {
00893     if (this->camerasearch == NULL) {
00894         this->camerasearch = new SoSearchAction;
00895     }
00896 
00897     // find camera used to render node
00898     this->camerasearch->setFind(SoSearchAction::TYPE);
00899     this->camerasearch->setInterest(SoSearchAction::LAST);
00900     this->camerasearch->setType(SoCamera::getClassTypeId());
00901     this->camerasearch->apply((SoPath*) path);
00902   
00903     if (!this->camerasearch->getPath()) {
00904         // if there is no camera there is no point rendering the bbox
00905         return;
00906     }
00907     this->localRoot->insertChild(this->camerasearch->getPath()->getTail(), 0);
00908     this->camerasearch->reset();
00909   
00910     if (this->bboxaction == NULL) {
00911         this->bboxaction = new SoGetBoundingBoxAction(SbViewportRegion(100, 100));
00912     }
00913     this->bboxaction->setViewportRegion(PUBLIC(this)->getViewportRegion());
00914     this->bboxaction->apply((SoPath*) path);
00915   
00916     SbXfBox3f & box = this->bboxaction->getXfBoundingBox();
00917   
00918     if (!box.isEmpty()) {
00919         // set cube size
00920         float x, y, z;
00921         box.getSize(x, y, z);
00922         this->cube->width  = x;
00923         this->cube->height  = y;
00924         this->cube->depth = z;
00925     
00926         SbMatrix transform = box.getTransform();
00927     
00928         // get center (in the local bbox coordinate system)
00929         SbVec3f center = box.SbBox3f::getCenter();
00930     
00931         // if center != (0,0,0), move the cube
00932         if (center != SbVec3f(0.0f, 0.0f, 0.0f)) {
00933             SbMatrix t;
00934             t.setTranslate(center);
00935             transform.multLeft(t);
00936         }
00937         this->xform->matrix = transform; 
00938     
00939         PUBLIC(this)->SoGLRenderAction::apply(this->localRoot);
00940     }
00941     // remove camera
00942     this->localRoot->removeChild(0);
00943 }
00944 
00945 SO_ACTION_SOURCE(SoBoxSelectionRenderAction);
00946 
00947 // Overridden from parent class.
00948 void
00949 SoBoxSelectionRenderAction::initClass(void)
00950 {
00951     SO_ACTION_INIT_CLASS(SoBoxSelectionRenderAction, SoGLRenderAction);
00952 }
00953 
00954 SoBoxSelectionRenderAction::SoBoxSelectionRenderAction(void)
00955   : inherited(SbViewportRegion())
00956 {
00957     this->constructorCommon();
00958 }
00959 
00960 SoBoxSelectionRenderAction::SoBoxSelectionRenderAction(const SbViewportRegion & viewportregion)
00961   : inherited(viewportregion)
00962 {
00963     this->constructorCommon();
00964 }
00965 
00966 //
00967 // private. called by both constructors
00968 //
00969 void
00970 SoBoxSelectionRenderAction::constructorCommon(void)
00971 {
00972     SO_ACTION_CONSTRUCTOR(SoBoxSelectionRenderAction);
00973 
00974     PRIVATE(this) = new SoBoxSelectionRenderActionP(this);
00975 
00976     // Initialize local variables
00977     PRIVATE(this)->initBoxGraph();
00978 
00979     this->hlVisible = TRUE;
00980 
00981     PRIVATE(this)->basecolor->rgb.setValue(1.0f, 0.0f, 0.0f);
00982     PRIVATE(this)->drawstyle->linePattern = 0xffff;
00983     PRIVATE(this)->drawstyle->lineWidth = 1.0f;
00984     PRIVATE(this)->searchaction = NULL;
00985     PRIVATE(this)->selectsearch = NULL;
00986     PRIVATE(this)->camerasearch = NULL;
00987     PRIVATE(this)->bboxaction = NULL;
00988 
00989     // SoBase-derived objects should be dynamically allocated.
00990     PRIVATE(this)->postprocpath = new SoTempPath(32);
00991     PRIVATE(this)->postprocpath->ref();
00992     PRIVATE(this)->highlightPath = 0;
00993 }
00994 
00995 SoBoxSelectionRenderAction::~SoBoxSelectionRenderAction(void)
00996 {
00997     PRIVATE(this)->postprocpath->unref();
00998     PRIVATE(this)->localRoot->unref();
00999 
01000     delete PRIVATE(this)->searchaction;
01001     delete PRIVATE(this)->selectsearch;
01002     delete PRIVATE(this)->camerasearch;
01003     delete PRIVATE(this)->bboxaction;
01004     delete PRIVATE(this);
01005 }
01006 
01007 void
01008 SoBoxSelectionRenderAction::apply(SoNode * node)
01009 {
01010     SoGLRenderAction::apply(node);
01011     if (this->hlVisible) {
01012         if (PRIVATE(this)->searchaction == NULL) {
01013             PRIVATE(this)->searchaction = new SoSearchAction;
01014         }
01015         PRIVATE(this)->searchaction->setType(SoFCSelection::getClassTypeId());
01016         PRIVATE(this)->searchaction->setInterest(SoSearchAction::ALL);
01017         PRIVATE(this)->searchaction->apply(node);
01018         const SoPathList & pathlist = PRIVATE(this)->searchaction->getPaths();
01019         if (pathlist.getLength() > 0) {
01020             for (int i = 0; i < pathlist.getLength(); i++ ) {
01021                 SoPath * path = pathlist[i];
01022                 assert(path);
01023                 SoFCSelection * selection = (SoFCSelection *) path->getTail();
01024                 assert(selection->getTypeId().isDerivedFrom(SoFCSelection::getClassTypeId()));
01025                 if (selection->selected.getValue() && selection->style.getValue() == SoFCSelection::BOX) {
01026                     PRIVATE(this)->basecolor->rgb.setValue(selection->colorSelection.getValue());
01027                     if (PRIVATE(this)->selectsearch == NULL) {
01028                         PRIVATE(this)->selectsearch = new SoSearchAction;
01029                     }
01030                     PRIVATE(this)->selectsearch->setType(SoShape::getClassTypeId());
01031                     PRIVATE(this)->selectsearch->setInterest(SoSearchAction::FIRST);
01032                     PRIVATE(this)->selectsearch->apply(selection);
01033                     SoPath* shapepath = PRIVATE(this)->selectsearch->getPath();
01034                     if (shapepath) {
01035                         SoPathList list;
01036                         list.append(shapepath);
01037                         this->drawBoxes(path, &list);
01038                     }
01039                     PRIVATE(this)->selectsearch->reset();
01040                 }
01041             }
01042         }
01043         PRIVATE(this)->searchaction->reset();
01044     }
01045 }
01046 
01047 void
01048 SoBoxSelectionRenderAction::apply(SoPath * path)
01049 {
01050     SoGLRenderAction::apply(path);
01051     SoNode* node = path->getTail();
01052     if (node && node->getTypeId() == SoFCSelection::getClassTypeId()) {
01053         SoFCSelection * selection = (SoFCSelection *) node;
01054 
01055         // This happens when dehighlighting the current shape
01056         if (PRIVATE(this)->highlightPath == path) {
01057             PRIVATE(this)->highlightPath->unref();
01058             PRIVATE(this)->highlightPath = 0;
01059             // FIXME: Doing a redraw to remove the shown bounding box causes
01060             // some problems when moving the mouse from one shape to another
01061             // because this will destroy the box immediately
01062             selection->touch(); // force a redraw when dehighlighting
01063         }
01064         else if (selection->isHighlighted() &&
01065                  selection->selected.getValue() == SoFCSelection::NOTSELECTED &&
01066                  selection->style.getValue() == SoFCSelection::BOX) {
01067             PRIVATE(this)->basecolor->rgb.setValue(selection->colorHighlight.getValue());
01068 
01069             if (PRIVATE(this)->selectsearch == NULL) {
01070               PRIVATE(this)->selectsearch = new SoSearchAction;
01071             }
01072             PRIVATE(this)->selectsearch->setType(SoShape::getClassTypeId());
01073             PRIVATE(this)->selectsearch->setInterest(SoSearchAction::FIRST);
01074             PRIVATE(this)->selectsearch->apply(selection);
01075             SoPath* shapepath = PRIVATE(this)->selectsearch->getPath();
01076             if (shapepath) {
01077                 SoPathList list;
01078                 list.append(shapepath);
01079                 PRIVATE(this)->highlightPath = path;
01080                 PRIVATE(this)->highlightPath->ref();
01081                 this->drawBoxes(path, &list);
01082             }
01083             PRIVATE(this)->selectsearch->reset();
01084         }
01085     }
01086 }
01087 
01088 void
01089 SoBoxSelectionRenderAction::apply(const SoPathList & pathlist,
01090                                   SbBool obeysrules)
01091 {
01092     SoGLRenderAction::apply(pathlist, obeysrules);
01093 }
01094 
01095 void
01096 SoBoxSelectionRenderAction::setColor(const SbColor & color)
01097 {
01098     PRIVATE(this)->basecolor->rgb = color;
01099 }
01100 
01101 const SbColor &
01102 SoBoxSelectionRenderAction::getColor(void)
01103 {
01104     return PRIVATE(this)->basecolor->rgb[0];
01105 }
01106 
01107 void
01108 SoBoxSelectionRenderAction::setLinePattern(unsigned short pattern)
01109 {
01110     PRIVATE(this)->drawstyle->linePattern = pattern;
01111 }
01112 
01113 unsigned short
01114 SoBoxSelectionRenderAction::getLinePattern(void) const
01115 {
01116     return PRIVATE(this)->drawstyle->linePattern.getValue();
01117 }
01118 
01119 void
01120 SoBoxSelectionRenderAction::setLineWidth(const float width)
01121 {
01122     PRIVATE(this)->drawstyle->lineWidth = width;
01123 }
01124 
01125 float
01126 SoBoxSelectionRenderAction::getLineWidth(void) const
01127 {
01128     return PRIVATE(this)->drawstyle->lineWidth.getValue();
01129 }
01130 
01131 void
01132 SoBoxSelectionRenderAction::drawBoxes(SoPath * pathtothis, const SoPathList * pathlist)
01133 {
01134     int i;
01135     int thispos = ((SoFullPath *)pathtothis)->getLength()-1;
01136     assert(thispos >= 0);
01137     PRIVATE(this)->postprocpath->truncate(0); // reset
01138   
01139     for (i = 0; i < thispos; i++)
01140         PRIVATE(this)->postprocpath->append(pathtothis->getNode(i));
01141 
01142     // we need to disable accumulation buffer antialiasing while
01143     // rendering selected objects
01144     int oldnumpasses = this->getNumPasses();
01145     this->setNumPasses(1);
01146 
01147     SoState * thestate = this->getState();
01148     thestate->push();
01149 
01150     for (i = 0; i < pathlist->getLength(); i++) {
01151         SoFullPath * path = (SoFullPath *)(*pathlist)[i];
01152 
01153         for (int j = 0; j < path->getLength(); j++) {
01154             PRIVATE(this)->postprocpath->append(path->getNode(j));
01155         }
01156 
01157         // Previously SoGLRenderAction was used to draw the bounding boxes
01158         // of shapes in selection paths, by overriding renderstyle state
01159         // elements to lines drawstyle and simply doing:
01160         //
01161         //   SoGLRenderAction::apply(PRIVATE(this)->postprocpath); // Bug
01162         //
01163         // This could have the unwanted side effect of rendering
01164         // non-selected shapes, as they could be part of the path (due to
01165         // being placed below SoGroup nodes (instead of SoSeparator
01166         // nodes)) up to the selected shape.
01167         //
01168         //
01169         // A better approach turned out to be to soup up and draw only the
01170         // bounding boxes of the selected shapes:
01171         PRIVATE(this)->updateBbox(PRIVATE(this)->postprocpath);
01172 
01173         // Remove temporary path from path buffer
01174         PRIVATE(this)->postprocpath->truncate(thispos);
01175     }
01176 
01177     this->setNumPasses(oldnumpasses);
01178     thestate->pop();
01179 }
01180 
01181 
01182 #undef PRIVATE
01183 #undef PUBLIC

Generated on Wed Nov 23 19:00:40 2011 for FreeCAD by  doxygen 1.6.1