Print

Print


Commit in GeomConverter on MAIN
src/org/lcsim/geometry/compact/VisAttributes.java+46-21.1 -> 1.2
src/org/lcsim/geometry/compact/converter/lcdd/LCDDDetector.java+12-11.14 -> 1.15
src/org/lcsim/geometry/compact/converter/lcdd/util/LCDD.java+21-21.19 -> 1.20
                                                  /VisAttributes.java+68-11.1 -> 1.2
test/org/lcsim/geometry/subdetector/subdetectors.xml+1-11.1 -> 1.2
+148-7
5 modified files
JM: Support all attributes of LCDD visualization in compact description.

GeomConverter/src/org/lcsim/geometry/compact
VisAttributes.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- VisAttributes.java	12 Sep 2006 01:20:52 -0000	1.1
+++ VisAttributes.java	17 Sep 2006 01:05:43 -0000	1.2
@@ -7,7 +7,11 @@
 {
 	double rgba[] = new double[4];
 	String name;
-	
+	String linestyle = "unbroken";
+	String drawingstyle = "wireframe";
+	boolean visible = true;
+	boolean showdaughters = true;
+		
 	protected VisAttributes(Element node)
     {
 		try {
@@ -15,7 +19,27 @@
 			rgba[0] = node.getAttribute("r").getDoubleValue();
 			rgba[1] = node.getAttribute("g").getDoubleValue();
 			rgba[2] = node.getAttribute("b").getDoubleValue();
-			rgba[3] = node.getAttribute("alpha").getDoubleValue();
+			rgba[3] = node.getAttribute("alpha").getDoubleValue();		
+			
+			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)
 		{
@@ -28,6 +52,26 @@
 		return rgba;
 	}
 	
+	public boolean getVisible()
+	{
+		return this.visible;
+	}
+	
+	public boolean getShowDaughters()
+	{
+		return this.showdaughters;
+	}
+	
+	public String getDrawingStyle()
+	{
+		return this.drawingstyle;
+	}
+	
+	public String getLineStyle()
+	{
+		return this.linestyle;
+	}
+	
 	public String getName()
 	{
 		return name;

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
LCDDDetector.java 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- LCDDDetector.java	12 Sep 2006 01:20:54 -0000	1.14
+++ LCDDDetector.java	17 Sep 2006 01:05:43 -0000	1.15
@@ -149,7 +149,12 @@
         	VisAttributes lcddvis = new VisAttributes(vis.getName());
         	
         	double rgba[] = vis.getRGBA();
-        	lcddvis.setColor(rgba[0],rgba[1],rgba[2],rgba[3]);
+        	lcddvis.setColor(rgba[0],rgba[1],rgba[2],rgba[3]);        	
+        	lcddvis.setDrawingStyle(vis.getDrawingStyle());
+        	lcddvis.setLineStyle(vis.getLineStyle());
+        	lcddvis.setVisible(vis.getVisible());
+        	lcddvis.setShowDaughters(vis.getShowDaughters());
+        	
         	lcdd.add(lcddvis);
         }
         
@@ -197,6 +202,12 @@
             }
         }
         
