Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add aspect ratio as a parameter for image requests #243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion WEB-INF/classes/gov/noaa/pfel/erddap/dataset/EDDGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -7130,6 +7130,7 @@ public boolean saveAsImage(
double minX = Double.NaN, maxX = Double.NaN, minY = Double.NaN, maxY = Double.NaN;
boolean xAscending = true, yAscending = true; // this is what controls flipping of the axes
String xScale = "", yScale = ""; // (default) or Linear or Log
double aspect = Double.NaN;
int nVars = 4;
EDV vars[] = null; // set by .vars or lower
int axisVarI[] = null, dataVarI[] = null; // set by .vars or lower
Expand Down Expand Up @@ -7335,6 +7336,12 @@ public boolean saveAsImage(
if (!yScale.equals("Log") && !yScale.equals("Linear"))
yScale = ""; // "" -> (the default)
}
if(pParts.length > 4){
aspect = String2.parseDouble(pParts[4]);
if(aspect < 0.01 || aspect > 100){
aspect = Double.NaN;
}
}
if (reallyVerbose)
String2.log(
".yRange min="
Expand All @@ -7344,7 +7351,9 @@ public boolean saveAsImage(
+ " ascending="
+ yAscending
+ " scale="
+ yScale);
+ yScale
+ " aspect="
+ aspect);

// just to be clear: ignore any unrecognized .something
} else if (ampPart.startsWith(".")) {
Expand Down
11 changes: 10 additions & 1 deletion WEB-INF/classes/gov/noaa/pfel/erddap/dataset/EDDTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -5129,6 +5129,7 @@ public boolean saveAsImage(
double xMin = Double.NaN, xMax = Double.NaN, yMin = Double.NaN, yMax = Double.NaN;
boolean xAscending = true, yAscending = true; // this is what controls flipping of the axes
String xScale = "", yScale = ""; // (default) or Linear or Log
double aspect = Double.NaN;
double fontScale = 1, vectorStandard = Double.NaN;
String currentDrawLandMask = null; // not yet set
StringBuilder title2 = new StringBuilder();
Expand Down Expand Up @@ -5310,6 +5311,12 @@ public boolean saveAsImage(
if (!yScale.equals("Log") && !yScale.equals("Linear"))
yScale = ""; // "" -> (the default)
}
if(pParts.length > 4){
aspect = String2.parseDouble(pParts[4]);
if(aspect < 0.01 || aspect > 100){
aspect = Double.NaN;
}
}
if (reallyVerbose)
String2.log(
".yRange min="
Expand All @@ -5319,7 +5326,9 @@ public boolean saveAsImage(
+ " ascending="
+ yAscending
+ " scale="
+ yScale);
+ yScale
+ " aspect="
+ aspect);

// ignore any unrecognized .something
} else if (ampPart.startsWith(".")) {
Expand Down