Skip to content

Instantly share code, notes, and snippets.

@LieutenantChips
Last active June 25, 2018 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LieutenantChips/4948758939c7fd027b8707bf6d6bc279 to your computer and use it in GitHub Desktop.
Save LieutenantChips/4948758939c7fd027b8707bf6d6bc279 to your computer and use it in GitHub Desktop.
import java.io.File;
public class JpgMetadata {
String name = "";
File file = null;
String latRef = "";
String lonRef = "";
double lat_d = 0.0;
double lat_m = 0.0;
double lat_s = 0.0;
double lon_d = 0.0;
double lon_m = 0.0;
double lon_s = 0.0;
int x_resolution = 0;
int y_resolution = 0;
int x_location_onImage = 0;
int y_location_onImage = 0;
public double[] getDecimalLatLon(){
double[] res = new double[2];
res[0] = Math.signum(this.lat_d) * (Math.abs(this.lat_d) + (this.lat_m/60) + (this.lat_s/3600.0));
res[1] = Math.signum(this.lon_d) * (Math.abs(this.lon_d) + (this.lon_m/60) + (this.lon_s/3600.0));
return res;
}
public double[] getXYFactors(){
double[] xy = new double[2];
double[] latlon = this.getDecimalLatLon();
xy[0] = (180 + latlon[0])/360;
xy[1] = (90 - latlon[1])/180;
return xy;
}
public int getX_location_onImage() {
return x_location_onImage;
}
public void setX_location_onImage(int x_location_onImage) {
this.x_location_onImage = x_location_onImage;
}
public int getY_location_onImage() {
return y_location_onImage;
}
public void setY_location_onImage(int y_location_onImage) {
this.y_location_onImage = y_location_onImage;
}
public JpgMetadata(File file, String latRef, String lonRef, double lat_d, double lat_m, double lat_s, double lon_d, double lon_m, double lon_s) {
this.file = file;
this.latRef = latRef;
this.lonRef = lonRef;
this.lat_d = lat_d;
this.lat_m = lat_m;
this.lat_s = lat_s;
this.lon_d = lon_d;
this.lon_m = lon_m;
this.lon_s = lon_s;
}
public JpgMetadata(String name, File file, String latRef, String lonRef, double[] lat, double[] lon, int x_resolution, int y_resolution) {
this.name = name;
this.file = file;
this.latRef = latRef;
this.lonRef = lonRef;
this.lat_d = lat[0];
this.lat_m = lat[1];
this.lat_s = lat[2];
this.lon_d = lon[0];
this.lon_m = lon[1];
this.lon_s = lon[2];
this.x_resolution = x_resolution;
this.y_resolution = y_resolution;
}
public JpgMetadata(String name, File file, String latRef, String lonRef, double lat_d, double lat_m, double lat_s, double lon_d, double lon_m, double lon_s, int x_resolution, int y_resolution) {
this.name = name;
this.file = file;
this.latRef = latRef;
this.lonRef = lonRef;
this.lat_d = lat_d;
this.lat_m = lat_m;
this.lat_s = lat_s;
this.lon_d = lon_d;
this.lon_m = lon_m;
this.lon_s = lon_s;
this.x_resolution = x_resolution;
this.y_resolution = y_resolution;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getLatRef() {
return latRef;
}
public void setLatRef(String latRef) {
this.latRef = latRef;
}
public String getLonRef() {
return lonRef;
}
public void setLonRef(String lonRef) {
this.lonRef = lonRef;
}
public double getLat_d() {
return lat_d;
}
public void setLat_d(double lat_d) {
this.lat_d = lat_d;
}
public double getLat_m() {
return lat_m;
}
public void setLat_m(double lat_m) {
this.lat_m = lat_m;
}
public double getLat_s() {
return lat_s;
}
public void setLat_s(double lat_s) {
this.lat_s = lat_s;
}
public double getLon_d() {
return lon_d;
}
public void setLon_d(double lon_d) {
this.lon_d = lon_d;
}
public double getLon_m() {
return lon_m;
}
public void setLon_m(double lon_m) {
this.lon_m = lon_m;
}
public double getLon_s() {
return lon_s;
}
public void setLon_s(double lon_s) {
this.lon_s = lon_s;
}
public int getX_resolution() {
return x_resolution;
}
public void setX_resolution(int x_resolution) {
this.x_resolution = x_resolution;
}
public int getY_resolution() {
return y_resolution;
}
public void setY_resolution(int y_resolution) {
this.y_resolution = y_resolution;
}
public JpgMetadata() { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment