CMS 3D CMS Logo

Public Member Functions

DDLRotationSequence Class Reference

DDLRotationSequence handles a set of Rotations. More...

#include <DDLRotationSequence.h>

Inheritance diagram for DDLRotationSequence:
DDLRotationByAxis DDXMLElement

List of all members.

Public Member Functions

 DDLRotationSequence (DDLElementRegistry *myreg)
 Constructor.
void preProcessElement (const std::string &name, const std::string &nmspace, DDCompactView &cpv)
 Called by loadAttributes AFTER attributes are loaded.
void processElement (const std::string &name, const std::string &nmspace, DDCompactView &cpv)
 Processing the element.
 ~DDLRotationSequence (void)
 Destructor.

Detailed Description

DDLRotationSequence handles a set of Rotations.

Author:
Michael Case

DDLRotationSequence.h - description ------------------- begin: Friday Nov. 15, 2003 email: case@ucdhep.ucdavis.edu

This is the RotationSequence processor.

Definition at line 24 of file DDLRotationSequence.h.


Constructor & Destructor Documentation

DDLRotationSequence::DDLRotationSequence ( DDLElementRegistry myreg)

Constructor.

Definition at line 21 of file DDLRotationSequence.cc.

  : DDLRotationByAxis( myreg ) 
{}
DDLRotationSequence::~DDLRotationSequence ( void  )

Destructor.

Definition at line 25 of file DDLRotationSequence.cc.

{}

Member Function Documentation

void DDLRotationSequence::preProcessElement ( const std::string &  name,
const std::string &  nmspace,
DDCompactView cpv 
) [virtual]

Called by loadAttributes AFTER attributes are loaded.

The preProcessElement method can assume that the attributes are loaded and perform any code that is necessary at the start of an element.

This would allow users to call their own code to setup anything necessary for the continued processing of the child elements.

Reimplemented from DDLRotationByAxis.

Definition at line 29 of file DDLRotationSequence.cc.

References DDXMLElement::clear(), DDLElementRegistry::getElement(), and DDXMLElement::myRegistry_.

{
  myRegistry_->getElement("RotationByAxis")->clear();
}
void DDLRotationSequence::processElement ( const std::string &  name,
const std::string &  nmspace,
DDCompactView cpv 
) [virtual]

Processing the element.

The processElement method completes any necessary work to process the XML element.

For example, this can be used to call the DDCore to make the geometry in memory. There is a default for this so that if not declared in the inheriting class, no processing is done.

Get the name, axis and angle of each Rotate child and make this the rotation.

Reimplemented from DDLRotationByAxis.

Definition at line 35 of file DDLRotationSequence.cc.

References DDXMLElement::clear(), DCOUT_V, DDrot(), DDXMLElement::getAttributeSet(), DDXMLElement::getDDName(), DDLElementRegistry::getElement(), i, DDXMLElement::myRegistry_, DDLRotationByAxis::processOne(), dttmaxenums::R, and DDXMLElement::size().

{
  DCOUT_V('P', "DDLRotationSequence::processElement started " << name);

  DDLRotationByAxis* myRotations = 
    dynamic_cast <DDLRotationByAxis * > (myRegistry_->getElement("RotationByAxis"));
  DDXMLAttribute atts;

  DDRotationMatrix R;
  for (size_t i = 0; i < myRotations->size(); ++i)
  {
    atts = myRotations->getAttributeSet(i);
    R = myRotations->processOne(R, atts.find("axis")->second, atts.find("angle")->second);
  }
    
  DDRotationMatrix* ddr = new DDRotationMatrix(R);
  DDRotation rot = DDrot(getDDName(nmspace), ddr);

  myRotations->clear();
  clear();

  DCOUT_V('P', "DDLRotationSequence::processElement completed");
}