CODE WITH ERRORS, a small requirement change required a small API

change...
This commit is contained in:
Paul Schaller 2023-11-23 16:32:26 +01:00
parent 2ea8096200
commit 44f6a87ebf
5 changed files with 148 additions and 58 deletions

View File

@ -0,0 +1,45 @@
package com.cringe_studios.christmastreescanning;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
import com.cringe_studios.christmastreescanning.scanning.SideScanner;
import com.cringe_studios.christmastreescanning.scanning.SingleColoredSideScanner;
public class FourSidedScanner extends SingleColorScanner {
private SideScanner frontSideScanner;
private SideScanner rightSideScanner;
private SideScanner behindSideScanner;
private SideScanner leftSideScanner;
public FourSidedScanner(BufferedImage frontSideImages[], BufferedImage rightSideImages[], BufferedImage behindSideImages[], BufferedImage leftSideImages[], byte gammaDelta) {
//TODO
frontSideScanner = new SingleColoredSideScanner(frontSideImages, gammaDelta, , , );
rightSideScanner = new SingleColoredSideScanner(rightSideImages, gammaDelta, , , );
behindSideScanner = new SingleColoredSideScanner(behindSideScanner, gammaDelta, , , );
leftSideScanner = new SingleColoredSideScanner(leftSideScanner, gammaDelta, , , );
}
@Override
public Point3D[] scan() {
// TODO Auto-generated method stub
frontSideScanner.scan();
frontSideScanner.normalizePoints();
Point2D[] frontPoints = frontSideScanner.getPoints();
rightSideScanner.scan();
rightSideScanner.normalizePoints();
Point2D[] rightSidePoints = rightSideScanner.getPoints();
behindSideScanner.scan();
behindSideScanner.normalizePoints();
Point2D[] frontPoints = behindSideScanner.getPoints();
leftSideScanner.scan();
leftSideScanner.normalizePoints();
Point2D[] rightSidePoints = leftSideScanner.getPoints();
return null;
}
}

View File

@ -0,0 +1,5 @@
package com.cringe_studios.christmastreescanning;
public abstract class MultiColorScanner extends Scanner {
}

View File

