package de.poaceae.SPG.frontend;

import de.poaceae.SPG.MeasurementUnit.Interface2MeasurementUnit;


public class FrontendHelper {
	
	final private int lambdaOffset = 200;
	final private int pixelOffset = 500;
	
	private int diagramtype = 1; // 1 - auf konstante Wellenlnge skalieren
	
	private Interface2MeasurementUnit interface2MeasurementUnit;
	
	public void setInterface2MeasurementUnit(Interface2MeasurementUnit in){
		interface2MeasurementUnit = in;
	}
	
	private int diagramPixel2PosX (int Pixel){
		int PosX;
		PosX = Pixel - pixelOffset;
		return PosX;
		
	};
	
	private int diagramPosX2Pixel (int PosX){
		int Pixel;
		Pixel = PosX + pixelOffset;
		return Pixel;
	}
	
	private int lambda2PosX (double lambda){
		return (int)lambda - lambdaOffset;
	};
	
	private double PosX2lambda (int PosX){
		return PosX + lambdaOffset;
	};	
	
	public int diagramPixelLambda2PosX(int Pixel, double Lambda){

		if (diagramtype == 1){
			return lambda2PosX(Lambda);
		}
		else
		{
			return diagramPixel2PosX(Pixel);
		}
	
		
	};
	public double diagramPosX2Lambda(int PosX){
		if (diagramtype == 1){
			return PosX2lambda(PosX);
		}
		else
		{
			return interface2MeasurementUnit.pixel2wavelength(diagramPosX2Pixel(PosX));
		}
	}
	
	public int Lambda2Pixel(double Lambda){
		return interface2MeasurementUnit.wavelength2pixel(Lambda);
	}

}

@@ -232,17 +232,17 @@
 mtype = 
-1
+2
 ; // 1 -
@@ -277,16 +277,68 @@
 alieren%0A
+%09                             // 2 - Alles anzeigen%0A
 %09%0A%09priva
@@ -599,27 +599,177 @@
 ;%0A%09%09
-return PosX;%0A%09%09%0A%09%7D;
+//PosX = (Pixel - 0)/4;%0A%09%09return PosX;%0A%09%09%0A%09%7D;%0A%09%0A%09private int Pixel2PosX (int Pixel)%7B%0A%09%09// Display all pixel%0A%09%09int PosX;%0A%09%09%0A%09%09PosX = (Pixel - 0)/2;%0A%09%09return PosX;%0A%09%09%0A%09%7D;%09
 %0A%09%0A%09
@@ -1156,24 +1156,82 @@
 ambda);%0A%09%09%7D%0A
+%09%09if (diagramtype == 2)%7B%0A%09%09%09return Pixel2PosX(Pixel);%0A%09%09%7D%0A
 %09%09else%0A%09%09%7B%0A%09
@@ -1377,24 +1377,82 @@
 (PosX);%0A%09%09%7D%0A
+%09%09if (diagramtype == 2)%7B%0A%09%09%09return PosX2lambda(PosX);%0A%09%09%7D%0A
 %09%09else%0A%09%09%7B%0A%09

Switch to branch logic, display all pixel