5 modified files
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.43 -r1.44
--- CompactReader.java 16 Jan 2009 19:50:22 -0000 1.43
+++ CompactReader.java 13 Feb 2009 00:21:14 -0000 1.44
@@ -28,7 +28,7 @@
* org.lcsim.geometry.GeometryReader class, which extends this.
*
* @author tonyj
- * @version $Id: CompactReader.java,v 1.43 2009/01/16 19:50:22 jeremy Exp $
+ * @version $Id: CompactReader.java,v 1.44 2009/02/13 00:21:14 jeremy Exp $
*
*/
public class CompactReader
@@ -228,8 +228,7 @@
det.addField(field);
}
}
- }
-
+ }
/** Create impl objects of materials and their references. */
private void readMaterials(org.jdom.Element lccdd, Detector det) throws JDOMException
@@ -249,6 +248,7 @@
*/
private void readVisAttributes(Element lccdd, Detector det) throws JDOMException, ElementCreationException
{
+
Element display = lccdd.getChild("display");
if ( display != null )
{
@@ -258,8 +258,20 @@
assert(vis != null);
VisAttributes v = factory.createElement(VisAttributes.class, vis, null);
det.addVisAttributes(v);
- }
- }
+ }
+
+ // Add an invisible vis settings that shows daughters.
+ VisAttributes invisible = new VisAttributes("InvisibleWithDaughters");
+ invisible.setVisible(false);
+ invisible.setShowDaughters(true);
+ det.addVisAttributes(invisible);
+
+ // Add an invisible vis settings that shows daughters.
+ VisAttributes invisibleNoDau = new VisAttributes("InvisibleNoDaughters");
+ invisibleNoDau.setVisible(false);
+ invisibleNoDau.setShowDaughters(false);
+ det.addVisAttributes(invisibleNoDau);
+ }
}
// TODO: Should be protected or private but need to fix some external code first.
GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.3 -r1.4
--- VisAttributes.java 13 Oct 2006 22:31:51 -0000 1.3
+++ VisAttributes.java 13 Feb 2009 00:21:14 -0000 1.4
@@ -14,66 +14,100 @@
String drawingstyle = "wireframe";
boolean visible = true;
boolean showdaughters = true;
-
- protected VisAttributes(Element node)
+
+ public VisAttributes(String name)
+ {
+ this.name = name;
+ }
+
+ protected VisAttributes(Element node)
+ {
+ try {
+ this.name = node.getAttributeValue("name");
+
+ // Create a Java Color from the input RGBA values.
+ if (node.getAttribute("r") != null)
+ {
+ this.rgba[0] = node.getAttribute("r").getDoubleValue();
+ }
+
+ if (node.getAttribute("g") != null)
+ {
+ this.rgba[1] = node.getAttribute("g").getDoubleValue();
+ }
+
+ if (node.getAttribute("b") != null)
+ {
+ this.rgba[2] = node.getAttribute("b").getDoubleValue();
+ }
+
+ if (node.getAttribute("alpha") != null)
+ {
+ this.rgba[3] = node.getAttribute("alpha").getDoubleValue();
+ }
+
+ // Create the Java Color from the RGBA input values.
+ this.color = new Color((float)(rgba[0]),(float)(rgba[1]),(float)(rgba[2]),(float)(rgba[3]));
+
+ //float[] x = {0,0,0,0};
+ //x = this.color.getColorComponents(x);
+ //System.out.println("JAVA COLOR --> " + x[0] + ", " + ", " + x[1] + "," + x[2] + ", " + x[3]);
+ //System.out.println(color.toString());
+
+ if (node.getAttribute("lineStyle") != null)
+ {
+ this.linestyle = node.getAttributeValue("lineStyle");
+ }
+
+ if (node.getAttribute("showDaughters") != null)
+ {
+ this.showdaughters = node.getAttribute("showDaughters").getBooleanValue();
+ }
+
+ if (node.getAttribute("visible") != null)
+ {
+ this.visible = node.getAttribute("visible").getBooleanValue();
+ }
+
+ if (node.getAttribute("drawingStyle") != null)
+ {
+ this.drawingstyle = node.getAttributeValue("drawingStyle");
+ }
+ }
+ catch (DataConversionException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ public void setVisible(boolean visible)
+ {
+ this.visible = visible;
+ }
+
+ public final void setColor(double r, double g, double b, double a)
+ {
+ rgba[0] = a;
+ rgba[1] = r;
+ rgba[2] = g;
+ rgba[3] = b;
+ }
+
+ public final void setShowDaughters(boolean b)
{
- try {
- this.name = node.getAttributeValue("name");
-
- // Create a Java Color from the input RGBA values.
- if (node.getAttribute("r") != null)
- {
- this.rgba[0] = node.getAttribute("r").getDoubleValue();
- }
-
- if (node.getAttribute("g") != null)
- {
- this.rgba[1] = node.getAttribute("g").getDoubleValue();
- }
-
- if (node.getAttribute("b") != null)
- {
- this.rgba[2] = node.getAttribute("b").getDoubleValue();
- }
-
- if (node.getAttribute("alpha") != null)
- {
- this.rgba[3] = node.getAttribute("alpha").getDoubleValue();
- }
-
- // Create the Java Color from the RGBA input values.
- this.color = new Color((float)(rgba[0]),(float)(rgba[1]),(float)(rgba[2]),(float)(rgba[3]));
-
- //float[] x = {0,0,0,0};
- //x = this.color.getColorComponents(x);
- //System.out.println("JAVA COLOR --> " + x[0] + ", " + ", " + x[1] + "," + x[2] + ", " + x[3]);
- //System.out.println(color.toString());
-
- if (node.getAttribute("lineStyle") != null)
- {
- this.linestyle = node.getAttributeValue("lineStyle");
- }
-
- if (node.getAttribute("showDaughters") != null)
- {
- this.showdaughters = node.getAttribute("showDaughters").getBooleanValue();
- }
-
- if (node.getAttribute("visible") != null)
- {
- this.visible = node.getAttribute("visible").getBooleanValue();
- }
-
- if (node.getAttribute("drawingStyle") != null)
- {
- this.drawingstyle = node.getAttributeValue("drawingStyle");
- }
- }
- catch (DataConversionException e)
- {
- throw new RuntimeException(e);
- }
+ showdaughters = b;
}
+
+ public final void setDrawingStyle(String drawingstyle)
+ {
+ this.drawingstyle = drawingstyle;
+ }
+
+ public final void setLineStyle(String s)
+ {
+ this.linestyle = s;
+ }
public Color getColor()
{
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
diff -u -r1.7 -r1.8
--- PolyconeSupport.java 12 Sep 2006 01:20:55 -0000 1.7
+++ PolyconeSupport.java 13 Feb 2009 00:21:14 -0000 1.8
@@ -35,7 +35,7 @@
}
public void addToLCDD(LCDD lcdd, SensitiveDetector sens) throws JDOMException
- {
+ {
String suppName = node.getAttributeValue("name");
// get LCDD objects
@@ -65,7 +65,11 @@
Volume vol = new Volume(suppName + "_envelope_volume");
vol.setMaterial(mat);
vol.setSolid(pc);
- setVisAttributes(lcdd, node, vol);
+ if (node.getAttribute("vis") != null)
+ {
+ // System.out.println("setting vis for polycone - " + suppName);
+ vol.setVisAttributes(lcdd.getVisAttributes(node.getAttributeValue("vis")));
+ }
structure.addVolume(vol);
// phys vol
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -u -r1.25 -r1.26
--- LCDD.java 8 Jan 2008 23:50:53 -0000 1.25
+++ LCDD.java 13 Feb 2009 00:21:14 -0000 1.26
@@ -58,16 +58,16 @@
addContent(display);
// Add an invisible vis settings that shows daughters.
- VisAttributes invisible = new VisAttributes("InvisibleWithDaughters");
- invisible.setVisible(false);
- invisible.setShowDaughters(true);
- this.add(invisible);
+ //VisAttributes invisible = new VisAttributes("InvisibleWithDaughters");
+ //invisible.setVisible(false);
+ //invisible.setShowDaughters(true);
+ //this.add(invisible);
// Add an invisible vis settings that shows daughters.
- VisAttributes invisibleNoDau = new VisAttributes("InvisibleNoDaughters");
- invisibleNoDau.setVisible(false);
- invisibleNoDau.setShowDaughters(false);
- this.add(invisibleNoDau);
+ //VisAttributes invisibleNoDau = new VisAttributes("InvisibleNoDaughters");
+ //invisibleNoDau.setVisible(false);
+ //invisibleNoDau.setShowDaughters(false);
+ //this.add(invisibleNoDau);
Element gdml = new Element("gdml");
addContent(gdml);
@@ -219,6 +219,15 @@
public VisAttributes getVisAttributes(String name)
{
VisAttributes vis = null;
+ // debug
+ //System.out.println("display");
+ //for (Iterator i = getChild("display").getChildren("vis").iterator(); i.hasNext(); )
+ //{
+ // VisAttributes thisvis = (VisAttributes) i.next();
+ // System.out.println("vis - " + thisvis.getAttributeValue("name"));
+ //}
+ //System.out.println("--");
+
for (Iterator i = getChild("display").getChildren("vis").iterator(); i.hasNext(); )
{
VisAttributes thisvis = (VisAttributes) i.next();
GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
diff -u -r1.2 -r1.3
--- VisAttributes.java 17 Sep 2006 01:05:44 -0000 1.2
+++ VisAttributes.java 13 Feb 2009 00:21:14 -0000 1.3
@@ -4,6 +4,23 @@
public class VisAttributes extends RefElement
{
+ public VisAttributes(String name)
+ {
+ super("vis",name);
+
+ this.setAttribute("line_style","unbroken");
+ this.setAttribute("drawing_style","wireframe");
+ this.setAttribute("show_daughters","true");
+ this.setAttribute("visible","true");
+
+ Element color = new Element("color");
+ color.setAttribute("R","1.0");
+ color.setAttribute("G","1.0");
+ color.setAttribute("B","1.0");
+ color.setAttribute("alpha","1.0");
+ this.addContent(color);
+ }
+
enum LineStyle
{
UNBROKEN("unbroken"),
@@ -40,24 +57,7 @@
return s;
}
}
-
- public VisAttributes(String name)
- {
- super("vis",name);
- this.setAttribute("line_style","unbroken");
- this.setAttribute("drawing_style","wireframe");
- this.setAttribute("show_daughters","true");
- this.setAttribute("visible","true");
-
- Element color = new Element("color");
- color.setAttribute("R","1.0");
- color.setAttribute("G","1.0");
- color.setAttribute("B","1.0");
- color.setAttribute("alpha","1.0");
- this.addContent(color);
- }
-
public final void setColor(double r, double g, double b, double a)
{
Element color = this.getChild("color");
CVSspam 0.2.8