changes name + params + values
This commit is contained in:
1 parent
bd6b7d3194
commit
5db2cd53ed
3 files changed
+15
-14
No files matched your search
@@ -16,27 +16,28 @@ public class Algorithm {
|
||||
this.parameters = new ArrayList<>();
|
||||
switch (path) {
|
||||
case "changeLuminosity":
|
||||
Parameter param1 = new Parameter("delta", "", -255, 255, false);
|
||||
Parameter param1 = new Parameter("delta", "delta", -255, 255, 1);
|
||||
this.parameters.add(param1);
|
||||
break;
|
||||
case "histogram":
|
||||
break;
|
||||
case "colorFilter":
|
||||
Parameter param2 = new Parameter("hue", "Teinte", 0, 360, false);
|
||||
Parameter param2 = new Parameter("hue", "Teinte", 0, 359, 1);
|
||||
this.parameters.add(param2);
|
||||
break;
|
||||
case "meanFilter":
|
||||
Parameter param3 = new Parameter("size", "Taille du filtre", 1, 101, true);
|
||||
Parameter param3 = new Parameter("size", "Taille du filtre", 1, 101, 2);
|
||||
this.parameters.add(param3);
|
||||
break;
|
||||
case "gaussienFilter":
|
||||
Parameter param4 = new Parameter("size", "Taille du filtre", 1, 101, true);
|
||||
this.parameters.add(param4);
|
||||
// TODO
|
||||
// Parameter param4 = new Parameter("size", "Taille du filtre", 1, 101, 2);
|
||||
// this.parameters.add(param4);
|
||||
break;
|
||||
case "contours":
|
||||
break;
|
||||
default:
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid pass");
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid path");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ public class AlgorithmController {
|
||||
algorithms.add(algo);
|
||||
algo = new Algorithm("Détection de contours", "contours");
|
||||
algorithms.add(algo);
|
||||
algo = new Algorithm("Histogramme", "histogram");
|
||||
algo = new Algorithm("Égalisation d'histogramme", "histogram");
|
||||
algorithms.add(algo);
|
||||
|
||||
ArrayNode nodes = mapper.createArrayNode();
|
||||
for (Algorithm a : algorithms) {
|
||||
ObjectNode objectNode = mapper.createObjectNode();
|
||||
objectNode.put("name", a.getName());
|
||||
objectNode.put("pass", a.getPath());
|
||||
objectNode.put("path", a.getPath());
|
||||
ArrayNode parameters = objectNode.putArray("parameters");
|
||||
for (Parameter p : a.getParameters()) {
|
||||
ObjectNode paramNode = mapper.createObjectNode();
|
||||
@@ -46,7 +46,7 @@ public class AlgorithmController {
|
||||
paramNode.put("displayName", p.getDisplayName());
|
||||
paramNode.put("min", p.getMin());
|
||||
paramNode.put("max", p.getMax());
|
||||
paramNode.put("mustBeOdd", p.mustBeOdd());
|
||||
paramNode.put("step", p.getStep());
|
||||
parameters.add(paramNode);
|
||||
}
|
||||
nodes.add(objectNode);
|
||||
|
||||
@@ -5,14 +5,14 @@ public class Parameter {
|
||||
private final String displayName;
|
||||
private final int min;
|
||||
private final int max;
|
||||
private final boolean mustBeOdd;
|
||||
private final int step;
|
||||
|
||||
public Parameter(String name, String displayName, int min, int max, boolean mustBeOdd) {
|
||||
public Parameter(String name, String displayName, int min, int max, int step) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.max = max;
|
||||
this.min = min;
|
||||
this.mustBeOdd = mustBeOdd;
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -31,7 +31,7 @@ public class Parameter {
|
||||
return this.max;
|
||||
}
|
||||
|
||||
public boolean mustBeOdd() {
|
||||
return this.mustBeOdd;
|
||||
public int getStep() {
|
||||
return this.step;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user