本文整理汇总了Java中org.opensourcephysics.controls.XMLControl.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java XMLControl.getDouble方法的具体用法?Java XMLControl.getDouble怎么用?Java XMLControl.getDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensourcephysics.controls.XMLControl
的用法示例。
在下文中一共展示了XMLControl.getDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Loads a DrawingPanel with data from an XMLControl.
*
* @param control the control
* @param obj the object
* @return the loaded object
*/
public Object loadObject(XMLControl control, Object obj) {
DrawingPanel panel = (DrawingPanel) obj;
double xmin = control.getDouble("preferred x min"); //$NON-NLS-1$
double xmax = control.getDouble("preferred x max"); //$NON-NLS-1$
double ymin = control.getDouble("preferred y min"); //$NON-NLS-1$
double ymax = control.getDouble("preferred y max"); //$NON-NLS-1$
panel.setPreferredMinMax(xmin, xmax, ymin, ymax); // this sets autoscale to false
panel.squareAspect = control.getBoolean("square aspect"); //$NON-NLS-1$
if(control.getBoolean("autoscale x")) { //$NON-NLS-1$
panel.setAutoscaleX(true);
}
if(control.getBoolean("autoscale y")) { //$NON-NLS-1$
panel.setAutoscaleY(true);
}
// load the drawables
Collection<?> drawables = Collection.class.cast(control.getObject("drawables")); //$NON-NLS-1$
if(drawables!=null) {
panel.clear();
Iterator<?> it = drawables.iterator();
while(it.hasNext()) {
panel.addDrawable((Drawable) it.next());
}
}
return obj;
}
示例2: 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;
}
示例3: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Loads the DrawableShape using the path stored in the control.
*
* @param control XMLControl
* @param obj Object
* @return Object
*/
public Object loadObject(XMLControl control, Object obj) {
DrawableShape drawableShape = (DrawableShape) obj;
String geometry = 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$
drawableShape.shape = (Shape) control.getObject("general path"); //$NON-NLS-1$
drawableShape.shapeClass = geometry;
drawableShape.x = x;
drawableShape.y = y;
drawableShape.color = (Color) control.getObject("fill color"); //$NON-NLS-1$
drawableShape.edgeColor = (Color) control.getObject("edge color"); //$NON-NLS-1$
drawableShape.setTheta(theta);
return obj;
}
示例4: 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;
}
示例5: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Loads data from the xml control into the ColorMapper object.
* @param control XMLControl
* @param obj Object
* @return Object
*/
public Object loadObject(XMLControl control, Object obj) {
ColorMapper mapper = (ColorMapper) obj;
int paletteType = control.getInt("palette type"); //$NON-NLS-1$
int numColors = control.getInt("number of colors"); //$NON-NLS-1$
double floor = control.getDouble("floor"); //$NON-NLS-1$
double ceil = control.getDouble("ceiling"); //$NON-NLS-1$
if(paletteType==CUSTOM) {
Color[] colors = (Color[]) control.getObject("colors"); //$NON-NLS-1$
mapper.setColorPalette(colors);
} else {
mapper.setPaletteType(paletteType);
mapper.setNumberOfColors(numColors);
}
mapper.setScale(floor, ceil);
Color floorColor = (Color) control.getObject("floor color"); //$NON-NLS-1$
Color ceilColor = (Color) control.getObject("ceiling color"); //$NON-NLS-1$
mapper.setFloorCeilColor(floorColor, ceilColor);
return obj;
}
示例6: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
DrawingPanel3D panel = (DrawingPanel3D) obj;
double minX = control.getDouble("preferred x min"); //$NON-NLS-1$
double maxX = control.getDouble("preferred x max"); //$NON-NLS-1$
double minY = control.getDouble("preferred y min"); //$NON-NLS-1$
double maxY = control.getDouble("preferred y max"); //$NON-NLS-1$
double minZ = control.getDouble("preferred z min"); //$NON-NLS-1$
double maxZ = control.getDouble("preferred z max"); //$NON-NLS-1$
panel.setPreferredMinMax(minX, maxX, minY, maxY, minZ, maxZ);
Collection<?> elements = Collection.class.cast(control.getObject("elements")); //$NON-NLS-1$
if(elements!=null) {
panel.removeAllElements();
Iterator<?> it = elements.iterator();
while(it.hasNext()) {
panel.addElement((Element) it.next());
}
}
// The subclass is responsible to load unmutable objects such as
// the visualization hints or the camera
// It is also responsible to update the screen after loading
return obj;
}
示例7: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Loads a VideoClip with data from an XMLControl.
*
* @param control the element
* @param obj the object
* @return the loaded object
*/
public Object loadObject(XMLControl control, Object obj) {
ClipControl clipControl = (ClipControl) obj;
// set rate
double rate = control.getDouble("rate"); //$NON-NLS-1$
if(rate!=Double.NaN) {
clipControl.setRate(rate);
}
// set dt
double dt = control.getDouble("delta_t"); //$NON-NLS-1$
if(dt!=Double.NaN) {
clipControl.setFrameDuration(dt);
}
// set looping and playing
clipControl.setLooping(control.getBoolean("looping")); //$NON-NLS-1$
// set frame number
if (control.getPropertyNames().contains("frame")) { //$NON-NLS-1$
int n = control.getInt("frame"); //$NON-NLS-1$
n = clipControl.getVideoClip().frameToStep(n);
clipControl.setStepNumber(n);
}
return obj;
}
示例8: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
InteractiveTextLine interactiveTextLine = (InteractiveTextLine) obj;
double x = control.getDouble("x"); //$NON-NLS-1$
double y = control.getDouble("y"); //$NON-NLS-1$
interactiveTextLine.setText(control.getString("text")); //$NON-NLS-1$
interactiveTextLine.enabled = control.getBoolean("is enabled"); //$NON-NLS-1$
interactiveTextLine.enableMeasure = control.getBoolean("is measured"); //$NON-NLS-1$
interactiveTextLine.color = (Color) control.getObject("color"); //$NON-NLS-1$
interactiveTextLine.setXY(x, y);
return obj;
}
示例9: 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;
}
示例10: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
FrameData data = (FrameData) obj;
data.xo = control.getDouble("xorigin"); //$NON-NLS-1$
data.yo = control.getDouble("yorigin"); //$NON-NLS-1$
data.an = control.getDouble("angle"); //$NON-NLS-1$ // angle in degrees
data.xs = control.getDouble("xscale"); //$NON-NLS-1$
data.ys = control.getDouble("yscale"); //$NON-NLS-1$
return obj;
}
示例11: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
Stripchart dataset = (Stripchart) obj;
dataset.xrange = control.getDouble("x_range"); //$NON-NLS-1$
dataset.yrange = control.getDouble("y_range"); //$NON-NLS-1$
dataset.lastx = control.getDouble("last_x"); //$NON-NLS-1$
dataset.rightToLeft = control.getBoolean("right_to_left"); //$NON-NLS-1$
super.loadObject(control, obj);
return obj;
}
示例12: 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;
}
示例13: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
DataColumn column = (DataColumn) obj;
Dataset.getLoader().loadObject(control, column);
if (control.getPropertyNames().contains("shift")) { //$NON-NLS-1$
column.shift = control.getDouble("shift"); //$NON-NLS-1$
}
column.deletable = control.getBoolean("deletable"); //$NON-NLS-1$
return obj;
}
示例14: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
DrawableTextLine drawableTextLine = (DrawableTextLine) obj;
drawableTextLine.x = control.getDouble("x"); //$NON-NLS-1$
drawableTextLine.y = control.getDouble("y"); //$NON-NLS-1$
drawableTextLine.theta = control.getDouble("theta"); //$NON-NLS-1$
drawableTextLine.pixelXY = control.getBoolean("pixel position"); //$NON-NLS-1$
drawableTextLine.setText(control.getString("text")); //$NON-NLS-1$
drawableTextLine.color = (Color) control.getObject("color"); //$NON-NLS-1$
return obj;
}
示例15: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
InteractiveArrow arrow = (InteractiveArrow) 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;
}