@ -4,53 +4,55 @@ import java.awt.image.BufferedImage;
import com.cringe_studios.christmastreescanning.scanning.image_scanning.ImageScanner;
public class Scanner {
BufferedImage frontSideImages[];
BufferedImage frontSideImagesRed[];
BufferedImage frontSideImagesGreen[];
BufferedImage frontSideImagesBlue[];
public abstract class Scanner {
// BufferedImage frontSideImages[];
// BufferedImage frontSideImagesRed[];
// BufferedImage frontSideImagesGreen[];
// BufferedImage frontSideImagesBlue[];
//
// BufferedImage rightSideImages[];
// BufferedImage rightSideImagesRed[];
// BufferedImage rightSideImagesGreen[];
// BufferedImage rightSideImagesBlue[];
//
// BufferedImage behindSideImages[];
// BufferedImage behindSideImagesRed[];
// BufferedImage behindSideImagesGreen[];
// BufferedImage behindSideImagesBlue[];
//
// BufferedImage leftSideImages[];
// BufferedImage leftSideImagesRed[];
// BufferedImage leftSideImagesGreen[];
// BufferedImage leftSideImagesBlue[];
BufferedImage rightSideImages[];
BufferedImage rightSideImagesRed[];
BufferedImage rightSideImagesGreen[];
BufferedImage rightSideImagesBlue[];
protected byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
BufferedImage behindSideImages[];
BufferedImage behindSideImagesRed[];
BufferedImage behindSideImagesGreen[];
BufferedImage behindSideImagesBlue[];
// Boolean distinctColorChannels = null; // use the non-primitive datatype, so the user has to set the state
// Boolean sideCount = null; // use the non-primitive datatype, so the user has to set the state
BufferedImage leftSideImages[];
BufferedImage leftSideImagesRed[];
BufferedImage leftSideImagesGreen[];
BufferedImage leftSideImagesBlue[];
// public Scanner() {}
byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
public abstract Point3D[] scan();
Boolean distinctColorChannels = null; // use the non-primitive datatype, so the user has to set the state
Boolean sideCount = null; // use the non-primitive datatype, so the user has to set the state
public Scanner() {}
public Point3D[] scan() {
if(distinctColorChannels == null || sideCount == null); //TODO error
Point3D[] ret;
if(distinctColorChannels == true && sideCount == true) {
}else if(distinctColorChannels == true && sideCount == false) {
}else if(distinctColorChannels == false && sideCount == true) {
}else if(distinctColorChannels == false && sideCount == false) {
}
//TODO call SideScanner.scan for every side and merge the four sides into 3d points
return null;
}
// public Point3D[] scan() {
// if(distinctColorChannels == null || sideCount == null); //TODO error
//
// Point3D[] ret;
//
// if(distinctColorChannels == true && sideCount == true) {
//
// }else if(distinctColorChannels == true && sideCount == false) {
//
// }else if(distinctColorChannels == false && sideCount == true) {
//
// }else if(distinctColorChannels == false && sideCount == false) {
//
// }
//
// //TODO call SideScanner.scan for every side and merge the four sides into 3d points
//
// return null;
// }
public void setData(ScannerData dataType, BufferedImage images[]) {
//TODO convert image to known format utilizing
@ -195,19 +197,19 @@ public class Scanner {
this.gammaDelta = gammaDelta;
}
/**
*
* @param useDistinctRGBImages if this parameter is true, you have to use the IMAGE_*_RED/_GREEN/_BLUE enum types in the setData method
*/
public void setDistinctColorChannels(boolean useDistinctRGBImages) {
this.distinctColorChannels = Boolean.valueOf(useDistinctRGBImages);
}
/**
*
* @param useAllFourSides if this Parameter is true, you have to give images for all sides with the "setData" method, if false, you may only give two sides: front and right
*/
public void setSideCount(boolean useAllFourSides) {
this.sideCount = Boolean.valueOf(useAllFourSides);
}
// /**
// *
// * @param useDistinctRGBImages if this parameter is true, you have to use the IMAGE_*_RED/_GREEN/_BLUE enum types in the setData method
// */
// public void setDistinctColorChannels(boolean useDistinctRGBImages) {
// this.distinctColorChannels = Boolean.valueOf(useDistinctRGBImages);
// }
//
// /**
// *
// * @param useAllFourSides if this Parameter is true, you have to give images for all sides with the "setData" method, if false, you may only give two sides: front and right
// */
// public void setSideCount(boolean useAllFourSides) {
// this.sideCount = Boolean.valueOf(useAllFourSides);
// }
}

View File

@ -0,0 +1,5 @@
package com.cringe_studios.christmastreescanning;
public abstract class SingleColorScanner extends Scanner{
}

View File

@ -0,0 +1,33 @@
package com.cringe_studios.christmastreescanning;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
import com.cringe_studios.christmastreescanning.scanning.SideScanner;
import com.cringe_studios.christmastreescanning.scanning.SingleColoredSideScanner;
public class TwoSidedScanner extends SingleColorScanner {
private SideScanner frontSideScanner;
private SideScanner rightSideScanner;
public TwoSidedScanner(BufferedImage frontSideImages[], BufferedImage rightSideImages[], byte gammaDelta) {
//TODO
frontSideScanner = new SingleColoredSideScanner(frontSideImages, gammaDelta, , , );
rightSideScanner = new SingleColoredSideScanner(rightSideImages, gammaDelta, , , );
}
@Override
public Point3D[] scan() {
// TODO Auto-generated method stub
frontSideScanner.scan();
frontSideScanner.normalizePoints();
Point2D[] frontPoints = frontSideScanner.getPoints();
rightSideScanner.scan();
rightSideScanner.normalizePoints();
Point2D[] rightSidePoints = rightSideScanner.getPoints();
return null;
}
}