Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

Location:
trunk/source/visualization/HepRep/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/visualization/HepRep/src/G4HepRepFileSceneHandler.cc

    r1228 r1315  
    2424// ********************************************************************
    2525//
    26 // $Id: G4HepRepFileSceneHandler.cc,v 1.68 2009/12/16 17:51:21 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4HepRepFileSceneHandler.cc,v 1.69 2010/06/05 06:25:03 perl Exp $
     27// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
    2828//
    2929//
     
    210210#endif
    211211       
     212        // HepRApp does not correctly represent the end faces of cones at
     213        // non-standard angles, let the base class convert these solids to polygons.   
     214        CLHEP::HepRotation r = fpObjectTransformation->getRotation();   
     215        G4bool linedUpWithAnAxis = (std::fabs(r.phiX())<=.001 || 
     216                                                                std::fabs(r.phiY())<=.001 ||
     217                                                                std::fabs(r.phiZ())<=.001 ||
     218                                                                std::fabs(r.phiX()-pi)<=.001 ||
     219                                                                std::fabs(r.phiY()-pi)<=.001 ||
     220                                                                std::fabs(r.phiZ()-pi)<=.001); 
     221        //G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle Z:" << r.phiZ() << G4endl;
     222        //G4cout << "linedUpWithAnAxis:" << linedUpWithAnAxis << G4endl;
     223       
    212224        // HepRep does not have a primitive for a cut cone,
    213225        // so if this cone is cut, let the base class convert this
    214226        // solid to polygons.
    215         if (cons.GetDeltaPhiAngle() < twopi) {
     227        G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
     228        if (cons.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons())
     229        {
    216230                G4VSceneHandler::AddSolid(cons);  // Invoke default action.
    217231        } else {
     
    278292        // so if this cylinder is cut, let the base class convert this
    279293        // solid to polygons.
    280         if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis)
     294        G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
     295        if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons())
    281296        {
    282297                G4VSceneHandler::AddSolid(tubs);  // Invoke default action.
     
    291306                haveVisible = false;
    292307                AddHepRepInstance("Cylinder", NULL);
    293                
    294                 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
    295308               
    296309                if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
     
    475488        if (!pTrModel) G4Exception
    476489                ("G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&): Not a G4TrajectoriesModel.");
    477         G4int drawingMode = pTrModel->GetDrawingMode();
    478490       
    479491        // Pointers to hold trajectory attribute values and definitions.
     
    551563                // Would rather be able to get these attDefs without needing a reference from any
    552564                // particular point, but don't know how to do that.
    553                 if ((drawingMode!=0 || trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())
     565                if ((trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())
    554566                        && traj.GetPointEntries()>0) {
    555567                        G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
     
    626638       
    627639        // Draw step points.
    628         if (drawingMode!=0 || trajContext->GetDrawStepPts()) {
     640        if (trajContext->GetDrawStepPts()) {
    629641                if (!doneInitTraj)
    630642                        InitTrajectory();
     
    642654                G4bool visible;
    643655                G4bool square;
    644                 if (drawingMode==0) {
    645                         G4Colour colour = trajContext->GetStepPtsColour();
    646                         redness = colour.GetRed();
    647                         greenness = colour.GetGreen();
    648                         blueness = colour.GetBlue();
    649                         markSize = (G4int) trajContext->GetStepPtsSize();
    650                         visible = (G4int) trajContext->GetStepPtsVisible();
    651                         square = (trajContext->GetStepPtsType()==G4Polymarker::squares);
    652                 } else {
    653                         redness = 1.;
    654                         greenness = 1.;
    655                         blueness = 1.;
    656                         markSize = std::abs(drawingMode/1000);
    657                         visible = true;
    658                         square = false;
    659                 }
     656                G4Colour colour = trajContext->GetStepPtsColour();
     657                redness = colour.GetRed();
     658                greenness = colour.GetGreen();
     659                blueness = colour.GetBlue();
     660                markSize = (G4int) trajContext->GetStepPtsSize();
     661                visible = (G4int) trajContext->GetStepPtsVisible();
     662                square = (trajContext->GetStepPtsType()==G4Polymarker::squares);
    660663
    661664                // Avoiding drawing anything black on black. 
     
    735738       
    736739        // Draw Auxiliary Points
    737         if (drawingMode!=0 || trajContext->GetDrawAuxPts()) {
     740        if (trajContext->GetDrawAuxPts()) {
    738741                if (!doneInitTraj)
    739742                        InitTrajectory();
     
    751754                G4bool visible;
    752755                G4bool square;
    753                 if (drawingMode==0) {
    754                         G4Colour colour = trajContext->GetAuxPtsColour();
    755                         redness = colour.GetRed();
    756                         greenness = colour.GetGreen();
    757                         blueness = colour.GetBlue();
    758                         markSize = (G4int) trajContext->GetAuxPtsSize();
    759                         visible = (G4int) trajContext->GetAuxPtsVisible();
    760                         square = (trajContext->GetAuxPtsType()==G4Polymarker::squares);
    761                 } else {
    762                         redness = 1.;
    763                         greenness = 1.;
    764                         blueness = 1.;
    765                         markSize = std::abs(drawingMode/1000);
    766                         visible = true;
    767                         square = false;
    768                 }
     756                G4Colour colour = trajContext->GetAuxPtsColour();
     757                redness = colour.GetRed();
     758                greenness = colour.GetGreen();
     759                blueness = colour.GetBlue();
     760                markSize = (G4int) trajContext->GetAuxPtsSize();
     761                visible = (G4int) trajContext->GetAuxPtsVisible();
     762                square = (trajContext->GetAuxPtsType()==G4Polymarker::squares);
    769763
    770764                // Avoiding drawing anything black on black. 
  • trunk/source/visualization/HepRep/src/G4HepRepMessenger.cc

    r1228 r1315  
    2424// ********************************************************************
    2525//
    26 // $Id: G4HepRepMessenger.cc,v 1.11 2009/11/23 05:42:28 perl Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4HepRepMessenger.cc,v 1.12 2010/06/05 06:25:03 perl Exp $
     27// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
    2828//
    2929#include "G4HepRepMessenger.hh"
     
    100100        }
    101101        setCullInvisiblesCommand->AvailableForStates(G4State_Idle);
     102               
     103        renderCylAsPolygonsCommand = new G4UIcmdWithABool("/vis/heprep/renderCylAsPolygons", this);
     104        renderCylAsPolygonsCommand->SetGuidance("Render cylinders and cones as polygons.");
     105        renderCylAsPolygonsCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML.");
     106        renderCylAsPolygonsCommand->SetParameterName("flag",false);
     107        renderCylAsPolygonsCommand->SetDefaultValue(true);
     108        renderCylAsPolygonsCommand->AvailableForStates(G4State_Idle);
    102109               
    103110    setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
     
    122129    addPointAttributesCommand->SetDefaultValue(false);
    123130    addPointAttributesCommand->AvailableForStates(G4State_Idle);
    124 
    125     useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
    126     useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
    127         useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile.");
    128     useSolidsCommand->SetParameterName("flag",false);
    129     useSolidsCommand->SetDefaultValue(true);
    130     useSolidsCommand->AvailableForStates(G4State_Idle);
     131               
     132        useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
     133        useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
     134        useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile..");
     135        useSolidsCommand->SetParameterName("flag",false);
     136        useSolidsCommand->SetDefaultValue(true);
     137        useSolidsCommand->AvailableForStates(G4State_Idle);
    131138}
    132139
     
    136143        delete setOverwriteCommand;
    137144        delete setCullInvisiblesCommand;
     145    delete renderCylAsPolygonsCommand;
    138146    delete setEventNumberSuffixCommand;
    139147    delete appendGeometryCommand;
     
    152160    } else if (command==setCullInvisiblesCommand) {
    153161        return cullInvisibles;
     162    } else if (command==renderCylAsPolygonsCommand) {
     163        return renderCylAsPolygonsCommand->ConvertToString(cylAsPolygons);
    154164    } else if (command==setEventNumberSuffixCommand) {
    155165        return suffix;
     
    174184    } else if (command==setCullInvisiblesCommand) {
    175185                cullInvisibles = setCullInvisiblesCommand->GetNewBoolValue(newValue);
     186    } else if (command==renderCylAsPolygonsCommand) {
     187        cylAsPolygons = renderCylAsPolygonsCommand->GetNewBoolValue(newValue);
    176188    } else if (command==setEventNumberSuffixCommand) {
    177189        suffix = newValue;
     
    201213}
    202214
     215G4bool G4HepRepMessenger::renderCylAsPolygons() {
     216    return cylAsPolygons;
     217}
     218
    203219G4String G4HepRepMessenger::getEventNumberSuffix() {
    204220    return suffix;
Note: See TracChangeset for help on using the changeset viewer.