use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class NsiliCommonUtils method setUCOEdges.
/**
* Set the UCO.Edges of the DAG according to the NSILI Spec. This requires the ids of the Nodes to
* be set in DFS order.
*
* @param root - the root node of the graph (NSIL_PRODUCT)
* @param graph - the graph representation of the DAG
*/
public static void setUCOEdges(Node root, Graph<Node, Edge> graph) {
if (graph != null) {
Deque<Node> stack = new ArrayDeque<>();
Deque<Node> visitorStack = new ArrayDeque<>();
stack.push(root);
while (!stack.isEmpty()) {
Node currNode = stack.pop();
if (!visitorStack.contains(currNode)) {
visitorStack.push(currNode);
for (Edge edge : graph.edgesOf(currNode)) {
processEdges(graph, stack, edge);
}
}
}
}
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class NsiliCommonUtils method processEdges.
private static void processEdges(Graph<Node, Edge> graph, Deque<Node> stack, Edge edge) {
Node source = graph.getEdgeSource(edge);
Node target = graph.getEdgeTarget(edge);
if (edge != null && source != null && target != null) {
edge.start_node = source.id;
edge.end_node = target.id;
stack.push(target);
}
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class ResultDAGConverter method addStringAttribute.
public static void addStringAttribute(DirectedAcyclicGraph<Node, Edge> graph, Node parentNode, String key, String value, ORB orb) {
Any any = orb.create_any();
any.insert_string(value);
Node node = new Node(0, NodeType.ATTRIBUTE_NODE, key, any);
graph.addVertex(node);
graph.addEdge(parentNode, node);
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class ResultDAGConverter method addImageryPart.
public static List<String> addImageryPart(DirectedAcyclicGraph<Node, Edge> graph, Node partNode, Metacard metacard, ORB orb, String parentAttrName, List<String> resultAttributes) {
List<String> addedAttributes = new ArrayList<>();
Any imageryAny = orb.create_any();
Node imageryNode = new Node(0, NodeType.ENTITY_NODE, NsiliConstants.NSIL_IMAGERY, imageryAny);
graph.addVertex(imageryNode);
graph.addEdge(partNode, imageryNode);
String attribute = parentAttrName + NsiliConstants.NSIL_IMAGERY;
addStrAttribute(graph, metacard.getAttribute(Core.TITLE), orb, resultAttributes, addedAttributes, imageryNode, attribute, NsiliConstants.TITLE);
addIntAttribute(graph, metacard.getAttribute(Media.HEIGHT), orb, resultAttributes, addedAttributes, imageryNode, attribute, NsiliConstants.NUMBER_OF_ROWS);
addIntAttribute(graph, metacard.getAttribute(Media.WIDTH), orb, resultAttributes, addedAttributes, imageryNode, attribute, NsiliConstants.NUMBER_OF_COLS);
addDecompressionAttributes(graph, metacard, orb, resultAttributes, addedAttributes, imageryNode, attribute);
addBandsAttribute(graph, metacard, orb, resultAttributes, addedAttributes, imageryNode, attribute);
addDblAsIntAttribute(graph, metacard.getAttribute(Isr.NATIONAL_IMAGERY_INTERPRETABILITY_RATING_SCALE), orb, resultAttributes, addedAttributes, imageryNode, attribute, NsiliConstants.NIIRS);
addCategoryAttribute(graph, metacard, orb, resultAttributes, addedAttributes, imageryNode, attribute, true);
addDblAsIntAttribute(graph, metacard.getAttribute(Isr.CLOUD_COVER), orb, resultAttributes, addedAttributes, imageryNode, attribute, NsiliConstants.CLOUD_COVER_PCT);
addIdentifierAttribute(graph, metacard, orb, resultAttributes, addedAttributes, imageryNode, attribute);
addStrAttribute(graph, metacard.getAttribute(Isr.COMMENTS), orb, resultAttributes, addedAttributes, imageryNode, attribute, NsiliConstants.COMMENTS);
return addedAttributes;
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class ResultDAGConverter method addGeomAttribute.
public static void addGeomAttribute(DirectedAcyclicGraph<Node, Edge> graph, Node parentNode, String key, Rectangle rectangle, ORB orb) {
if (rectangle != null) {
Any any = orb.create_any();
RectangleHelper.insert(any, rectangle);
Node node = new Node(0, NodeType.ATTRIBUTE_NODE, key, any);
graph.addVertex(node);
graph.addEdge(parentNode, node);
}
}
Aggregations