//
// VisADLineArray.java
//

/*
VisAD system for interactive analysis and visualization of numerical
data.  Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom
Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and
Tommy Jasmin.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/

package visad;

/**
   VisADLineArray stands in for j3d.LineArray
   and is Serializable.

*/ public class VisADLineArray extends VisADGeometryArray { /** * Merge an array of VisADLineArrays into a single VisADLineArray. * @param arrays array of VisADLineArrays (may be null) * @return a single VisADLineArray with all the info of arrays. * returns null if input is null. */ public static VisADLineArray merge(VisADLineArray[] arrays) throws VisADException { if (arrays == null || arrays.length == 0) return null; VisADLineArray array = new VisADLineArray(); merge(arrays, array); /* int n = arrays.length; int count = 0; boolean color_flag = (arrays[0].colors != null); for (int i=0; i max_length) max_length = lengths[i]; } } // end for (int i=0; i= limit_length) { for (int i=0; i limit_length); } } */ cs = null; rs = null; float[] lastcoord = null; byte[] lastcol = null; VisADLineArray array = new VisADLineArray(); // worst case splits every line float[] coords = new float[3 * coordinates.length]; int color_length = 0; byte[] cols = null; if (colors != null) { color_length = 3; cols = new byte[3 * colors.length]; if (colors.length != coordinates.length) color_length = 4; } int ki = 0; int kj = 0; j = 0; for (int i=0; i<3*len; i+=6) { if (!test[i/3]) { coords[ki] = coordinates[i]; coords[ki+1] = coordinates[i+1]; coords[ki+2] = coordinates[i+2]; coords[ki+3] = coordinates[i+3]; coords[ki+4] = coordinates[i+4]; coords[ki+5] = coordinates[i+5]; ki += 6; if (color_length == 3) { cols[kj] = colors[j]; cols[kj+1] = colors[j+1]; cols[kj+2] = colors[j+2]; cols[kj+3] = colors[j+3]; cols[kj+4] = colors[j+4]; cols[kj+5] = colors[j+5]; kj += 6; } else if (color_length == 4) { cols[kj] = colors[j]; cols[kj+1] = colors[j+1]; cols[kj+2] = colors[j+2]; cols[kj+3] = colors[j+3]; cols[kj+4] = colors[j+4]; cols[kj+5] = colors[j+5]; cols[kj+6] = colors[j+6]; cols[kj+7] = colors[j+7]; kj += 8; } } else { any_split = true; } j += 2 * color_length; } //System.out.println("VisADLineArray.adjustSeam any_split = " + any_split); if (!any_split) { return this; } else { array.vertexCount = ki / 3; array.coordinates = new float[ki]; System.arraycopy(coords, 0, array.coordinates, 0, ki); if (colors != null) { array.colors = new byte[kj]; System.arraycopy(cols, 0, array.colors, 0, kj); } return array; } } public VisADGeometryArray removeMissing() { VisADLineArray array = new VisADLineArray(); float[] coords = new float[coordinates.length]; int color_length = 3; byte[] cols = null; if (colors != null) { cols = new byte[colors.length]; if (colors.length != coordinates.length) color_length = 4; } int k = 0; int m = 0; int j = 0; boolean any_missing = false; for (int i=0; i

Ads help maintain this website.