百度地图api中怎么清除自己画的弧线

我添加了一个点击事件 当点击时 就在两个点之间画上一条弧线
但是现在我想当鼠标继续点击时 所画的弧线消失 该怎么做呢??

这是代码

                 for(var i = 0; i<data.length; i++){
                     var name = data[i];
                    $.get('static/scripts/1.json', function (geojson) {
                        for (var j = 0; j < geojson.features.length; j++) {
                            if(name==geojson.features[j].properties.name){
                                var points = [];
                                points.push(thisPosition)
                                points.push(point[j]);
                                var curve = new BMapLib.CurveLine(points, {strokeColor:"red", strokeWeight:5, strokeOpacity:0.5}); //创建弧线对象
                                map.addOverlay(curve); //添加到地图中
                                curve.enableEditing(); //开启编辑功能
                                //map.removeOverlay(curve);
                            }
                        }
                    })
                 }