FilterGradRepresentation.java revision 4e289659f746cf659e300c9fcd2048960e115f0c
1e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford/* 2e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * Copyright (C) 2013 The Android Open Source Project 3e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * 4e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * Licensed under the Apache License, Version 2.0 (the "License"); 5e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * you may not use this file except in compliance with the License. 6e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * You may obtain a copy of the License at 7e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * 8e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * http://www.apache.org/licenses/LICENSE-2.0 9e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * 10e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * Unless required by applicable law or agreed to in writing, software 11e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * distributed under the License is distributed on an "AS IS" BASIS, 12e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * See the License for the specific language governing permissions and 14e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford * limitations under the License. 15e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford */ 16e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordpackage com.android.gallery3d.filtershow.filters; 17e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 18e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport android.graphics.Rect; 19e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport android.util.JsonReader; 20e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport android.util.JsonWriter; 21e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 22e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport com.android.gallery3d.R; 23e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport com.android.gallery3d.filtershow.editors.EditorGrad; 24e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport com.android.gallery3d.filtershow.imageshow.MasterImage; 25e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport com.android.gallery3d.filtershow.imageshow.Line; 26e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 27e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport java.io.IOException; 28e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordimport java.util.Vector; 29e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 30e162b032fe387eabbd69d367dae6fe7003e850a1John Hofordpublic class FilterGradRepresentation extends FilterRepresentation 31e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford implements Line { 32e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private static final String LOGTAG = "FilterGradRepresentation"; 33e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public static final int MAX_POINTS = 16; 34e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public static final int PARAM_BRIGHTNESS = 0; 35e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public static final int PARAM_SATURATION = 1; 36e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public static final int PARAM_CONTRAST = 2; 37e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private static final double ADD_MIN_DIST = .05; 38e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private static String LINE_NAME = "Point"; 39e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private static final String SERIALIZATION_NAME = "grad"; 40e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 41e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public FilterGradRepresentation() { 42e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford super("Grad"); 43e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford setSerializationName(SERIALIZATION_NAME); 44e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford creatExample(); 45db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford setOverlayId(R.drawable.filtershow_button_grad); 46e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford setFilterClass(ImageFilterGrad.class); 47e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford setTextId(R.string.grad); 48e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford setEditorId(EditorGrad.ID); 49e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 50e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 51e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void trimVector(){ 52e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int n = mBands.size(); 53e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (int i = n; i < MAX_POINTS; i++) { 54e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mBands.add(new Band()); 55e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 56e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (int i = MAX_POINTS; i < n; i++) { 57e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mBands.remove(i); 58e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 59e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 60e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 61e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford Vector<Band> mBands = new Vector<Band>(); 62e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford Band mCurrentBand; 63e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 64e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford static class Band { 65e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private boolean mask = true; 66db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford 67e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private int xPos1 = -1; 68e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private int yPos1 = 100; 69e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private int xPos2 = -1; 70e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private int yPos2 = 100; 714e289659f746cf659e300c9fcd2048960e115f0cJohn Hoford private int brightness = -40; 72e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private int contrast = 0; 73e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private int saturation = 0; 74db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford 75e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 76e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public Band() { 77e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 78e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 79e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public Band(int x, int y) { 80e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford xPos1 = x; 81e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford yPos1 = y+30; 82e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford xPos2 = x; 83e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford yPos2 = y-30; 84e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 85e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 86e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public Band(Band copy) { 87e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mask = copy.mask; 88e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford xPos1 = copy.xPos1; 89e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford yPos1 = copy.yPos1; 90e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford xPos2 = copy.xPos2; 91e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford yPos2 = copy.yPos2; 92e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford brightness = copy.brightness; 93e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford contrast = copy.contrast; 94e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford saturation = copy.saturation; 95e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 96e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 97e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 98e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 99e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 100e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public String toString() { 101e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int count = 0; 102e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 103e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (!point.mask) { 104e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford count++; 105e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 106e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 107e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return "c=" + mBands.indexOf(mBands) + "[" + mBands.size() + "]" + count; 108e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 109e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 110e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford private void creatExample() { 111e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford Band p = new Band(); 112e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.mask = false; 113e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.xPos1 = -1; 114e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.yPos1 = 100; 115e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.xPos2 = -1; 116e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.yPos2 = 100; 117e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.brightness = 40; 118e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.contrast = 0; 119e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.saturation = 0; 120e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mBands.add(0, p); 121e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand = p; 122e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford trimVector(); 123e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 124e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 125e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 126e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void useParametersFrom(FilterRepresentation a) { 127e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford FilterGradRepresentation rep = (FilterGradRepresentation) a; 128e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford Vector<Band> tmpBands = new Vector<Band>(); 129e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int n = (rep.mCurrentBand == null) ? 0 : rep.mBands.indexOf(rep.mCurrentBand); 130e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band band : rep.mBands) { 131e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford tmpBands.add(new Band(band)); 132e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 133e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand = null; 134e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mBands = tmpBands; 135e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand = mBands.elementAt(n); 136e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 137e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 138e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 139e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public FilterRepresentation copy() { 140e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford FilterGradRepresentation representation = new FilterGradRepresentation(); 141e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford copyAllParameters(representation); 142e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return representation; 143e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 144e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 145e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 146e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford protected void copyAllParameters(FilterRepresentation representation) { 147e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford super.copyAllParameters(representation); 148e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford representation.useParametersFrom(this); 149e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 150e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 151e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 152e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public boolean equals(FilterRepresentation representation) { 153e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (representation instanceof FilterGradRepresentation) { 154db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford FilterGradRepresentation rep = (FilterGradRepresentation) representation; 155db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford int n = getNumberOfBands(); 156db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford if (rep.getNumberOfBands() != n) { 157db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford return false; 158db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford } 159db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford for (int i = 0; i < mBands.size(); i++) { 160db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford Band b1 = mBands.get(i); 161db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford Band b2 = rep.mBands.get(i); 162db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford if (b1.mask != b2.mask 163db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford || b1.brightness != b2.brightness 164db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford || b1.contrast != b2.contrast 165db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford || b1.saturation != b2.saturation 166db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford || b1.xPos1 != b2.xPos1 167db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford || b1.xPos2 != b2.xPos2 168db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford || b1.yPos1 != b2.yPos1 169db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford || b1.yPos2 != b2.yPos2) { 170db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford return false; 171db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford } 172db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford } 173db7b89f63ec342d217efe6af90a3949f47e2fd33John Hoford return true; 174e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 175e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return false; 176e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 177e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 178e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int getNumberOfBands() { 179e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int count = 0; 180e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 181e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (!point.mask) { 182e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford count++; 183e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 184e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 185e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return count; 186e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 187e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 188e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int addBand(Rect rect) { 189e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mBands.add(0, mCurrentBand = new Band(rect.centerX(), rect.centerY())); 190e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.mask = false; 191e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int x = (mCurrentBand.xPos1 + mCurrentBand.xPos2)/2; 192e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int y = (mCurrentBand.yPos1 + mCurrentBand.yPos2)/2; 193e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford double addDelta = ADD_MIN_DIST * Math.max(rect.width(), rect.height()); 194e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford boolean moved = true; 195e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int count = 0; 196e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int toMove = mBands.indexOf(mCurrentBand); 197e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 198e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford while (moved) { 199e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford moved = false; 200e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford count++; 201e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (count > 14) { 202e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford break; 203e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 204e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 205e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 206e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (point.mask) { 207e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford break; 208e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 209e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 210e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 211e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 212e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (point.mask) { 213e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford break; 214e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 215e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int index = mBands.indexOf(point); 216e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 217e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (toMove != index) { 218e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford double dist = Math.hypot(point.xPos1 - x, point.yPos1 - y); 219e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (dist < addDelta) { 220e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford moved = true; 221e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.xPos1 += addDelta; 222e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.yPos1 += addDelta; 223e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.xPos2 += addDelta; 224e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.yPos2 += addDelta; 225e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford x = (mCurrentBand.xPos1 + mCurrentBand.xPos2)/2; 226e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford y = (mCurrentBand.yPos1 + mCurrentBand.yPos2)/2; 227e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 228e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (mCurrentBand.yPos1 > rect.bottom) { 229e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.yPos1 = (int) (rect.top + addDelta); 230e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 231e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (mCurrentBand.xPos1 > rect.right) { 232e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.xPos1 = (int) (rect.left + addDelta); 233e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 234e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 235e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 236e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 237e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 238e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford trimVector(); 239e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return 0; 240e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 241e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 242e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void deleteCurrentBand() { 243e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int index = mBands.indexOf(mCurrentBand); 244e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mBands.remove(mCurrentBand); 245e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford trimVector(); 246e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (getNumberOfBands() == 0) { 247e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford addBand(MasterImage.getImage().getOriginalBounds()); 248e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 249e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand = mBands.get(0); 250e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 251e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 252e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void nextPoint(){ 253e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int index = mBands.indexOf(mCurrentBand); 254e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int tmp = index; 255e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford Band point; 256e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int k = 0; 257e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford do { 258e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford index = (index+1)% mBands.size(); 259e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford point = mBands.get(index); 260e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (k++ >= mBands.size()) { 261e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford break; 262e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 263e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 264e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford while (point.mask == true); 265e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand = mBands.get(index); 266e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 267e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 268e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void setSelectedPoint(int pos) { 269e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand = mBands.get(pos); 270e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 271e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 272e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int getSelectedPoint() { 273e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return mBands.indexOf(mCurrentBand); 274e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 275e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 276e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public boolean[] getMask() { 277e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford boolean[] ret = new boolean[mBands.size()]; 278e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int i = 0; 279e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 280e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford ret[i++] = !point.mask; 281e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 282e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return ret; 283e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 284e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 285e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int[] getXPos1() { 286e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int[] ret = new int[mBands.size()]; 287e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int i = 0; 288e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 289e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford ret[i++] = point.xPos1; 290e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 291e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return ret; 292e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 293e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 294e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int[] getYPos1() { 295e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int[] ret = new int[mBands.size()]; 296e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int i = 0; 297e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 298e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford ret[i++] = point.yPos1; 299e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 300e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return ret; 301e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 302e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 303e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int[] getXPos2() { 304e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int[] ret = new int[mBands.size()]; 305e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int i = 0; 306e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 307e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford ret[i++] = point.xPos2; 308e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 309e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return ret; 310e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 311e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 312e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int[] getYPos2() { 313e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int[] ret = new int[mBands.size()]; 314e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int i = 0; 315e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 316e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford ret[i++] = point.yPos2; 317e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 318e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return ret; 319e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 320e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 321e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int[] getBrightness() { 322e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int[] ret = new int[mBands.size()]; 323e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int i = 0; 324e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 325e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford ret[i++] = point.brightness; 326e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 327e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return ret; 328e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 329e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 330e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int[] getContrast() { 331e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int[] ret = new int[mBands.size()]; 332e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int i = 0; 333e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 334e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford ret[i++] = point.contrast; 335e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 336e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return ret; 337e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 338e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 339e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int[] getSaturation() { 340e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int[] ret = new int[mBands.size()]; 341e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int i = 0; 342e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (Band point : mBands) { 343e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford ret[i++] = point.saturation; 344e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 345e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return ret; 346e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 347e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 348e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int getParameter(int type) { 349e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford switch (type){ 350e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_BRIGHTNESS: 351e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return mCurrentBand.brightness; 352e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_SATURATION: 353e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return mCurrentBand.saturation; 354e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_CONTRAST: 355e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return mCurrentBand.contrast; 356e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 357e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford throw new IllegalArgumentException("no such type " + type); 358e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 359e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 360e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int getParameterMax(int type) { 361e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford switch (type) { 362e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_BRIGHTNESS: 363e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return 100; 364e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_SATURATION: 365e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return 100; 366e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_CONTRAST: 367e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return 100; 368e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 369e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford throw new IllegalArgumentException("no such type " + type); 370e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 371e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 372e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public int getParameterMin(int type) { 373e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford switch (type) { 374e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_BRIGHTNESS: 375e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return -100; 376e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_SATURATION: 377e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return -100; 378e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_CONTRAST: 379e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return -100; 380e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 381e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford throw new IllegalArgumentException("no such type " + type); 382e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 383e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 384e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void setParameter(int type, int value) { 385e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.mask = false; 386e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford switch (type) { 387e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_BRIGHTNESS: 388e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.brightness = value; 389e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford break; 390e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_SATURATION: 391e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.saturation = value; 392e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford break; 393e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford case PARAM_CONTRAST: 394e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.contrast = value; 395e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford break; 396e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford default: 397e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford throw new IllegalArgumentException("no such type " + type); 398e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 399e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 400e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 401e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 402e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void setPoint1(float x, float y) { 403e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.xPos1 = (int)x; 404e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.yPos1 = (int)y; 405e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 406e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 407e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 408e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void setPoint2(float x, float y) { 409e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.xPos2 = (int)x; 410e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand.yPos2 = (int)y; 411e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 412e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 413e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 414e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public float getPoint1X() { 415e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return mCurrentBand.xPos1; 416e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 417e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 418e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 419e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public float getPoint1Y() { 420e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return mCurrentBand.yPos1; 421e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 422e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 423e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public float getPoint2X() { 424e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return mCurrentBand.xPos2; 425e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 426e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 427e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 428e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public float getPoint2Y() { 429e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford return mCurrentBand.yPos2; 430e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 431e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 432e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 433e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void serializeRepresentation(JsonWriter writer) throws IOException { 434e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.beginObject(); 435e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int len = mBands.size(); 436e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int count = 0; 437e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 438e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford for (int i = 0; i < len; i++) { 439e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford Band point = mBands.get(i); 440e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (point.mask) { 441e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford continue; 442e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 443e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.name(LINE_NAME + count); 444e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford count++; 445e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.beginArray(); 446e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.value(point.xPos1); 447e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.value(point.yPos1); 448e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.value(point.xPos2); 449e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.value(point.yPos2); 450e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.value(point.brightness); 451e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.value(point.contrast); 452e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.value(point.saturation); 453e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.endArray(); 454e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 455e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford writer.endObject(); 456e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 457e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 458e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford @Override 459e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford public void deSerializeRepresentation(JsonReader sreader) throws IOException { 460e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.beginObject(); 461e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford Vector<Band> points = new Vector<Band>(); 462e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 463e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford while (sreader.hasNext()) { 464e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford String name = sreader.nextName(); 465e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford if (name.startsWith(LINE_NAME)) { 466e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford int pointNo = Integer.parseInt(name.substring(LINE_NAME.length())); 467e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.beginArray(); 468e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford Band p = new Band(); 469e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.mask = false; 470e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.hasNext(); 471e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.xPos1 = sreader.nextInt(); 472e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.hasNext(); 473e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.yPos1 = sreader.nextInt(); 474e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.hasNext(); 475e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.xPos2 = sreader.nextInt(); 476e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.hasNext(); 477e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.yPos2 = sreader.nextInt(); 478e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.hasNext(); 479e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.brightness = sreader.nextInt(); 480e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.hasNext(); 481e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.contrast = sreader.nextInt(); 482e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.hasNext(); 483e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford p.saturation = sreader.nextInt(); 484e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.hasNext(); 485e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.endArray(); 486e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford points.add(p); 487e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford 488e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } else { 489e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.skipValue(); 490e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 491e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 492e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mBands = points; 493e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford trimVector(); 494e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford mCurrentBand = mBands.get(0); 495e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford sreader.endObject(); 496e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford } 497e162b032fe387eabbd69d367dae6fe7003e850a1John Hoford} 498