|
[HepData-svn] r1751 - in trunk/hepdata-webapp/src/main/java/cedar/hepdata: formats webapp/componentsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue Feb 25 14:43:57 GMT 2014
Author: whalley Date: Tue Feb 25 14:43:57 2014 New Revision: 1751 Log: ain/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java Tue Feb 25 12:41:06 2014 (r1750) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java Tue Feb 25 14:43:57 2014 (r1751) @@ -10,6 +10,7 @@ import java.util.*; import org.antlr.stringtemplate.*; +import com.Ostermiller.util.SignificantFigures; public class InputFormatter { @@ -198,8 +199,17 @@ s.append(" " + ds.getXAxis(nx+1).getBin(i+1).getRelation().toString()); } if(ds.getXAxis(nx+1).getBin(i+1).getFocus() != null){ - s.append(" " + ds.getXAxis(nx+1).getBin(i+1).getFocus()); - if(ds.getXAxis(nx+1).getBin(i+1).getLowValue() != null + SignificantFigures focusx = new SignificantFigures(ds.getXAxis(nx+1).getBin(i+1).getFocus()); + int lsd = focusx.getLSD(); + int msd = focusx.getMSD(); + if(msd == 0) msd = 1; + if(ds.getXAxis(nx+1).getBin(i+1).getFocusLength() != null){ + lsd = -ds.getXAxis(nx+1).getBin(i+1).getFocusLength(); + } + String foc = Formats.forms(ds.getXAxis(nx+1).getBin(i+1).getFocus(),msd,-lsd); + s.append(" " + foc); + // s.append(" " + ds.getXAxis(nx+1).getBin(i+1).getFocus()); + if(ds.getXAxis(nx+1).getBin(i+1).getLowValue() != null && ds.getXAxis(nx+1).getBin(i+1).getHighValue() != null && !ds.getXAxis(nx+1).getBin(i+1).getLowValue().equals(ds.getXAxis(nx+1).getBin(i+1).getHighValue())){ s.append(" (BIN=" + ds.getXAxis(nx+1).getBin(i+1).getLowValue() + " TO " + ds.getXAxis(nx+1).getBin(i+1).getHighValue() + ")"); Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Tue Feb 25 12:41:06 2014 (r1750) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Tue Feb 25 14:43:57 2014 (r1751) @@ -585,7 +585,7 @@ } int msd = val.getMSD(); if (msd <= 0) msd = 1; - // if(allzero == sumzero) lsd = 0; + // ` if(allzero == sumzero) lsd = 0; if (verbatim) { writer.write(pt2.getValue().toString().replaceAll("E","e")); } else{ writer.write(Formats.forms(pt2.getValue(),msd, -lsd)); } @@ -686,9 +686,15 @@ // writer.element("br"); writer.end(); // Plot link + Double yratio = _dataset.getYAxis(iy).getMaxValue()/_dataset.getYAxis(iy).getMinValue(); if(nx==1){ writer.element("a"); - writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/y" + iy); + if(_dataset.getYAxis(iy).getMinValue()>0.0 && yratio > 100.0){ + writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/ylog" + iy); + } + else{ + writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/y" + iy); + } writer.attributes("title", "Display this table in graphical form"); writer.write("Plot"); writer.end(); @@ -697,7 +703,12 @@ else { for (int nxx=1; nxx<=nx; nxx++){ writer.element("a"); - writer.attributes("href", baseurl + "/plot" + urlparts + "/x0"+nxx+"/y" + iy); + if(_dataset.getYAxis(iy).getMinValue()>0.0 && yratio > 100.0){ + writer.attributes("href", baseurl + "/plot" + urlparts + "/x0"+nxx+"/ylog" + iy); + } + else { + writer.attributes("href", baseurl + "/plot" + urlparts + "/x0"+nxx+"/y" + iy); + } writer.attributes("title", "Display this table in graphical form using xaxis "+nxx); writer.write("Plot v x"+nxx); writer.end();
More information about the HepData-svn mailing list |