java - Passing 2D Array argument with JACOB -


i have com method i'm trying invoke, there's argument of type 'object' must 2d double safe array, collection of lat/long points. how can create safearray in jacob send through com interface?

i've tried passing 2d array object in object list. method doesn't return error, not see results expect in falconview (rendering of polygon).

    double polypoints[][] = new double[5][2];     polypoints[0][0] = 75.3;     polypoints[0][1] = 4.5;          polypoints[1][0] = 3.8;     polypoints[1][1] = 4.8;     polypoints[2][0] = 2.3;     polypoints[2][1] = 2.5;     polypoints[3][0] = 5.3;     polypoints[3][1] = 6.5;     polypoints[4][0] = 0.3;     polypoints[4][1] = -1.5;  // can't recreate variant or safearray double[x][y] array;      object[] polygonargs = new object[] {m_mainlayerhandle, polypoints, 1};     variant returnaddpolygon = dispatch.invoke(mainlayerdispatch, "addpolygon", dispatch.method, polygonargs,  new int[1]);     system.out.println("polygon handle: " + returnaddpolygon.getint());      object[] refreshargs = new object[] {m_mainlayerhandle};     variant refreshvariant = dispatch.invoke(mainlayerdispatch, "refresh", dispatch.method, refreshargs,  new int[1]); 

the second arument documentation:

lat_lon_array 2 dimensional safearray of doubles. first dimension contains latitude values. second dimension contains longitude values

it seems safearray supports 1 dimensional, 2 dimensional, , n-dimensional arrays using unclear constructors. given 2d double array created above, able copy data in 2d double safe array. more efficient create double[][] front, i'm doing in prototype code. there may ways copy entire arrays in safe array... not sure.

// 2d array of type double. first dimension size 5, second dimemnsion size 2. safearray safearray = new safearray(variant.variantdouble, 5, 2); for(int = 0; < 5; i++) {     (int j = 0; j < 2; j++) {             // set value of safearray[i][j] value polypoints[i][j]         safearray.setdouble(i, j, polypoints[i][j]);     } } 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -