Ejemplo n.º 1
0
  public IIOMetadataNode getStandardDocumentNode() {
    String versionString;
    switch (version) {
      case VERSION_2_5:
        versionString = "2.5";
        break;
      case VERSION_2_8_W_PALETTE:
        versionString = "2.8 with palette";
        break;
      case VERSION_2_8_WO_PALETTE:
        versionString = "2.8 without palette";
        break;
      case VERSION_PC_WINDOWS:
        versionString = "PC Paintbrush for Windows";
        break;
      case VERSION_3_0:
        versionString = "3.0";
        break;
      default:
        // unknown
        versionString = null;
    }

    IIOMetadataNode documentNode = null;
    if (versionString != null) {
      documentNode = new IIOMetadataNode("Document");
      IIOMetadataNode node = new IIOMetadataNode("FormatVersion");
      node.setAttribute("value", versionString);
      documentNode.appendChild(node);
    }

    return documentNode;
  }
Ejemplo n.º 2
0
 IIOMetadataNode getNativeNode() {
   IIOMetadataNode node = new IIOMetadataNode("dqtable");
   node.setAttribute("elementPrecision", Integer.toString(elementPrecision));
   node.setAttribute("qtableId", Integer.toString(tableID));
   node.setUserObject(new JPEGQTable(data));
   return node;
 }
Ejemplo n.º 3
0
  /**
   * Reads image meta data.
   *
   * @param oimage
   * @return
   */
  public static Map<String, String> readImageData(IIOImage oimage) {
    Map<String, String> dict = new HashMap<String, String>();

    IIOMetadata imageMetadata = oimage.getMetadata();
    if (imageMetadata != null) {
      IIOMetadataNode dimNode = (IIOMetadataNode) imageMetadata.getAsTree("javax_imageio_1.0");
      NodeList nodes = dimNode.getElementsByTagName("HorizontalPixelSize");
      int dpiX;
      if (nodes.getLength() > 0) {
        float dpcWidth = Float.parseFloat(nodes.item(0).getAttributes().item(0).getNodeValue());
        dpiX = (int) Math.round(25.4f / dpcWidth);
      } else {
        dpiX = Toolkit.getDefaultToolkit().getScreenResolution();
      }
      dict.put("dpiX", String.valueOf(dpiX));

      nodes = dimNode.getElementsByTagName("VerticalPixelSize");
      int dpiY;
      if (nodes.getLength() > 0) {
        float dpcHeight = Float.parseFloat(nodes.item(0).getAttributes().item(0).getNodeValue());
        dpiY = (int) Math.round(25.4f / dpcHeight);
      } else {
        dpiY = Toolkit.getDefaultToolkit().getScreenResolution();
      }
      dict.put("dpiY", String.valueOf(dpiY));
    }

    return dict;
  }
Ejemplo n.º 4
0
 IIOMetadataNode getNativeNode() {
   IIOMetadataNode node = new IIOMetadataNode("JFIFthumbJPEG");
   if (thumbMetadata != null) {
     node.appendChild(thumbMetadata.getNativeTree());
   }
   return node;
 }
Ejemplo n.º 5
0
 IIOMetadataNode getNativeNode() {
   IIOMetadataNode node = new IIOMetadataNode("app2ICC");
   if (profile != null) {
     node.setUserObject(ICC_Profile.getInstance(profile));
   }
   return node;
 }
  public void buildSettings(
      Settings settings, File output, JProgressPane progress, String versionNumber)
      throws IOException {

    IIOMetadataNode settingsNode = new IIOMetadataNode("settings");

    // create settings
    progress.update("Saving window settings...", 20);
    settingsNode.appendChild(buildWindow(settings));
    progress.update("Saving file settings...", 40);
    settingsNode.appendChild(buildFiles(settings));
    progress.update("Saving options...", 60);
    settingsNode.appendChild(buildOptions(settings, versionNumber));
    progress.update("Saving display settings...", 80);
    settingsNode.appendChild(buildTableDisplay(settings));

    OutputFormat of = new OutputFormat("XML", "ISO-8859-1", true);
    of.setIndent(1);
    of.setIndenting(true);

    progress.update("Writing to file...", 90);

    FileOutputStream fos = new FileOutputStream(output);
    XMLSerializer serializer = new XMLSerializer(fos, of);
    serializer.serialize(settingsNode);
    fos.flush();
    fos.close();
  }
