Esempio n. 1
0
 @Override
 public String getShapeState() {
   StringBuffer sb = new StringBuffer();
   sb.append("  axes scale ").append(viewer.getAxesScale()).append(";\n");
   if (fixedOrigin != null)
     sb.append("  axes center ").append(Escape.escape(fixedOrigin)).append(";\n");
   if (axisXY.z != 0)
     sb.append("  axes position [")
         .append((int) axisXY.x)
         .append(" ")
         .append((int) axisXY.y)
         .append(" ")
         .append(axisXY.z < 0 ? " %" : "")
         .append("];\n");
   if (labels != null) {
     sb.append("  axes labels ");
     for (int i = 0; i < labels.length; i++) sb.append(Escape.escape(labels[i])).append(" ");
     sb.append(";\n");
   }
   return super.getShapeState() + sb;
 }
 private void loadFiles(List<File> fileList) {
   StringBuffer sb = new StringBuffer();
   for (int i = 0; i < fileList.size(); ++i) {
     File f = fileList.get(i);
     String fname = f.getAbsolutePath();
     fname = fname.replace('\\', '/').trim();
     fname = (fname.startsWith("/") ? "file://" : "file:///") + fname;
     sb.append("load ").append(i == 0 ? "" : "APPEND ").append(Escape.escape(fname)).append(";\n");
   }
   sb.append("frame *;reset;");
   viewer.script(sb.toString());
 }
Esempio n. 3
0
 public String getShapeState() {
   if (!isValid) return "";
   StringBuffer s = new StringBuffer();
   s.append("dipole ID ").append(thisID);
   if (haveAtoms)
     s.append(" ({")
         .append(atoms[0].getAtomIndex())
         .append(" ")
         .append(atoms[1].getAtomIndex())
         .append("})");
   else if (coords[0] == null) return "";
   else
     s.append(" ").append(Escape.escape(coords[0])).append(" ").append(Escape.escape(coords[1]));
   if (isUserValue) s.append(" value ").append(dipoleValue);
   if (mad != Dipoles.DEFAULT_MAD) s.append(" width ").append(mad / 1000f);
   if (offsetAngstroms != 0) s.append(" offset ").append(offsetAngstroms);
   else if (offsetPercent != 0) s.append(" offset ").append(offsetPercent);
   if (offsetSide != Dipoles.DEFAULT_OFFSETSIDE) s.append(" offsetSide ").append(offsetSide);
   if (noCross) s.append(" nocross");
   if (!visible) s.append(" off");
   s.append(";\n");
   return s.toString();
 }
Esempio n. 4
0
 public static void main(String[] args) {
   // note that -o-x are implied, but -n is not.
   // in this case -n means "no GRAPHICS" for speed
   JmolApp jmolApp = new JmolApp();
   jmolApp.isDataOnly = true;
   jmolApp.haveConsole = false;
   // jmolApp.haveDisplay = false;
   jmolApp.info.put("exit", Boolean.TRUE);
   jmolApp.parseCommandLine(args);
   if (!jmolApp.isSilent) {
     System.out.println("JmolData using command options " + Escape.escape(args));
     if (!jmolApp.info.containsKey("noGraphics"))
       System.out.println(
           "Add -n (NOGRAPHICS) for faster performance if you are not creating images.");
   }
   new JmolData(jmolApp);
 }
