Hi,

On Nov 14, 2007 6:18 PM, Radim Blazek <[EMAIL PROTECTED]> wrote:
> On Nov 14, 2007 5:51 PM, Andreas Hocevar <[EMAIL PROTECTED]> wrote:
> > On Nov 14, 2007 5:26 PM, Radim Blazek <[EMAIL PROTECTED]> wrote:
> GmlRendererOL has to be connected
> > to the targetModel to work correctly.
>
> But that does only rendering?

It renders the features after drawing them, and this is what you need.
The objRef.featureLayer you are referring to is always empty, except
while the user is drawing a feature, as you already found out.

> I am trying to write DragFeature widget in MB but it does not work.
> DragFeature in OL works. I did not inspect OL deeply so far, but
> I found that OL DragFeature does not work if
> OpenLayers.Control.DragFeature.layer is empty
> (seems obvious that it cannot work if there is nothing in the layer?)
> I set the layer in my DragFeature:
>
>    this.createControl = function(objRef) {
>      return OpenLayers.Control.DragFeature;
>   }
>
>    this.instantiateControl = function(objRef, Control) {
>       return new Control(objRef.featureLayer);

You do not want to use objRef.featureLayer, but the layer where ready
features are. So change that line to
         return new Control(objRef.targetContext.getParam("gmlRendererLayer"));

>    }

> but the DragFeature.featureLayer (inherited from EditButtonBase) is
> created empty and never filled with data
> (except by new features created by OL).
> Should I do that in DragFeature or am I completely wrong?

If you use the modified code as described above, you would
additionally have to check for features in the renderer layer:

rendererLayer = objRef.targetContext.getParam("gmlRendererLayer");
if (rendererLayer.features && rendererLayer.features.length > 0) {
    // go on
} else {
    // dragFeature control not allowed in that state of the app.
}

By the way, we would be glad if you could contribute your work as a
patch once it is finished. Dragging features is something that users
desire quite frequently.

Regards,
Andreas.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
mapbuilder-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-devel

Reply via email to