Changeset 4330 for trunk/gui


Ignore:
Timestamp:
Apr 7, 2014 4:30:15 AM (10 years ago)
Author:
ldelgass
Message:

Fix up camera reset. Since we still reset with a default base layer, force
a valid render while that layer exists before deleting the layer.

File:
1 edited

Legend:

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

    r4329 r4330  
    119119    private variable _reset 1;          # Indicates that server was reset and
    120120                                        # needs to be reinitialized.
     121    private variable _initCamera 1;
    121122    private variable _haveTerrain 0
    122123
     
    940941                    }
    941942                }
     943                # XXX: Remove these after implementing batch load of layers with reset
     944                # This is needed to force a valid render before deleting the base layer
     945                # Don't want to flush since we don't need to see this image
     946                SendCmd "render"
    942947                SendCmd "map layer delete base"
    943948            }
     
    956961            error "No map settings on reset"
    957962        }
    958 
    959         # FIXME: How to tell if this is the first reset?
    960         # If we reset the connection, we shouldn't use
    961         # the map settings
    962         if { [info exists _mapsettings(camera)] } {
    963             set location $_mapsettings(camera)
    964             if { $location != "" } {
    965                 array set _view $location
    966             }
    967         }
    968         camera set all
    969         SendCmd "imgflush"
    970963    }
    971964
     
    1002995                #SetLayerOpacity $layer
    1003996            }
     997        }
     998    }
     999
     1000    if {$_reset} {
     1001        if {$_initCamera} {
     1002            # If this is the first Rebuild, we need to
     1003            # set up the initial view settings if there
     1004            # are any
     1005            if { [info exists _mapsettings(camera)] } {
     1006                set location $_mapsettings(camera)
     1007                if { $location != "" } {
     1008                    array set _view $location
     1009                    camera set all
     1010                }
     1011            }
     1012            set _initCamera 0
     1013        } else {
     1014            # Restore view from before reconnect
     1015            camera set all
    10041016        }
    10051017    }
Note: See TracChangeset for help on using the changeset viewer.