Skip to content

Commit

Permalink
Nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
fvilla committed Oct 19, 2024
1 parent 5100e2f commit f896ae9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,18 @@
import org.integratedmodelling.klab.api.services.runtime.extension.Resolver;
import org.integratedmodelling.klab.runtime.storage.DoubleStorage;

@Library(name = "klab.geospatial.generators", description = "Contextualizers that generate " +
"realistic-looking geographic " +
"terrains and features for stress-testing")
@Library(name = "klab.geospatial.generators", description = """
Contextualizers that generate realistic-looking geographic terrains and features for stress-testing""")
public class Generators {

@KlabFunction(name = "terrain", description = "Generate fractal surfaces within a user-defined range " +
"and with a " +
"configurable degree of smoothness, apt to simulating several terrain patterns such as " +
"elevation or slope" +
". As the generator works in RAM, this should not be used on very large grids.", geometry = "S2",
type = Type.NUMBER, version = Version.CURRENT,
@KlabFunction(name = "terrain", description = """
Generate fractal surfaces within a user-defined range \
and with a configurable degree of smoothness, apt to simulating several terrain patterns such as \
elevation or slope. As the generator works in RAM, this should not be used on very large grids.""",
geometry = "S2", type = Type.NUMBER, version = Version.CURRENT,
parameters = {
@KlabFunction.Argument(name = "range", type = Type.RANGE, description = "The " +
"min-max range " +
"of the values produced. Default is 0 to 4000", optional = true),
@KlabFunction.Argument(name = "detail", type = Type.NUMBER, description =
"Controls the " +
"amount of detail in the generated structure. Default is 8, " +
"appropriate " +
"for " +
"elevation", optional = true),
@KlabFunction.Argument(name = "roughness", type = Type.NUMBER, description =
"Controls the " +
"roughness of the generated terrain. Default is 0.55, appropriate" +
" for " +
"elevation",
optional = true)
})
@KlabFunction.Argument(name = "range", type = Type.RANGE, description = "The " + "min-max range " + "of the values produced. Default is 0 to 4000", optional = true),
@KlabFunction.Argument(name = "detail", type = Type.NUMBER, description = "Controls the " + "amount of detail in the generated structure. Default is 8, " + "appropriate " + "for " + "elevation", optional = true), @KlabFunction.Argument(name = "roughness", type = Type.NUMBER, description = "Controls the " + "roughness of the generated terrain. Default is 0.55, appropriate" + " for " + "elevation", optional = true)})
public static class FractalTerrain implements Resolver<State> {

@Override
Expand All @@ -52,9 +36,7 @@ public void resolve(State state, ServiceCall call, ContextScope scope) {
var xy = scope.getContextObservation().getGeometry().dimension(Dimension.Type.SPACE).getShape();
var storage = state.storage(DoubleStorage.class);
var terrain = new Terrain(call.getParameters().get("detail", 8), call.getParameters().get(
"roughness"
, 0.55),
range.getLowerBound(), range.getUpperBound());
"roughness", 0.55), range.getLowerBound(), range.getUpperBound());

/**
appropriate pattern for generic scale when we handle only one dimension, even if in most
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public boolean merge(ResolutionGraph childGraph) {
*/
this.graph.addVertex(this.target);
this.graph.addVertex(childGraph.target);
this.graph.addEdge(this.target, childGraph.target, new ResolutionEdge(childGraph.targetCoverage));
this.graph.addEdge(this.target, childGraph.target, new ResolutionEdge(childGraph.targetCoverage, null));

/*
...by the amount determined in its coverage, "painting" the incoming extents onto ours.
Expand Down Expand Up @@ -247,11 +247,12 @@ public List<Resolvable> rootNodes() {
public static class ResolutionEdge extends DefaultEdge {

public Coverage coverage;
public String localName;

public ResolutionEdge() {
}

public ResolutionEdge(Coverage coverage) {
public ResolutionEdge(Coverage coverage, String localName) {
this.coverage = coverage;
}
}
Expand Down

0 comments on commit f896ae9

Please sign in to comment.