1

I have a bunch of tracks on screen in a vector layer. I used some hover and select styles in the layer styleMap and these styles are properly triggered by:

    var highlightCtrl = new OpenLayers.Control.SelectFeature(tbTrack.vector, {
        hover: true,
        highlightOnly: true,
        renderIntent: "hover",
    });

    var selectCtrl = new OpenLayers.Control.SelectFeature(tbTrack.vector,
        {clickout: true, renderIntent: "select"}
    );

    tbMap.map.addControl(highlightCtrl);
    tbMap.map.addControl(selectCtrl);

    highlightCtrl.activate();
    selectCtrl.activate()

All these tracks are listed in a table under the map. I want to trigger the corresponding hover and select styles for a track if I click or hover on them in the table. How to do this? I allready have the coupling between the table and the lines, I just don't know the right way to trigger the hover or select events.

1

This question has been answered before on stackoverflow:

https://stackoverflow.com/questions/8832029/how-to-select-a-feature-programmatically-on-a-vector-layer-in-openlayers

  • thanks, I didn't found that one, but it works. – Jeroen Jul 12 '12 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.