资源简介

该文件涉及VISSIM COM接口的基本指令,内容包括通过JAVA, C++, VB, MATLAB, PYTHON等语言对VISSIM COM 接口进行操作的基本指令。

资源截图

代码片段和文件信息



import com.jacob.com.SafeArray;
import com.jacob.com.Variant;

public class COM_Basic_Commands_utils
{
    private final static String DIMENSION_ERROR = “Wrong Dimension in SafeArray!“;

    public static Variant[][] get2DArrayFromSafeArray(SafeArray safeArray) throws Exception
    {
        if (isTwoDimensional(safeArray))
        {
            int size1 = getFirstDimensionSize(safeArray);
            int size2 = getSecondDimensionSize(safeArray);
            Variant[][] array = new Variant[size1][size2];
            for (int i = 0; i < size1; i++)
            {
                for (int j = 0; j < size2; j++)
                {
                    array[i][j] = safeArray.getVariant(i j);
                }
            }
            return array;
        }
        throw new Exception(DIMENSION_ERROR);
    }

    public static int[][] get2DIntArrayFromSafeArray(SafeArray safeArray) throws Exception
    {
        if (isTwoDimensional(safeArray))
        {
            int size1 = getFirstDimensionSize(safeArray);
            int size2 = getSecondDimensionSize(safeArray);
            int[][] array = new int[size1][size2];
            for (int i = 0; i < size1; i++)
            {
                for (int j = 0; j < size2; j++)
                {
                    array[i][j] = safeArray.getInt(i j);
                }
            }
            return array;
        }
        throw new Exception(DIMENSION_ERROR);
    }


    public static String[][] get2DStringArrayFromSafeArray(SafeArray safeArray) throws Exception
    {
        if (isTwoDimensional(safeArray))
        {
            int size1 = getFirstDimensionSize(safeArray);
            int size2 = getSecondDimensionSize(safeArray);
            String[][] array = new String[size1][size2];
            for (int i = 0; i < size1; i++)
            {
                for (int j = 0; j < size2; j++)
                {
                    array[i][j] = safeArray.getString(i j);
                }
            }
            return array;
        }
        throw new Exception(DIMENSION_ERROR);
    }

    public static double[][] get2DDoubleArrayFromSafeArray(SafeArray safeArray) throws Exception
    {
        if (isTwoDimensional(safeArray))
        {
            int size1 = getFirstDimensionSize(safeArray);
            int size2 = getSecondDimensionSize(safeArray);
            double[][] array = new double[size1][size2];
            for (int i = 0; i < size1; i++)
            {
                for (int j = 0; j < size2; j++)
                {
                    array[i][j] = safeArray.getDouble(i j);
                }
            }
            return array;
        }
        throw new Exception(DIMENSION_ERROR);
    }

    private static int getFirstDimensionSize(SafeArray safeArray)
    {
        return safeArray.getUBound(1) + 1;
    }

    private static int getSecondDimensionSize(SafeArray safeArray)
    {
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     134573  2016-05-31 19:01  Basic Commands\COM Basic Commands - Hide vehicles.layx

     文件       3179  2016-05-31 19:01  Basic Commands\COM Basic Commands - Utils.java

     文件      98733  2016-08-18 16:21  Basic Commands\COM Basic Commands ENG.pdf

     文件     173628  2017-01-11 15:26  Basic Commands\COM Basic Commands saved.inp0

     文件     173628  2017-01-20 13:02  Basic Commands\COM Basic Commands saved.inpx

     文件     134197  2017-01-20 13:03  Basic Commands\COM Basic Commands saved.layx

     文件      11264  2017-01-20 13:02  Basic Commands\COM Basic Commands saved.results\1.db

     文件      11264  2017-01-20 13:02  Basic Commands\COM Basic Commands saved.results\2.db

     文件      11264  2017-01-20 13:02  Basic Commands\COM Basic Commands saved.results\3.db

     文件     152438  2016-05-31 19:01  Basic Commands\COM Basic Commands VBS.layx

     文件      28472  2016-08-22 16:08  Basic Commands\COM Basic Commands.bas

     文件      27755  2016-06-27 14:24  Basic Commands\COM Basic Commands.cpp

     文件      32292  2016-09-09 21:27  Basic Commands\COM Basic Commands.cs

     文件     168528  2016-06-02 18:48  Basic Commands\COM Basic Commands.inpx

     文件      31308  2016-05-31 19:01  Basic Commands\COM Basic Commands.java

     文件     135206  2016-05-31 19:01  Basic Commands\COM Basic Commands.layx

     文件      24921  2016-09-09 21:27  Basic Commands\COM Basic Commands.m

     文件      24845  2016-08-22 16:08  Basic Commands\COM Basic Commands.py

     文件      11264  2017-01-20 13:02  Basic Commands\COM Basic Commands.results\1.db

     文件      11264  2017-01-20 13:02  Basic Commands\COM Basic Commands.results\2.db

     文件      11264  2017-01-20 13:02  Basic Commands\COM Basic Commands.results\3.db

     文件       6505  2016-05-31 19:01  Basic Commands\COM Basic Commands.sig

     文件      36385  2016-08-22 16:08  Basic Commands\COM Basic Commands.vbs

     文件     221078  2016-08-18 16:21  Basic Commands\COM Java Bridge For Eclipse.pdf

     文件      44045  2017-01-20 13:01  Basic Commands\screenshot2D.jpg

     文件      53562  2017-01-20 13:01  Basic Commands\screenshot3D.jpg

     目录          0  2017-02-07 11:31  Basic Commands\COM Basic Commands saved.results

     目录          0  2017-02-07 11:31  Basic Commands\COM Basic Commands.results

     目录          0  2017-02-07 11:31  Basic Commands

----------- ---------  ---------- -----  ----

............此处省略2个文件信息

评论

共有 条评论

相关资源