ShadowFunctionOrSetType

Hi Bill,

I came across the following exception: UnimplementedException("terminal LEGAL 
unimplemented: ShadowFunctionOrSetType.doTransform"); appearing in a display 
cell. I'm trying to determine what mapping will generate this exception. In 
ShadowFunctionOrSetType.java before the exception is thrown, I'm not sure what 
your code below is doing specifially with the flow1, flow2, and color arrays. 
Can you tell me how this exception is related to those fields?

Thanks,
Michelle

else if (LevelOfDifficulty == SIMPLE_ANIMATE_FIELD) {

        Control control = null;
        Object swit = null;
        int index = -1;

        if (DomainComponents.length == 1) {
          RealType real = (RealType) DomainComponents[0].getType();
          for (int i=0; i<valueArrayLength; i++) {
            ScalarMap map = (ScalarMap) MapVector.elementAt(valueToMap[i]);
            float[] values = display_values[i];
            if (values != null && real.equals(map.getScalar())) {
              int displayScalarIndex = valueToScalar[i];
              DisplayRealType dreal
                display.getDisplayScalar(displayScalarIndex);
              if (dreal.equals(Display.Animation) ||
                  dreal.equals(Display.SelectValue)) {
                swit = shadow_api.makeSwitch();
                index = i;
                control = map.getControl();
                break;
              }
            } // end if (values != null && && real.equals(map.getScalar()))
          } // end for (int i=0; i<valueArrayLength; i++)
        } // end if (DomainComponents.length == 1)

        if (control == null) {
          throw new DisplayException("bad SIMPLE_ANIMATE_FIELD: " +
                                     "ShadowFunctionOrSetType.doTransform");
        }

        for (int i=0; i<domain_length; i++) {
          Object branch = shadow_api.makeBranch();
          if (range_select[0] == null || range_select[0].length == 1 ||
              range_select[0][i]) {
            VisADGeometryArray array = null;

            float[][] sp = new float[3][1];
            if (spatial_values[0].length > 1) {
              sp[0][0] = spatial_values[0][i];
              sp[1][0] = spatial_values[1][i];
              sp[2][0] = spatial_values[2][i];
            }
            else {
              sp[0][0] = spatial_values[0][0];
              sp[1][0] = spatial_values[1][0];
              sp[2][0] = spatial_values[2][0];
            }
            byte[][] co = new byte[3][1];
            if (color_values == null) {
              co[0][0] = floatToByte(constant_color[0]);
              co[1][0] = floatToByte(constant_color[1]);
              co[2][0] = floatToByte(constant_color[2]);
            }
            else if (color_values[0].length > 1) {
              co[0][0] = color_values[0][i];
              co[1][0] = color_values[1][i];
              co[2][0] = color_values[2][i];
            }
            else {
              co[0][0] = color_values[0][0];
              co[1][0] = color_values[1][0];
              co[2][0] = color_values[2][0];
            }
            boolean[][] ra = {{true}};

            boolean anyShapeCreated = false;
            VisADGeometryArray[] arrays
              shadow_api.assembleShape(display_values, valueArrayLength,
                            valueToMap, MapVector, valueToScalar, display,
                            default_values, inherited_values,
                            sp, co, ra, i, shadow_api);
            if (arrays != null) {
              for (int j=0; j<arrays.length; j++) {
                array = arrays[j];
                shadow_api.addToGroup(branch, array, mode,
                                      constant_alpha, constant_color);
                array = null;
/* why null constant_alpha?
                appearance = makeAppearance(mode, null, constant_color, 
geometry);
*/
              }
              anyShapeCreated = true;
              arrays = null;
            }

            boolean anyTextCreated = false;
            if (anyText && text_values != null && text_control != null) {
              String[] te = new String[1];
              if (text_values.length > 1) {
                te[0] = text_values[i];
              }
              else {
                te[0] = text_values[0];
              }
              array = shadow_api.makeText(te, text_control, sp, co, ra);
              if (array != null) {
                shadow_api.addTextToGroup(branch, array, mode,
                                          constant_alpha, constant_color);
                array = null;
                anyTextCreated = true;
              }
            }

            boolean anyFlowCreated = false;
            if (anyFlow) {
              if (flow1_values != null && flow1_values[0] != null) {
                // try Flow1
                float[][] f1 = new float[3][1];
                if (flow1_values[0].length > 1) {
                  f1[0][0] = flow1_values[0][i];
                  f1[1][0] = flow1_values[1][i];
                  f1[2][0] = flow1_values[2][i];
                }
                else {
                  f1[0][0] = flow1_values[0][0];
                  f1[1][0] = flow1_values[1][0];
                  f1[2][0] = flow1_values[2][0];
                }
                arrays = shadow_api.makeFlow(0, f1, flowScale[0], sp, co, ra);
                if (arrays != null) {
                  for (int j=0; j<arrays.length; j++) {
                    if (arrays[j] != null) {
                      shadow_api.addToGroup(branch, arrays[j], mode,
                                            constant_alpha, constant_color);
                      arrays[j] = null;
                    }
                  }
                }
                anyFlowCreated = true;
              }
    
              // try Flow2
              if (flow2_values != null && flow2_values[0] != null) {
                float[][] f2 = new float[3][1];
                if (flow2_values[0].length > 1) {
                  f2[0][0] = flow2_values[0][i];
                  f2[1][0] = flow2_values[1][i];
                  f2[2][0] = flow2_values[2][i];
                }
                else {
                  f2[0][0] = flow2_values[0][0];
                  f2[1][0] = flow2_values[1][0];
                  f2[2][0] = flow2_values[2][0];
                }
                arrays = shadow_api.makeFlow(1, f2, flowScale[1], sp, co, ra);
                if (arrays != null) {
                  for (int j=0; j<arrays.length; j++) {
                    if (arrays[j] != null) {
                      shadow_api.addToGroup(branch, arrays[j], mode,
                                            constant_alpha, constant_color);
                      arrays[j] = null;
                    }
                  }
                }
                anyFlowCreated = true;
              }
            }

            if (!anyShapeCreated && !anyTextCreated &&
                !anyFlowCreated) {
              array = new VisADPointArray();
              array.vertexCount = 1;
              coordinates = new float[3];
              coordinates[0] = sp[0][0];
              coordinates[1] = sp[1][0];
              coordinates[2] = sp[2][0];
              array.coordinates = coordinates;
              if (color_values != null) {
                colors = new byte[3];
                colors[0] = co[0][0];
                colors[1] = co[1][0];
                colors[2] = co[2][0];
                array.colors = colors;
              }
              shadow_api.addToGroup(branch, array, mode,
                                    constant_alpha, constant_color);
              array = null;
              // System.out.println("addChild " + i + " of " + domain_length);
            }
          }
          else { // if (range_select[0][i])
/* WLH 18 Aug 98
   empty BranchGroup or Shape3D may cause NullPointerException
   from Shape3DRetained.setLive
            // add null BranchGroup as child to maintain order
            branch.addChild(new Shape3D());
*/
            // System.out.println("addChild " + i + " of " + domain_length +
            //                    " MISSING");
          }
          shadow_api.addToSwitch(swit, branch);
        } // end for (int i=0; i<domain_length; i++)

        shadow_api.addSwitch(group, swit, control, domain_set, renderer);
        return false;
      }  // end if (LevelOfDifficulty == SIMPLE_ANIMATE_FIELD)
      else { // must be LevelOfDifficulty == LEGAL
        // add values to value_array according to SelectedMapVector-s
        // of RealType-s in Domain (including Reference) and Range
        //
        // accumulate Vector of value_array-s at this ShadowType,
        // to be rendered in a post-process to scanning data
        //
        // ** OR JUST EACH FIELD INDEPENDENTLY **
        //
/*
        return true;
*/
        throw new UnimplementedException("terminal LEGAL unimplemented: " +
                                         "ShadowFunctionOrSetType.doTransform");

Michelle Kam           (408) 742-2881
Lockheed Martin Space Systems Co. SSM/ATC/MSIS
B/153 O/L922 
1111 Lockheed Martin Way, Sunnyvale, CA 94089