Skip to main content

Hide labels tool error after upgrade

Comments

2 comments

  • Mike Ketler
    Hi,

     

    In the 2.8 release of the HTML5 viewer we changed how modules are loaded. Unfortunately, the code gallery sample you have configured will not work in GVH 2.8, it would need to be rebuilt and compiled. 

     

    Thanks,

     

    Mike Ketler
    0
  • Mike Diss-Torrance
    I wrote new version that works with GE 4.9.0.  I also added comments to the text file to indicate how to incoorporate it into one of the json.js files. Note: the folder "DNR_Customized" is located within the HTML5 web application folder.

     

      //BTS.LabelToggleModules //Last updated by Mike DT on May 29th, 2018 /* Add this library reference to the 'Libraries' section (at the top of the *.json.js file): , { "id": "LabelToggleModules", "uri": "Resources/DNR_Customized/BTS_SEC/LabelToggleModules.js" } Add this configuration section within the 'modules' section (Starting around line 90): , { "moduleName": "LabelToggleModules", "moduleType": "BTS.LabelToggleModules", "libraryId": "LabelToggleModules" } */ dojo.declare("BTS.LabelToggleModules", geocortex.framework.application.ModuleBase, { constructor: function (app, id) { //keep track of when the measure tool is being added and removed this.app.eventRegistry.event("MeasurementMarkupAdded").subscribe(this, this.onMeasurementMarkupAdded); this.app.eventRegistry.event("MeasurementMarkupDeleted").subscribe(this, this.onMeasurementMarkupDeleted); }, initialize: function (configuration) {}, onMeasurementMarkupAdded: function() { //When the measure tool has drawn on the map... if (!this.ToggleLabel_token) { //register a new command. this.ToggleLabel_token = this.app.command("ToggleLabel").register(this, this.executeToggleLabel, this.canexecuteToggleLabel); //Make reference to the graphic layer that contains the measure labels this.GraphicLayer = geocortex.essentialsHtmlViewer.mapping.infrastructure.GraphicUtils.getGraphicsLayer("Drawings_measurement", false, this.app); } this.canexecute = true; this.LabelVisibility = true; this.app.command("ToggleLabel").raiseCanExecuteChanged(); //indicate that any tool referencing this command, it's execution status has changed }, onMeasurementMarkupDeleted: function() { this.canexecute = false; this.app.command("ToggleLabel").raiseCanExecuteChanged(); }, canexecuteToggleLabel: function() { //all tools that use this command will call this method to determine if they are enables (and/or visible) return this.canexecute; }, executeToggleLabel: function() { //Turn on/off the graphic layer. if (this.GraphicLayer) { this.LabelVisibility = !this.LabelVisibility; this.GraphicLayer.setVisibility(this.LabelVisibility); } } }); geocortex.framework.notifyLibraryDownload("LabelToggleModules"); It requires one to create toggle button and run the command "ToggleLabel":

     

    Toggle Button

     

    Cheers,

     

    Mike

     

     
    0

Please sign in to leave a comment.