示例#1
0
  static {
    try {
      PropertyDescriptor pd = null;
      sProperties = new ArrayList<PropertyDescriptor>(PhysicalObjectBeanInfo.getPropertyList());
      /*
      			pd = new PropertyDescriptor("boundingArea",baseClass);
      			pd.setBound(true);
      			sProperties.add(pd);

      */
      pd = new PropertyDescriptor("application", baseClass);
      pd.setBound(true);
      sProperties.add(pd);
      pd = new PropertyDescriptor("dip", baseClass);
      sProperties.add(pd);
      pd = new PropertyDescriptor("generatingB", baseClass);
      pd.setBound(true);
      sProperties.add(pd);
      pd = new PropertyDescriptor("globalField", baseClass);
      pd.setBound(true);
      sProperties.add(pd);
      pd = new PropertyDescriptor("numStripes", baseClass);
      pd.setBound(true);
      sProperties.add(pd);
      pd = new PropertyDescriptor("spreadAxis", baseClass);
      pd.setBound(true);
      sProperties.add(pd);
      pd = new PropertyDescriptor("strike", baseClass);
      pd.setBound(true);
      sProperties.add(pd);
      pd = new PropertyDescriptor("stripsDip", baseClass);
      pd.setBound(true);
      sProperties.add(pd);

      TDebug.println(baseClass.getName() + "BeanInfo: array complete");
    } catch (IntrospectionException ie) {
      TDebug.println(ie.getMessage());
    }
  }
示例#2
0
 public void vec2FieldMagnitude(Field field, AffineTransform ftoi) {
   AffineTransform itof = null;
   try {
     itof = ftoi.createInverse();
   } catch (NoninvertibleTransformException niv) {
     TDebug.println(0, "NoninvertibleTransformException: " + niv);
   }
   Vector3d v = new Vector3d();
   Point2D.Double p = new Point2D.Double();
   for (int j = 0, k = 0; j < height; ++j)
     for (int i = 0; i < width; ++i, ++k) {
       p.x = i;
       p.y = j;
       itof.transform(p, p);
       v = field.get(p.x, p.y, 0.0);
       f[k] = (float) Math.sqrt(v.x * v.x + v.y * v.y);
     }
 }
示例#3
0
 public void vec2FieldZero(Field field, AffineTransform ftoi) {
   AffineTransform itof = null;
   try {
     itof = ftoi.createInverse();
   } catch (NoninvertibleTransformException niv) {
     TDebug.println(0, "NoninvertibleTransformException: " + niv);
   }
   Vector3d v = new Vector3d();
   Point2D.Double p = new Point2D.Double();
   for (int j = 0, k = 0; j < height; ++j)
     for (int i = 0; i < width; ++i, ++k) {
       p.x = i;
       p.y = j;
       itof.transform(p, p);
       v = field.get(p.x, p.y, 0.0);
       if ((v.x == 0.0) && (v.y == 0.0)) f[k] = 1.0f;
       else f[k] = 0.0f;
     }
 }