Ejemplo n.º 7
0
 /*     */ IIOMetadataNode getNativeNode() {
   /* 132 */ IIOMetadataNode localIIOMetadataNode = new IIOMetadataNode("unknown");
   /* 133 */ localIIOMetadataNode.setAttribute("MarkerTag", Integer.toString(this.tag));
   /* 134 */ localIIOMetadataNode.setUserObject(this.data);
   /*     */
   /* 136 */ return localIIOMetadataNode;
   /*     */ }
Ejemplo n.º 8
0
 IIOMetadataNode getNativeNode() {
   IIOMetadataNode node = new IIOMetadataNode("dqt");
   for (int i = 0; i < tables.size(); i++) {
     Qtable table = (Qtable) tables.get(i);
     node.appendChild(table.getNativeNode());
   }
   return node;
 }
Ejemplo n.º 9
0
 ICCMarkerSegment(Node node) throws IIOInvalidTreeException {
   super(JPEG.APP2);
   if (node instanceof IIOMetadataNode) {
     IIOMetadataNode ourNode = (IIOMetadataNode) node;
     ICC_Profile prof = (ICC_Profile) ourNode.getUserObject();
     if (prof != null) { // May be null
       profile = prof.getData();
     }
   }
 }
 /*
  * 2 covered goals:
  * 1 net.sf.xisemele.impl.OperationsHelperImpl.children(Lorg/w3c/dom/Node;)Ljava/util/List;: I19 Branch 1 IF_ICMPGE L28 - false
  * 2 net.sf.xisemele.impl.OperationsHelperImpl.children(Lorg/w3c/dom/Node;)Ljava/util/List;: I31 Branch 2 IF_ICMPNE L30 - false
  */
 @Test
 public void test1() throws Throwable {
   OperationsHelperImpl operationsHelperImpl0 = new OperationsHelperImpl();
   IIOMetadataNode iIOMetadataNode0 = new IIOMetadataNode((String) null);
   IIOMetadataNode iIOMetadataNode1 =
       (IIOMetadataNode) iIOMetadataNode0.appendChild((Node) iIOMetadataNode0);
   List<Node> list0 = operationsHelperImpl0.children((Node) iIOMetadataNode1);
   assertNotNull(list0);
   assertEquals(false, list0.isEmpty());
 }
Ejemplo n.º 11
0
  private int computeLength(IIOMetadataNode root) {
    NodeList list = root.getChildNodes();
    int length = 0;
    for (int i = 0; i < list.getLength(); i++) {
      IIOMetadataNode node = (IIOMetadataNode) list.item(i);
      String name = node.getNodeName();

      if (format.isLeaf(name))
        length += new Integer((String) Box.getAttribute(node, "Length")).intValue();
      else length += computeLength(node);
    }

    return length + (root.getNodeName().startsWith("JPEG2000") ? 8 : 0);
  }
  public IIOMetadataNode getStandardDocumentNode() {
    IIOMetadataNode document_node = new IIOMetadataNode("Document");
    IIOMetadataNode node = null; // scratch node

    node = new IIOMetadataNode("FormatVersion");
    node.setAttribute("value", version);
    document_node.appendChild(node);

    // SubimageInterpretation not in format
    // ImageCreationTime not in format
    // ImageModificationTime not in format

    return document_node;
  }
Ejemplo n.º 13
0
  private void writeSuperBox(IIOMetadataNode node) throws IOException {
    NodeList list = node.getChildNodes();

    String name = node.getNodeName();
    if (name.startsWith("JPEG2000")) {
      stream.writeInt(computeLength(node));
      stream.writeInt(Box.getTypeInt((String) Box.getTypeByName(name)));
      otherLength += 8;
    }

    for (int i = 0; i < list.getLength(); i++) {
      IIOMetadataNode child = (IIOMetadataNode) list.item(i);

      name = child.getNodeName();
      if (name.startsWith("JPEG2000") && format.isLeaf(name)) writeBox(child);
      else writeSuperBox(child);
    }
  }
