CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
LinearSearchNavSurfaceImpl Class Reference

#include <LinearSearchNavSurfaceImpl.h>

Public Member Functions

void addVolume (const NavVolume *vol, const Bounds *bounds, SurfaceOrientation::Side side)
 
const Boundsbounds (const NavVolume *vol)
 
const NavVolumenextVolume (const NavSurface::LocalPoint &point, SurfaceOrientation::Side side) const
 

Private Types

typedef std::pair< const NavVolume *, const Bounds * > VolumeAndBounds
 
typedef std::vector< VolumeAndBoundsVolumeContainer
 

Private Member Functions

const NavVolumefindVolume (const NavSurface::LocalPoint &point, const VolumeContainer &volumes) const
 

Private Attributes

VolumeContainer theNegVolumes
 
VolumeContainer thePosVolumes
 

Detailed Description

Definition at line 10 of file LinearSearchNavSurfaceImpl.h.

Member Typedef Documentation

typedef std::pair< const NavVolume*, const Bounds*> LinearSearchNavSurfaceImpl::VolumeAndBounds
private

Definition at line 23 of file LinearSearchNavSurfaceImpl.h.

Definition at line 24 of file LinearSearchNavSurfaceImpl.h.

Member Function Documentation

void LinearSearchNavSurfaceImpl::addVolume ( const NavVolume vol,
const Bounds bounds,
SurfaceOrientation::Side  side 
)

Definition at line 41 of file LinearSearchNavSurfaceImpl.cc.

References Bounds::clone(), SurfaceOrientation::positiveSide, theNegVolumes, and thePosVolumes.

Referenced by NavCylinder::addVolume(), NavCone::addVolume(), and NavPlane::addVolume().

43 {
45  thePosVolumes.push_back( VolumeAndBounds( vol, bounds->clone()));
46  }
47  else {
48  theNegVolumes.push_back( VolumeAndBounds( vol, bounds->clone()));
49  }
50 }
virtual Bounds * clone() const =0
std::pair< const NavVolume *, const Bounds * > VolumeAndBounds
const Bounds * LinearSearchNavSurfaceImpl::bounds ( const NavVolume vol)

Definition at line 30 of file LinearSearchNavSurfaceImpl.cc.

References mps_fire::i, theNegVolumes, and thePosVolumes.

Referenced by NavCylinder::bounds(), NavCone::bounds(), and NavPlane::bounds().

31 {
32  for (VolumeContainer::const_iterator i=thePosVolumes.begin(); i!=thePosVolumes.end(); i++) {
33  if (i->first == vol) return i->second;
34  }
35  for (VolumeContainer::const_iterator i=theNegVolumes.begin(); i!=theNegVolumes.end(); i++) {
36  if (i->first == vol) return i->second;
37  }
38  return 0; // if volume not found
39 }
const NavVolume * LinearSearchNavSurfaceImpl::findVolume ( const NavSurface::LocalPoint point,
const VolumeContainer volumes 
) const
private

Definition at line 16 of file LinearSearchNavSurfaceImpl.cc.

References mps_fire::i.

Referenced by nextVolume().

18 {
19 // simple linear search for volume who's bounds contain the point
20 
21 //MM:return 0 if no volume was defined on this side!
22  if (vols.size()==0) return 0;
23 
24  for (VolumeContainer::const_iterator i=vols.begin(); i!=vols.end(); i++) {
25  if (i->second->inside(point)) return i->first;
26  }
27  return 0; // if point outside of all bounds on this side
28 }
const NavVolume * LinearSearchNavSurfaceImpl::nextVolume ( const NavSurface::LocalPoint point,
SurfaceOrientation::Side  side 
) const

Definition at line 4 of file LinearSearchNavSurfaceImpl.cc.

References findVolume(), SurfaceOrientation::negativeSide, SurfaceOrientation::positiveSide, theNegVolumes, and thePosVolumes.

Referenced by NavCylinder::nextVolume(), NavCone::nextVolume(), and NavPlane::nextVolume().

6 {
8  return findVolume( point, thePosVolumes);
9  }
10  else if (side == SurfaceOrientation::negativeSide) {
11  return findVolume( point, theNegVolumes);
12  }
13  else return 0; // should not be called with SurfaceOrientation::onSurface
14 }
const NavVolume * findVolume(const NavSurface::LocalPoint &point, const VolumeContainer &volumes) const

Member Data Documentation

VolumeContainer LinearSearchNavSurfaceImpl::theNegVolumes
private

Definition at line 27 of file LinearSearchNavSurfaceImpl.h.

Referenced by addVolume(), bounds(), and nextVolume().

VolumeContainer LinearSearchNavSurfaceImpl::thePosVolumes
private

Definition at line 26 of file LinearSearchNavSurfaceImpl.h.

Referenced by addVolume(), bounds(), and nextVolume().