From: Edwin C. <com...@gm...> - 2009-03-06 08:39:14
|
Hi Brendan, As far as I can see the problem is with the GML constructor. The constructor needs an options object, even if it that options object is empty. I added an empty options object to the GMLImpl create method. Possibly it needs more. If I look at the vector-formats example than it might be necessary to change: public static native JSObject create() /*-{ return new $wnd.OpenLayers.Format.GML.v3({}); }-*/; to public static native JSObject create(String type, String namespace) /*-{ return new $wnd.OpenLayers.Format.GML.v3({ featureType : type, featureNS: namespace }); }-*/; Greetings, Edwin 2009/3/5 Brendan Grady <bre...@gm...> > Hi Edwin, > > An updated patch to include the DragFeature Control. > > I figured out the weirdness with KML, and that one was my fault. It > appears when I added the KML to the popup, that it lost everything that had > special characters in it. Makes sense because I think the Popup is supposed > to be just for HTML. > > However, I am pretty stumped with GML. Everything in the code looks like > it should work, but the call to the empty constructor fails. Looking at the > Openlayer api, any options should be optional. > > Some more debug info: > > - new GML() fails outright with a an exception in the GWT shell output: > > GWTShell: > [java] Uncaught JavaScript exception > [com.google.gwt.core.client.JavaScriptException: (TypeError): Object > expected > [java] number: -2146823281 > [java] description: Object expected > [java] at > com.eg.gwt.openLayers.client.format.GML2Impl.create(Native Method) > [java] at > com.eg.gwt.openLayers.client.format.GML2.<init>(GML2.java:21) > > > At the moment, serializing and deserializing in GML is my most pressing > feature. Hopefully, I have a breakthough before my prototype demo tomorrow. > > If you have any insight/ideas into deserialization, I would be happy to try > to implement them. > > Thanks Again, > Brendan > > > > > On Thu, Mar 5, 2009 at 2:35 PM, Edwin Commandeur < > com...@gm...> wrote: > >> Hi Brendan, >> >> Thanks for the patch. I will take look at it and already commit the css to >> the trunk first thing tommorow morning. >> >> If WKT works, than I'm pretty sure that KML needs some additional options >> that can't be specified yet. I added a Tracker on SF to track Milestone >> issues, which should list all the issues to be fixed for release 0.4 and >> getting the KML Format fully working will definitely be on the list. >> >> Greetings and thanks for all your efforts, >> Edwin >> >> 2009/3/5 Brendan Grady <bre...@gm...> >> >> Thanks again for the response. I really appreciate your time. >>> >>> I'm sure you are swamped with other things, so I put together a patch for >>> adding controls to the EditControlPanel. If you think it is ok, feel free >>> to add it to the trunk. First time working with JSNI, so if it doesn't >>> follow standards, feel free to scrap it. >>> >>> The following css needs to be added to your applications css: >>> >>> .olControlEditingToolbar { >>> width: 400px!important; >>> } >>> .olControlEditingToolbar .olControlSelectFeatureItemActive { >>> background-image: url("img/select_feature_on.png"); >>> background-repeat: no-repeat; >>> } >>> .olControlEditingToolbar .olControlSelectFeatureItemInactive { >>> background-image: url("img/select_feature_off.png"); >>> background-repeat: no-repeat; >>> } >>> .olControlEditingToolbar .olControlModifyFeatureItemActive { >>> background-image: url("img/move_vertex_on.png"); >>> background-repeat: no-repeat; >>> } >>> .olControlEditingToolbar .olControlModifyFeatureItemInactive { >>> background-image: url("img/move_vertex_off.png"); >>> background-repeat: no-repeat; >>> } >>> .olControlEditingToolbar .olControlDragFeatureItemActive { >>> background-image: >>> url("openlayers/theme/default/img/move_feature_on.png"); >>> background-repeat: no-repeat; >>> } >>> .olControlEditingToolbar .olControlDragFeatureItemInactive { >>> background-image: >>> url("openlayers/theme/default/img/move_feature_off.png"); >>> background-repeat: no-repeat; >>> } >>> >>> If you can't find the images, I can provide those too. As a zip maybe? >>> >>> I'm also going to take a look at the GML2,3 / KML >>> serializer/deserializer. Those seem to be broken right now, though WKT >>> serialize does seem to work, so I'll use that as a guideline. >>> >>> Brendan >>> >>> >>> >>> On Thu, Mar 5, 2009 at 8:53 AM, Brendan Grady <bre...@gm...>wrote: >>> >>>> Hi Edwin - >>>> >>>> The SelectFeature appears to be working perfectly. Thanks! >>>> >>>> Implementing the editing features that are in >>>> http://crschmidt.net/mapping/wpserverdemo/ would make for a very >>>> powerful toolset. I would be happy to test out whatever you have. >>>> >>>> As an aside, this is how I tested out the Select Feauture: >>>> >>>> SelectFeatureOptions options = new SelectFeatureOptions(); >>>> options.onSelect( new SelectFeature.SelectFeatureListener(){ >>>> >>>> public void onFeatureSelected(JSObject vectorFeature) { >>>> VectorFeature overlay = >>>> VectorFeature.narrowToVectorFeature(vectorFeature); >>>> popup = new AnchoredBubble("vector-info", >>>> new LonLat(0,0), >>>> new Size(300, 400), >>>> "<p>" + new KML().write(overlay) + "</p>", >>>> new Icon("", new Size(0, 0), new Pixel(0, 0)), >>>> true); >>>> map.addPopup(popup); >>>> } >>>> >>>> }); >>>> >>>> For some reason though, the info that popped up is not KML. It looks >>>> more like this: >>>> >>>> OpenLayers exportExported on Thu Mar 5 08:49:56 >>>> EST2009OpenLayers.Feature.Vector_262No description available-0.0703125, >>>> 2.4609375 -0.703125,-20.390625 ... >>>> >>>> Am I using the KML exporter incorrectly? >>>> >>>> Thanks again, >>>> >>>> Brendan >>>> >>>> >>>> >>>> On Thu, Mar 5, 2009 at 5:43 AM, Edwin Commandeur < >>>> com...@gm...> wrote: >>>> >>>>> Hi there, >>>>> >>>>> Selecting features happens with a control in OpenLayers. I saw in the >>>>> GWT-OpenLayers codebase that we are not yet wrapping the SelectFeature >>>>> control. By default the SelectFeature selects features on click and you can >>>>> pass it options to select on hover. >>>>> >>>>> So: >>>>> (1) we need to add support for the select feature control => ADDED 5 >>>>> min ago >>>>> >>>>> I added a wrapper for SelectFeature, but did not thoroughly test it... >>>>> Maybe you can try it out. >>>>> >>>>> One caveat: The onSelect and onUnselect callback methods do not hook in >>>>> with the broader OpenLayers event system. By the latter I mean that for >>>>> example Vector (a vector layer object) has an Event object to register and >>>>> unregister events, while the onSelect and onUnselect are just callback >>>>> methods of the Control. This is why I added the Listener interfaces to the >>>>> Control itself and this is why the methods onSelectFeature and >>>>> onUnselectFeature return a JSObject which is a VectorFeature that you have >>>>> to narrow to a VectorFeature yourself inside the method e.g. >>>>> new SelectFeatureListener(){ >>>>> public void onSelectFeature(JSObject vectorFeature) { >>>>> VectorFeature vf = >>>>> VectorFeature.narrowToVectorFeature(vectorFeature); >>>>> } >>>>> >>>>> (2) you then need to add a button to activate the SelectFeature control >>>>> (and deactivate the other editing controls). >>>>> >>>>> Point (2) could be realised in two ways: (a) you should create your own >>>>> editing toolbar using GWT (b) we could support adding controls to the >>>>> Editing Toolbar. Option 2b is not yet in OpenLayers, but would not be very >>>>> difficult to support this in GWT-OpenLayers. I guess that most people want >>>>> an editing toolbar like this one: >>>>> >>>>> http://crschmidt.net/mapping/wpserverdemo/ >>>>> >>>>> I will look into point 2b shortly, but cannot promise to have anything >>>>> ready overnight. >>>>> >>>>> Greetings, >>>>> Edwin >>>>> >>>>> 2009/3/4 Brendan Grady <bre...@gm...> >>>>> >>>>>> Hello, >>>>>> >>>>>> >>>>>> New user to gwt-openlayers. >>>>>> >>>>>> Does anyone have an example of adding a "select" listener to a Vector >>>>>> layer? I am adding vectors using the Editing Toolbar. >>>>>> >>>>>> In openlayers, I would add something like the following: >>>>>> >>>>>> selectControl = new OpenLayers.Control.SelectFeature(overlayLayer, >>>>>> {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect}); >>>>>> >>>>>> >>>>>> I tried the following, but I think I need to add something else to the >>>>>> map to make the layer "selectable" as it does not seem to register that I am >>>>>> over a selectable vector: >>>>>> >>>>>> <snip> >>>>>> Vector overlayLayer = new Vector("Overlay Creation Layer"); >>>>>> map.addLayer(overlayLayer); >>>>>> map.addControl(new EditingToolbar(overlayLayer)); >>>>>> >>>>>> overlayLayer.addVectorFeatureSelectedListener( new >>>>>> VectorFeatureSelectedListener(){ >>>>>> >>>>>> public void onFeatureSelected(Vector source, >>>>>> FeatureSelectedEvent eventObject) { >>>>>> VectorFeature overlay = eventObject.getFeature(); >>>>>> popup = new AnchoredBubble("vector-info", >>>>>> new LonLat(0,0), >>>>>> new Size(300, 400), >>>>>> "<p>" + new KML().write(overlay) + "</p>", >>>>>> new Icon("", new Size(0, 0), new Pixel(0, 0)), >>>>>> true); >>>>>> map.addPopup(popup); >>>>>> } >>>>>> >>>>>> }); >>>>>> </snip> >>>>>> >>>>>> Any suggestions? >>>>>> >>>>>> Thanks, >>>>>> Brendan >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Open Source Business Conference (OSBC), March 24-25, 2009, San >>>>>> Francisco, CA >>>>>> -OSBC tackles the biggest issue in open source: Open Sourcing the >>>>>> Enterprise >>>>>> -Strategies to boost innovation and cut costs with open source >>>>>> participation >>>>>> -Receive a $600 discount off the registration fee with the source >>>>>> code: SFAD >>>>>> http://p.sf.net/sfu/XcvMzF8H >>>>>> _______________________________________________ >>>>>> Gwt-openlayers-users mailing list >>>>>> Gwt...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users >>>>>> >>>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Open Source Business Conference (OSBC), March 24-25, 2009, San >>>>> Francisco, CA >>>>> -OSBC tackles the biggest issue in open source: Open Sourcing the >>>>> Enterprise >>>>> -Strategies to boost innovation and cut costs with open source >>>>> participation >>>>> -Receive a $600 discount off the registration fee with the source code: >>>>> SFAD >>>>> http://p.sf.net/sfu/XcvMzF8H >>>>> _______________________________________________ >>>>> Gwt-openlayers-users mailing list >>>>> Gwt...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users >>>>> >>>>> >>>> >>> >> > |