Java 类com.google.gwt.core.client.JsArrayUtils 实例源码

项目:jmini3d    文件:GpuUploader.java   
public Integer upload(VertexColors vertexColors) {
    if (vertexColors == null) {
        return null;
    }

    Integer bufferId = vertexColorsBuffers.get(vertexColors);
    if ((vertexColors.status & GpuObjectStatus.VERTEX_COLORS_UPLOADED) == 0) {
        vertexColors.status |= GpuObjectStatus.VERTEX_COLORS_UPLOADED;

        float[] colors = vertexColors.getVertexColors();
        if (colors != null) {
            if (bufferId == null) {
                bufferId = gl.createBuffer();
                vertexColorsBuffers.put(vertexColors, bufferId);
            }
            gl.bindBuffer(WebGLRenderingContext.ARRAY_BUFFER, bufferId);
            gl.bufferData(WebGLRenderingContext.ARRAY_BUFFER, JsUtils.createFloat32Array(JsArrayUtils.readOnlyJsArray(colors)), WebGLRenderingContext.STATIC_DRAW);
        }
    }

    return bufferId;
}
项目:DMWeb    文件:LineString.java   
public LineString(Point[] points)
{
   JavaScriptObject[] tmp = new JavaScriptObject[points.length];
   for (int i = 0; i < points.length; i++)
   {
      tmp[i] = points[i].jsGeometry;
   }
   JsArray<JavaScriptObject> jsArray = JsArrayUtils.readOnlyJsArray(tmp);
   this.jsGeometry = this.newLineString(jsArray);
}
项目:empiria.player    文件:JSArrayUtils.java   
public static <T extends JavaScriptObject> JsArray<JavaScriptObject> convert(Collection<T> collection) {
    JavaScriptObject[] array = collection.toArray(new JavaScriptObject[0]);
    return JsArrayUtils.readOnlyJsArray(array);
}
项目:gwt-worker    文件:MessagePortRefJsoImpl.java   
@Override
public final void postMessage(int message, Transferable... t) {
    JsArray<TransferableJsoImpl> ts = JsArrayUtils.readOnlyJsArray((TransferableJsoImpl[])t);
    postMessage(message, ts);
}
项目:gwt-worker    文件:MessagePortRefJsoImpl.java   
@Override
public final void postMessage(String message, Transferable... t) {
    JsArray<TransferableJsoImpl> ts = JsArrayUtils.readOnlyJsArray((TransferableJsoImpl[])t);
    postMessage(message, ts);
}
项目:gwt-worker    文件:MessagePortRefJsoImpl.java   
@Override
public final void postMessage(JavaScriptObject message, Transferable... t) {
    JsArray<TransferableJsoImpl> ts = JsArrayUtils.readOnlyJsArray((TransferableJsoImpl[])t);
    postMessage(message, ts);
}
项目:vtm    文件:Tessellator.java   
public static int tessellate(float[] points, int ppos, int plen, int[] index,
        int ipos, int rings, int vertexOffset, VertexData outTris) {

    Int32Array io;
    try {
        io = tessellate(JsArrayUtils.readOnlyJsArray(points), ppos, plen,
                        JsArrayUtils.readOnlyJsArray(index), ipos, rings);
    } catch (JavaScriptException e) {
        e.printStackTrace();
        return 0;
    }

    if (io == null) {
        //log.debug("building tessellation failed");
        return 0;
    }

    //      if (vo.length() != plen) {
    //          // TODO handle different output points
    //          log.debug(" + io.length());
    //
    //          //for (int i = 0; i < vo.length(); i += 2)
    //          //  log.debug(vo.get(i) + " " + vo.get(i + 1));
    //          //for (int i = ppos; i < ppos + plen; i += 2)
    //          //  log.debug( points[i]+ " " + points[i + 1]);
    //
    //          return 0;
    //      }

    int numIndices = io.length();

    for (int k = 0, cnt = 0; k < numIndices; k += cnt) {
        VertexData.Chunk chunk = outTris.obtainChunk();

        cnt = VertexData.SIZE - chunk.used;

        if (k + cnt > numIndices)
            cnt = numIndices - k;

        for (int i = 0; i < cnt; i++) {
            int idx = (vertexOffset + io.get(k + i));
            chunk.vertices[chunk.used + i] = (short) idx;
        }
        chunk.used += cnt;
        outTris.releaseChunk();
    }

    return numIndices;
}
项目:jmini3d    文件:GpuUploader.java   
public GeometryBuffers upload(Geometry geometry3d) {
    GeometryBuffers buffers = geometryBuffers.get(geometry3d);
    if (buffers == null) {
        buffers = new GeometryBuffers();
        geometryBuffers.put(geometry3d, buffers);
    }

    if ((geometry3d.status & GpuObjectStatus.VERTICES_UPLOADED) == 0) {
        geometry3d.status |= GpuObjectStatus.VERTICES_UPLOADED;
        float[] vertex = geometry3d.vertex();
        if (vertex != null) {
            if (buffers.vertexBufferId == null) {
                buffers.vertexBufferId = gl.createBuffer();
            }
            gl.bindBuffer(WebGLRenderingContext.ARRAY_BUFFER, buffers.vertexBufferId);
            gl.bufferData(WebGLRenderingContext.ARRAY_BUFFER, JsUtils.createFloat32Array(JsArrayUtils.readOnlyJsArray(vertex)), WebGLRenderingContext.STATIC_DRAW);
        }
    }

    if ((geometry3d.status & GpuObjectStatus.NORMALS_UPLOADED) == 0) {
        geometry3d.status |= GpuObjectStatus.NORMALS_UPLOADED;
        float[] normals = geometry3d.normals();
        if (normals != null) {
            if (buffers.normalsBufferId == null) {
                buffers.normalsBufferId = gl.createBuffer();
            }
            gl.bindBuffer(WebGLRenderingContext.ARRAY_BUFFER, buffers.normalsBufferId);
            gl.bufferData(WebGLRenderingContext.ARRAY_BUFFER, JsUtils.createFloat32Array(JsArrayUtils.readOnlyJsArray(normals)), WebGLRenderingContext.STATIC_DRAW);
        }
    }

    if ((geometry3d.status & GpuObjectStatus.UVS_UPLOADED) == 0) {
        geometry3d.status |= GpuObjectStatus.UVS_UPLOADED;
        float[] uvs = geometry3d.uvs();
        if (uvs != null) {
            if (buffers.uvsBufferId == null) {
                buffers.uvsBufferId = gl.createBuffer();
            }
            gl.bindBuffer(WebGLRenderingContext.ARRAY_BUFFER, buffers.uvsBufferId);
            gl.bufferData(WebGLRenderingContext.ARRAY_BUFFER, JsUtils.createFloat32Array(JsArrayUtils.readOnlyJsArray(uvs)), WebGLRenderingContext.STATIC_DRAW);
        }
    }

    if ((geometry3d.status & GpuObjectStatus.FACES_UPLOADED) == 0) {
        geometry3d.status |= GpuObjectStatus.FACES_UPLOADED;
        short[] faces = geometry3d.faces();
        if (faces != null) {
            geometry3d.facesLength = faces.length;
            if (buffers.facesBufferId == null) {
                buffers.facesBufferId = gl.createBuffer();
            }
            gl.bindBuffer(WebGLRenderingContext.ELEMENT_ARRAY_BUFFER, buffers.facesBufferId);
            gl.bufferData(WebGLRenderingContext.ELEMENT_ARRAY_BUFFER, JsUtils.createInt16Array(JsArrayUtils.readOnlyJsArray(faces)), WebGLRenderingContext.STATIC_DRAW);
        }
    }
    return buffers;
}
项目:gwt-rtc    文件:Constraints.java   
public final void setOptional(Constraint[] constraint){
    set("optional", JsArrayUtils.readOnlyJsArray(constraint));
}
项目:gwt-d3    文件:Array.java   
/**
 * Create a new Array from the given values.
 * 
 * @param args
 *            the values
 * @return the new array
 */
