test_class.declarator: dispatcher
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private CommandDispatcher dispatcher;
test_class.type: CommandDispatcher
test_class.var_name: dispatcher
test_class.declarator: geometries
test_class.modifier: private
test_class.original_string: private List<Geometry> geometries;
test_class.type: List<Geometry>
test_class.var_name: geometries
test_class.file: command/src/test/java/org/geomajas/command/geometry/GeometryMergeCommandTest.java
test_class.identifier: GeometryMergeCommandTest
test_case.body: @Test
  	public void withoutPrecisionAsBufferTest() {
  		GeometryMergeRequest request = new GeometryMergeRequest();
  		request.setGeometries(geometries);
  		request.setPrecision(0);
  		request.setUsePrecisionAsBuffer(false);
  		GeometryMergeResponse response = (GeometryMergeResponse) dispatcher.execute(
  				GeometryMergeRequest.COMMAND, request, null, "en");
  		// Line and point are ignored due to the fact that buffer = 0.
  		Assert.assertEquals(1, response.getGeometry().getGeometries().length);
  	}
test_case.class_method_signature: GeometryMergeCommandTest.withoutPrecisionAsBufferTest()
test_case.full_signature: @Test public void withoutPrecisionAsBufferTest()
test_case.identifier: withoutPrecisionAsBufferTest
test_case.invocations: setGeometries setPrecision setUsePrecisionAsBuffer execute assertEquals getGeometries getGeometry
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void withoutPrecisionAsBufferTest()
focal_class.declarator: converter
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private DtoConverterService converter;
focal_class.type: DtoConverterService
focal_class.var_name: converter
focal_class.file: command/src/main/java/org/geomajas/command/geometry/GeometryMergeCommand.java
focal_class.identifier: GeometryMergeCommand
focal_class.interfaces: implements CommandHasRequest<GeometryMergeRequest, GeometryMergeResponse>
focal_class.class_method_signature: GeometryMergeCommand.getEmptyCommandRequest()
focal_class.full_signature: @Override public GeometryMergeRequest getEmptyCommandRequest()
focal_class.identifier: getEmptyCommandRequest
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: GeometryMergeRequest
focal_class.signature: GeometryMergeRequest getEmptyCommandRequest()
focal_class.class_method_signature: GeometryMergeCommand.getEmptyCommandResponse()
focal_class.full_signature: @Override public GeometryMergeResponse getEmptyCommandResponse()
focal_class.identifier: getEmptyCommandResponse
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: GeometryMergeResponse
focal_class.signature: GeometryMergeResponse getEmptyCommandResponse()
focal_class.class_method_signature: GeometryMergeCommand.execute(GeometryMergeRequest request, GeometryMergeResponse response)
focal_class.full_signature: @Override public void execute(GeometryMergeRequest request, GeometryMergeResponse response)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (GeometryMergeRequest request, GeometryMergeResponse response)
focal_class.return: void
focal_class.signature: void execute(GeometryMergeRequest request, GeometryMergeResponse response)
focal_method.body: @Override
  	public void execute(GeometryMergeRequest request, GeometryMergeResponse response) throws Exception {
  		List<org.geomajas.geometry.Geometry> clientGeometries = request.getGeometries();
  		if (clientGeometries == null || clientGeometries.size() == 0) {
  			throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "request");
  		}
  		if (clientGeometries.size() == 1) {
  			response.setGeometry(clientGeometries.get(0));
  			return;
  		}
  		int precision = request.getPrecision();
  
  		List<Geometry> geometries = new ArrayList<Geometry>();
  		for (org.geomajas.geometry.Geometry geometry : clientGeometries) {
  			geometry.setPrecision(precision);
  			geometries.add(converter.toInternal(geometry));
  		}
  		PrecisionModel precisionModel;
  		if (precision == -1) {
  			precisionModel = new PrecisionModel(PrecisionModel.FLOATING);
  			precision = 20;
  		} else {
  			precisionModel = new PrecisionModel(Math.pow(10.0, precision));
  		}
  		GeometryFactory factory = new GeometryFactory(precisionModel, geometries.get(0).getSRID());
  
  		// Calculate the union:
  		double buffer = 0;
  		if (request.usePrecisionAsBuffer()) {
  			buffer = Math.pow(10.0, -(precision - 1));
  		}
  		GeometryCollection geometryCollection = (GeometryCollection) factory.buildGeometry(geometries);
  
  		Geometry union = geometryCollection.buffer(buffer);
  		response.setGeometry(converter.toDto(union));
  	}
focal_method.class_method_signature: GeometryMergeCommand.execute(GeometryMergeRequest request, GeometryMergeResponse response)
focal_method.full_signature: @Override public void execute(GeometryMergeRequest request, GeometryMergeResponse response)
focal_method.identifier: execute
focal_method.invocations: getGeometries size size setGeometry get getPrecision setPrecision add toInternal pow getSRID get usePrecisionAsBuffer pow buildGeometry buffer setGeometry toDto
focal_method.modifiers: @Override public
focal_method.parameters: (GeometryMergeRequest request, GeometryMergeResponse response)
focal_method.return: void
focal_method.signature: void execute(GeometryMergeRequest request, GeometryMergeResponse response)