public Scientrace.RectangularPrism parseXRectangularPrism(XElement xrectprism) { //try { //Console.WriteLine("Adding Square Prism"); //check basic prerequisites if (xrectprism.Name.ToString() != "RectangularPrism") { throw new XMLException("RectangularPrism does not match its name: " + xrectprism.Name.ToString()); } Scientrace.Vector width = this.X.getXVectorByName(xrectprism, "Width"); Scientrace.Vector length = this.X.getXVectorByName(xrectprism, "Length"); Scientrace.Vector height = this.X.getXVectorByName(xrectprism, "Height"); if (width.length * length.length * height.length == 0) { Console.WriteLine("WARNING: Rectangular Prism " + xrectprism.Attribute("Tag").Value + " has no volume and will " + "therefor not be created."); return(null); } Scientrace.Location location = null; if (xrectprism.Element("Center") == null) { location = this.X.getXVectorByName(xrectprism, "Location").toLocation(); } else { location = (this.X.getXVectorByName(xrectprism, "Center") + (width * -0.5) + (length * -0.5) + (height * -0.5)) .toLocation(); } Scientrace.MaterialProperties materialprops = this.getXMaterialForObject(xrectprism); /* * string materialid = this.X.getXStringByAttribute(xrectprism,"Material"); * Scientrace.MaterialProperties material = Scientrace.MaterialProperties.FromIdentifier(materialid); */ //tryToNonzeroVector operations below are permitted since the prism has a volume as was tested above. Scientrace.RectangularPrism tretprism = new Scientrace.RectangularPrism(this.parentcollection, materialprops, location, width.tryToNonzeroVector(), height.tryToNonzeroVector(), length.tryToNonzeroVector()); this.addCommonObjectProperties(tretprism, xrectprism); return(tretprism); /* } catch(Exception e) {Console.WriteLine("Couldn't create RectangularPrism: "+this.X.getXString(xrectprism.Attribute("Tag"))); * throw(e); * }*/ }
public Scientrace.RectangularPrism parseXRectangularPrism(XElement xrectprism) { //try { //Console.WriteLine("Adding Square Prism"); //check basic prerequisites if (xrectprism.Name.ToString() != "RectangularPrism") { throw new XMLException("RectangularPrism does not match its name: "+xrectprism.Name.ToString()); } Scientrace.Vector width = this.X.getXVectorByName(xrectprism, "Width"); Scientrace.Vector length = this.X.getXVectorByName(xrectprism, "Length"); Scientrace.Vector height = this.X.getXVectorByName(xrectprism,"Height"); if (width.length*length.length*height.length == 0) { Console.WriteLine("WARNING: Rectangular Prism "+xrectprism.Attribute("Tag").Value+" has no volume and will " + "therefor not be created."); return null; } Scientrace.Location location = null; if (xrectprism.Element("Center") == null) { location = this.X.getXVectorByName(xrectprism,"Location").toLocation(); } else { location = (this.X.getXVectorByName(xrectprism, "Center")+(width*-0.5)+(length*-0.5)+(height*-0.5)) .toLocation(); } Scientrace.MaterialProperties materialprops = this.getXMaterialForObject(xrectprism); /* string materialid = this.X.getXStringByAttribute(xrectprism,"Material"); Scientrace.MaterialProperties material = Scientrace.MaterialProperties.FromIdentifier(materialid); */ //tryToNonzeroVector operations below are permitted since the prism has a volume as was tested above. Scientrace.RectangularPrism tretprism = new Scientrace.RectangularPrism(this.parentcollection, materialprops, location, width.tryToNonzeroVector(), height.tryToNonzeroVector(),length.tryToNonzeroVector()); this.addCommonObjectProperties(tretprism, xrectprism); return tretprism; /* } catch(Exception e) {Console.WriteLine("Couldn't create RectangularPrism: "+this.X.getXString(xrectprism.Attribute("Tag"))); throw(e); }*/ }