private String getLiteralInputValue( ProcessletInputs in, String paramId ) { LiteralInput input = ( (LiteralInput) in.getParameter( paramId ) ); return input == null ? null : input.getValue(); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); boolean crosses = geometry1.crosses( geometry2 ); LiteralOutput crossesOutput = (LiteralOutput) out.getParameter( "Crosses" ); crossesOutput.setValue( String.valueOf( crosses ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); boolean touches = geometry1.touches( geometry2 ); LiteralOutput touchesOutput = (LiteralOutput) out.getParameter( "Touches" ); touchesOutput.setValue( String.valueOf( touches ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); boolean equals = geometry1.equals( geometry2 ); LiteralOutput equalsOutput = (LiteralOutput) out.getParameter( "Equals" ); equalsOutput.setValue( String.valueOf( equals ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); boolean contains = geometry1.contains( geometry2 ); LiteralOutput containsOutput = (LiteralOutput) out.getParameter( "Contains" ); containsOutput.setValue( String.valueOf( contains ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); Geometry difference = geometry1.getDifference( geometry2 ); ComplexOutput differenceOutput = (ComplexOutput) out.getParameter( "Difference" ); writeGeometry( differenceOutput, difference ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); Geometry union = geometry1.getUnion( geometry2 ); ComplexOutput unionOutput = (ComplexOutput) out.getParameter( "Union" ); writeGeometry( unionOutput, union ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); Geometry intersection = geometry1.getIntersection( geometry2 ); ComplexOutput intersectionOutput = (ComplexOutput) out.getParameter( "Intersection" ); writeGeometry( intersectionOutput, intersection ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); Measure distance = geometry1.getDistance( geometry2, null ); LiteralOutput distanceOutput = (LiteralOutput) out.getParameter( "Distance" ); distanceOutput.setValue( String.valueOf( distance.getValueAsDouble() ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput = (ComplexInput) in.getParameter( "GMLInput" ); Geometry geometry = readGeometry( gmlInput ); Point centroid = geometry.getCentroid(); ComplexOutput centroidOutput = (ComplexOutput) out.getParameter( "Centroid" ); writeGeometry( centroidOutput, centroid ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput = (ComplexInput) in.getParameter( "GMLInput" ); Geometry geometry = readGeometry( gmlInput ); Geometry hulledGeometry = geometry.getConvexHull(); ComplexOutput hullOutput = (ComplexOutput) out.getParameter( "ConvexHull" ); writeGeometry( hullOutput, hulledGeometry ); }
LiteralInput li = (LiteralInput) in.getParameter( "LiteralInput" ); LOG.debug( "- LiteratlInput: " + li ); BoundingBoxInput bboxInput = (BoundingBoxInput) in.getParameter( "BBOXInput" ); LOG.debug( "- BBOXInput: " + bboxInput ); ComplexInput xmlInput = (ComplexInput) in.getParameter( "XMLInput" ); LOG.debug( "- XMLInput: " + xmlInput ); ComplexInput binaryInput = (ComplexInput) in.getParameter( "BinaryInput" ); LOG.debug( "- BinaryInput: " + binaryInput );
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput input = (ComplexInput) in.getParameter( IN_PARAM_ID ); try { XMLStreamReader sld = input.getValueAsXMLStream();
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { double bufferDistance = Double.parseDouble( ( (LiteralInput) in.getParameter( "BufferDistance" ) ).getValue() ); ComplexInput gmlInputGeometry = (ComplexInput) in.getParameter( "GMLInput" ); Geometry geom = null; Geometry bufferedGeom = null; try { XMLStreamReader xmlReader = gmlInputGeometry.getValueAsXMLStream(); GMLStreamReader gmlReader = GMLInputFactory.createGMLStreamReader( GML_31, xmlReader ); geom = gmlReader.readGeometry(); bufferedGeom = geom.getBuffer( new Measure( new BigDecimal( bufferDistance ), "unity" ) ); } catch ( Exception e ) { throw new ProcessletException( "Error parsing parameter " + gmlInputGeometry.getIdentifier() + ": " + e.getMessage() ); } ComplexOutput gmlOutputGeometry = (ComplexOutput) out.getParameter( "BufferedGeometry" ); try { SchemaLocationXMLStreamWriter sw = new SchemaLocationXMLStreamWriter( gmlOutputGeometry.getXMLStreamWriter(), "http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/geometryAggregates.xsd" ); sw.setPrefix( "gml", GMLNS ); GMLStreamWriter gmlWriter = GMLOutputFactory.createGMLStreamWriter( GML_31, sw ); gmlWriter.write( bufferedGeom ); } catch ( Exception e ) { throw new ProcessletException( "Error exporting geometry: " + e.getMessage() ); } }
throws ProcessletException { ComplexInput xmlInput = (ComplexInput) in.getParameter( IN_INPUTDATA ); String mime = xmlInput.getMimeType(); String inSchema = xmlInput.getSchema();