mirror of
https://github.com/csharpee/Map-Projections.git
synced 2025-12-09 00:00:11 -05:00
Bring in the maps!
I threw in Danseiji O, I, II, III, and IV. I'll do the others later once I'm happier with the tearing algorithm, but for now, I think this is pretty darn rad, dude. Check out the MapAnalyzer images!
This commit is contained in:
parent
33fedc06f8
commit
bcf925b2a7
@ -115,15 +115,16 @@ public abstract class MapApplication extends Application {
|
||||
private static final KeyCombination CTRL_ENTER = new KeyCodeCombination(KeyCode.ENTER, KeyCodeCombination.CONTROL_DOWN);
|
||||
|
||||
|
||||
public static final Projection[] FEATURED_PROJECTIONS = { Arbitrary.DANSEIJI_III, Cylindrical.MERCATOR,
|
||||
public static final Projection[] FEATURED_PROJECTIONS = { Arbitrary.DANSEIJI_O, Arbitrary.DANSEIJI_I, Arbitrary.DANSEIJI_II, Arbitrary.DANSEIJI_III, Arbitrary.DANSEIJI_IV, Cylindrical.MERCATOR,
|
||||
Cylindrical.EQUIRECTANGULAR, Cylindrical.EQUAL_AREA, Cylindrical.GALL_STEREOGRAPHIC,
|
||||
Azimuthal.STEREOGRAPHIC, Azimuthal.POLAR, Azimuthal.EQUAL_AREA, Azimuthal.GNOMONIC,
|
||||
Azimuthal.PERSPECTIVE, Conic.LAMBERT, Conic.EQUIDISTANT, Conic.ALBERS,
|
||||
Polyhedral.LEE_TETRAHEDRAL_RECTANGULAR, Polyhedral.ACTUAUTHAGRAPH,
|
||||
Polyhedral.AUTHAPOWER, Octohedral.KEYES_BASIC_M, Pseudocylindrical.SINUSOIDAL,
|
||||
Pseudocylindrical.MOLLWEIDE, Tobler.TOBLER, Lenticular.AITOFF,
|
||||
Lenticular.VAN_DER_GRINTEN, ArbitraryPseudocylindrical.ROBINSON, WinkelTripel.WINKEL_TRIPEL,
|
||||
Misc.PEIRCE_QUINCUNCIAL, Misc.TWO_POINT_EQUIDISTANT, Pseudocylindrical.LEMONS }; //the set of featured projections for the ComboBox
|
||||
Lenticular.VAN_DER_GRINTEN, ArbitraryPseudocylindrical.ROBINSON,
|
||||
WinkelTripel.WINKEL_TRIPEL, Misc.PEIRCE_QUINCUNCIAL, Misc.TWO_POINT_EQUIDISTANT,
|
||||
Pseudocylindrical.LEMONS }; //the set of featured projections for the ComboBox
|
||||
|
||||
public static final String[] PROJECTION_CATEGORIES = { "Cylindrical", "Azimuthal", "Conic",
|
||||
"Polyhedral", "Pseudocylindrical", "Lenticular", "Other", "Invented by Justin" }; //the overarching categories by which I organise my projections
|
||||
@ -145,9 +146,11 @@ public abstract class MapApplication extends Application {
|
||||
Lenticular.VAN_DER_GRINTEN, WinkelTripel.WINKEL_TRIPEL },
|
||||
{ Snyder.GS50, Misc.GUYOU, Misc.HAMMER_RETROAZIMUTHAL, Pseudocylindrical.LEMONS,
|
||||
Misc.PEIRCE_QUINCUNCIAL, Misc.TWO_POINT_EQUIDISTANT, Misc.FLAT_EARTH },
|
||||
{ MyProjections.EXPERIMENT, Polyhedral.AUTHAPOWER, Polyhedral.ACTUAUTHAGRAPH,
|
||||
MyProjections.MAGNIFIER, MyProjections.PSEUDOSTEREOGRAPHIC,
|
||||
Polyhedral.TETRAGRAPH, MyProjections.TWO_POINT_EQUALIZED } }; // every projection I have programmed
|
||||
{ Arbitrary.DANSEIJI_O, Arbitrary.DANSEIJI_I, Arbitrary.DANSEIJI_II,
|
||||
Arbitrary.DANSEIJI_III, Arbitrary.DANSEIJI_IV, MyProjections.EXPERIMENT,
|
||||
Polyhedral.AUTHAPOWER, Polyhedral.ACTUAUTHAGRAPH, MyProjections.MAGNIFIER,
|
||||
MyProjections.PSEUDOSTEREOGRAPHIC, Polyhedral.TETRAGRAPH,
|
||||
MyProjections.TWO_POINT_EQUALIZED } }; // every projection I have programmed
|
||||
|
||||
private static final String[] ASPECT_NAMES = { "Standard", "Transverse", "Cassini", "Atlantis",
|
||||
"Jerusalem", "Point Nemo", "Longest Line", "Cylindrical", "Tetrahedral", "Antipode",
|
||||
|
||||
3573
src/data/danseijiI.csv
Normal file
3573
src/data/danseijiI.csv
Normal file
File diff suppressed because it is too large
Load Diff
3573
src/data/danseijiII.csv
Normal file
3573
src/data/danseijiII.csv
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3611
src/data/danseijiIV.csv
Normal file
3611
src/data/danseijiIV.csv
Normal file
File diff suppressed because it is too large
Load Diff
3573
src/data/danseijiO.csv
Normal file
3573
src/data/danseijiO.csv
Normal file
File diff suppressed because it is too large
Load Diff
@ -41,11 +41,31 @@ public class Arbitrary {
|
||||
private static final int X = 0, Y = 1;
|
||||
|
||||
|
||||
public static final ArbitraryProjection DANSEIJI_O = new ArbitraryProjection(
|
||||
"Danseiji O", "The optimal conventional lenticular map.",
|
||||
true, Type.OTHER, Property.COMPROMISE, "danseijiO.csv");
|
||||
|
||||
|
||||
public static final ArbitraryProjection DANSEIJI_I = new ArbitraryProjection(
|
||||
"Danseiji I", "The optimal conventional equal-area map.",
|
||||
true, Type.OTHER, Property.COMPROMISE, "danseijiI.csv");
|
||||
|
||||
|
||||
public static final ArbitraryProjection DANSEIJI_II = new ArbitraryProjection(
|
||||
"Danseiji II", "Like Danseiji O, but with more weight given to shapes.",
|
||||
true, Type.OTHER, Property.COMPROMISE, "danseijiII.csv");
|
||||
|
||||
|
||||
public static final ArbitraryProjection DANSEIJI_III = new ArbitraryProjection(
|
||||
"Danseiji III", "A map optimised to move distortion from the continents into the oceans",
|
||||
"Danseiji III", "A map optimised to move distortion from the continents into the oceans.",
|
||||
true, Type.OTHER, Property.COMPROMISE, "danseijiIII.csv");
|
||||
|
||||
|
||||
public static final ArbitraryProjection DANSEIJI_IV = new ArbitraryProjection(
|
||||
"Danseiji IV", "A map optimised to show off the continents by compressing the oceans.",
|
||||
true, Type.OTHER, Property.COMPROMISE, "danseijiIV.csv");
|
||||
|
||||
|
||||
|
||||
private static class ArbitraryProjection extends Projection {
|
||||
|
||||
@ -75,7 +95,7 @@ public class Arbitrary {
|
||||
cells[i][j][k] = Integer.parseInt(row[k]);
|
||||
}
|
||||
} // and skip the edge; it's not relevant here
|
||||
} catch (IOException e) {
|
||||
} catch (IOException | NullPointerException | ArrayIndexOutOfBoundsException e) {
|
||||
System.err.println("Could not load mesh: "+e);
|
||||
width = 2;
|
||||
height = 2;
|
||||
@ -92,12 +112,14 @@ public class Arbitrary {
|
||||
|
||||
|
||||
public double[] project(double lat, double lon) {
|
||||
int i = (int)Math2.floorMod((Math.PI/2-lat)/Math.PI*cells.length, cells.length);
|
||||
int j = (int)Math2.floorMod((lon+Math.PI)/(2*Math.PI)*cells[i].length, cells[i].length);
|
||||
double cs = Math2.floorMod((Math.PI/2-lat)/Math.PI*cells.length, 1);
|
||||
double cw = 1 - Math2.floorMod((lon+Math.PI)/(2*Math.PI)*cells[i].length, 1);
|
||||
int i = (int)((Math.PI/2-lat)/Math.PI*cells.length); // map it to the array
|
||||
i = Math.max(0, Math.min(cells.length-1, i)); // coerce it into bounds
|
||||
int j = (int)((lon+Math.PI)/(2*Math.PI)*cells[i].length);
|
||||
j = Math.max(0, Math.min(cells[i].length-1, j));
|
||||
double cs = (Math.PI/2-lat)/Math.PI*cells.length - i; // do linear interpolation
|
||||
double ce = (lon+Math.PI)/(2*Math.PI)*cells[i].length - j;
|
||||
double cn = 1 - cs;
|
||||
double ce = 1 - cw;
|
||||
double cw = 1 - ce;
|
||||
double[] ne = vertices[cells[i][j][NE]], nw = vertices[cells[i][j][NW]],
|
||||
sw = vertices[cells[i][j][SW]], se = vertices[cells[i][j][SE]];
|
||||
return new double[] {
|
||||
@ -107,7 +129,9 @@ public class Arbitrary {
|
||||
|
||||
|
||||
public double[] inverse(double x, double y) {
|
||||
return null; // TODO
|
||||
return WinkelTripel.WINKEL_TRIPEL.inverse(
|
||||
x*WinkelTripel.WINKEL_TRIPEL.getWidth()/this.getWidth(),
|
||||
y*WinkelTripel.WINKEL_TRIPEL.getHeight()/this.getHeight(), Projection.NORTH_POLE, 40);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,6 +167,11 @@ public abstract class Projection {
|
||||
return project(obliquifySphc(lat, lon, pole));
|
||||
}
|
||||
|
||||
public double[] project(double lat, double lon, double[] pole, double... params) {
|
||||
setParameters(params);
|
||||
return project(lat, lon, pole);
|
||||
}
|
||||
|
||||
|
||||
public double[] inverse(double[] coords) {
|
||||
return inverse(coords[0], coords[1]);
|
||||
@ -180,6 +185,11 @@ public abstract class Projection {
|
||||
return inverse(x, y, pole, false);
|
||||
}
|
||||
|
||||
public double[] inverse(double x, double y, double[] pole, double... params) {
|
||||
setParameters(params);
|
||||
return inverse(x, y, pole);
|
||||
}
|
||||
|
||||
public double[] inverse(double x, double y, double[] pole, boolean cropAtPi) {
|
||||
final double[] relCoords = inverse(x, y);
|
||||
if (relCoords == null || (cropAtPi && Math.abs(relCoords[1]) > Math.PI))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user