Ejemplo n.º 14
0
 /*     */ MarkerSegment(Node paramNode) /*     */ throws IIOInvalidTreeException /*     */ {
   /*  84 */ this.tag = getAttributeValue(paramNode, null, "MarkerTag", 0, 255, true);
   /*     */
   /*  89 */ this.length = 0;
   /*     */
   /*  91 */ if ((paramNode instanceof IIOMetadataNode)) {
     /*  92 */ IIOMetadataNode localIIOMetadataNode = (IIOMetadataNode) paramNode;
     /*     */ try {
       /*  94 */ this.data = ((byte[]) localIIOMetadataNode.getUserObject());
       /*     */ } catch (Exception localException) {
       /*  96 */ IIOInvalidTreeException localIIOInvalidTreeException =
           new IIOInvalidTreeException("Can't get User Object", paramNode);
       /*     */
       /*  99 */ localIIOInvalidTreeException.initCause(localException);
       /* 100 */ throw localIIOInvalidTreeException;
       /*     */ }
     /*     */ } else {
     /* 103 */ throw new IIOInvalidTreeException("Node must have User Object", paramNode);
     /*     */ }
   /*     */ }
  public IIOMetadataNode getStandardDimensionNode() {
    IIOMetadataNode dimension_node = new IIOMetadataNode("Dimension");
    IIOMetadataNode node = null; // scratch node

    node = new IIOMetadataNode("PixelAspectRatio");
    float aspectRatio = 1.0F;
    if (pixelAspectRatio != 0) {
      aspectRatio = (pixelAspectRatio + 15) / 64.0F;
    }
    node.setAttribute("value", Float.toString(aspectRatio));
    dimension_node.appendChild(node);

    node = new IIOMetadataNode("ImageOrientation");
    node.setAttribute("value", "Normal");
    dimension_node.appendChild(node);

    // HorizontalPixelSize not in format
    // VerticalPixelSize not in format
    // HorizontalPhysicalPixelSpacing not in format
    // VerticalPhysicalPixelSpacing not in format
    // HorizontalPosition not in format
    // VerticalPosition not in format
    // HorizontalPixelOffset not in stream
    // VerticalPixelOffset not in stream

    node = new IIOMetadataNode("HorizontalScreenSize");
    node.setAttribute(
        "value",
        logicalScreenWidth == UNDEFINED_INTEGER_VALUE ? "" : Integer.toString(logicalScreenWidth));
    dimension_node.appendChild(node);

    node = new IIOMetadataNode("VerticalScreenSize");
    node.setAttribute(
        "value",
        logicalScreenHeight == UNDEFINED_INTEGER_VALUE
            ? ""
            : Integer.toString(logicalScreenHeight));
    dimension_node.appendChild(node);

    return dimension_node;
  }
Ejemplo n.º 16
0
 /**
  * Updates the metadata information based on the parameters to this writer.
  *
  * @param meta the metadata
  * @param params the parameters
  * @return the updated metadata
  */
 protected IIOMetadata updateMetadata(IIOMetadata meta, ImageWriterParams params) {
   final String stdmeta = "javax_imageio_1.0";
   if (meta.isStandardMetadataFormatSupported()) {
     IIOMetadataNode root = (IIOMetadataNode) meta.getAsTree(stdmeta);
     IIOMetadataNode dim = getChildNode(root, "Dimension");
     IIOMetadataNode child;
     if (params.getResolution() != null) {
       child = getChildNode(dim, "HorizontalPixelSize");
       if (child == null) {
         child = new IIOMetadataNode("HorizontalPixelSize");
         dim.appendChild(child);
       }
       child.setAttribute("value", Double.toString(params.getResolution().doubleValue() / 25.4));
       child = getChildNode(dim, "VerticalPixelSize");
       if (child == null) {
         child = new IIOMetadataNode("VerticalPixelSize");
         dim.appendChild(child);
       }
       child.setAttribute("value", Double.toString(params.getResolution().doubleValue() / 25.4));
     }
     try {
       meta.mergeTree(stdmeta, root);
     } catch (IIOInvalidTreeException e) {
       throw new RuntimeException("Cannot update image metadata: " + e.getMessage());
     }
   }
   return meta;
 }