示例#4
0
 public void actionPerformed(ActionEvent e) {
   String command = e.getActionCommand();
   System.out.println("Action: " + command);
   if (e.getActionCommand().compareToIgnoreCase("Capacitor2") == 0) {
     if ((mFramework != null) && (mFramework instanceof TFramework)) {
       ((TFramework) mFramework).openBrowser("help/capacitor.html");
     } else {
       TDebug.println("mFramework is null!");
     }
   } else if (e.getSource() == plate1Number) {
     int value = 0;
     try {
       value = Integer.parseInt(plate1Number.getText());
     } catch (NumberFormatException exception) {
       return;
     }
     if (value < 0) {
       value = 0;
       plate1Number.setText("0");
     }
     int change = value - pcList1.size();
     if (change > 0) {
       addChargesToList1(change);
     } else {
       removeChargesFromList1(-change);
     }
   } else if (e.getSource() == plate2Number) {
     int value = 0;
     try {
       value = Integer.parseInt(plate2Number.getText());
     } catch (NumberFormatException exception) {
       return;
     }
     if (value < 0) {
       value = 0;
       plate2Number.setText("0");
     }
     int change = value - pcList2.size();
     if (change > 0) {
       addChargesToList2(change);
     } else {
       removeChargesFromList2(-change);
     }
   } else if (e.getSource() == plate1Charge) {
     double value = 0.;
     try {
       value = Double.parseDouble(plate1Charge.getText());
     } catch (NumberFormatException exception) {
       return;
     }
     for (int i = 0; i < pcList1.size(); i++) {
       PointCharge pc = (PointCharge) pcList1.get(i);
       pc.setCharge(value);
     }
   } else if (e.getSource() == plate2Charge) {
     double value = 0.;
     try {
       value = Double.parseDouble(plate2Charge.getText());
     } catch (NumberFormatException exception) {
       return;
     }
     for (int i = 0; i < pcList2.size(); i++) {
       PointCharge pc = (PointCharge) pcList2.get(i);
       pc.setCharge(value);
     }
   } else {
     super.actionPerformed(e);
   }
 }
  public void actionPerformed(ActionEvent evt) {
    if (evt.getSource() == showLinesCB) {
      setLinesEnabled(showLinesCB.isSelected());

    } else if (evt.getSource() == showFVisCB) {
      setFVEnabled(showFVisCB.isSelected());

    } else if (evt.getSource() == colorModeCB) {
      perVertexColor = colorModeCB.isSelected();
      manager.setColorMode(
          colorModeCB.isSelected() ? FieldLine.COLOR_VERTEX : FieldLine.COLOR_VERTEX_FLAT);

    } else {
      int cmd = Integer.parseInt(evt.getActionCommand());
      if (fconvolution != null) {
        Cursor cr = null;
        if (fWork instanceof TFramework) {
          cr = ((TFramework) fWork).getAppCursor();
          ((TFramework) fWork).setAppCursor(new Cursor(Cursor.WAIT_CURSOR));
        }
        Thread.yield();
        TSimEngine model = fconvolution.getSimEngine();
        if (model != null) {
          TEngineControl smc = model.getEngineControl();
          if (smc.getSimState() == TEngineControl.RUNNING) {
            smc.stop();
            model.refresh();
            Thread.yield();
          }

          switch (cmd) {
            case DLIC.DLIC_FLAG_E:
              //                            fconvolution.setField(((EMEngine)model).getEField());
              fconvolution.setField(model.getElementByType(EField.class));
              fconvolution.generateFieldImage();
              break;
            case DLIC.DLIC_FLAG_B:
              //                            fconvolution.setField(((EMEngine)model).getBField());
              fconvolution.setField(model.getElementByType(BField.class));
              fconvolution.generateFieldImage();
              break;
            case DLIC.DLIC_FLAG_G:
              //                            fconvolution.setField(((EMEngine)model).getGField());
              fconvolution.setField(model.getElementByType(GField.class));
              fconvolution.generateFieldImage();
              break;
            case DLIC.DLIC_FLAG_P:
              //                            fconvolution.setField(((EMEngine)model).getPField());
              fconvolution.setField(model.getElementByType(PField.class));
              fconvolution.generateFieldImage();
              break;
            case DLIC.DLIC_FLAG_EP:
              //                            fconvolution.setField(new
              // Potential(((EMEngine)model).getEField()));
              fconvolution.setField(new Potential(model.getElementByType(EField.class)));
              fconvolution.generateFieldImage();
              break;
            case DLIC.DLIC_FLAG_BP:
              //                            fconvolution.setField(new
              // Potential(((EMEngine)model).getBField()));
              fconvolution.setField(new Potential(model.getElementByType(BField.class)));
              fconvolution.generateFieldImage();
              break;
            case DLIC.DLIC_FLAG_EF:
              //                            fconvolution.setField(((EMEngine)model).getEField());
              fconvolution.setField(model.getElementByType(EField.class));
              fconvolution.generateColorMappedFluxImage();
              break;
            case DLIC.DLIC_FLAG_BF:
              //                            fconvolution.setField(((EMEngine)model).getBField());
              fconvolution.setField(model.getElementByType(BField.class));
              fconvolution.generateColorMappedFluxImage();
              break;
            default:
              break;
          }
          fconvolution.getImage();
        } else {
          TDebug.println(0, "DLIC model is null");
        }
        if (fWork instanceof TFramework) {
          ((TFramework) fWork).setAppCursor(cr);
        }
      }
    }
  }