当前位置: 首页>>代码示例>>Java>>正文


Java XMLControl.getObject方法代码示例

本文整理汇总了Java中org.opensourcephysics.controls.XMLControl.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java XMLControl.getObject方法的具体用法?Java XMLControl.getObject怎么用?Java XMLControl.getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opensourcephysics.controls.XMLControl的用法示例。


在下文中一共展示了XMLControl.getObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  InteractiveShape interactiveShape = (InteractiveShape) obj;
  String type = control.getString("geometry");                                                 //$NON-NLS-1$
  double x = control.getDouble("x");                                                           //$NON-NLS-1$
  double y = control.getDouble("y");                                                           //$NON-NLS-1$
  double theta = control.getDouble("theta");                                                   //$NON-NLS-1$
  Shape shape = getShape(type, x, y, control.getDouble("width"), control.getDouble("height")); //$NON-NLS-1$ //$NON-NLS-2$
  if(shape==null) {                                                           // check for special geometry
    interactiveShape.shape = (GeneralPath) control.getObject("general path"); //$NON-NLS-1$
  } else {
    interactiveShape.shape = shape;
  }
  // the shape should already be scaled so just set the instatance fields
  interactiveShape.width = control.getDouble("width");   //$NON-NLS-1$
  interactiveShape.height = control.getDouble("height"); //$NON-NLS-1$
  interactiveShape.xoff = control.getDouble("x offset"); //$NON-NLS-1$
  interactiveShape.yoff = control.getDouble("y offset"); //$NON-NLS-1$
  interactiveShape.x = x;
  interactiveShape.y = y;
  interactiveShape.setPixelSized(control.getBoolean("pixel sized")); //$NON-NLS-1$
  interactiveShape.setEnabled(control.getBoolean("is enabled"));     //$NON-NLS-1$
  interactiveShape.setMeasured(control.getBoolean("is measured"));   //$NON-NLS-1$
  interactiveShape.color = (Color) control.getObject("color"); //$NON-NLS-1$
  interactiveShape.setTheta(theta); // orient the shape
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:27,代码来源:InteractiveShape.java

示例2: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads an ImageCoordSystem with data from an XMLControl.
 *
 * @param control the control
 * @param obj the ImageCoordSystem object
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  ImageCoordSystem coords = (ImageCoordSystem) obj;
  coords.setLocked(false);
  // load fixed origin, angle and scale
  coords.setFixedOrigin(control.getBoolean("fixedorigin")); //$NON-NLS-1$
  coords.setFixedAngle(control.getBoolean("fixedangle"));   //$NON-NLS-1$
  coords.setFixedScale(control.getBoolean("fixedscale"));   //$NON-NLS-1$
  // load frame data
  FrameData[] data = (FrameData[]) control.getObject("framedata"); //$NON-NLS-1$
  coords.setLength(Math.max(coords.getLength(), data.length));
  for(int n = 0; n<data.length; n++) {
  	if (data[n]==null) continue;
    coords.setOriginXY(n, data[n].xo, data[n].yo);
    coords.setAngle(n, data[n].an*Math.PI/180); // convert from degrees to radians
    coords.setScaleXY(n, data[n].xs, data[n].ys);
  }
  // load locked
  coords.setLocked(control.getBoolean("locked")); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:28,代码来源:ImageCoordSystem.java

示例3: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  Histogram his = (Histogram) obj;
  double[] bins = (double[]) control.getObject("bins"); //$NON-NLS-1$
  double[] vals = (double[]) control.getObject("vals"); //$NON-NLS-1$
  his.name = control.getString("name");                           //$NON-NLS-1$
  his.xColumnName = control.getString("x_column_name");           //$NON-NLS-1$
  his.yColumnName = control.getString("y_column_name");           //$NON-NLS-1$
  his.binColumnName = control.getString("bin_column_name");       //$NON-NLS-1$
  his.logScale = control.getBoolean("log_scale");                 //$NON-NLS-1$
  his.discrete = control.getBoolean("discrete");                  //$NON-NLS-1$
  his.adjustForWidth = control.getBoolean("adjust_for_width");    //$NON-NLS-1$
  his.binFillColor = (Color) control.getObject("bin_fill_color"); //$NON-NLS-1$
  his.binEdgeColor = (Color) control.getObject("bin_edge_color"); //$NON-NLS-1$
  his.binStyle = control.getInt("bin_style");                     //$NON-NLS-1$
  his.binWidth = control.getDouble("bin_width");                  //$NON-NLS-1$
  his.binOffset = control.getDouble("bin_offset");                //$NON-NLS-1$
  his.adjustForWidth = control.getBoolean("adjust_for_width");    //$NON-NLS-1$
  if((bins!=null)&&(vals!=null)) {
    for(int i = 0, n = bins.length; i<n; i++) {
      his.append(bins[i], vals[i]);
    }
  }
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:25,代码来源:Histogram.java

