//
// ShadowNodeFunctionTypeJ3D.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.cluster;

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

import java.rmi.*;

import java.awt.image.*;

/**
   The ShadowNodeFunctionTypeJ3D class shadows the FunctionType class for
   NodeRendererJ3D, within a DataDisplayLink, under Java3D.

*/ public class ShadowNodeFunctionTypeJ3D extends ShadowFunctionTypeJ3D { public ShadowNodeFunctionTypeJ3D(MathType t, DataDisplayLink link, ShadowType parent) throws VisADException, RemoteException { super(t, link, parent); } public boolean doTransform(Object group, Data data, float[] value_array, float[] default_values, DataRenderer renderer) throws VisADException, RemoteException { Data new_data = data; if (renderer instanceof NodeRendererJ3D && data instanceof RemoteNodePartitionedFieldImpl) { int resolution = ((NodeRendererJ3D) renderer).getResolution(); if (resolution > 1) { FieldImpl adaptedField = ((RemoteNodePartitionedFieldImpl) data).getAdaptedField(); Set set = adaptedField.getDomainSet(); if (set instanceof Gridded3DSet && set.getManifoldDimension() == 3) { Gridded3DSet domain_set = (Gridded3DSet) set; float[][] samples = domain_set.getSamples(false); int x_len = domain_set.getLength(0); int y_len = domain_set.getLength(1); int z_len = domain_set.getLength(2); int len = domain_set.getLength(); int new_x_len = 1 + (x_len - 1) / resolution; int new_y_len = 1 + (y_len - 1) / resolution; int new_z_len = 1 + (z_len - 1) / resolution; int new_len = new_x_len * new_y_len * new_z_len; float[][] new_samples = new float[3][new_len]; for (int x=0; x 0) { ((VisADGroup) group).setChild(branch, 0); } else { ((VisADGroup) group).addChild(branch); } } public Object makeSwitch() { return new VisADSwitch(); } public Object makeBranch() { VisADGroup branch = new VisADGroup(); return branch; } public void addToGroup(Object group, Object branch) throws VisADException { ((VisADGroup) group).addChild((VisADGroup) branch); } public void addToSwitch(Object swit, Object branch) throws VisADException { ((VisADSwitch) swit).addChild((VisADGroup) branch); } public void addSwitch(Object group, Object swit, Control control, Set domain_set, DataRenderer renderer) throws VisADException { ((VisADSwitch) swit).setSet(domain_set); // Serialize domain_set with swit ((VisADGroup) group).addChild((VisADSwitch) swit); } // NOT true in ShadowFunctionOrSetTypeJ3D // could be true for better Serializable compression // but false means client does not need to un-index it public boolean wantIndexed() { return false; } public boolean addToGroup(Object group, VisADGeometryArray array, GraphicsModeControl mode, float constant_alpha, float[] constant_color) throws VisADException { return ShadowNodeFunctionTypeJ3D.staticAddToGroup(group, array, mode, constant_alpha, constant_color); } public static boolean staticAddToGroup(Object group, VisADGeometryArray array, GraphicsModeControl mode, float constant_alpha, float[] constant_color) throws VisADException { if (array != null) { VisADAppearance appearance = makeAppearance(mode, constant_alpha, constant_color, array); ((VisADGroup) group).addChild(appearance); return true; } else { return false; } } /** construct an VisADAppearance object */ static VisADAppearance makeAppearance(GraphicsModeControl mode, float constant_alpha, float[] constant_color, VisADGeometryArray array) { VisADAppearance appearance = new VisADAppearance(); appearance.pointSize = mode.getPointSize(); appearance.lineWidth = mode.getLineWidth(); appearance.alpha = constant_alpha; // may be Float.NaN if (constant_color != null && constant_color.length == 3) { appearance.color_flag = true; appearance.red = constant_color[0]; appearance.green = constant_color[1]; appearance.blue = constant_color[2]; } appearance.array = array; // may be null return appearance; } }

Ads help maintain this website.