From: Edwin C. <com...@gm...> - 2010-02-18 14:02:08
|
Hi Andrew, A pure GWT port of OpenLayers would be ideal, but that is also a lot more work than wrapping OpenLayers. Wrapping OL is still useful, because without a wrapping OpenLayers is not accessible to the parts of your application that are in GWT. If there were no wrapper library, then everbody would have to write all wrapper code themselves. A lot of hard work has gone into OpenLayers and it would take quite an effort to do a implementation in GWT (like OpenScales for Flex). It would be nice to provide a convenience method for setOnImageLoadErrorDisplayNone(). However, I would favor that on the Map object rather than on the MapWidget. Greetings, Edwin On 18 February 2010 00:15, Andrew Hughes <ahh...@gm...> wrote: > Thanks Edwin :) > I've got quite a bit of catching up to do on gwt-openlayers but hopefully > you can be patient with me :) apologies. > Agree on class/namespace and static method's only. > I don't like all this JSNI JavaScript (I'm guessing you don't either). It > would be so much nicer if this were pure GWT :'( It seems unavoidable. Given > that the implementation is most likely going to be defined in JSNI, then > why bother wrapping it at all? It's no different from doing the following: > public class MyMapWidget extends Composite{ > public MyMapWidget(){ > ...//stuff > MyMapWidget. setOnImageLoadErrorDisplayNone(); > ...//other stuff... > } > public static native void setOnImageLoadErrorDisplayNone()/*-{ > $wnd.Openlayers.Util.onImageLoadError = function(){this.style.display > ="none";} > }-*/; > } > What do you think? > Cheers > --AH > > On Wed, Feb 17, 2010 at 11:15 PM, Edwin Commandeur > <com...@gm...> wrote: >> >> Hi Andrew, >> >> The Util class does indeed contain some handy functions that would be >> nice to wrap. The Util class should never be instantiated and should >> only have static methods in my opinion so both a Util and UtilImpl are >> not strictly necessary, but having both may give more flexibility and >> clarity than only a Util with static JSNI methods in it. >> >> If we mirror OL then Util is in the >> org.gwtopenmaps.client.openlayers.* namespace and not in >> org.gwtopenmaps.client.openlayers.util.* >> >> Example of usage: >> >> Util.extend(x:JSObjectWrapper, y:JSObjectWrapper) >> >> in Util: >> >> public static JSObjectWrapper extend(JSObjectWrapper destination, >> JSObjectWrapper source){ >> JSObject obj = UtilImpl.extend(destination.getJSObject(), >> source.getJSObject()); >> return destination.setJSObject(obj); >> } >> >> In UtilImpl >> >> public static JSObject extend(JSObject destination, JSObject source)/*-{ >> return $wnd.OpenLayers.Util.extend(destination, source); >> }-*/; >> >> The example you give is immediately an example for which plain JSNI >> seems the most appropriate, because you need to create a function that >> can be pretty broad. You could off course do sth similar as in >> setFormatOutput of MousePositionOptions, but plain JSNI is more >> straightfoward: >> >> public static void onImageLoadErrorDisplayNone()/*-{ >> $wnd.Openlayers.Util.onImageLoadError = function() >> {this.style.display ="none";} >> }-*/; >> >> Such a function could off course be added as a convenience to GWT-OL >> on the Util object. >> >> Greetings, >> Edwin >> >> On 17 February 2010 07:18, Andrew Hughes <ahh...@gm...> wrote: >> > Hi Guys, >> > There is a (handy) OpenLayer's class that doesn't appear to be wrapped >> > >> > 'OpenLayers/Util.js': http://trac.openlayers.org/browser/tags/openlayers/release-2.8/lib/OpenLayers/Util.js >> > I'd like to wrapping this >> > with: org.gwtopenmaps.openlayers.client.Util.java >> > and org.gwtopenmaps.openlayers.client.UtilImp.java >> > There's a slight naming overlap with >> > the org.gwtopenmaps.openlayers.client.util package. But is a minor >> > issue. >> > Anyone like to chip in on this one? Trac ticket e.t.c. I need this so I >> > can >> > fix those annoying pink tiles for missing map images. >> > Like this.. OpenLayers.Util.onImageLoadError = function() { >> > this.style.display="none";} >> > This appears to be a singleton (same for us) and I'm not sure if this >> > should >> > 'extends OpenLayersObjectWrapper'. Some advice would be great. >> > Cheers :) >> > --AH >> > >> > ------------------------------------------------------------------------------ >> > SOLARIS 10 is the OS for Data Centers - provides features such as >> > DTrace, >> > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW >> > http://p.sf.net/sfu/solaris-dev2dev >> > _______________________________________________ >> > Gwt-openlayers-users mailing list >> > Gwt...@li... >> > https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users >> > >> > > > |