public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    BasicShapeAttributes that = (BasicShapeAttributes) o;

    if (drawOutline != that.drawOutline) return false;
    if (drawInterior != that.drawInterior) return false;
    if (enableAntialiasing != that.enableAntialiasing) return false;
    if (Double.compare(that.outlineOpacity, outlineOpacity) != 0) return false;
    if (Double.compare(that.interiorOpacity, interiorOpacity) != 0) return false;
    if (Double.compare(that.outlineWidth, outlineWidth) != 0) return false;
    if (that.outlineStippleFactor != outlineStippleFactor) return false;
    if (that.outlineStipplePattern != outlineStipplePattern) return false;
    if (interiorMaterial != null
        ? !interiorMaterial.equals(that.interiorMaterial)
        : that.interiorMaterial != null) return false;
    if (outlineMaterial != null
        ? !outlineMaterial.equals(that.outlineMaterial)
        : that.outlineMaterial != null) return false;
    if (interiorImageSource != null
        ? !interiorImageSource.equals(that.interiorImageSource)
        : that.interiorImageSource != null) return false;
    //noinspection RedundantIfStatement
    if (Double.compare(that.interiorImageScale, interiorImageScale) != 0) return false;

    return true;
  }
 /**
  * @param m
  * @param n
  * @param w
  * @param h
  * @param pix
  */
 public InteractiveRenderer(int m, int n, int w, int h) {
   W = w;
   H = h;
   renderer = new Renderer();
   pixels = renderer.init(W, H);
   Geometry g = this.add();
   texture = new Texture(pixels, W, H, "grid", false);
   Material material = new Material();
   material.setTexture(texture);
   g.setMaterial(material);
   g.setDoubleSided(true);
   g.mesh(m, n);
   g.name = "mesh";
   init();
 }
 public int hashCode() {
   int result;
   long temp;
   result = (drawInterior ? 1 : 0);
   result = 31 * result + (drawOutline ? 1 : 0);
   result = 31 * result + (enableAntialiasing ? 1 : 0);
   result = 31 * result + (interiorMaterial != null ? interiorMaterial.hashCode() : 0);
   result = 31 * result + (outlineMaterial != null ? outlineMaterial.hashCode() : 0);
   temp = interiorOpacity != +0.0d ? Double.doubleToLongBits(interiorOpacity) : 0L;
   result = 31 * result + (int) (temp ^ (temp >>> 32));
   temp = outlineOpacity != +0.0d ? Double.doubleToLongBits(outlineOpacity) : 0L;
   result = 31 * result + (int) (temp ^ (temp >>> 32));
   temp = outlineWidth != +0.0d ? Double.doubleToLongBits(outlineWidth) : 0L;
   result = 31 * result + (int) (temp ^ (temp >>> 32));
   temp = outlineStippleFactor;
   result = 31 * result + (int) (temp ^ (temp >>> 32));
   temp = outlineStipplePattern;
   result = 31 * result + (int) (temp ^ (temp >>> 32));
   result = 31 * result + (interiorImageSource != null ? interiorImageSource.hashCode() : 0);
   temp = Double.doubleToLongBits(interiorImageScale);
   result = 31 * result + (int) (temp ^ (temp >>> 32));
   return result;
 }
 @Override
 public Material getMaterial(int x, int y, int z) {
   return Material.get(getBlockType(x, y, z), getDataValue(x, y, z));
 }
  /**
   * Builds the SRA elements that are related to this ISATAB assay. It adds runs and an experiment
   * to the respective set.
   *
   * @return true if it could successfully build the exported items.
   */
  protected boolean buildExportedAssay(
      Assay assay,
      SubmissionType.FILES xsubFiles,
      RunSetType xrunSet,
      ExperimentSetType xexperimentSet,
      SampleSetType xsampleSet) {
    String assayAcc = assay.getAcc();

    // Now create an experiment for the input material and link it to the run

    // get Material associated to the assay and get its identifier
    Material material = assay.getMaterial();
    String materialAcc = material.getAcc();

    // create a new SRA Experiment and assign ISA Material name as SRA Experiment Title
    ExperimentType xexp = ExperimentType.Factory.newInstance();
    xexp.setAlias(materialAcc);
    xexp.setTITLE("experiment made with the sample " + material.getName());

    xexp.setCenterName(centerName);
    xexp.setBrokerName(brokerName);

    PlatformType xplatform = buildExportedPlatform(assay);
    if (xplatform == null) {
      return false;
    }
    xexp.setPLATFORM(xplatform);

    xexp.setPROCESSING(buildExportedProcessing(assay));

    STUDYREF xstudyRef = STUDYREF.Factory.newInstance();
    xstudyRef.setRefname(assay.getStudy().getAcc());
    xexp.setSTUDYREF(xstudyRef);
    EXPERIMENTREF xexpRef = EXPERIMENTREF.Factory.newInstance();
    xexpRef.setRefname(materialAcc);

    DESIGN xdesign = DESIGN.Factory.newInstance();
    xdesign.setDESIGNDESCRIPTION("See study and sample descriptions for details");

    SAMPLEDESCRIPTOR xsampleRef = buildExportedAssaySample(assay, xsampleSet);
    if (xsampleRef == null) {
      return false;
    }

    xdesign.setSAMPLEDESCRIPTOR(xsampleRef);

    LIBRARYDESCRIPTOR xlib = buildExportedLibraryDescriptor(assay);
    if (xlib == null) {
      return false;
    }
    xdesign.setLIBRARYDESCRIPTOR(xlib);

    SpotDescriptorType xspotd = buildExportedSpotDescriptor(assay);
    if (xspotd == null) {
      return false;
    }

    xdesign.setSPOTDESCRIPTOR(xspotd);

    xexp.setDESIGN(xdesign);

    // For each file, builds one run, with one data block and one file
    // TODO: We should introduce something like "Run Name", so that multiple files associated to a
    // single run can be
    // specified
    //
    for (AssayResult ar : ProcessingUtils.findAssayResultsFromAssay(assay)) {
      Data data = ar.getData();
      String url = StringUtils.trimToNull(data.getUrl());
      Study study = ar.getStudy();

      if (url == null) {
        String msg =
            MessageFormat.format(
                "The assay file of type {0} / {1} for study {2} has a data file node without file name, ignoring",
                assay.getMeasurement().getName(),
                assay.getTechnologyName(),
                assay.getStudy().getAcc());
        nonRepeatedMessages.add(msg + ". Data node is " + data.getName());
        log.trace(msg);
        return false;
      }

      FILE.Filetype.Enum xfileType = null;
      String fileType =
          StringUtils.trimToNull(data.getSingleAnnotationValue("comment:SRA File Type"));
      if (fileType == null) {
        // Let's try to get it from the file extension
        //
        fileType = StringUtils.trimToNull(FilenameUtils.getExtension(url));
        if (fileType != null) {
          xfileType = FILE.Filetype.Enum.forString(fileType.toLowerCase());
        }

        if (xfileType == null) {
          String msg =
              MessageFormat.format(
                  "The assay file of type {0} / {1} for study {2} has a data file node without the annotation "
                      + "'SRA file type' and I cannot compute the file type from the file name, ignoring the assay",
                  assay.getMeasurement().getName(),
                  assay.getTechnologyName(),
                  assay.getStudy().getAcc());
          nonRepeatedMessages.add(msg);
          log.trace(msg + ". Data node is " + data.getName());
          return false;
        }
      }

      if (xfileType == null) {
        // fileType is certainly non null at this point, cause it was explicitly provided and so we
        // have to process it
        //
        xfileType = FILE.Filetype.Enum.forString(fileType.toLowerCase());

        if (xfileType == null) {
          String msg =
              MessageFormat.format(
                  "The assay file of type {0} / {1} for study {2} has a bad 'SRA File Type' annotation: '"
                      + fileType
                      + "'"
                      + ", ignoring the assy",
                  assay.getMeasurement().getName(),
                  assay.getTechnologyName(),
                  assay.getStudy().getAcc());
          nonRepeatedMessages.add(msg);
          log.trace(msg + ". Data node is " + data.getName());
          return false;
        }
      }

      RunType xrun = RunType.Factory.newInstance();
      xrun.setAlias(assayAcc);
      xrun.setCenterName(centerName);
      xrun.setBrokerName(brokerName);

      DATABLOCK dataBlock = DATABLOCK.Factory.newInstance();
      FILES xfiles = FILES.Factory.newInstance();
      FILE xfile = FILE.Factory.newInstance();
      xfile.setFiletype(xfileType);
      xfile.setFilename(url);
      xfiles.addNewFILE();
      xfiles.setFILEArray(0, xfile);
      dataBlock.setFILES(xfiles);
      xrun.addNewDATABLOCK();
      xrun.setDATABLOCKArray(xrun.sizeOfDATABLOCKArray() - 1, dataBlock);

      addExportedSubmissionFile(xsubFiles, url);
      // TODO: remove, it's deprecated now xrun.setTotalDataBlocks ( BigInteger.ONE );
      xrun.setEXPERIMENTREF(xexpRef);

      xrunSet.addNewRUN();
      xrunSet.setRUNArray(xrunSet.sizeOfRUNArray() - 1, xrun);
    }

    xexperimentSet.addNewEXPERIMENT();
    xexperimentSet.setEXPERIMENTArray(xexperimentSet.sizeOfEXPERIMENTArray() - 1, xexp);
    return true;
  }
  /** Setup the basic scene which consists of a quad and a viewpoint */
  private void setupSceneGraph() {
    // View group

    Viewpoint vp = new Viewpoint();

    Vector3f trans = new Vector3f(0, 0, 1);

    Matrix4f mat = new Matrix4f();
    mat.setIdentity();
    mat.setTranslation(trans);

    TransformGroup tx = new TransformGroup();
    tx.addChild(vp);
    tx.setTransform(mat);

    Group scene_root = new Group();
    scene_root.addChild(tx);

    // Flat panel that has the viewable object as the demo
    float[] coord = {0, 0, -1, 0.25f, 0, -1, 0, 0.25f, -1};
    float[] normal = {0, 0, 1, 0, 0, 1, 0, 0, 1};

    TriangleArray geom = new TriangleArray();
    geom.setValidVertexCount(3);
    geom.setVertices(TriangleArray.COORDINATE_3, coord);
    geom.setNormals(normal);

    Material material = new Material();
    material.setDiffuseColor(new float[] {0, 0, 1});
    material.setEmissiveColor(new float[] {0, 0, 1});
    material.setSpecularColor(new float[] {1, 1, 1});
    material.setTransparency(0.5f);

    Appearance app = new Appearance();
    app.setMaterial(material);

    Shape3D shape = new Shape3D();
    shape.setGeometry(geom);
    shape.setAppearance(app);

    TransformGroup tg = new TransformGroup();
    Matrix4f transform = new Matrix4f();
    transform.setIdentity();
    transform.setTranslation(new Vector3f(0.15f, 0, -1));
    tg.setTransform(transform);

    Shape3D backShape = new Shape3D();
    Material material2 = new Material();
    material2.setDiffuseColor(new float[] {1, 0, 0});
    material2.setEmissiveColor(new float[] {1, 0, 0});
    material2.setSpecularColor(new float[] {1, 1, 1});

    Appearance app2 = new Appearance();
    app2.setMaterial(material2);
    backShape.setGeometry(geom);
    backShape.setAppearance(app2);
    tg.addChild(backShape);

    scene_root.addChild(tg);
    scene_root.addChild(shape);

    SimpleScene scene = new SimpleScene();
    scene.setRenderedGeometry(scene_root);
    scene.setActiveView(vp);

    // Then the basic layer and viewport at the top:
    SimpleViewport view = new SimpleViewport();
    view.setDimensions(0, 0, 500, 500);
    view.setScene(scene);

    SimpleLayer layer = new SimpleLayer();
    layer.setViewport(view);

    Layer[] layers = {layer};
    displayManager.setLayers(layers, 1);
  }
Beispiel #7
0
 public void setDiffuseColor(int diffuseColor) {
   material.diffuseColor = diffuseColor;
 }