Results 1 to 3 of 3

Thread: [OpenLayers] Feature edition buttons

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    31
    Answers
    2

    Default Answered: [OpenLayers] Feature edition buttons

    Hi,

    I'm trying to add feature edition buttons to an OpenLayers map. For that, I created OpenLayers controls and ExtJs buttons that activate/deactivate those controls when pressed/depressed.
    The problem is that when I click on one of those buttons for the first time after page is loaded, I get a javascript error:
    Code:
    TypeError: node.recordIndexToNodeIndex is not a function
    This error makes other buttons, that are in the same toggle group with the feature edition buttons, behave strangely.
    This strange behaviour disappears after the user performs some toggling between the feature edition buttons and other buttons.
    Below, the code of an add line button :
    Code:
        addLine = new Ext.Button({
            iconCls: 'addLine',
            tooltip: 'ajouter une ligne',
            toggleGroup: 'controls',
            enableToggle: true,
            allowDepress: false,
            toggleHandler: function(toggled){
                if(toggled.pressed){
                    drawControls['addLine'].activate();
                    console.debug('addLine activated');
                }
                else{
                    drawControls['addLine'].deactivate();
                    console.debug('addLine deactivated');
                }
            }
        });
    features edition controls are:
    Code:
    drawControls = {
            navigate : new OpenLayers.Control.Navigation(),
            addPoint : new OpenLayers.Control.DrawFeature(vectors,
                    OpenLayers.Handler.Point),
            addLine : new OpenLayers.Control.DrawFeature(vectors,
                    OpenLayers.Handler.Path),
            addPolygon : new OpenLayers.Control.DrawFeature(vectors,
                    OpenLayers.Handler.Polygon),
            addRectangle : new OpenLayers.Control.DrawFeature(vectors,
                    OpenLayers.Handler.RegularPolygon, {
                        handlerOptions : {
                            sides : 4,
                            irregular : true
                        }
                    }),
            modify : new OpenLayers.Control.ModifyFeature(vectors,
                    OpenLayers.Handler.Click),
            erase : eraseF,
            addText : add
        };

  2. The problem used to appear because of a GeoExt LayerContainer object that I had on a TreePanel. After deleting that object from my application, the error disappeared.

  3. #2
    Sencha User kevin.chen's Avatar
    Join Date
    Sep 2012
    Location
    Redwood City, CA
    Posts
    242
    Answers
    12

    Default

    looks the error is generated from OpenLayers, it is not from Extjs library.

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    31
    Answers
    2

    Default

    The problem used to appear because of a GeoExt LayerContainer object that I had on a TreePanel. After deleting that object from my application, the error disappeared.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •