default:
throw new IllegalArgumentException("Wrong data type");
}
// Create the constant operation.
TiledImage used = new TiledImage(sm, tileW, tileH);
for (int b = 0; b < numBands; b++) {
for (int j = 0; j < width; j++) {
for (int k = 0; k < height; k++) {
//Addition of a cross on the image
if (j == k || j == width - k - 1) {
switch (dataType) {
case DataBuffer.TYPE_BYTE:
used.setSample(j, k, b, crossValueByte);
break;
case DataBuffer.TYPE_USHORT:
used.setSample(j, k, b, crossValueUShort);
break;
case DataBuffer.TYPE_SHORT:
used.setSample(j, k, b, crossValueShort);
break;
case DataBuffer.TYPE_INT:
used.setSample(j, k, b, crossValueInteger);
break;
case DataBuffer.TYPE_FLOAT:
used.setSample(j, k, b, crossValueFloat);
break;
case DataBuffer.TYPE_DOUBLE:
used.setSample(j, k, b, crossValueDouble);
break;
default:
throw new IllegalArgumentException("Wrong data type");
}
//If selected, the image could be filled
} else
// a little square of no data on the upper left is inserted
if( (j>=20) && (j<50) && (k>=20) && (k<50)){
switch (dataType) {
case DataBuffer.TYPE_BYTE:
used.setSample(j, k, b, 0);
break;
case DataBuffer.TYPE_USHORT:
used.setSample(j, k, b, 0);
break;
case DataBuffer.TYPE_SHORT:
used.setSample(j, k, b, 0);
break;
case DataBuffer.TYPE_INT:
used.setSample(j, k, b, 0);
break;
case DataBuffer.TYPE_FLOAT:
used.setSample(j, k, b, 0);
break;
case DataBuffer.TYPE_DOUBLE:
used.setSample(j, k, b,0);
break;
default:
throw new IllegalArgumentException("Wrong data type");
}
if( (j>=30) && (j<40) && (k>=20) && (k<30)){
switch (dataType) {
case DataBuffer.TYPE_BYTE:
used.setSample(j, k, b, crossValueByte);
break;
case DataBuffer.TYPE_USHORT:
used.setSample(j, k, b, crossValueUShort);
break;
case DataBuffer.TYPE_SHORT:
used.setSample(j, k, b, crossValueShort);
break;
case DataBuffer.TYPE_INT:
used.setSample(j, k, b, crossValueInteger);
break;
case DataBuffer.TYPE_FLOAT:
used.setSample(j, k, b, crossValueFloat);
break;
case DataBuffer.TYPE_DOUBLE:
used.setSample(j, k, b, crossValueDouble);
break;
default:
throw new IllegalArgumentException("Wrong data type");
}
}
}else{
// No Data is set
switch (dataType) {
case DataBuffer.TYPE_BYTE:
used.setSample(j, k, b, valueB + b);
break;
case DataBuffer.TYPE_USHORT:
used.setSample(j, k, b, valueUS + b);
break;
case DataBuffer.TYPE_SHORT:
used.setSample(j, k, b, valueS + b);
break;
case DataBuffer.TYPE_INT:
used.setSample(j, k, b, valueI + b);
break;
case DataBuffer.TYPE_FLOAT:
float data = valueF + b / 3.0f;
used.setSample(j, k, b, data);
break;
case DataBuffer.TYPE_DOUBLE:
double dataD = valueD + b / 3.0d;
used.setSample(j, k, b, dataD);
break;
default:
throw new IllegalArgumentException("Wrong data type");
}
}