public static final Array<Integer> fromInts(final int... args) {
    Array<Integer> a = JsArrayUtils.readOnlyJsArray(args).cast();
    replaceArrayToString(a);
    return a;
}
项目:gwt-d3    文件:Array.java   
/**
 * Create a new Array from the given values.
 * 
 * @param args
 *            the values
 * @return the new array
 */
public static final Array<Byte> fromBytes(final byte... args) {
    Array<Byte> a = JsArrayUtils.readOnlyJsArray(args).cast();
    replaceArrayToString(a);
    return a;
}
项目:gwt-d3    文件:Array.java   
/**
 * Create a new Array from the given values.
 * 
 * @param args
 *            the values
 * @return the new array
 */
public static final Array<Double> fromDoubles(final double... args) {
    Array<Double> a = JsArrayUtils.readOnlyJsArray(args).cast();
    replaceArrayToString(a);
    return a;
}
项目:gwt-d3    文件:Array.java   
/**
 * Create a new Array from the given values.
 * 
 * @param args
 *            the values
 * @return the new array
 */
public static final Array<Float> fromFloats(final float... args) {
    Array<Float> a = JsArrayUtils.readOnlyJsArray(args).cast();
    replaceArrayToString(a);
    return a;
}
项目:gwt-d3    文件:Array.java   
/**
 * Create a new Array from the given values.
 * 
 * @param args
 *            the values
 * @return the new array
 */
