44 DCOUT_V(
'P',
"DDLBooleanSolid::processElement started" );
58 double x=0.0,
y=0.0,
z=0.0;
63 if( myrSolid->
size() == 0 )
66 if ( atts.find(
"firstSolid") != atts.end() && atts.find(
"secondSolid") != atts.end() ) {
70 std::string
s (
"DDLBooleanSolid did not find any solids with which to form a boolean solid.");
75 else if (myrSolid->
size() == 2)
77 ddn1 = myrSolid->
getDDName(nmspace,
"name", 0);
78 ddn2 = myrSolid->
getDDName(nmspace,
"name", 1);
80 std::string
s(
"DDLBooleanSolid did not find any solids with which to form a boolean solid.");
85 if (myTranslation->
size() > 0)
89 x = ev.
eval(nmspace, atts.find(
"x")->second);
90 y = ev.
eval(nmspace, atts.find(
"y")->second);
91 z = ev.
eval(nmspace, atts.find(
"z")->second);
94 if (myrRotation->
size() > 0)
101 if (name ==
"UnionSolid") {
109 else if (name ==
"SubtractionSolid") {
117 else if (name ==
"IntersectionSolid") {
126 throw DDException(
"DDLBooleanSolid was asked to do something other than Union-, Subtraction- or IntersectionSolid?");
134 myTranslation->
clear();
135 myrRotation->
clear();
138 DCOUT_V(
'P',
"DDLBooleanSolid::processElement completed");
149 s = std::string (
"\n<") + name +
" name=\"" + atts.find(
"name")->second +
"\"";
151 if (atts.find(
"firstSolid") != atts.end()) s+=
" firstSolid=\"" + atts.find(
"firstSolid")->second +
"\"";
152 if (atts.find(
"secondSolid") != atts.end()) s+=
" secondSolid=\"" + atts.find(
"secondSolid")->second +
"\"";
158 if (myrSolid->
size() > 0)
160 for (
size_t i = 0;
i < myrSolid->
size(); ++
i)
163 s+=
"<rSolid name=\"" + atts.find(
"name")->second +
"\"/>\n";
169 if (atts.find(
"x") != atts.end())
170 s+=
" x=\"" + atts.find(
"x")->second +
"\"";
171 if (atts.find(
"y") != atts.end())
172 s+=
" y=\"" + atts.find(
"y")->second +
"\"";
173 if (atts.find(
"z") != atts.end())
174 s+=
" z=\"" + atts.find(
"z")->second +
"\"";
178 if (atts.find(
"name") != atts.end())
180 s+=
"<rRotation name=\"" + atts.find(
"name")->second +
"\"/>\n";
182 s+=
"</" + name +
">\n\n";
DDLElementRegistry * myRegistry_
~DDLBooleanSolid()
Destructor.
An exception for DDD errors.
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
DDName is used to identify DDD entities uniquely.
type of data representation of DDCompactView
std::map< std::string, std::string > DDXMLAttribute
A DDSolid represents the shape of a part.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Represents a uniquely identifyable rotation matrix.
DDXMLElement * getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
static value_type & instance()
static DDSolid intersection(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
virtual size_t size(void) const
Number of elements accumulated.
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Processing the element.
Interface of an Expression Evaluator.
DDLBooleanSolid(DDLElementRegistry *myreg)
Constructor.
#define DCOUT_V(M_v_Y, M_v_S)
std::string dumpBooleanSolid(const std::string &name, const std::string &nmspace)
DDLSolid processes Box elements.
virtual double eval(const std::string &ns, const std::string &expr)=0
evaluate an expression expr inside the local namespace
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
This is a base class for processing XML elements in the DDD.
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Called by loadAttributes AFTER attributes are loaded.
The main class for processing parsed elements.
virtual void clear(void)
clear this element's contents.
static DDSolid unionSolid(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
void setReference(const std::string &nmspace, DDCompactView &cpv)