本文整理汇总了Java中com.google.gwt.core.client.JsArrayNumber.push方法的典型用法代码示例。如果您正苦于以下问题:Java JsArrayNumber.push方法的具体用法?Java JsArrayNumber.push怎么用?Java JsArrayNumber.push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.client.JsArrayNumber
的用法示例。
在下文中一共展示了JsArrayNumber.push方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doDeserializeArray
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public double[] doDeserializeArray( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) {
JsArrayNumber jsArray = JsArrayNumber.createArray().cast();
reader.beginArray();
while ( JsonToken.END_ARRAY != reader.peek() ) {
if ( JsonToken.NULL == reader.peek() ) {
reader.skipValue();
jsArray.push( DEFAULT );
} else {
jsArray.push( reader.nextDouble() );
}
}
reader.endArray();
if ( GWT.isScript() ) {
return reinterpretCast( jsArray );
} else {
int length = jsArray.length();
double[] ret = new double[length];
for ( int i = 0; i < length; i++ ) {
ret[i] = jsArray.get( i );
}
return ret;
}
}
示例2: fromDoubles
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
public static JsArrayNumber fromDoubles(Collection<Double> collection) {
JsArrayNumber array = JsArrayNumber.createArray().cast();
for(Double item : collection) {
array.push(item);
}
return array;
}
示例3: iterateConnectionProxies
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
private String iterateConnectionProxies(SearchResultProxy res) {
List<ConnectionProxy> c = res.getConnections();
Iterator<ConnectionProxy> cp_it = c.iterator();
String total = "";
while(cp_it.hasNext()) {
ConnectionProxy cp = cp_it.next();
String s = "Total distance: " + cp.getDistance() + "m: " + cp.getTime() + "min\n";
Iterator<LineProxy> i = cp.getLines().iterator();
while(i.hasNext()) {
LineProxy lp = i.next();
s += lp.toString();
if(lp.getStartStreet() != null && lp.getDestStreet() != null) {
s += " desde " + lp.getStartStreet() + " hasta " + lp.getDestStreet();
}
s += " /distance: " + lp.getDistance() + "m: " + lp.getTime() + "min\n";
if(lp.getAlternativeLines().size() > 0) {
s += "Alternatives: ";
for(String ss : lp.getAlternativeLines()) {
s += ss + ", ";
}
s = s.substring(0, s.length() - 2);
s += "\n";
}
JsArrayNumber jsnums = getNativeArray();
for(int j = 0; j < lp.getAllPoints().size(); j++) {
jsnums.push(lp.getAllPoints().get(j));
}
drawPoly(jsnums, false, "#000000");
jsnums = getNativeArray();
for(int j = 0; j < lp.getRelevantPoints().size(); j++) {
jsnums.push(lp.getRelevantPoints().get(j));
}
drawPoly(jsnums, false, "#ff0000");
}
s += "\n";
total += s;
}
return total;
}
示例4: setVisibleRange
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
public void setVisibleRange(double... values) {
JsArrayNumber array = JsArrayNumber.createArray().cast();
for (double value : values) {
array.push(value);
}
_setVisibleRange(array);
}
示例5: updateSliderForNumberArray
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
private void updateSliderForNumberArray(SliderOption option, List<Double> value) {
JsArrayNumber array = JavaScriptObject.createArray().cast();
for (Double val : value) {
array.push(val);
}
if (isAttached()) {
setAttribute(getElement(), option.getName(), array);
refresh();
} else {
String arrayStr = JsonUtils.stringify(array);
attributeMixin.setAttribute(option.getDataAttribute(), arrayStr);
}
}
示例6: toJsArray
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
/**
* Converts the range to a JavaScript number array.
*
* @return a JavaScript number array
*/
public JsArrayNumber toJsArray() {
JsArrayNumber array = JavaScriptObject.createArray().cast();
array.push(minValue);
array.push(maxValue);
return array;
}
示例7: setData
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
public final void setData(double[] data){
JsArrayNumber array = JsArrayNumber.createArray().cast();
for(double str : data)
array.push(str);
setData(array);
}
示例8: toJsonText
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
/**
* i can't trust this maybe 2 influence fixed
* @return
*/
public String toJsonText(){
JsArray<AnimationBone> clonedBone=cloneBones(bones);
JSONArray arrays=new JSONArray(clonedBone);
lastJsonObject.put("bones", arrays);
//AnimationBoneConverter.setBoneAngles(clonedBone, rawAnimationData, 0); //TODO
if(withAnimation.getValue()){
lastJsonObject.put("animation", new JSONObject(rawAnimationData));
}
//private JsArray<Vector4> bodyIndices;
//private JsArray<Vector4> bodyWeight;
/*
List<String> lines=new ArrayList<String>();
for(int i=0;i<bodyWeight.length();i++){
lines.add(i+get(bodyWeight.get(i)));
}
LogUtils.log("after");
LogUtils.log(Joiner.on("\n").join(lines));f
*/
//LogUtils.log(bodyIndices);
//LogUtils.log(bodyWeight);
JsArrayNumber indices=(JsArrayNumber) JsArrayNumber.createArray();
for(int i=0;i<bodyIndices.length();i++){
indices.push(bodyIndices.get(i).getX());
indices.push(bodyIndices.get(i).getY());
}
lastJsonObject.put("skinIndices", new JSONArray(indices));
JsArrayNumber weights=(JsArrayNumber) JsArrayNumber.createArray();
for(int i=0;i<bodyWeight.length();i++){
weights.push(bodyWeight.get(i).getX());
weights.push(bodyWeight.get(i).getY());
}
lastJsonObject.put("skinWeights", new JSONArray(weights));
//rewrite gen
JSONModelFile file=(JSONModelFile) lastJsonObject.getJavaScriptObject();
file.getMetaData().setGeneratedBy(getGeneratedBy());
return stringify(lastJsonObject.getJavaScriptObject());
//return lastJsonObject.toString();
}
示例9: setWindowPaddingTopRightBottomLeft
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
/**
* Sets the window padding to top, right, bottom, and right sides. This
* is useful in cases where the window has areas that the drop-down menu
* should not cover - for instance a fixed header.
*
* @param top
* @param right
* @param bottom
* @param left
*/
public void setWindowPaddingTopRightBottomLeft(final int top, final int right,
final int bottom, final int left) {
JsArrayNumber array = JavaScriptObject.createArray(4).cast();
array.push(top);
array.push(right);
array.push(bottom);
array.push(left);
attrMixin.setAttribute(WINDOW_PADDING, JsonUtils.stringify(array));
}
示例10: createAnimation
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
public AnimationClip createAnimation(int boneIndex,double x,double y,double z,boolean both){
Quaternion q=THREE.Quaternion();
Quaternion xq=THREE.Quaternion().setFromAxisAngle(THREE.Vector3(1, 0, 0), x);
q.multiply(xq);
Quaternion yq=THREE.Quaternion().setFromAxisAngle(THREE.Vector3(0, 1, 0), y);
q.multiply(yq);
Quaternion zq=THREE.Quaternion().setFromAxisAngle(THREE.Vector3(0, 0, 1), z);
q.multiply(zq);
Quaternion q2=THREE.Quaternion();
Quaternion xq2=THREE.Quaternion().setFromAxisAngle(THREE.Vector3(1, 0, 0), x*-1);
q2.multiply(xq2);
Quaternion yq2=THREE.Quaternion().setFromAxisAngle(THREE.Vector3(0, 1, 0), y*-1);
q2.multiply(yq2);
Quaternion zq2=THREE.Quaternion().setFromAxisAngle(THREE.Vector3(0, 0, 1), z*-1);
q2.multiply(zq2);
double duration=1.0;
JsArray<KeyframeTrack> tracks=JavaScriptObject.createArray().cast();
JsArrayNumber times=JavaScriptObject.createArray().cast();
times.push(0);
times.push(duration);
times.push(duration*2);
if(both){
times.push(duration*3);
times.push(duration*4);
}
JsArrayNumber values=JsArray.createArray().cast();
JavaScriptUtils.concat(values,THREE.Quaternion().toArray());
JavaScriptUtils.concat(values,q.toArray());
JavaScriptUtils.concat(values,THREE.Quaternion().toArray());
if(both){
JavaScriptUtils.concat(values,q2.toArray());
JavaScriptUtils.concat(values,THREE.Quaternion().toArray());
}
//LogUtils.log(values);
//value is not valid number
//head fixed
//quaternion is alias for rot
QuaternionKeyframeTrack track=THREE.QuaternionKeyframeTrack(".bones["+boneIndex+"].quaternion", times, values);
tracks.push(track);
AnimationClip clip=THREE.AnimationClip(name, -1, tracks);
//LogUtils.log(track.validate());
return clip;
}