示例4: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  super.loadObject(control, obj);
  DrawingPanel3D panel = (DrawingPanel3D) obj;
  // Load the visualization hints
  VisualizationHints hints = (VisualizationHints) control.getObject("visualization hints"); //$NON-NLS-1$
  hints.setPanel(panel);
  panel.visHints = hints;
  panel.hintChanged(VisualizationHints.HINT_DECORATION_TYPE);
  // Load the camera
  Camera cam = (Camera) control.getObject("camera"); //$NON-NLS-1$
  cam.setPanel(panel);
  panel.camera = cam;
  panel.cameraChanged(Camera.CHANGE_ANY);
  // Order a render()
  panel.needsToRecompute = true;
  panel.dirtyImage = true; // new data so image is dirtry
  panel.updatePanel();
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:20,代码来源:DrawingPanel3D.java

示例5: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads properties into a XuggleVideo.
 *
 * @param control the control
 * @param obj the XuggleVideo object
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
	XuggleVideo video = (XuggleVideo) obj;
  Collection<?> filters = (Collection<?>) control.getObject("filters"); //$NON-NLS-1$
  if(filters!=null) {
    video.getFilterStack().clear();
    Iterator<?> it = filters.iterator();
    while(it.hasNext()) {
      Filter filter = (Filter) it.next();
      video.getFilterStack().addFilter(filter);
    }
  }
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:video-engines,代码行数:21,代码来源:XuggleVideo.java

示例6: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  Matrix3DTransformation transf = (Matrix3DTransformation) obj;
  transf.matrix = (double[][]) control.getObject("matrix");         //$NON-NLS-1$
  transf.inverseMatrix = (double[][]) control.getObject("inverse"); //$NON-NLS-1$
  transf.origin = (double[]) control.getObject("origin");           //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:8,代码来源:Matrix3DTransformation.java

