POST
|
It turns out that toolbarBean class needs arcview license at minimum to operate. At least when I enabled the Arcview license in the initializer the issue goes away.
... View more
01-09-2013
04:55 AM
|
0
|
0
|
4
|
POST
|
I was still getting problems with this but I think i found the problem. You must allocate the full number of possible parameters when passing even if no value is set private static ISpatialReference getCustomSpatialRefFromFile() throws Exception {//, ISpatialReference inSpaRef ISpatialReferenceFactory srf = new SpatialReferenceEnvironment(); IProjectedCoordinateSystem pcs = (IProjectedCoordinateSystem) srf.createESRISpatialReferenceFromPRJFile("test.prj"); IProjectedCoordinateSystem4GEN pcsGen = (IProjectedCoordinateSystem4GEN) pcs; IParameter[][] parameters = new IParameter[1][16]; // the 16 is very important. pcsGen.getParameters(parameters); for (int i = 0; i < parameters[0].length; i++){ IParameter currentParameter = parameters[0]; if (currentParameter != null){ System.out.println(currentParameter.getName() + ", " + currentParameter.getIndex() + ", " + currentParameter.getValue()); } // set the value by parameter name if (parameters[0].getName().equals("My_Parameter") == true){IParameter p = parameters[0];p.setValue(0);} } pcs.changed(); for (int i = 0; i < parameters[0].length; i++){ IParameter currentParameter = parameters[0]; if (currentParameter != null) System.out.println(currentParameter.getName() + ", " + currentParameter.getIndex() + ", " + currentParameter.getValue()); } return pcs; } I hope this helps some other poor soul in the future. It has to do "I Believe" with how ArcObjects accesses the engine using JNI which we all know can be touchy. because it is passing marshaled data from java to a COM interface and retrieving then marshaling the return information the Arc Object Com Interface allocates a full array in memory for the object. If it does not receive empty values to populate those registers it goes all funky. Just a guess but it works nonetheless. I will test with define and see if this was the problem in the first place.
... View more
12-18-2012
12:04 PM
|
0
|
0
|
5
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|