Ejemplo n.º 17
0
  /**
   * Returns a tree of DOM nodes representing this object and any subordinate JFXX extension or ICC
   * Profile segments.
   */
  IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("app0JFIF");
    node.setAttribute("majorVersion", Integer.toString(majorVersion));
    node.setAttribute("minorVersion", Integer.toString(minorVersion));
    node.setAttribute("resUnits", Integer.toString(resUnits));
    node.setAttribute("Xdensity", Integer.toString(Xdensity));
    node.setAttribute("Ydensity", Integer.toString(Ydensity));
    node.setAttribute("thumbWidth", Integer.toString(thumbWidth));
    node.setAttribute("thumbHeight", Integer.toString(thumbHeight));
    if (!extSegments.isEmpty()) {
      IIOMetadataNode JFXXnode = new IIOMetadataNode("JFXX");
      node.appendChild(JFXXnode);
      for (Iterator iter = extSegments.iterator(); iter.hasNext(); ) {
        JFIFExtensionMarkerSegment seg = (JFIFExtensionMarkerSegment) iter.next();
        JFXXnode.appendChild(seg.getNativeNode());
      }
    }
    if (iccSegment != null) {
      node.appendChild(iccSegment.getNativeNode());
    }

    return node;
  }
Ejemplo n.º 18
0
 Qtable(Node node) throws IIOInvalidTreeException {
   if (node.getNodeName().equals("dqtable")) {
     NamedNodeMap attrs = node.getAttributes();
     int count = attrs.getLength();
     if ((count < 1) || (count > 2)) {
       throw new IIOInvalidTreeException("dqtable node must have 1 or 2 attributes", node);
     }
     elementPrecision = 0;
     tableID = getAttributeValue(node, attrs, "qtableId", 0, 3, true);
     if (node instanceof IIOMetadataNode) {
       IIOMetadataNode ourNode = (IIOMetadataNode) node;
       JPEGQTable table = (JPEGQTable) ourNode.getUserObject();
       if (table == null) {
         throw new IIOInvalidTreeException("dqtable node must have user object", node);
       }
       data = table.getTable();
     } else {
       throw new IIOInvalidTreeException("dqtable node must have user object", node);
     }
   } else {
     throw new IIOInvalidTreeException("Invalid node, expected dqtable", node);
   }
 }
  private static byte[] convertChartToByteArray(
      Chart chartDetails, JFreeChart chart, int width, int height)
      throws IOException, IIOInvalidTreeException {
    BufferedImage buffImg =
        chart.createBufferedImage(
            width, height, BufferedImage.BITMASK | BufferedImage.SCALE_SMOOTH, null);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ImageWriter writer = ImageIO.getImageWritersByFormatName("png").next();

    ImageWriteParam writeParam = writer.getDefaultWriteParam();
    ImageTypeSpecifier typeSpecifier =
        ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_INT_RGB);
    IIOMetadata metadata = writer.getDefaultImageMetadata(typeSpecifier, writeParam);

    if (chartDetails != null) {
      if (chartDetails.getId() == null) {
        chartDetails.setId("%ID%");
      }
      IIOMetadataNode textEntry = new IIOMetadataNode("tEXtEntry");
      textEntry.setAttribute("keyword", "chart-google-data");
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      ObjectOutputStream objectOutputStream = new ObjectOutputStream(bout);
      objectOutputStream.writeObject(chartDetails);
      objectOutputStream.flush();
      textEntry.setAttribute(
          "value",
          (String)
              ChartRendererFactory.getRendererForOutput(ChartRendererGoogleTools.TYPE)
                  .renderChart(chartDetails));

      IIOMetadataNode text = new IIOMetadataNode("tEXt");
      text.appendChild(textEntry);

      IIOMetadataNode root = new IIOMetadataNode("javax_imageio_png_1.0");
      root.appendChild(text);

      metadata.mergeTree("javax_imageio_png_1.0", root);
    }
    // setDPI(metadata);

    final ImageOutputStream stream = ImageIO.createImageOutputStream(baos);
    try {
      writer.setOutput(stream);
      writer.write(metadata, new IIOImage(buffImg, null, metadata), writeParam);
    } finally {
      stream.close();
    }

    byte[] bytes = baos.toByteArray(); // ChartUtilities.encodeAsPNG(buffImg, true, 9);
    return bytes;
  }
  @SuppressWarnings("unused")
  private static void setDPI(IIOMetadata metadata) throws IIOInvalidTreeException {

    // for PNG, it's dots per millimeter
    double dotsPerMilli = 1.0 * 600 / 10 / 2.54;

    IIOMetadataNode horiz = new IIOMetadataNode("HorizontalPixelSize");
    horiz.setAttribute("value", Double.toString(dotsPerMilli));

    IIOMetadataNode vert = new IIOMetadataNode("VerticalPixelSize");
    vert.setAttribute("value", Double.toString(dotsPerMilli));

    IIOMetadataNode dim = new IIOMetadataNode("Dimension");
    dim.appendChild(horiz);
    dim.appendChild(vert);

    IIOMetadataNode root = new IIOMetadataNode("javax_imageio_1.0");
    root.appendChild(dim);

    metadata.mergeTree("javax_imageio_1.0", root);
  }
