|
From: Edwin C. <com...@gm...> - 2010-06-10 13:47:10
|
Are you perhaps trying to get the controls when there are no controls
on the map? Or are you sure there are controls? I found the KMLTest to
fail when it did not return any vectorfeatures. Looking at that now.
Greetings,
Edwin
On 9 June 2010 10:00, Edwin Commandeur <com...@gm...> wrote:
> Hi Andrew,
>
> I am not sure what goes wrong, but apparently it happens in the
> getPropertyAsArray method. I hope to be able to look at it tomorrow
>
> The VectorFormat read method shows how an array can be retrieved
> without the getPropertyAsArray method, so maybe that is an option.
>
> Greetings,
> Edwin
>
> On 9 June 2010 02:15, Andrew Hughes <ahh...@gm...> wrote:
>> I tried the following (in Map):
>> /**
>> * This will fetch all of the controls on the map.
>> * @return the Controls or an empty array.
>> */
>> public Control[] getControls(){
>> JSObject[] jsObjects = getJSObject().getPropertyAsArray("controls");
>> int count = jsObjects.length;
>> Control[] controls = new Control[count];
>> for(int i =0; i < count ;i++){
>> controls[i] = Control.narrowToControl(jsObjects[i]);
>> }
>> return controls;
>> }
>> But this doesn't work, I'm out of my depth with JSNI...
>>
>> java.lang.IllegalArgumentException: Something other than a Java object was
>> returned from JSNI method
>> '@org.gwtopenmaps.openlayers.client.util.JSObjectHelper::getProperty(Lorg/gwtopenmaps/openlayers/client/util/JSObject;Ljava/lang/String;)':
>> JS value of type int, expected java.lang.Object
>>
>>
>> at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:178)
>> at
>> com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:266)
>> at
>> com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
>>
>>
>> at
>> org.gwtopenmaps.openlayers.client.util.JSObjectHelper.getProperty(JSObjectHelper.java)
>> at
>> org.gwtopenmaps.openlayers.client.util.JSObject$.getProperty$(JSObject.java:100)
>> at
>> org.gwtopenmaps.openlayers.client.util.JSObject$.getPropertyAsArray$(JSObject.java:141)
>>
>>
>> at org.gwtopenmaps.openlayers.client.Map.getControls(Map.java:124)
>>
>> Any help would be greatly appreciated :)
>>
>> On Tue, Jun 8, 2010 at 5:58 AM, Edwin Commandeur
>> <com...@gm...> wrote:
>>>
>>> Hi Andrew,
>>>
>>> That would be easy to add as a method to the Map, and it seems to make
>>> sense. Controls are stored in an array on the map. We need to get the
>>> JSObjects, narrow them to controls and return them in a Collection. I
>>> guess there is no method for that in OpenLayers because accessing the
>>> controls array is so easy in Javascript.
>>>
>>> Greetings,
>>> Edwin
>>>
>>> On 7 June 2010 09:01, Andrew Hughes <ahh...@gm...> wrote:
>>> > Hi Guys,
>>> > I need to be able to manipulate all the controls on a map, but I can't
>>> > do
>>> > anything like... map.getControls(); any ideas?
>>> > Cheers
>>> > --AH
>>> > p.s. I really need to iterate over all controls and remove the ones I
>>> > don't
>>> > want.
>>> >
>>> > ------------------------------------------------------------------------------
>>> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
>>> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>>> > lucky parental unit. See the prize list and enter to win:
>>> > http://p.sf.net/sfu/thinkgeek-promo
>>> > _______________________________________________
>>> > Gwt-openlayers-users mailing list
>>> > Gwt...@li...
>>> > https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users
>>> >
>>> >
>>
>>
>> ------------------------------------------------------------------------------
>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> lucky parental unit. See the prize list and enter to win:
>> http://p.sf.net/sfu/thinkgeek-promo
>> _______________________________________________
>> Gwt-openlayers-users mailing list
>> Gwt...@li...
>> https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users
>>
>>
>
|