示例7: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  FlatData gpd = (FlatData) obj;
  double[] data = (double[]) control.getObject("data"); //$NON-NLS-1$
  gpd.data = data;
  gpd.left = control.getDouble("left");              //$NON-NLS-1$
  gpd.right = control.getDouble("right");            //$NON-NLS-1$
  gpd.bottom = control.getDouble("bottom");          //$NON-NLS-1$
  gpd.top = control.getDouble("top");                //$NON-NLS-1$
  gpd.dx = control.getDouble("dx");                  //$NON-NLS-1$
  gpd.dy = control.getDouble("dy");                  //$NON-NLS-1$
  gpd.cellData = control.getBoolean("is cell data"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:14,代码来源:FlatData.java

示例8: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads data from the xml control into the Arrow object.
 * @param control XMLControl
 * @param obj Object
 * @return Object
 */
public Object loadObject(XMLControl control, Object obj) {
  Arrow arrow = (Arrow) obj;
  arrow.x = control.getDouble("x");                        //$NON-NLS-1$
  arrow.y = control.getDouble("y");                        //$NON-NLS-1$
  arrow.a = control.getDouble("a");                        //$NON-NLS-1$
  arrow.b = control.getDouble("b");                        //$NON-NLS-1$
  arrow.headSize = (float) control.getDouble("head size"); //$NON-NLS-1$
  arrow.color = (Color) control.getObject("color");        //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:17,代码来源:ArrowLoader.java

示例9: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  FunctionTool tool = (FunctionTool)obj;
  ArrayList<?> functions = (ArrayList<?>) control.getObject("functions"); //$NON-NLS-1$
  if(functions!=null) {
    for(Iterator<?> it = functions.iterator(); it.hasNext(); ) {
      FunctionPanel panel = (FunctionPanel) it.next();
      tool.addPanel(panel.getName(), panel);
    }
  }
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:12,代码来源:FunctionTool.java

示例10: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  DataFunction data = (DataFunction) obj;
  data.setYColumnName(control.getString("function_name")); //$NON-NLS-1$
  data.setExpression(control.getString("function"));       //$NON-NLS-1$
  data.setYColumnDescription(control.getString("y_description")); //$NON-NLS-1$
  data.setID(control.getInt("datasetID"));                 //$NON-NLS-1$
  // load Dataset display properties but not data itself
  if(control.getPropertyNames().contains("marker_shape")) { //$NON-NLS-1$
    data.setMarkerShape(control.getInt("marker_shape"));    //$NON-NLS-1$
  }
  if(control.getPropertyNames().contains("marker_size")) { //$NON-NLS-1$
    data.setMarkerSize(control.getInt("marker_size"));     //$NON-NLS-1$
  }
  data.setSorted(control.getBoolean("sorted"));       //$NON-NLS-1$
  data.setConnected(control.getBoolean("connected")); //$NON-NLS-1$
  Color color = (Color) control.getObject("line_color"); //$NON-NLS-1$
  if(color!=null) {
    data.setLineColor(color);
  }
  Color fill = (Color) control.getObject("fill_color"); //$NON-NLS-1$
  color = (Color) control.getObject("edge_color"); //$NON-NLS-1$
  if(fill!=null) {
    if(color!=null) {
      data.setMarkerColor(fill, color);
    } else {
      data.setMarkerColor(fill);
    }
  }
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:31,代码来源:DataFunction.java

示例11: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  InteractiveCenteredArrow arrow = (InteractiveCenteredArrow) obj;
  double x = control.getDouble("x");      //$NON-NLS-1$
  double y = control.getDouble("y");      //$NON-NLS-1$
  double w = control.getDouble("width");  //$NON-NLS-1$
  double h = control.getDouble("height"); //$NON-NLS-1$
  arrow.enabled = control.getBoolean("is enabled");        //$NON-NLS-1$
  arrow.enableMeasure = control.getBoolean("is measured"); //$NON-NLS-1$
  arrow.color = (Color) control.getObject("color");        //$NON-NLS-1$
  arrow.setXY(x, y);
  arrow.setWidthHeight(w, h);
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:14,代码来源:InteractiveCenteredArrow.java

示例12: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads an object with data from an XMLControl.
 *
 * @param control the control
 * @param obj the object
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  DoubleArray dataArray = (DoubleArray) obj;
  double[] data = (double[]) control.getObject("data"); //$NON-NLS-1$
  dataArray.array = data;
  dataArray.defaultArray = data;
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:15,代码来源:DoubleArray.java

示例13: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads an object with data from an XMLControl.
 *
 * @param control the control
 * @param obj the object
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  IntegerArray dataArray = (IntegerArray) obj;
  int[] data = (int[]) control.getObject("data"); //$NON-NLS-1$
  dataArray.array = data;
  dataArray.defaultArray = data;
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:15,代码来源:IntegerArray.java

示例14: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  UserFunctionEditor editor = (UserFunctionEditor) obj;
  UserFunction[] functions = (UserFunction[]) control.getObject("main_functions"); //$NON-NLS-1$
  editor.setMainFunctions(functions);
  int row = functions.length;
  functions = (UserFunction[]) control.getObject("support_functions"); //$NON-NLS-1$
  if(functions!=null) {
    for(int i = 0; i<functions.length; i++) {
      editor.addObject(functions[i], row+i, false, false);
    }
  }
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:14,代码来源:UserFunctionEditor.java

示例15: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  Trail trail = (Trail) obj;
  trail.connected = control.getBoolean("connected");                   //$NON-NLS-1$
  trail.color = (Color) control.getObject("color");                    //$NON-NLS-1$
  trail.numpts = control.getInt("number of pts");                      //$NON-NLS-1$
  trail.generalPath = (GeneralPath) control.getObject("general path"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:9,代码来源:Trail.java


注:本文中的org.opensourcephysics.controls.XMLControl.getObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。