How to remove custom controls? Planned maintenance scheduled April 23, 2019 at 23:30 UTC...

Simple Http Server

Does the Mueller report show a conspiracy between Russia and the Trump Campaign?

What does the writing on Poe's helmet say?

Did any compiler fully use 80-bit floating point?

Where is the Next Backup Size entry on iOS 12?

Test print coming out spongy

Project Euler #1 in C++

Getting out of while loop on console

Why shouldn't this prove the Prime Number Theorem?

Why weren't discrete x86 CPUs ever used in game hardware?

Mounting TV on a weird wall that has some material between the drywall and stud

A term for a woman complaining about things/begging in a cute/childish way

Wrapping text with mathclap

Why is it faster to reheat something than it is to cook it?

Tips to organize LaTeX presentations for a semester

One-one communication

Asymptotics question

Special flights

Why complex landing gears are used instead of simple,reliability and light weight muscle wire or shape memory alloys?

Random body shuffle every night—can we still function?

What initially awakened the Balrog?

Resize vertical bars (absolute-value symbols)

Would color changing eyes affect vision?

What does Turing mean by this statement?



How to remove custom controls?



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?OpenLayers WFS flip coordinatesAre there any examples of creating custom openlayers geometry types?lonlat from geometry point gives strange resulttoggle clustering with map controlsOpenlayers error after removing selectFeature controlHow to remove the key control so users won't be able to use - and + to zoom?How can I remove default zoom in/out [+/-] buttons from openlayers to keep the navigation bar on?How to register to event in OpenLayers 3?OpenLayers Full Screen control not workingUsing multiple Openlayers.Control.SelectFeature controls?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I am trying to remove custom draw controls from my OpenLayers application which I create like this:



var drawControls = {
polygon: new OpenLayers.Control.DrawFeature(polygonLayerFreehand, OpenLayers.Handler.Polygon),
select: selectControl,
box: new OpenLayers.Control.DrawFeature(boxLayer,
OpenLayers.Handler.RegularPolygon, {
handlerOptions: {
sides: 4,
irregular: true
}
}
)
};


and which I add to the map like this:



for(var key in drawControls) {
_map.addControl(drawControls[key]);
}


I now would like to know how I can remove this custom control. I found examples for removing the standard OL controls like e.g. this



var ovMapControl = _map.getControlsBy("CLASS_NAME", "OpenLayers.Control.OverviewMap")[0];
_map.removeControl(ovMapControl);


or



var ovMapControl = _map.getControlsBy('displayClass','olControlPanZoomBar')[0];
_map.removeControl(ovMapControl);


but what is the 'displayClass' or the 'CLASS_NAME' in the case of custom controls like my 'drawControls'?










share|improve this question
















