//
// ShadowBarbRealTupleTypeJ3D.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.bom;

import visad.*;
import visad.java3d.*;

import java.rmi.*;

/**
   The ShadowBarbRealTupleTypeJ3D class shadows the RealTupleType class
   for BarbManipulationRendererJ3D and BarbRendererJ3D, within a
   DataDisplayLink, under Java3D.

*/ public class ShadowBarbRealTupleTypeJ3D extends ShadowRealTupleTypeJ3D { public ShadowBarbRealTupleTypeJ3D(MathType t, DataDisplayLink link, ShadowType parent) throws VisADException, RemoteException { super(t, link, parent); } public VisADGeometryArray[] makeFlow(int which, float[][] flow_values, float flowScale, float arrowScale, float[][] spatial_values, byte[][] color_values, boolean[][] range_select) throws VisADException { DataRenderer renderer = getLink().getRenderer(); boolean direct = renderer.getIsDirectManipulation(); if (direct && renderer instanceof BarbManipulationRendererJ3D) { return ShadowBarbRealTupleTypeJ3D.staticMakeFlow(getDisplay(), which, flow_values, flowScale, spatial_values, color_values, range_select, renderer, true); } else { return ShadowBarbRealTupleTypeJ3D.staticMakeFlow(getDisplay(), which, flow_values, flowScale, spatial_values, color_values, range_select, renderer, false); } } private static final int NUM = 1024; public static VisADGeometryArray[] staticMakeFlow(DisplayImpl display, int which, float[][] flow_values, float flowScale, float[][] spatial_values, byte[][] color_values, boolean[][] range_select, DataRenderer renderer, boolean direct) throws VisADException { if (flow_values[0] == null) return null; if (spatial_values[0] == null) return null; int len = spatial_values[0].length; int flen = flow_values[0].length; int rlen = 0; // number of non-missing values if (range_select[0] == null) { rlen = len; } else { for (int j=0; j vx.length) { float[] cx = vx; float[] cy = vy; float[] cz = vz; int l = 2 * vx.length; vx = new float[l]; vy = new float[l]; vz = new float[l]; System.arraycopy(cx, 0, vx, 0, cx.length); System.arraycopy(cy, 0, vy, 0, cy.length); System.arraycopy(cz, 0, vz, 0, cz.length); if (color_values != null) { byte[] cred = vred; byte[] cgreen = vgreen; byte[] cblue = vblue; byte[] calpha = (numColors == 4) ? valpha : null; vred = new byte[l]; vgreen = new byte[l]; vblue = new byte[l]; if (calpha != null) valpha = new byte[l]; System.arraycopy(cred, 0, vred, 0, cred.length); System.arraycopy(cgreen, 0, vgreen, 0, cgreen.length); System.arraycopy(cblue, 0, vblue, 0, cblue.length); if (calpha != null) System.arraycopy(calpha, 0, valpha, 0, calpha.length); } } if (numt[0] + NUM/4 > tx.length) { float[] cx = tx; float[] cy = ty; float[] cz = tz; int l = 2 * tx.length; tx = new float[l]; ty = new float[l]; tz = new float[l]; System.arraycopy(cx, 0, tx, 0, cx.length); System.arraycopy(cy, 0, ty, 0, cy.length); System.arraycopy(cz, 0, tz, 0, cz.length); if (color_values != null) { byte[] cred = tred; byte[] cgreen = tgreen; byte[] cblue = tblue; byte[] calpha = (numColors == 4) ? talpha : null; tred = new byte[l]; tgreen = new byte[l]; tblue = new byte[l]; if (calpha != null) talpha = new byte[l]; System.arraycopy(cred, 0, tred, 0, cred.length); System.arraycopy(cgreen, 0, tgreen, 0, cgreen.length); System.arraycopy(cblue, 0, tblue, 0, cblue.length); if (calpha != null) System.arraycopy(calpha, 0, talpha, 0, calpha.length); } } int oldnv = numv[0]; int oldnt = numt[0]; float mbarb[] = ((BarbRenderer) renderer).makeVector(south[j], spatial_values[0][j], spatial_values[1][j], spatial_values[2][j], scale, pt_size, f0, f1, vx, vy, vz, numv, tx, ty, tz, numt); if (direct) { ((BarbManipulationRendererJ3D) renderer). setVectorSpatialValues(mbarb, which); } int nv = numv[0]; int nt = numt[0]; if (color_values != null) { if (color_values[0].length > 1) { for (int i=oldnv; i 0) { tarray = new VisADTriangleArray(); tarray.vertexCount = nt; coordinates = new float[3 * nt]; float[] normals = new float[3 * nt]; m = 0; for (int i=0; i

Ads help maintain this website.