merge cells (and their intervals) into one cell
| 155 | |
| 156 | // merge cells (and their intervals) into one cell |
| 157 | BOOL LASinterval::merge_cells(const U32 num_indices, const I32* indices, const I32 new_index) |
| 158 | { |
| 159 | U32 i; |
| 160 | if (num_indices == 1) |
| 161 | { |
| 162 | my_cell_hash::iterator hash_element = ((my_cell_hash*)cells)->find(indices[0]); |
| 163 | if (hash_element == ((my_cell_hash*)cells)->end()) |
| 164 | { |
| 165 | return FALSE; |
| 166 | } |
| 167 | ((my_cell_hash*)cells)->insert(my_cell_hash::value_type(new_index, (*hash_element).second)); |
| 168 | ((my_cell_hash*)cells)->erase(hash_element); |
| 169 | } |
| 170 | else |
| 171 | { |
| 172 | if (cells_to_merge) ((my_cell_set*)cells_to_merge)->clear(); |
| 173 | for (i = 0; i < num_indices; i++) |
| 174 | { |
| 175 | add_cell_to_merge_cell_set(indices[i], TRUE); |
| 176 | } |
| 177 | if (!merge(TRUE)) return FALSE; |
| 178 | ((my_cell_hash*)cells)->insert(my_cell_hash::value_type(new_index, merged_cells)); |
| 179 | merged_cells = 0; |
| 180 | } |
| 181 | return TRUE; |
| 182 | } |
| 183 | |
| 184 | // merge adjacent intervals with small gaps in cells to reduce total interval number to maximum |
| 185 | void LASinterval::merge_intervals(U32 maximum_intervals) |