Ejemplo n.º 21
0
  public IIOMetadataNode buildFiles(Settings settings) {
    IIOMetadataNode files = new IIOMetadataNode("files");

    // image directory
    IIOMetadataNode imageDir = new IIOMetadataNode("image_dir");
    imageDir.setAttribute("path", settings.getLastImageDir().getAbsolutePath());
    files.appendChild(imageDir);

    // ecu definition files
    Vector<File> defFiles = settings.getEcuDefinitionFiles();

    for (int i = 0; i < defFiles.size(); i++) {
      IIOMetadataNode ecuDef = new IIOMetadataNode("ecudefinitionfile");
      ecuDef.setAttribute("name", defFiles.get(i).getAbsolutePath());
      files.appendChild(ecuDef);
    }

    return files;
  }
  public IIOMetadataNode getStandardCompressionNode() {
    IIOMetadataNode compression_node = new IIOMetadataNode("Compression");
    IIOMetadataNode node = null; // scratch node

    node = new IIOMetadataNode("CompressionTypeName");
    node.setAttribute("value", "lzw");
    compression_node.appendChild(node);

    node = new IIOMetadataNode("Lossless");
    node.setAttribute("value", "true");
    compression_node.appendChild(node);

    // NumProgressiveScans not in stream
    // BitRate not in format

    return compression_node;
  }
  public IIOMetadataNode getStandardDataNode() {
    IIOMetadataNode data_node = new IIOMetadataNode("Data");
    IIOMetadataNode node = null; // scratch node

    // PlanarConfiguration

    node = new IIOMetadataNode("SampleFormat");
    node.setAttribute("value", "Index");
    data_node.appendChild(node);

    node = new IIOMetadataNode("BitsPerSample");
    node.setAttribute(
        "value",
        colorResolution == UNDEFINED_INTEGER_VALUE ? "" : Integer.toString(colorResolution));
    data_node.appendChild(node);

    // SignificantBitsPerSample
    // SampleMSB

    return data_node;
  }
