Search in sources :

Example 1 with ASOCBoxMetadataNode

use of it.geosolutions.imageio.plugins.jp2k.box.ASOCBoxMetadataNode in project imageio-ext by geosolutions-it.

the class JP2KStreamMetadata method buildTree.

private Node buildTree(final JP2KBoxMetadata node) {
    if (node == null)
        throw new IllegalArgumentException("Null node provided ");
    IIOMetadataNode mdNode;
    switch(node.getType()) {
        // Using LazyBox in the following 3 cases.
        case XMLBox.BOX_TYPE:
            mdNode = new XMLBoxMetadataNode(node);
            break;
        case UUIDBox.BOX_TYPE:
            mdNode = new UUIDBoxMetadataNode(node);
            break;
        case ASOCBox.BOX_TYPE:
            mdNode = new ASOCBoxMetadataNode(node);
            break;
        case JP2KFileBox.BOX_TYPE:
            mdNode = node.getNativeNode();
            mdNode.setAttribute(NUM_CODESTREAMS, Integer.toString(0));
            break;
        case ContiguousCodestreamBox.BOX_TYPE:
            return null;
        default:
            mdNode = node.getNativeNode();
    }
    final int childCount = node.getChildCount();
    int i = 0;
    while (i < childCount) {
        final Node appendMe = buildTree((JP2KBoxMetadata) node.getChildAt(i++));
        if (appendMe != null)
            mdNode.appendChild(appendMe);
    }
    return mdNode;
}
Also used : XMLBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.XMLBoxMetadataNode) UUIDBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.UUIDBoxMetadataNode) ASOCBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.ASOCBoxMetadataNode) IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode) Node(org.w3c.dom.Node) UUIDBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.UUIDBoxMetadataNode) XMLBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.XMLBoxMetadataNode) ASOCBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.ASOCBoxMetadataNode) IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Example 2 with ASOCBoxMetadataNode

use of it.geosolutions.imageio.plugins.jp2k.box.ASOCBoxMetadataNode in project imageio-ext by geosolutions-it.

the class JP2KStreamMetadata method searchFirstOccurrenceNode.

// private ASOCBoxMetadataNode findParentASOCBoxMetadataNode(){
// final Node rootNode = createNativeTree();
// final IIOMetadataNode returnedNode[] = new IIOMetadataNode[1];
// searchFirstOccurrenceNode (rootNode,
// BoxUtilities.getName(ASOCBox.BOX_TYPE), returnedNode);
// if (returnedNode[0]!=null)
// return (ASOCBoxMetadataNode)returnedNode[0];
// return null;
// }
// 
/**
 * Search the first occurrence of a node related to the specified box type
 * and return it as a {@link IIOMetadataNode} or null in case of not found.
 * Search is performed visiting the children of a node before the brothers.
 */
public IIOMetadataNode searchFirstOccurrenceNode(final int requestedBoxType) {
    final Node rootNode = getAsTree(nativeMetadataFormatName);
    final List<IIOMetadataNode> returnedNodes = new ArrayList<IIOMetadataNode>(1);
    searchOccurrencesNode(rootNode, BoxUtilities.getName(requestedBoxType), returnedNodes, true);
    if (!returnedNodes.isEmpty())
        return returnedNodes.get(0);
    return null;
}
Also used : ASOCBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.ASOCBoxMetadataNode) IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode) Node(org.w3c.dom.Node) UUIDBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.UUIDBoxMetadataNode) XMLBoxMetadataNode(it.geosolutions.imageio.plugins.jp2k.box.XMLBoxMetadataNode) ArrayList(java.util.ArrayList) IIOMetadataNode(javax.imageio.metadata.IIOMetadataNode)

Aggregations

ASOCBoxMetadataNode (it.geosolutions.imageio.plugins.jp2k.box.ASOCBoxMetadataNode)2 UUIDBoxMetadataNode (it.geosolutions.imageio.plugins.jp2k.box.UUIDBoxMetadataNode)2 XMLBoxMetadataNode (it.geosolutions.imageio.plugins.jp2k.box.XMLBoxMetadataNode)2 IIOMetadataNode (javax.imageio.metadata.IIOMetadataNode)2 Node (org.w3c.dom.Node)2 ArrayList (java.util.ArrayList)1