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; import com.cringe_studios.christmastreescanning.scanning.image_scanning.ImageScanner;
public class Scanner { public abstract class Scanner {
BufferedImage frontSideImages[]; // BufferedImage frontSideImages[];
BufferedImage frontSideImagesRed[]; // BufferedImage frontSideImagesRed[];
BufferedImage frontSideImagesGreen[]; // BufferedImage frontSideImagesGreen[];
BufferedImage frontSideImagesBlue[]; // 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[]; protected byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
BufferedImage rightSideImagesRed[];
BufferedImage rightSideImagesGreen[];
BufferedImage rightSideImagesBlue[];
BufferedImage behindSideImages[]; // Boolean distinctColorChannels = null; // use the non-primitive datatype, so the user has to set the state
BufferedImage behindSideImagesRed[]; // Boolean sideCount = null; // use the non-primitive datatype, so the user has to set the state
BufferedImage behindSideImagesGreen[];
BufferedImage behindSideImagesBlue[];
BufferedImage leftSideImages[]; // public Scanner() {}
BufferedImage leftSideImagesRed[];
BufferedImage leftSideImagesGreen[]; public abstract Point3D[] scan();
BufferedImage leftSideImagesBlue[];
byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT; // public Point3D[] scan() {
// if(distinctColorChannels == null || sideCount == null); //TODO error
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 // Point3D[] ret;
//
public Scanner() {} // if(distinctColorChannels == true && sideCount == true) {
//
public Point3D[] scan() { // }else if(distinctColorChannels == true && sideCount == false) {
if(distinctColorChannels == null || sideCount == null); //TODO error //
// }else if(distinctColorChannels == false && sideCount == true) {
Point3D[] ret; //
// }else if(distinctColorChannels == false && sideCount == false) {
if(distinctColorChannels == true && sideCount == true) { //
// }
}else if(distinctColorChannels == true && sideCount == false) { //
// //TODO call SideScanner.scan for every side and merge the four sides into 3d points
}else if(distinctColorChannels == false && sideCount == true) { //
// return null;
}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[]) { public void setData(ScannerData dataType, BufferedImage images[]) {
//TODO convert image to known format utilizing //TODO convert image to known format utilizing
@ -195,19 +197,19 @@ public class Scanner {
this.gammaDelta = gammaDelta; 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 // * @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) { // public void setDistinctColorChannels(boolean useDistinctRGBImages) {
this.distinctColorChannels = Boolean.valueOf(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 // * @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) { // public void setSideCount(boolean useAllFourSides) {
this.sideCount = Boolean.valueOf(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;
}
}