I have some following code :
void loadFloorPlanImage(FloorPlan floorPlan) {
BitmapFactory.Options options = createBitmapOptions(floorPlan);
FutureResult<Bitmap> result = ia.fetchFloorPlanImage(floorPlan, options);
result.setCallback(new ResultCallback<Bitmap>() {
@Override
public void onResult(final Bitmap result) {
// now you have floor plan bitmap, do something with it
updateImageViewInUiThread(result);
}
// handle error conditions
}
}
What i'm getting confused is in line :
BitmapFactory.Options options = createBitmapOptions(floorPlan);
What i'm supposed gonna to do in 'createBitmapOptions' ?
That's not an IndoorAtlas specific question. You can adjust eg the size of the bitmap image to be produced or simply leave the options null. Look at http://developer.android.com/reference/android/graphics/BitmapFactory.html
Sample might look like this if you wanted to restrict the maximum size of the image to be used in your app's map view:
private BitmapFactory.Options createBitmapOptions(FloorPlan floorPlan) {
int reqWidth = 2048;
int reqHeight = 2048;
final int width = (int) floorPlan.dimensions[0];
final int height = (int) floorPlan.dimensions[1];
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int halfHeight = height / 2;
final int halfWidth = width / 2;
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height and width larger than the requested height and width.
while ((halfHeight / inSampleSize) > reqHeight
&& (halfWidth / inSampleSize) > reqWidth) {
inSampleSize *= 2;
}
}
options.inSampleSize = inSampleSize;
return options;
}