Commit 352fe8f7 authored by Daniel Eggert's avatar Daniel Eggert
Browse files

added license and license header to all java files.

parent 42afbb42
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package de.potsdam.gfz.flink.api;
/**
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
This diff is collapsed.
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......@@ -40,4 +56,4 @@ public interface SceneIndex {
public SceneData getSceneData(SceneData sceneData, int dataidx);
}
\ No newline at end of file
}
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
package de.potsdam.gfz.gms.database.misc;
public class ColorFunction {
/**
* blue -> green -> red
*/
private static final byte[][] DEFAULT_COLORS = { { 0, 0, (byte) 255 }, { 0, (byte) 255, 0 }, { (byte) 255, 0, 0 } };
private final double min;
private final double max;
private final double range;
private final double colorOffset;
private final byte[][] colors;
/**
* Creates the default color function with a gradient from blue over green to red
*
* @param min
* @param max
*/
public ColorFunction(double min, double max) {
this(min, max, DEFAULT_COLORS);
}
public ColorFunction(double min, double max, byte[]... colors) {
this.min = min;
this.max = max;
this.range = max - min;
this.colors = colors;
if (colors == null || colors.length < 1) {
throw new IllegalArgumentException("At least one color has to be provided");
} else if (colors.length == 1) {
this.colorOffset = 0;
} else {
this.colorOffset = range / (colors.length - 1);
}
}
public byte[] getColor(double val) {
return getColor(val, new byte[3], 0);
}
public byte[] getColor(double val, byte[] color, int offset) {
if (val >= max) {
color[offset] = colors[colors.length - 1][0];
color[offset + 1] = colors[colors.length - 1][1];
color[offset + 2] = colors[colors.length - 1][2];
return color;
}
if (val <= min || colors.length == 1) {
color[offset] = colors[0][0];
color[offset + 1] = colors[0][1];
color[offset + 2] = colors[0][2];
return color;
}
// find corresponding colors
double rangePos = (val - min) / range;
int color1Idx = (int) Math.floor((colors.length - 1) * rangePos);
int color2Idx = color1Idx + 1;
// update rangePos within color vals
rangePos = (val - min - (color1Idx * colorOffset)) / colorOffset;
// interpolate inbetween colors
for (int i = 0; i < colors[color1Idx].length; ++i) {
double colorLow = colors[color1Idx][i] & 0xff;
double colorHigh = colors[color2Idx][i] & 0xff;
color[offset + i] = (byte) (0.5 + (colorLow + rangePos * (colorHigh - colorLow)));
}
return color;
}
public double getMin() {
return min;
}
public double getMax() {
return max;
}
}
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package de.potsdam.gfz.gms.database.misc;
public class ColorFunction {
/**
* blue -> green -> red
*/
private static final byte[][] DEFAULT_COLORS = { { 0, 0, (byte) 255 }, { 0, (byte) 255, 0 }, { (byte) 255, 0, 0 } };
private final double min;
private final double max;
private final double range;
private final double colorOffset;
private final byte[][] colors;
/**
* Creates the default color function with a gradient from blue over green to red
*
* @param min
* @param max
*/
public ColorFunction(double min, double max) {
this(min, max, DEFAULT_COLORS);
}
public ColorFunction(double min, double max, byte[]... colors) {
this.min = min;
this.max = max;
this.range = max - min;
this.colors = colors;
if (colors == null || colors.length < 1) {
throw new IllegalArgumentException("At least one color has to be provided");
} else if (colors.length == 1) {
this.colorOffset = 0;
} else {
this.colorOffset = range / (colors.length - 1);
}
}
public byte[] getColor(double val) {
return getColor(val, new byte[3], 0);
}
public byte[] getColor(double val, byte[] color, int offset) {
if (val >= max) {
color[offset] = colors[colors.length - 1][0];
color[offset + 1] = colors[colors.length - 1][1];
color[offset + 2] = colors[colors.length - 1][2];
return color;
}
if (val <= min || colors.length == 1) {
color[offset] = colors[0][0];
color[offset + 1] = colors[0][1];
color[offset + 2] = colors[0][2];
return color;
}
// find corresponding colors
double rangePos = (val - min) / range;
int color1Idx = (int) Math.floor((colors.length - 1) * rangePos);
int color2Idx = color1Idx + 1;
// update rangePos within color vals
rangePos = (val - min - (color1Idx * colorOffset)) / colorOffset;
// interpolate inbetween colors
for (int i = 0; i < colors[color1Idx].length; ++i) {
double colorLow = colors[color1Idx][i] & 0xff;
double colorHigh = colors[color2Idx][i] & 0xff;
color[offset + i] = (byte) (0.5 + (colorLow + rangePos * (colorHigh - colorLow)));
}
return color;
}
public double getMin() {
return min;
}
public double getMax() {
return max;
}
}
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package de.potsdam.gfz.gms.database.misc;
public class DatatypeConv {
......@@ -31,4 +47,4 @@ public class DatatypeConv {
return ints;
}
}
\ No newline at end of file
}
/*******************************************************************************
* Copyright (C) 2018 Daniel Eggert (daniel.eggert@gfz-potsdam.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
/**
*
*/
......
Markdown is supported