Params root path and color model stuff.
This commit is contained in:
@ -43,6 +43,7 @@ import ch.psi.daq.domain.query.operation.Compression;
|
||||
import ch.psi.daq.domain.query.operation.QueryField;
|
||||
import ch.psi.daq.domain.query.response.Response;
|
||||
import ch.psi.daq.domain.query.response.ResponseFormat;
|
||||
import ch.psi.daq.domain.query.transform.image.color.ColorModelType;
|
||||
import ch.psi.daq.domain.query.transform.image.resize.ValueAggregation;
|
||||
import ch.psi.daq.domain.request.validate.RequestProviderValidator;
|
||||
import ch.psi.daq.queryrest.query.QueryManager;
|
||||
@ -368,12 +369,22 @@ public class QueryRestController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current list of {@link Compression}s available.
|
||||
* Returns the current list of {@link ValueAggregation}s available.
|
||||
*
|
||||
* @return list of {@link Compression}s as String array
|
||||
* @return list of {@link ValueAggregation}s as String array
|
||||
*/
|
||||
@RequestMapping(value = PARAMETERS_ROOT_PATH + "/valueaggregations", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public @ResponseBody List<ValueAggregation> getValueAggregations() {
|
||||
return Lists.newArrayList(ValueAggregation.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current list of {@link ValueAggregation}s available.
|
||||
*
|
||||
* @return list of {@link ValueAggregation}s as String array
|
||||
*/
|
||||
@RequestMapping(value = PARAMETERS_ROOT_PATH + "/colormodeltypes", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public @ResponseBody List<ColorModelType> getColorModelTypes() {
|
||||
return Lists.newArrayList(ColorModelType.values());
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,8 @@ import ch.psi.daq.domain.query.transform.ValueTransformationSequence;
|
||||
import ch.psi.daq.domain.query.transform.image.ImageEncodingValueTransformation;
|
||||
import ch.psi.daq.domain.query.transform.image.ImageDownScaleValueTransformation;
|
||||
import ch.psi.daq.domain.query.transform.image.ImageFormat;
|
||||
import ch.psi.daq.domain.query.transform.image.color.ColorModelType;
|
||||
import ch.psi.daq.domain.query.transform.image.color.TypedColorModel;
|
||||
import ch.psi.daq.domain.query.transform.image.encoding.Base64ImageEncoder;
|
||||
import ch.psi.daq.domain.query.transform.sampling.ValueSamplerValueTransformation;
|
||||
import ch.psi.daq.domain.request.range.RequestRangeDate;
|
||||
@ -2223,7 +2225,11 @@ public class JsonQueryRestControllerTableTest extends AbstractDaqRestTest {
|
||||
request.addValueTransformation(
|
||||
new ValueTransformationSequence(
|
||||
ValueTransformationSequence.ALL_CHANNELS,
|
||||
new ImageDownScaleValueTransformation(8, Color.BLUE, Color.RED),
|
||||
new ImageDownScaleValueTransformation(8,
|
||||
new TypedColorModel(
|
||||
ColorModelType.LINEAR,
|
||||
64,
|
||||
Arrays.asList(Color.BLUE, Color.RED))),
|
||||
new ImageEncodingValueTransformation(
|
||||
ImageFormat.PNG,
|
||||
new Base64ImageEncoder(StandardCharsets.UTF_8, true, false))));
|
||||
@ -2310,7 +2316,11 @@ public class JsonQueryRestControllerTableTest extends AbstractDaqRestTest {
|
||||
request.addValueTransformation(
|
||||
new ValueTransformationSequence(
|
||||
null,
|
||||
new ImageDownScaleValueTransformation(8, Color.BLUE, Color.RED),
|
||||
new ImageDownScaleValueTransformation(8,
|
||||
new TypedColorModel(
|
||||
ColorModelType.LINEAR,
|
||||
64,
|
||||
Arrays.asList(Color.BLUE, Color.RED))),
|
||||
new ImageEncodingValueTransformation(
|
||||
ImageFormat.PNG,
|
||||
new Base64ImageEncoder(StandardCharsets.UTF_8, true, false))));
|
||||
|
@ -40,6 +40,8 @@ import ch.psi.daq.domain.query.transform.ValueTransformationSequence;
|
||||
import ch.psi.daq.domain.query.transform.image.ImageEncodingValueTransformation;
|
||||
import ch.psi.daq.domain.query.transform.image.ImageDownScaleValueTransformation;
|
||||
import ch.psi.daq.domain.query.transform.image.ImageFormat;
|
||||
import ch.psi.daq.domain.query.transform.image.color.ColorModelType;
|
||||
import ch.psi.daq.domain.query.transform.image.color.TypedColorModel;
|
||||
import ch.psi.daq.domain.query.transform.image.encoding.Base64ImageEncoder;
|
||||
import ch.psi.daq.domain.query.transform.sampling.ValueSamplerValueTransformation;
|
||||
import ch.psi.daq.domain.request.range.RequestRangeDate;
|
||||
@ -1145,7 +1147,11 @@ public class JsonQueryRestControllerTest extends AbstractDaqRestTest {
|
||||
request.addValueTransformation(
|
||||
new ValueTransformationSequence(
|
||||
ValueTransformationSequence.ALL_CHANNELS,
|
||||
new ImageDownScaleValueTransformation(8, Color.BLUE, Color.RED),
|
||||
new ImageDownScaleValueTransformation(8,
|
||||
new TypedColorModel(
|
||||
ColorModelType.LINEAR,
|
||||
64,
|
||||
Arrays.asList(Color.BLUE, Color.RED))),
|
||||
new ImageEncodingValueTransformation(
|
||||
ImageFormat.PNG,
|
||||
new Base64ImageEncoder(StandardCharsets.UTF_8, true, false))));
|
||||
@ -1187,8 +1193,7 @@ public class JsonQueryRestControllerTest extends AbstractDaqRestTest {
|
||||
request.addValueTransformation(
|
||||
new ValueTransformationSequence(
|
||||
channelName,
|
||||
new ValueSamplerValueTransformation(2))
|
||||
);
|
||||
new ValueSamplerValueTransformation(2)));
|
||||
|
||||
String content = mapper.writeValueAsString(request);
|
||||
System.out.println(content);
|
||||
@ -1213,7 +1218,7 @@ public class JsonQueryRestControllerTest extends AbstractDaqRestTest {
|
||||
value = JsonPath.read(document, "$[0].data[1].transformedValue.value").toString();
|
||||
assertTrue(value.startsWith("[101.0,"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testValueTransformation_03() throws Exception {
|
||||
String channelName = "TestImage";
|
||||
@ -1231,7 +1236,10 @@ public class JsonQueryRestControllerTest extends AbstractDaqRestTest {
|
||||
request.addValueTransformation(
|
||||
new ValueTransformationSequence(
|
||||
null,
|
||||
new ImageDownScaleValueTransformation(8, Color.BLUE, Color.RED),
|
||||
new ImageDownScaleValueTransformation(8, new TypedColorModel(
|
||||
ColorModelType.LINEAR,
|
||||
64,
|
||||
Arrays.asList(Color.BLUE, Color.RED))),
|
||||
new ImageEncodingValueTransformation(
|
||||
ImageFormat.PNG,
|
||||
new Base64ImageEncoder(StandardCharsets.UTF_8, true, false))));
|
||||
@ -1259,7 +1267,7 @@ public class JsonQueryRestControllerTest extends AbstractDaqRestTest {
|
||||
assertTrue(image.startsWith(imageScheme));
|
||||
image = JsonPath.read(document, "$[0].data[1].transformedValue");
|
||||
assertTrue(image.startsWith(imageScheme));
|
||||
|
||||
|
||||
String shape = JsonPath.read(document, "$[1].data[0].transformedValue.shape").toString();
|
||||
assertEquals("[40,20]", shape);
|
||||
String value = JsonPath.read(document, "$[1].data[0].transformedValue.value").toString();
|
||||
|
Reference in New Issue
Block a user