Ejemplo n.º 24
0
  public IIOMetadataNode buildTableDisplay(Settings settings) {
    IIOMetadataNode tableDisplay = new IIOMetadataNode("tabledisplay");

    // font
    IIOMetadataNode font = new IIOMetadataNode("font");
    font.setAttribute("face", settings.getTableFont().getName());
    font.setAttribute("size", settings.getTableFont().getSize() + "");
    font.setAttribute("decoration", settings.getTableFont().getStyle() + "");
    tableDisplay.appendChild(font);

    // table cell size
    IIOMetadataNode cellSize = new IIOMetadataNode("cellsize");
    cellSize.setAttribute("height", ((int) settings.getCellSize().getHeight()) + "");
    cellSize.setAttribute("width", ((int) settings.getCellSize().getWidth()) + "");
    tableDisplay.appendChild(cellSize);

    // colors
    IIOMetadataNode colors = new IIOMetadataNode("colors");
    // max
    IIOMetadataNode max = new IIOMetadataNode("max");
    max.setAttribute("r", settings.getMaxColor().getRed() + "");
    max.setAttribute("g", settings.getMaxColor().getGreen() + "");
    max.setAttribute("b", settings.getMaxColor().getBlue() + "");
    colors.appendChild(max);
    // min
    IIOMetadataNode min = new IIOMetadataNode("min");
    min.setAttribute("r", settings.getMinColor().getRed() + "");
    min.setAttribute("g", settings.getMinColor().getGreen() + "");
    min.setAttribute("b", settings.getMinColor().getBlue() + "");
    colors.appendChild(min);
    // highlight
    IIOMetadataNode highlight = new IIOMetadataNode("highlight");
    highlight.setAttribute("r", settings.getHighlightColor().getRed() + "");
    highlight.setAttribute("g", settings.getHighlightColor().getGreen() + "");
    highlight.setAttribute("b", settings.getHighlightColor().getBlue() + "");
    colors.appendChild(highlight);
    // increased cell border
    IIOMetadataNode increaseBorder = new IIOMetadataNode("increaseborder");
    increaseBorder.setAttribute("r", settings.getIncreaseBorder().getRed() + "");
    increaseBorder.setAttribute("g", settings.getIncreaseBorder().getGreen() + "");
    increaseBorder.setAttribute("b", settings.getIncreaseBorder().getBlue() + "");
    colors.appendChild(increaseBorder);
    // decreased cell border
    IIOMetadataNode decreaseBorder = new IIOMetadataNode("decreaseborder");
    decreaseBorder.setAttribute("r", settings.getDecreaseBorder().getRed() + "");
    decreaseBorder.setAttribute("g", settings.getDecreaseBorder().getGreen() + "");
    decreaseBorder.setAttribute("b", settings.getDecreaseBorder().getBlue() + "");
    colors.appendChild(decreaseBorder);
    // axis cells
    IIOMetadataNode axis = new IIOMetadataNode("axis");
    axis.setAttribute("r", settings.getAxisColor().getRed() + "");
    axis.setAttribute("g", settings.getAxisColor().getGreen() + "");
    axis.setAttribute("b", settings.getAxisColor().getBlue() + "");
    colors.appendChild(axis);

    tableDisplay.appendChild(colors);

    return tableDisplay;
  }
Ejemplo n.º 25
0
  public IIOMetadataNode buildOptions(Settings settings, String versionNumber) {
    IIOMetadataNode options = new IIOMetadataNode("options");

    // obsolete warning
    IIOMetadataNode obsoleteWarning = new IIOMetadataNode("obsoletewarning");
    obsoleteWarning.setAttribute("value", settings.isObsoleteWarning() + "");
    options.appendChild(obsoleteWarning);

    // calcultion conflicting warning
    IIOMetadataNode calcConflictWarning = new IIOMetadataNode("calcconflictwarning");
    calcConflictWarning.setAttribute("value", settings.isCalcConflictWarning() + "");
    options.appendChild(calcConflictWarning);

    // debug mode
    IIOMetadataNode debug = new IIOMetadataNode("debug");
    debug.setAttribute("value", settings.isDebug() + "");
    options.appendChild(debug);

    // userlevel
    IIOMetadataNode userLevel = new IIOMetadataNode("userlevel");
    userLevel.setAttribute("value", settings.getUserLevel() + "");
    options.appendChild(userLevel);

    // table click count
    IIOMetadataNode tableClickCount = new IIOMetadataNode("tableclickcount");
    tableClickCount.setAttribute("value", settings.getTableClickCount() + "");
    options.appendChild(tableClickCount);

    // last version used
    IIOMetadataNode version = new IIOMetadataNode("version");
    version.setAttribute("value", versionNumber);
    options.appendChild(version);

    // save debug level tables
    IIOMetadataNode saveDebugTables = new IIOMetadataNode("savedebugtables");
    saveDebugTables.setAttribute("value", settings.isSaveDebugTables() + "");
    options.appendChild(saveDebugTables);

    // display tables higher than userlevel
    IIOMetadataNode displayHighTables = new IIOMetadataNode("displayhightables");
    displayHighTables.setAttribute("value", settings.isDisplayHighTables() + "");
    options.appendChild(displayHighTables);

    return options;
  }