Esempio n. 5
0
  boolean createIsosurface(boolean justForPlane) {
    resetIsosurface();
    jvxlData.cutoff = Float.NaN;
    if (!readAndSetVolumeParameters(justForPlane)) return false;
    if (!justForPlane && !Float.isNaN(params.sigma) && !allowSigma) {
      if (params.sigma > 0)
        Logger.error("Reader does not support SIGMA option -- using cutoff 1.6");
      params.cutoff = 1.6f;
    }
    // negative sigma just ignores the error message
    // and means it was inserted by Jmol as a default option
    if (params.sigma < 0) params.sigma = -params.sigma;
    nPointsX = voxelCounts[0];
    nPointsY = voxelCounts[1];
    nPointsZ = voxelCounts[2];
    jvxlData.isSlabbable = ((params.dataType & Parameters.IS_SLABBABLE) != 0);
    jvxlData.insideOut = params.insideOut;
    jvxlData.dataXYReversed = params.dataXYReversed;
    jvxlData.isBicolorMap = params.isBicolorMap;
    jvxlData.nPointsX = nPointsX;
    jvxlData.nPointsY = nPointsY;
    jvxlData.nPointsZ = nPointsZ;
    jvxlData.jvxlVolumeDataXml = volumeData.xmlData;
    jvxlData.voxelVolume = volumeData.voxelVolume;
    if (justForPlane) {
      // float[][][] voxelDataTemp =  volumeData.voxelData;
      volumeData.setMappingPlane(params.thePlane);
      // volumeData.setDataDistanceToPlane(params.thePlane);
      if (meshDataServer != null)
        meshDataServer.fillMeshData(meshData, MeshData.MODE_GET_VERTICES, null);
      params.setMapRanges(this, false);
      generateSurfaceData();
      volumeData.setMappingPlane(null);

      // if (volumeData != null)
      //  volumeData.voxelData = voxelDataTemp;
    } else {
      if (!readVolumeData(false)) return false;
      generateSurfaceData();
    }
    if (jvxlFileHeaderBuffer != null) {
      String s = jvxlFileHeaderBuffer.toString();
      int i = s.indexOf('\n', s.indexOf('\n', s.indexOf('\n') + 1) + 1) + 1;
      jvxlData.jvxlFileTitle = s.substring(0, i);
    }
    if (params.contactPair == null) setBoundingBox();
    if (!params.isSilent)
      Logger.info("boundbox corners " + Escape.escape(xyzMin) + " " + Escape.escape(xyzMax));
    jvxlData.boundingBox = new Point3f[] {xyzMin, xyzMax};
    jvxlData.dataMin = dataMin;
    jvxlData.dataMax = dataMax;
    jvxlData.cutoff = (isJvxl ? jvxlCutoff : params.cutoff);
    jvxlData.isCutoffAbsolute = params.isCutoffAbsolute;
    jvxlData.pointsPerAngstrom = 1f / volumeData.volumetricVectorLengths[0];
    jvxlData.jvxlColorData = "";
    jvxlData.jvxlPlane = params.thePlane;
    jvxlData.jvxlEdgeData = edgeData;
    jvxlData.isBicolorMap = params.isBicolorMap;
    jvxlData.isContoured = params.isContoured;
    jvxlData.colorDensity = params.colorDensity;
    if (jvxlData.vContours != null) params.nContours = jvxlData.vContours.length;
    jvxlData.nContours = (params.contourFromZero ? params.nContours : -1 - params.nContours);
    jvxlData.nEdges = edgeCount;
    jvxlData.edgeFractionBase = edgeFractionBase;
    jvxlData.edgeFractionRange = edgeFractionRange;
    jvxlData.colorFractionBase = colorFractionBase;
    jvxlData.colorFractionRange = colorFractionRange;
    jvxlData.jvxlDataIs2dContour = jvxlDataIs2dContour;
    jvxlData.jvxlDataIsColorMapped = jvxlDataIsColorMapped;
    jvxlData.jvxlDataIsColorDensity = jvxlDataIsColorDensity;
    jvxlData.isXLowToHigh = isXLowToHigh;
    jvxlData.vertexDataOnly = vertexDataOnly;
    jvxlData.saveVertexCount = 0;

    if (jvxlDataIsColorMapped || jvxlData.nVertexColors > 0) {
      if (meshDataServer != null) {
        meshDataServer.fillMeshData(meshData, MeshData.MODE_GET_VERTICES, null);
        meshDataServer.fillMeshData(meshData, MeshData.MODE_GET_COLOR_INDEXES, null);
      }
      jvxlData.jvxlColorData = readColorData();
      updateSurfaceData();
      if (meshDataServer != null) meshDataServer.notifySurfaceMappingCompleted();
    }
    return true;
  }