Changeset 6257 for trunk


Ignore:
Timestamp:
Apr 7, 2016, 12:52:01 PM (8 years ago)
Author:
ldelgass
Message:

Refactor: make enable a subcommand of placard method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/mapviewer.tcl

    r6256 r6257  
    5555    public method disconnect {}
    5656    public method download {option args}
    57     public method enablePlacard {state layerName}
     57    public method placard {option args}
    5858    public method get {args}
    5959    public method isconnected {}
     
    990990
    991991# ----------------------------------------------------------------------
    992 # USAGE: enablePlacard <state> <layerName>
     992# USAGE: placard enable <state> <layerName>
    993993#
    994994# Clients use this method to enable/disable display of a feature placard
    995995# when a feature is clicked/selected.
    996996# ----------------------------------------------------------------------
    997 itcl::body Rappture::MapViewer::enablePlacard {state layerName} {
    998     if {![info exists _layers($layerName)]} {
    999         error "Unknown layer \"$layerName\""
    1000     }
    1001     if {![string is boolean $state]} {
    1002         error "argument to enablePlacard must be boolean"
    1003     }
    1004     SendCmd "placard enable $state $layerName"
     997itcl::body Rappture::MapViewer::placard {option args} {
     998    switch $option {
     999        enable {
     1000            if {[llength $args] != 2} {
     1001                error "wrong $ args: should be \"enable <boolean> <layerName>\""
     1002            }
     1003            set state [lindex $args 0]
     1004            set layerName [lindex $args 1]
     1005            if {![info exists _layers($layerName)]} {
     1006                error "Unknown layer \"$layerName\""
     1007            }
     1008            if {![string is boolean $state]} {
     1009                error "argument to placard enable must be boolean"
     1010            }
     1011            SendCmd "placard enable $state $layerName"
     1012        }
     1013        default {
     1014            error "bad option \"$option\": should be enable"
     1015        }
     1016    }
    10051017}
    10061018
Note: See TracChangeset for help on using the changeset viewer.