Changeset 6261 for trunk


Ignore:
Timestamp:
Apr 12, 2016, 1:23:45 PM (8 years ago)
Author:
ldelgass
Message:

In mapviewer, rename delete method to hide and add clear method to really delete
objects from render server. For now, call hide from delete method.

File:
1 edited

Legend:

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

    r6257 r6261  
    5252    public method add {dataobj {settings ""}}
    5353    public method camera {option args}
    54     public method delete {args}
     54    public method clear {args}
     55    public method delete {args} { eval hide $args }
    5556    public method disconnect {}
    5657    public method download {option args}
     58    public method hide {args}
    5759    public method placard {option args}
    5860    public method get {args}
     
    690692
    691693# ----------------------------------------------------------------------
    692 # USAGE: delete ?<dataobj1> <dataobj2> ...?
    693 #
    694 # Clients use this to delete a dataobj from the plot.  If no dataobjs
    695 # are specified, then all dataobjs are deleted.  No data objects are
    696 # deleted.  They are only removed from the display list.
    697 # ----------------------------------------------------------------------
    698 itcl::body Rappture::MapViewer::delete {args} {
     694# USAGE: hide ?<dataobj1> <dataobj2> ...?
     695#
     696# Clients use this to hide a dataobj from the plot.  If no dataobjs are
     697# specified, then all dataobjs are hidden.
     698# ----------------------------------------------------------------------
     699itcl::body Rappture::MapViewer::hide {args} {
    699700    DebugTrace "Enter"
    700701    if { [llength $args] == 0} {
    701702        set args $_dlist
    702703    }
    703     # Delete all specified dataobjs
     704    # Mark all specified dataobjs as hidden
    704705    set changed 0
    705706    foreach dataobj $args {
     
    716717        }
    717718        array unset _obj2ovride $dataobj-*
     719        set changed 1
     720    }
     721    # If anything changed, then rebuild the plot
     722    if { $changed } {
     723        $_dispatcher event -idle !rebuild
     724    }
     725}
     726
     727# ----------------------------------------------------------------------
     728# USAGE: clear ?<dataobj1> <dataobj2> ...?
     729#
     730# Clients use this to permanently clear a dataobj from the plot and the
     731# render server.  If no dataobjs are specified, then all dataobjs are
     732# cleared.
     733# ----------------------------------------------------------------------
     734itcl::body Rappture::MapViewer::clear {args} {
     735    DebugTrace "Enter"
     736    if { [llength $args] == 0} {
     737        set args [concat $_dlist $_hidden]
     738    }
     739    # Delete all specified dataobjs
     740    set changed 0
     741    foreach dataobj $args {
     742        set found 0
     743        set dpos [lsearch -exact $_dlist $dataobj]
     744        if { $dpos >= 0 } {
     745            set found 1
     746        }
     747        set hpos [lsearch -exact $_hidden $dataobj]
     748        if { $hpos >= 0 } {
     749            set found 1
     750        }
     751        if { !$found } {
     752            continue
     753        }
     754        foreach tag [array names _layers -glob $dataobj-*] {
     755            SendCmd "map layer delete $tag"
     756        }
     757        if { [info commands $dataobj] == $dataobj } {
     758            # Remove the layers from the client and server.
     759            foreach layer [$dataobj layers] {
     760                if { ![$dataobj layer $layer shared] } {
     761                    # Remove shared layer if no other objects have it?
     762                }
     763            }
     764        }
     765        if { $dpos >= 0 } {
     766            # Remove it from the dataobj list.
     767            set _dlist [lreplace $_dlist $dpos $dpos]
     768        }
     769        if { $hpos >= 0 } {
     770            # Remove it from the hidden list.
     771            set _hidden [lreplace $_hidden $hpos $hpos]
     772        }
     773        array unset _obj2ovride $dataobj-*
     774        array unset _layers $dataobj-*
     775        array unset _opacity $dataobj-*
     776        array unset _visibility $dataobj-*
    718777        set changed 1
    719778    }
Note: See TracChangeset for help on using the changeset viewer.