bumped to the homepage by Community 3 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    1















    I am trying to remove custom draw controls from my OpenLayers application which I create like this:



    var drawControls = {
    polygon: new OpenLayers.Control.DrawFeature(polygonLayerFreehand, OpenLayers.Handler.Polygon),
    select: selectControl,
    box: new OpenLayers.Control.DrawFeature(boxLayer,
    OpenLayers.Handler.RegularPolygon, {
    handlerOptions: {
    sides: 4,
    irregular: true
    }
    }
    )
    };


    and which I add to the map like this:



    for(var key in drawControls) {
    _map.addControl(drawControls[key]);
    }


    I now would like to know how I can remove this custom control. I found examples for removing the standard OL controls like e.g. this



    var ovMapControl = _map.getControlsBy("CLASS_NAME", "OpenLayers.Control.OverviewMap")[0];
    _map.removeControl(ovMapControl);


    or



    var ovMapControl = _map.getControlsBy('displayClass','olControlPanZoomBar')[0];
    _map.removeControl(ovMapControl);


    but what is the 'displayClass' or the 'CLASS_NAME' in the case of custom controls like my 'drawControls'?










    share|improve this question
















    bumped to the homepage by Community 3 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I am trying to remove custom draw controls from my OpenLayers application which I create like this:



      var drawControls = {
      polygon: new OpenLayers.Control.DrawFeature(polygonLayerFreehand, OpenLayers.Handler.Polygon),
      select: selectControl,
      box: new OpenLayers.Control.DrawFeature(boxLayer,
      OpenLayers.Handler.RegularPolygon, {
      handlerOptions: {
      sides: 4,
      irregular: true
      }
      }
      )
      };


      and which I add to the map like this:



      for(var key in drawControls) {
      _map.addControl(drawControls[key]);
      }


      I now would like to know how I can remove this custom control. I found examples for removing the standard OL controls like e.g. this



      var ovMapControl = _map.getControlsBy("CLASS_NAME", "OpenLayers.Control.OverviewMap")[0];
      _map.removeControl(ovMapControl);


      or



      var ovMapControl = _map.getControlsBy('displayClass','olControlPanZoomBar')[0];
      _map.removeControl(ovMapControl);


      but what is the 'displayClass' or the 'CLASS_NAME' in the case of custom controls like my 'drawControls'?










      share|improve this question
















      I am trying to remove custom draw controls from my OpenLayers application which I create like this:



      var drawControls = {
      polygon: new OpenLayers.Control.DrawFeature(polygonLayerFreehand, OpenLayers.Handler.Polygon),
      select: selectControl,
      box: new OpenLayers.Control.DrawFeature(boxLayer,
      OpenLayers.Handler.RegularPolygon, {
      handlerOptions: {
      sides: 4,
      irregular: true
      }
      }
      )
      };


      and which I add to the map like this:



      for(var key in drawControls) {
      _map.addControl(drawControls[key]);
      }


      I now would like to know how I can remove this custom control. I found examples for removing the standard OL controls like e.g. this



      var ovMapControl = _map.getControlsBy("CLASS_NAME", "OpenLayers.Control.OverviewMap")[0];
      _map.removeControl(ovMapControl);


      or



      var ovMapControl = _map.getControlsBy('displayClass','olControlPanZoomBar')[0];
      _map.removeControl(ovMapControl);


      but what is the 'displayClass' or the 'CLASS_NAME' in the case of custom controls like my 'drawControls'?







      openlayers-2 mapcontrol






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 15 '17 at 9:06









      nmtoken

      8,12542866




      8,12542866










      asked Jun 24 '14 at 18:01









      Jan Peters-AndersJan Peters-Anders

      919




      919





      bumped to the homepage by Community 3 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 3 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Assume you still have access to drawControls object at the place you want to remove the controls, then you can do something like:



          for (var key in drawControls){
          _map.removeControl(drawControls[key]);
          }





          share|improve this answer































            0














            You can simply remove control by using



            _map.removeControl(drawControls[key]);






            share|improve this answer
























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "79"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f103056%2fhow-to-remove-custom-controls%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Assume you still have access to drawControls object at the place you want to remove the controls, then you can do something like:



              for (var key in drawControls){
              _map.removeControl(drawControls[key]);
              }





              share|improve this answer




























                0














                Assume you still have access to drawControls object at the place you want to remove the controls, then you can do something like:



                for (var key in drawControls){
                _map.removeControl(drawControls[key]);
                }





                share|improve this answer


























                  0












                  0








                  0







                  Assume you still have access to drawControls object at the place you want to remove the controls, then you can do something like:



                  for (var key in drawControls){
                  _map.removeControl(drawControls[key]);
                  }





                  share|improve this answer













                  Assume you still have access to drawControls object at the place you want to remove the controls, then you can do something like:



                  for (var key in drawControls){
                  _map.removeControl(drawControls[key]);
                  }






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 24 '14 at 18:13









                  mfdevmfdev

                  1,7141918




                  1,7141918

























                      0














                      You can simply remove control by using



                      _map.removeControl(drawControls[key]);






                      share|improve this answer




























                        0














                        You can simply remove control by using



                        _map.removeControl(drawControls[key]);






                        share|improve this answer


























                          0












                          0








                          0







                          You can simply remove control by using



                          _map.removeControl(drawControls[key]);






                          share|improve this answer













                          You can simply remove control by using



                          _map.removeControl(drawControls[key]);







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jun 2 '18 at 17:16









                          neogeomatneogeomat

                          5,93034276




                          5,93034276






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f103056%2fhow-to-remove-custom-controls%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Щит и меч (фильм) Содержание Названия серий | Сюжет |...

                              Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

                              Meter-Bus Содержание Параметры шины | Стандартизация |...