X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fphantom.cpp;h=9d9a537acadf1c43f22622a6c42179e0705f02e4;hb=3d52fe3684ae9f5bf411c6ec4476381932ca6d00;hp=4d2cc28fbbc03896eaed2f6bfbcb72e331640dc8;hpb=320062d4d1e53ab9da799c77e9886b1e36cddcf5;p=ctsim.git diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index 4d2cc28..9d9a537 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: phantom.cpp,v 1.31 2001/03/24 05:28:28 kevin Exp $ +** $Id: phantom.cpp,v 1.33 2003/03/15 14:52:36 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -217,7 +217,7 @@ Phantom::createFromFile (const char* const fname) bool Phantom::fileWrite (const char* const fname) { - fstream file (fname, ios::out); + fstream file (fname, std::ios::out); if (! file.fail()) printDefinitions (file); @@ -239,8 +239,13 @@ Phantom::fileWrite (const char* const fname) void Phantom::addPElem (const char *type, const double cx, const double cy, const double u, const double v, const double rot, const double atten) { - PhantomElement *pelem = new PhantomElement (type, cx, cy, u, v, rot, atten); + PhmElemType pe_type = PhantomElement::convertNameToType (type); + if (pe_type == PELEM_INVALID) { + sys_error (ERR_WARNING, "Unknown PhantomElement type %s [PhantomElement::PhantomElement]", type); + return; + } + PhantomElement *pelem = new PhantomElement (type, cx, cy, u, v, rot, atten); m_listPElem.push_front (pelem); // update phantom limits @@ -599,8 +604,6 @@ PhantomElement::convertNameToType (const char* const typeName) type = PELEM_SECTOR; else if (strcasecmp (typeName, "segment") == 0) type = PELEM_SEGMENT; - else - sys_error (ERR_WARNING, "Unknown PhantomElement type %s [PhantomElement::PhantomElement]", type); return (type); } @@ -732,7 +735,7 @@ PhantomElement::makeVectorOutline () m_yOutline[cpts] = 0.0; break; default: - sys_error(ERR_WARNING, "illegal pelem type %d [makeVectorOutline]", m_type); + sys_error(ERR_WARNING, "Illegal phantom element type %d [makeVectorOutline]", m_type); return; }