Ejemplo n.º 26
0
  /**
   * Creates an <code>IIOMetadataNode</code> from this channel definition box. The format of this
   * node is defined in the XML dtd and xsd for the JP2 image file.
   */
  public IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode(BoxUtilities.getName(getType()));
    setDefaultAttributes(node);

    IIOMetadataNode child = new IIOMetadataNode("NumberOfDefinition");
    child.setUserObject(new Short(num));
    child.setNodeValue("" + num);
    node.appendChild(child);

    child = new IIOMetadataNode("Definitions");
    node.appendChild(child);

    for (int i = 0; i < num; i++) {
      IIOMetadataNode child1 = new IIOMetadataNode("ChannelNumber");
      child1.setUserObject(new Short(channels[i]));
      child1.setNodeValue("" + channels[i]);
      child.appendChild(child1);

      child1 = new IIOMetadataNode("ChannelType");
      child1.setUserObject(new Integer(types[i]));
      child1.setNodeValue("" + types[i]);
      child.appendChild(child1);

      child1 = new IIOMetadataNode("Association");
      child1.setUserObject(new Short(associations[i]));
      child1.setNodeValue("" + associations[i]);
      child.appendChild(child1);
    }

    return node;
  }
Ejemplo n.º 27
0
 IIOMetadataNode getNativeNode() {
   IIOMetadataNode node = new IIOMetadataNode(name);
   node.setAttribute("thumbWidth", Integer.toString(thumbWidth));
   node.setAttribute("thumbHeight", Integer.toString(thumbHeight));
   return node;
 }
Ejemplo n.º 28
0
 IIOMetadataNode getNativeNode() {
   IIOMetadataNode node = new IIOMetadataNode("app0JFXX");
   node.setAttribute("extensionCode", Integer.toString(code));
   node.appendChild(thumb.getNativeNode());
   return node;
 }
Ejemplo n.º 29
0
  public IIOMetadataNode getStandardDimensionNode() {
    IIOMetadataNode dimensionNode = new IIOMetadataNode("Dimension");
    IIOMetadataNode node = null; // scratch node

    node = new IIOMetadataNode("HorizontalPixelOffset");
    node.setAttribute("value", String.valueOf(xmin));
    dimensionNode.appendChild(node);

    node = new IIOMetadataNode("VerticalPixelOffset");
    node.setAttribute("value", String.valueOf(ymin));
    dimensionNode.appendChild(node);

    node = new IIOMetadataNode("HorizontalPixelSize");
    node.setAttribute("value", String.valueOf(254.0 / hdpi));
    dimensionNode.appendChild(node);

    node = new IIOMetadataNode("VerticalPixelSize");
    node.setAttribute("value", String.valueOf(254.0 / vdpi));
    dimensionNode.appendChild(node);

    if (hsize != 0) {
      node = new IIOMetadataNode("HorizontalScreenSize");
      node.setAttribute("value", String.valueOf(hsize));
      dimensionNode.appendChild(node);
    }

    if (vsize != 0) {
      node = new IIOMetadataNode("VerticalScreenSize");
      node.setAttribute("value", String.valueOf(vsize));
      dimensionNode.appendChild(node);
    }

    return dimensionNode;
  }
Ejemplo n.º 30
0
  public IIOMetadataNode buildWindow(Settings settings) {
    IIOMetadataNode windowSettings = new IIOMetadataNode("window");

    // window size
    IIOMetadataNode size = new IIOMetadataNode("size");
    size.setAttribute("x", ((int) settings.getWindowSize().getHeight()) + "");
    size.setAttribute("y", ((int) settings.getWindowSize().getWidth()) + "");
    windowSettings.appendChild(size);

    // window location
    IIOMetadataNode location = new IIOMetadataNode("location");
    location.setAttribute("x", ((int) settings.getWindowLocation().getX()) + "");
    location.setAttribute("y", ((int) settings.getWindowLocation().getY()) + "");
    windowSettings.appendChild(location);

    // splitpane location
    IIOMetadataNode splitpane = new IIOMetadataNode("splitpane");
    splitpane.setAttribute("location", settings.getSplitPaneLocation() + "");
    windowSettings.appendChild(splitpane);

    return windowSettings;
  }