public static final Array<Long> fromLongs(final long... args) {
    Array<Long> a = JsArrayUtils.readOnlyJsArray(args).cast();
    replaceArrayToString(a);
    return a;
}
项目:gwt-d3    文件:Array.java   
/**
 * Create a new Array from the given values.
 * 
 * @param args
 *            the values
 * @return the new array
 */
public static final Array<Short> fromShorts(final short... args) {
    Array<Short> a = JsArrayUtils.readOnlyJsArray(args).cast();
    replaceArrayToString(a);
    return a;
}
项目:gwt-d3    文件:ContinuousQuantitativeScale.java   
/**
 * See {@link #rangeRound(JavaScriptObject)}.
 * 
 * @param numbers
 * @return the current scale for chaining
 */
public final S rangeRound(final double... numbers) {
    return this.rangeRound(JsArrayUtils.readOnlyJsArray(numbers));
}
项目:gwt-d3    文件:Selection.java   
/**
 * Joins the specified array of data with the current selection using the
 * default by-index key mapping.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @return the update selection
 */
public final UpdateSelection data(final byte[] array) {
    return data(JsArrayUtils.readOnlyJsArray(array));
}
项目:gwt-d3    文件:Selection.java   
/**
 * Same as {@link #data(JavaScriptObject, KeyFunction)}.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @param keyFunction
 *            the function to control how data is mapped to the selection
 *            elements
 * @return the update selection
 */
public final UpdateSelection data(final byte[] array,
        final KeyFunction<?> keyFunction) {
    return data(JsArrayUtils.readOnlyJsArray(array), keyFunction);
}
项目:gwt-d3    文件:Selection.java   
/**
 * Joins the specified array of data with the current selection using the
 * default by-index key mapping.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @return the update selection
 */
public final UpdateSelection data(final double[] array) {
    return data(JsArrayUtils.readOnlyJsArray(array));
}
项目:gwt-d3    文件:Selection.java   
/**
 * Same as {@link #data(JavaScriptObject, KeyFunction)}.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @param keyFunction
 *            the function to control how data is mapped to the selection
 *            elements
 * @return the update selection
 */
public final UpdateSelection data(final double[] array,
        final KeyFunction<?> keyFunction) {
    return data(JsArrayUtils.readOnlyJsArray(array), keyFunction);
}
项目:gwt-d3    文件:Selection.java   
/**
 * Joins the specified array of data with the current selection using the
 * default by-index key mapping.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @return the update selection
 */
public final UpdateSelection data(final float[] array) {
    return data(JsArrayUtils.readOnlyJsArray(array));
}
项目:gwt-d3    文件:Selection.java   
/**
 * Same as {@link #data(JavaScriptObject, KeyFunction)}.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @param keyFunction
 *            the function to control how data is mapped to the selection
 *            elements
 * @return the update selection
 */
public final UpdateSelection data(final float[] array,
        final KeyFunction<?> keyFunction) {
    return data(JsArrayUtils.readOnlyJsArray(array), keyFunction);
}
项目:gwt-d3    文件:Selection.java   
/**
 * Joins the specified array of data with the current selection using the
 * default by-index key mapping.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @return the update selection
 */
public final UpdateSelection data(final int[] array) {
    return data(JsArrayUtils.readOnlyJsArray(array));
}
项目:gwt-d3    文件:Selection.java   
/**
 * Same as {@link #data(JavaScriptObject, KeyFunction)}.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @param keyFunction
 *            the function to control how data is mapped to the selection
 *            elements
 * @return the update selection
 */
public final UpdateSelection data(final int[] array,
        final KeyFunction<?> keyFunction) {
    return data(JsArrayUtils.readOnlyJsArray(array), keyFunction);
}
项目:gwt-d3    文件:Selection.java   
/**
 * Joins the specified array of data with the current selection using the
 * default by-index key mapping.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @return the update selection
 */
public final UpdateSelection data(final long[] array) {
    return data(JsArrayUtils.readOnlyJsArray(array));
}
项目:gwt-d3    文件:Selection.java   
/**
 * Same as {@link #data(JavaScriptObject, KeyFunction)}.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @param keyFunction
 *            the function to control how data is mapped to the selection
 *            elements
 * @return the update selection
 */
public final UpdateSelection data(final long[] array,
        final KeyFunction<?> keyFunction) {
    return data(JsArrayUtils.readOnlyJsArray(array), keyFunction);
}
项目:gwt-d3    文件:Selection.java   
/**
 * Joins the specified array of data with the current selection using the
 * default by-index key mapping.
 * <p>
 *
 * @param array
 *            the data array to map to the selection
 * @return the update selection
 */
public final UpdateSelection data(final short[] array) {
    return data(JsArrayUtils.readOnlyJsArray(array));
}