+        // Set the world volume to invisible.
+        VisAttributes worldVis = new VisAttributes("WorldVis");
+        worldVis.setVisible(false);
+        lcdd.getWorldVolume().setVisAttributes(worldVis);
+        lcdd.add(worldVis);
+        
         /* fields */
         for (Field field : getFields().values())
         {

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
LCDD.java 1.19 -> 1.20
diff -u -r1.19 -r1.20
--- LCDD.java	12 Sep 2006 01:21:06 -0000	1.19
+++ LCDD.java	17 Sep 2006 01:05:44 -0000	1.20
@@ -17,6 +17,7 @@
 public class LCDD extends Element
 {
     private Map materials = new HashMap();
+    Volume worldVolume = null;
     public LCDD()
     {
         super("lcdd");
@@ -69,10 +70,10 @@
         worldSolid.setAttribute("z","world_z");
         solids.addSolid(worldSolid);        
         
-        Volume worldVolume = new Volume("world_volume");
+        this.worldVolume = new Volume("world_volume");
         worldVolume.setSolid(worldSolid);
         structure.setWorldVolume(worldVolume);
-        
+                
         Tube trackingSolid = new Tube("tracking_cylinder");
         trackingSolid.setAttribute("rmax","tracking_region_radius");
         trackingSolid.setAttribute("z","2*tracking_region_zmax");
@@ -398,4 +399,22 @@
         }
         return limitset;
     }
+    
+    public Volume getWorldVolume()
+    {
+    	return this.worldVolume;
+    }  
+    
+    public Volume getVolume(String name)
+    {
+    	for (Iterator i = getChild("structure").getChildren("volume").iterator(); i.hasNext(); )
+    	{
+    		Volume vol = (Volume) i.next();
+    		if (vol.getRefName().compareTo(name) == 0)
+    		{
+    			return vol;
+    		}
+    	}
+    	return null;
+    }
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd/util
VisAttributes.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- VisAttributes.java	12 Sep 2006 01:21:07 -0000	1.1
+++ VisAttributes.java	17 Sep 2006 01:05:44 -0000	1.2
@@ -3,7 +3,44 @@
 import org.jdom.Element;
 
 public class VisAttributes extends RefElement
-{		
+{	
+	enum LineStyle
+	{
+		UNBROKEN("unbroken"),
+		DASHED("dashed"),
+		DOTTED("dotted");
+		
+		private String s;
+		
+		LineStyle(String s)
+		{
+			this.s = s;
+		}
+		
+		public String toString()
+		{
+			return s;
+		}
+	}
+	
+	enum DrawingStyle
+	{
+		WIREFRAME("wireframe"),
+		SOLID("solid");
+		
+		private String s;
+		
+		DrawingStyle(String s)
+		{
+			this.s = s;
+		}
+		
+		public String toString()
+		{
+			return s;
+		}
+	}
+	
 	public VisAttributes(String name)
 	{
 		super("vis",name);
@@ -29,4 +66,34 @@
 		color.setAttribute("B",String.valueOf(b));
 		color.setAttribute("alpha",String.valueOf(a));
 	}
+	
+	public final void setShowDaughters(boolean b)
+	{
+		this.setAttribute("show_daughters",Boolean.toString(b));
+	}
+	
+	public final void setDrawingStyle(DrawingStyle s)
+	{
+		this.setAttribute("drawing_style",s.toString());
+	}
+	
+	public final void setDrawingStyle(String s)
+	{
+		this.setAttribute("drawing_style",s);
+	}
+	
+	public final void setLineStyle(LineStyle s)
+	{
+		this.setAttribute("line_style",s.toString());
+	}		
+	
+	public final void setLineStyle(String s)
+	{
+		this.setAttribute("line_style",s);
+	}
+	
+	public final void setVisible(boolean v)
+	{
+		this.setAttribute("visible",Boolean.toString(v));
+	}	
 }
\ No newline at end of file

GeomConverter/test/org/lcsim/geometry/subdetector
subdetectors.xml 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- subdetectors.xml	12 Sep 2006 01:21:14 -0000	1.1
+++ subdetectors.xml	17 Sep 2006 01:05:44 -0000	1.2
@@ -17,7 +17,7 @@
 	<materials>
   </materials>
 	<display>
-		<vis name="TestVis" alpha="1.0" r="1.0" g="0.0" b="0.0"/>
+		<vis name="TestVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="wireframe" lineStyle="unbroken" showDaughters="true" visible="true" />
 	</display>
 	<detectors>
 		<detector id="1" name="MultiLayerTracker" type="MultiLayerTracker" readout="MultiLayerTracker_RO" vis="TestVis">
CVSspam 0.2.8