# mkFloor w
#
# Create a top-level window containing a canvas that displays the
# floorplan for DEC's Western Research Laboratory.
#
# Arguments:
#    w -	Name to use for new top-level window.
#
# @(#) mkFloor.tcl 1.2 94/12/23 15:51:59

proc mkFloor {{w .cfloor}} {
    global c tk_library currentRoom colors
    catch {destroy $w}
    toplevel $w
#    dpos $w
    wm title $w "Floorplan Canvas Demonstration"
    wm iconname $w "Floorplan"
    wm minsize $w 100 100
    set c $w.frame2.c

    label $w.msg -font -Adobe-Times-Medium-R-Normal--*-180-*-*-*-*-*-* \
	    -wraplength 800 -justify left -text "This window contains a canvas \
	    widget showing the floorplan of Digital Equipment Corporation's \
	    Western Research Laboratory.  It has three levels.  At any \
	    given time one of the levels is active, meaning that you can \
	    see its room structure.  To activate a level, click the left \
	    mouse button anywhere on it.  As the mouse moves over the active \
	    level, the room under the mouse lights up and its room number \
	    appears in the \"Room:\" entry.  You can also type a room \
	    number in the entry and the room will light up."
    frame $w.frame2
    button $w.ok -text "OK" -command "destroy $w" -width 8
    pack $w.msg -side top -fill both
    pack $w.frame2 -side top -fill both -expand yes
    pack $w.ok -side bottom -pady 5

    scrollbar $w.frame2.vscroll -command "$c yview"
    scrollbar $w.frame2.hscroll -orient horiz -command "$c xview"
    canvas $c -width 900 -height 500 -relief sunken -borderwidth 2 \
	    -xscroll "$w.frame2.hscroll set" -yscroll "$w.frame2.vscroll set"
    pack $w.frame2.hscroll -side bottom -fill x
    pack $w.frame2.vscroll -side right -fill y
    pack $c -in $w.frame2 -expand yes -fill both

    # Create an entry for displaying and typing in current room.

    entry $c.entry -width 10 -relief sunken -bd 2 -textvariable currentRoom

    # Choose colors, then fill in the floorplan.

    if {[tk colormodel $c] == "color"} {
	set colors(bg1) #c0a3db55dc28
	set colors(outline1) #70207f868000
	set colors(bg2) #aeb8c6eec7ad
	set colors(outline2) #59b466056666
	set colors(bg3) #9cfab288b333
	set colors(outline3) #43474c834ccd
	set colors(offices) Black
	set colors(active) #dae0f278f332
    } else {
	set colors(bg1) white
	set colors(outline1) black
	set colors(bg2) white
	set colors(outline2) black
	set colors(bg3) white
	set colors(outline3) black
	set colors(offices) Black
	set colors(active) black
    }
    floorDisplay $c 3

    # Set up event bindings for canvas:

    $c bind floor1 <1> "floorDisplay $c 1"
    $c bind floor2 <1> "floorDisplay $c 2"
    $c bind floor3 <1> "floorDisplay $c 3"
    $c bind room <Enter> \
	    "set currentRoom \$floorLabels(\[$c find withtag current\])
	     update idletasks"
    $c bind room <Leave> {set currentRoom ""}
    bind $c <2> "$c scan mark %x %y"
    bind $c <B2-Motion> "$c scan dragto %x %y"
    bind $c <Destroy> "unset currentRoom"
    bind $c <Enter> "focus $c.entry"
    set currentRoom ""
    trace variable currentRoom w "roomChanged $c"
}

set activeFloor ""

# The following procedure recreates the floorplan display in the canvas
# given by "w".  The floor given by "active" (1, 2, or 3) is displayed
# on top, with office structure visible.

proc floorDisplay {w active} {
    global floorLabels floorItems colors activeFloor

    if {$activeFloor == $active} {
	return
    }

    $w delete all
    set activeFloor $active

    # First go through the three floors, displaying the backgrounds for
    # each floor.

    bg1 $w $colors(bg1) $colors(outline1)
    bg2 $w $colors(bg2) $colors(outline2)
    bg3 $w $colors(bg3) $colors(outline3)

    # Raise the background for the active floor so that it's on top.

    $w raise floor$active

    # Create a dummy item just to mark this point in the display list,
    # so we can insert highlights here.

    $w create rect 0 100 1 101 -fill {} -outline {} -tags marker

    # Add the walls and labels for the active floor, along with
    # transparent polygons that define the rooms on the floor.
    # Make sure that the room polygons are on top.

    catch {unset floorLabels}
    catch {unset floorItems}
    fg$active $w $colors(offices)
    $w raise room

    # Offset the floors diagonally from each other.

    $w move floor1 2c 2c
    $w move floor2 1c 1c

    # Create items for the room entry and its label.

    $w create window 600 100 -anchor w -window $w.entry
    $w create text 600 100 -anchor e -text "Room: "
    $w config -scrollregion [$w bbox all]
}

# This procedure is invoked whenever the currentRoom variable changes.
# It highlights the current room and unhighlights any previous room.

proc roomChanged {w args} {
    global currentRoom floorItems colors
    $w delete highlight
    if [catch {set item $floorItems($currentRoom)}] {
	return
    }
    set new [eval \
	"$w create polygon [$w coords $item] -fill $colors(active) \
	-tags highlight"]
    $w raise $new marker
}

# The following procedures are invoked to instantiate various portions
# of the building floorplan.  The bodies of these procedures were
# generated automatically from database files describing the building.

proc bg1 {w fill outline} {
    $w create poly 347 80 349 82 351 84 353 85 363 92 375 99 386 104 \
	386 129 398 129 398 162 484 162 484 129 559 129 559 133 725 \
	133 725 129 802 129 802 389 644 389 644 391 559 391 559 327 \
	508 327 508 311 484 311 484 278 395 278 395 288 400 288 404 \
	288 409 290 413 292 418 297 421 302 422 309 421 318 417 325 \
	411 330 405 332 397 333 344 333 340 334 336 336 335 338 332 \
	342 331 347 332 351 334 354 336 357 341 359 340 360 335 363 \
	331 365 326 366 304 366 304 355 258 355 258 387 60 387 60 391 \
	0 391 0 337 3 337 3 114 8 114 8 25 30 25 30 5 93 5 98 5 104 7 \
	110 10 116 16 119 20 122 28 123 32 123 68 220 68 220 34 221 \
	22 223 17 227 13 231 8 236 4 242 2 246 0 260 0 283 1 300 5 \
	321 14 335 22 348 25 365 29 363 39 358 48 352 56 337 70 \
	344 76 347 80 \
	-tags {floor1 bg} -fill $fill
    $w create line 386 129 398 129 -fill $outline -tags {floor1 bg}
    $w create line 258 355 258 387 -fill $outline -tags {floor1 bg}
    $w create line 60 387 60 391 -fill $outline -tags {floor1 bg}
    $w create line 0 337 0 391 -fill $outline -tags {floor1 bg}
    $w create line 60 391 0 391 -fill $outline -tags {floor1 bg}
    $w create line 3 114 3 337 -fill $outline -tags {floor1 bg}
    $w create line 258 387 60 387 -fill $outline -tags {floor1 bg}
    $w create line 484 162 398 162 -fill $outline -tags {floor1 bg}
    $w create line 398 162 398 129 -fill $outline -tags {floor1 bg}
    $w create line 484 278 484 311 -fill $outline -tags {floor1 bg}
    $w create line 484 311 508 311 -fill $outline -tags {floor1 bg}
    $w create line 508 327 508 311 -fill $outline -tags {floor1 bg}
    $w create line 559 327 508 327 -fill $outline -tags {floor1 bg}
    $w create line 644 391 559 391 -fill $outline -tags {floor1 bg}
    $w create line 644 389 644 391 -fill $outline -tags {floor1 bg}
    $w create line 559 129 484 129 -fill $outline -tags {floor1 bg}
    $w create line 484 162 484 129 -fill $outline -tags {floor1 bg}
    $w create line 725 133 559 133 -fill $outline -tags {floor1 bg}
    $w create line 559 129 559 133 -fill $outline -tags {floor1 bg}
    $w create line 725 129 802 129 -fill $outline -tags {floor1 bg}
    $w create line 802 389 802 129 -fill $outline -tags {floor1 bg}
    $w create line 3 337 0 337 -fill $outline -tags {floor1 bg}
    $w create line 559 391 559 327 -fill $outline -tags {floor1 bg}
    $w create line 802 389 644 389 -fill $outline -tags {floor1 bg}
    $w create line 725 133 725 129 -fill $outline -tags {floor1 bg}
    $w create line 8 25 8 114 -fill $outline -tags {floor1 bg}
    $w create line 8 114 3 114 -fill $outline -tags {floor1 bg}
    $w create line 30 25 8 25 -fill $outline -tags {floor1 bg}
    $w create line 484 278 395 278 -fill $outline -tags {floor1 bg}
    $w create line 30 25 30 5 -fill $outline -tags {floor1 bg}
    $w create line 93 5 30 5 -fill $outline -tags {floor1 bg}
    $w create line 98 5 93 5 -fill $outline -tags {floor1 bg}
    $w create line 104 7 98 5 -fill $outline -tags {floor1 bg}
    $w create line 110 10 104 7 -fill $outline -tags {floor1 bg}
    $w create line 116 16 110 10 -fill $outline -tags {floor1 bg}
    $w create line 119 20 116 16 -fill $outline -tags {floor1 bg}
    $w create line 122 28 119 20 -fill $outline -tags {floor1 bg}
    $w create line 123 32 122 28 -fill $outline -tags {floor1 bg}
    $w create line 123 68 123 32 -fill $outline -tags {floor1 bg}
    $w create line 220 68 123 68 -fill $outline -tags {floor1 bg}
    $w create line 386 129 386 104 -fill $outline -tags {floor1 bg}
    $w create line 386 104 375 99 -fill $outline -tags {floor1 bg}
    $w create line 375 99 363 92 -fill $outline -tags {floor1 bg}
    $w create line 353 85 363 92 -fill $outline -tags {floor1 bg}
    $w create line 220 68 220 34 -fill $outline -tags {floor1 bg}
    $w create line 337 70 352 56 -fill $outline -tags {floor1 bg}
    $w create line 352 56 358 48 -fill $outline -tags {floor1 bg}
    $w create line 358 48 363 39 -fill $outline -tags {floor1 bg}
    $w create line 363 39 365 29 -fill $outline -tags {floor1 bg}
    $w create line 365 29 348 25 -fill $outline -tags {floor1 bg}
    $w create line 348 25 335 22 -fill $outline -tags {floor1 bg}
    $w create line 335 22 321 14 -fill $outline -tags {floor1 bg}
    $w create line 321 14 300 5 -fill $outline -tags {floor1 bg}
    $w create line 300 5 283 1 -fill $outline -tags {floor1 bg}
    $w create line 283 1 260 0 -fill $outline -tags {floor1 bg}
    $w create line 260 0 246 0 -fill $outline -tags {floor1 bg}
    $w create line 246 0 242 2 -fill $outline -tags {floor1 bg}
    $w create line 242 2 236 4 -fill $outline -tags {floor1 bg}
    $w create line 236 4 231 8 -fill $outline -tags {floor1 bg}
    $w create line 231 8 227 13 -fill $outline -tags {floor1 bg}
    $w create line 223 17 227 13 -fill $outline -tags {floor1 bg}
    $w create line 221 22 223 17 -fill $outline -tags {floor1 bg}
    $w create line 220 34 221 22 -fill $outline -tags {floor1 bg}
    $w create line 340 360 335 363 -fill $outline -tags {floor1 bg}
    $w create line 335 363 331 365 -fill $outline -tags {floor1 bg}
    $w create line 331 365 326 366 -fill $outline -tags {floor1 bg}
    $w create line 326 366 304 366 -fill $outline -tags {floor1 bg}
    $w create line 304 355 304 366 -fill $outline -tags {floor1 bg}
    $w create line 395 288 400 288 -fill $outline -tags {floor1 bg}
    $w create line 404 288 400 288 -fill $outline -tags {floor1 bg}
    $w create line 409 290 404 288 -fill $outline -tags {floor1 bg}
    $w create line 413 292 409 290 -fill $outline -tags {floor1 bg}
    $w create line 418 297 413 292 -fill $outline -tags {floor1 bg}
    $w create line 421 302 418 297 -fill $outline -tags {floor1 bg}
    $w create line 422 309 421 302 -fill $outline -tags {floor1 bg}
    $w create line 421 318 422 309 -fill $outline -tags {floor1 bg}
    $w create line 421 318 417 325 -fill $outline -tags {floor1 bg}
    $w create line 417 325 411 330 -fill $outline -tags {floor1 bg}
    $w create line 411 330 405 332 -fill $outline -tags {floor1 bg}
    $w create line 405 332 397 333 -fill $outline -tags {floor1 bg}
    $w create line 397 333 344 333 -fill $outline -tags {floor1 bg}
    $w create line 344 333 340 334 -fill $outline -tags {floor1 bg}
    $w create line 340 334 336 336 -fill $outline -tags {floor1 bg}
    $w create line 336 336 335 338 -fill $outline -tags {floor1 bg}
    $w create line 335 338 332 342 -fill $outline -tags {floor1 bg}
    $w create line 331 347 332 342 -fill $outline -tags {floor1 bg}
    $w create line 332 351 331 347 -fill $outline -tags {floor1 bg}
    $w create line 334 354 332 351 -fill $outline -tags {floor1 bg}
    $w create line 336 357 334 354 -fill $outline -tags {floor1 bg}
    $w create line 341 359 336 357 -fill $outline -tags {floor1 bg}
    $w create line 341 359 340 360 -fill $outline -tags {floor1 bg}
    $w create line 395 288 395 278 -fill $outline -tags {floor1 bg}
    $w create line 304 355 258 355 -fill $outline -tags {floor1 bg}
    $w create line 347 80 344 76 -fill $outline -tags {floor1 bg}
    $w create line 344 76 337 70 -fill $outline -tags {floor1 bg}
    $w create line 349 82 347 80 -fill $outline -tags {floor1 bg}
    $w create line 351 84 349 82 -fill $outline -tags {floor1 bg}
    $w create line 353 85 351 84 -fill $outline -tags {floor1 bg}
}

proc bg2 {w fill outline} {
    $w create poly 559 129 484 129 484 162 398 162 398 129 315 129 \
	315 133 176 133 176 129 96 129 96 133 3 133 3 339 0 339 0 391 \
	60 391 60 387 258 387 258 329 350 329 350 311 395 311 395 280 \
	484 280 484 311 508 311 508 327 558 327 558 391 644 391 644 \
	367 802 367 802 129 725 129 725 133 559 133 559 129 \
	-tags {floor2 bg} -fill $fill
    $w create line 350 311 350 329 -fill $outline -tags {floor2 bg}
    $w create line 398 129 398 162 -fill $outline -tags {floor2 bg}
    $w create line 802 367 802 129 -fill $outline -tags {floor2 bg}
    $w create line 802 129 725 129 -fill $outline -tags {floor2 bg}
    $w create line 725 133 725 129 -fill $outline -tags {floor2 bg}
    $w create line 559 129 559 133 -fill $outline -tags {floor2 bg}
    $w create line 559 133 725 133 -fill $outline -tags {floor2 bg}
    $w create line 484 162 484 129 -fill $outline -tags {floor2 bg}
    $w create line 559 129 484 129 -fill $outline -tags {floor2 bg}
    $w create line 802 367 644 367 -fill $outline -tags {floor2 bg}
    $w create line 644 367 644 391 -fill $outline -tags {floor2 bg}
    $w create line 644 391 558 391 -fill $outline -tags {floor2 bg}
    $w create line 558 327 558 391 -fill $outline -tags {floor2 bg}
    $w create line 558 327 508 327 -fill $outline -tags {floor2 bg}
    $w create line 508 327 508 311 -fill $outline -tags {floor2 bg}
    $w create line 484 311 508 311 -fill $outline -tags {floor2 bg}
    $w create line 484 280 484 311 -fill $outline -tags {floor2 bg}
    $w create line 398 162 484 162 -fill $outline -tags {floor2 bg}
    $w create line 484 280 395 280 -fill $outline -tags {floor2 bg}
    $w create line 395 280 395 311 -fill $outline -tags {floor2 bg}
    $w create line 258 387 60 387 -fill $outline -tags {floor2 bg}
    $w create line 3 133 3 339 -fill $outline -tags {floor2 bg}
    $w create line 3 339 0 339 -fill $outline -tags {floor2 bg}
    $w create line 60 391 0 391 -fill $outline -tags {floor2 bg}
    $w create line 0 339 0 391 -fill $outline -tags {floor2 bg}
    $w create line 60 387 60 391 -fill $outline -tags {floor2 bg}
    $w create line 258 329 258 387 -fill $outline -tags {floor2 bg}
    $w create line 350 329 258 329 -fill $outline -tags {floor2 bg}
    $w create line 395 311 350 311 -fill $outline -tags {floor2 bg}
    $w create line 398 129 315 129 -fill $outline -tags {floor2 bg}
    $w create line 176 133 315 133 -fill $outline -tags {floor2 bg}
    $w create line 176 129 96 129 -fill $outline -tags {floor2 bg}
    $w create line 3 133 96 133 -fill $outline -tags {floor2 bg}
    $w create line 315 133 315 129 -fill $outline -tags {floor2 bg}
    $w create line 176 133 176 129 -fill $outline -tags {floor2 bg}
    $w create line 96 133 96 129 -fill $outline -tags {floor2 bg}
}

proc bg3 {w fill outline} {
    $w create poly 159 300 107 300 107 248 159 248 159 129 96 129 96 \
	133 21 133 21 331 0 331 0 391 60 391 60 370 159 370 159 300 \
	-tags {floor3 bg} -fill $fill
    $w create poly 258 370 258 329 350 329 350 311 399 311 399 129 \
	315 129 315 133 176 133 176 129 159 129 159 370 258 370 \
	-tags {floor3 bg} -fill $fill
    $w create line 96 133 96 129 -fill $outline -tags {floor3 bg}
    $w create line 176 129 96 129 -fill $outline -tags {floor3 bg}
    $w create line 176 129 176 133 -fill $outline -tags {floor3 bg}
    $w create line 315 133 176 133 -fill $outline -tags {floor3 bg}
    $w create line 315 133 315 129 -fill $outline -tags {floor3 bg}
    $w create line 399 129 315 129 -fill $outline -tags {floor3 bg}
    $w create line 399 311 399 129 -fill $outline -tags {floor3 bg}
    $w create line 399 311 350 311 -fill $outline -tags {floor3 bg}
    $w create line 350 329 350 311 -fill $outline -tags {floor3 bg}
    $w create line 350 329 258 329 -fill $outline -tags {floor3 bg}
    $w create line 258 370 258 329 -fill $outline -tags {floor3 bg}
    $w create line 60 370 258 370 -fill $outline -tags {floor3 bg}
    $w create line 60 370 60 391 -fill $outline -tags {floor3 bg}
    $w create line 60 391 0 391 -fill $outline -tags {floor3 bg}
    $w create line 0 391 0 331 -fill $outline -tags {floor3 bg}
    $w create line 21 331 0 331 -fill $outline -tags {floor3 bg}
    $w create line 21 331 21 133 -fill $outline -tags {floor3 bg}
    $w create line 96 133 21 133 -fill $outline -tags {floor3 bg}
    $w create line 107 300 159 300 159 248 107 248 107 300 \
	    -fill $outline -tags {floor3 bg}
}

proc fg1 {w color} {
    global floorLabels floorItems
    set i [$w create polygon 375 246 375 172 341 172 341 246 -fill {} -tags {floor1 room}]
    set floorLabels($i) 101
    set {floorItems(101)} $i
    $w create text 358 209 -text 101 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 307 240 339 240 339 206 307 206 -fill {} -tags {floor1 room}]
    set floorLabels($i) {Pub Lift1}
    set {floorItems(Pub Lift1)} $i
    $w create text 323 223 -text {Pub Lift1} -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 339 205 307 205 307 171 339 171 -fill {} -tags {floor1 room}]
    set floorLabels($i) {Priv Lift1}
    set {floorItems(Priv Lift1)} $i
    $w create text 323 188 -text {Priv Lift1} -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 42 389 42 337 1 337 1 389 -fill {} -tags {floor1 room}]
    set floorLabels($i) 110
    set {floorItems(110)} $i
    $w create text 21.5 363 -text 110 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 59 389 59 385 90 385 90 337 44 337 44 389 -fill {} -tags {floor1 room}]
    set floorLabels($i) 109
    set {floorItems(109)} $i
    $w create text 67 363 -text 109 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 51 300 51 253 6 253 6 300 -fill {} -tags {floor1 room}]
    set floorLabels($i) 111
    set {floorItems(111)} $i
    $w create text 28.5 276.5 -text 111 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 98 248 98 309 79 309 79 248 -fill {} -tags {floor1 room}]
    set floorLabels($i) 117B
    set {floorItems(117B)} $i
    $w create text 88.5 278.5 -text 117B -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 51 251 51 204 6 204 6 251 -fill {} -tags {floor1 room}]
    set floorLabels($i) 112
    set {floorItems(112)} $i
    $w create text 28.5 227.5 -text 112 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 6 156 51 156 51 203 6 203 -fill {} -tags {floor1 room}]
    set floorLabels($i) 113
    set {floorItems(113)} $i
    $w create text 28.5 179.5 -text 113 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 85 169 79 169 79 192 85 192 -fill {} -tags {floor1 room}]
    set floorLabels($i) 117A
    set {floorItems(117A)} $i
    $w create text 82 180.5 -text 117A -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 77 302 77 168 53 168 53 302 -fill {} -tags {floor1 room}]
    set floorLabels($i) 117
    set {floorItems(117)} $i
    $w create text 65 235 -text 117 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 51 155 51 115 6 115 6 155 -fill {} -tags {floor1 room}]
    set floorLabels($i) 114
    set {floorItems(114)} $i
    $w create text 28.5 135 -text 114 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 95 115 53 115 53 168 95 168 -fill {} -tags {floor1 room}]
    set floorLabels($i) 115
    set {floorItems(115)} $i
    $w create text 74 141.5 -text 115 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 87 113 87 27 10 27 10 113 -fill {} -tags {floor1 room}]
    set floorLabels($i) 116
    set {floorItems(116)} $i
    $w create text 48.5 70 -text 116 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 89 91 128 91 128 113 89 113 -fill {} -tags {floor1 room}]
    set floorLabels($i) 118
    set {floorItems(118)} $i
    $w create text 108.5 102 -text 118 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 178 128 178 132 216 132 216 91 163 91 163 112 149 112 149 128 -fill {} -tags {floor1 room}]
    set floorLabels($i) 120
    set {floorItems(120)} $i
    $w create text 189.5 111.5 -text 120 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 79 193 87 193 87 169 136 169 136 192 156 192 156 169 175 169 175 246 79 246 -fill {} -tags {floor1 room}]
    set floorLabels($i) 122
    set {floorItems(122)} $i
    $w create text 131 207.5 -text 122 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 138 169 154 169 154 191 138 191 -fill {} -tags {floor1 room}]
    set floorLabels($i) 121
    set {floorItems(121)} $i
    $w create text 146 180 -text 121 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 99 300 126 300 126 309 99 309 -fill {} -tags {floor1 room}]
    set floorLabels($i) 106A
    set {floorItems(106A)} $i
    $w create text 112.5 304.5 -text 106A -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 128 299 128 309 150 309 150 248 99 248 99 299 -fill {} -tags {floor1 room}]
    set floorLabels($i) 105
    set {floorItems(105)} $i
    $w create text 124.5 278.5 -text 105 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 174 309 174 300 152 300 152 309 -fill {} -tags {floor1 room}]
    set floorLabels($i) 106B
    set {floorItems(106B)} $i
    $w create text 163 304.5 -text 106B -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 176 299 176 309 216 309 216 248 152 248 152 299 -fill {} -tags {floor1 room}]
    set floorLabels($i) 104
    set {floorItems(104)} $i
    $w create text 184 278.5 -text 104 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 138 385 138 337 91 337 91 385 -fill {} -tags {floor1 room}]
    set floorLabels($i) 108
    set {floorItems(108)} $i
    $w create text 114.5 361 -text 108 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 256 337 140 337 140 385 256 385 -fill {} -tags {floor1 room}]
    set floorLabels($i) 107
    set {floorItems(107)} $i
    $w create text 198 361 -text 107 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 300 353 300 329 260 329 260 353 -fill {} -tags {floor1 room}]
    set floorLabels($i) Smoking
    set {floorItems(Smoking)} $i
    $w create text 280 341 -text Smoking -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 314 135 314 170 306 170 306 246 177 246 177 135 -fill {} -tags {floor1 room}]
    set floorLabels($i) 123
    set {floorItems(123)} $i
    $w create text 245.5 190.5 -text 123 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 217 248 301 248 301 326 257 326 257 310 217 310 -fill {} -tags {floor1 room}]
    set floorLabels($i) 103
    set {floorItems(103)} $i
    $w create text 259 287 -text 103 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 396 188 377 188 377 169 316 169 316 131 396 131 -fill {} -tags {floor1 room}]
    set floorLabels($i) 124
    set {floorItems(124)} $i
    $w create text 356 150 -text 124 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 397 226 407 226 407 189 377 189 377 246 397 246 -fill {} -tags {floor1 room}]
    set floorLabels($i) 125
    set {floorItems(125)} $i
    $w create text 392 217.5 -text 125 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 399 187 409 187 409 207 474 207 474 164 399 164 -fill {} -tags {floor1 room}]
    set floorLabels($i) 126
    set {floorItems(126)} $i
    $w create text 436.5 185.5 -text 126 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 409 209 409 229 399 229 399 253 486 253 486 239 474 239 474 209 -fill {} -tags {floor1 room}]
    set floorLabels($i) 127
    set {floorItems(127)} $i
    $w create text 436.5 231 -text 127 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 501 164 501 174 495 174 495 188 490 188 490 204 476 204 476 164 -fill {} -tags {floor1 room}]
    set floorLabels($i) MShower
    set {floorItems(MShower)} $i
    $w create text 488.5 184 -text MShower -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 497 176 513 176 513 204 492 204 492 190 497 190 -fill {} -tags {floor1 room}]
    set floorLabels($i) Closet
    set {floorItems(Closet)} $i
    $w create text 502.5 190 -text Closet -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 476 237 476 206 513 206 513 254 488 254 488 237 -fill {} -tags {floor1 room}]
    set floorLabels($i) WShower
    set {floorItems(WShower)} $i
    $w create text 494.5 230 -text WShower -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 486 131 558 131 558 135 724 135 724 166 697 166 697 275 553 275 531 254 515 254 515 174 503 174 503 161 486 161 -fill {} -tags {floor1 room}]
    set floorLabels($i) 130
    set {floorItems(130)} $i
    $w create text 638.5 205 -text 130 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 308 242 339 242 339 248 342 248 342 246 397 246 397 276 393 276 393 309 300 309 300 248 308 248 -fill {} -tags {floor1 room}]
    set floorLabels($i) 102
    set {floorItems(102)} $i
    $w create text 367.5 278.5 -text 102 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 397 255 486 255 486 276 397 276 -fill {} -tags {floor1 room}]
    set floorLabels($i) 128
    set {floorItems(128)} $i
    $w create text 441.5 265.5 -text 128 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 510 309 486 309 486 255 530 255 552 277 561 277 561 325 510 325 -fill {} -tags {floor1 room}]
    set floorLabels($i) 129
    set {floorItems(129)} $i
    $w create text 535.5 293 -text 129 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 696 281 740 281 740 387 642 387 642 389 561 389 561 277 696 277 -fill {} -tags {floor1 room}]
    set floorLabels($i) 133
    set {floorItems(133)} $i
    $w create text 628.5 335 -text 133 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 742 387 742 281 800 281 800 387 -fill {} -tags {floor1 room}]
    set floorLabels($i) 132
    set {floorItems(132)} $i
    $w create text 771 334 -text 132 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 800 168 800 280 699 280 699 168 -fill {} -tags {floor1 room}]
    set floorLabels($i) 134
    set {floorItems(134)} $i
    $w create text 749.5 224 -text 134 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 726 131 726 166 800 166 800 131 -fill {} -tags {floor1 room}]
    set floorLabels($i) 135
    set {floorItems(135)} $i
    $w create text 763 148.5 -text 135 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 340 360 335 363 331 365 326 366 304 366 304 312 396 312 396 288 400 288 404 288 409 290 413 292 418 297 421 302 422 309 421 318 417 325 411 330 405 332 397 333 344 333 340 334 336 336 335 338 332 342 331 347 332 351 334 354 336 357 341 359 -fill {} -tags {floor1 room}]
    set floorLabels($i) {Ramona Stair}
    set {floorItems(Ramona Stair)} $i
    $w create text 368 323 -text {Ramona Stair} -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 30 23 30 5 93 5 98 5 104 7 110 10 116 16 119 20 122 28 123 32 123 68 220 68 220 87 90 87 90 23 -fill {} -tags {floor1 room}]
    set floorLabels($i) {University Stair}
    set {floorItems(University Stair)} $i
    $w create text 155 77.5 -text {University Stair} -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 282 37 295 40 312 49 323 56 337 70 352 56 358 48 363 39 365 29 348 25 335 22 321 14 300 5 283 1 260 0 246 0 242 2 236 4 231 8 227 13 223 17 221 22 220 34 260 34 -fill {} -tags {floor1 room}]
    set floorLabels($i) {Plaza Stair}
    set {floorItems(Plaza Stair)} $i
    $w create text 317.5 28.5 -text {Plaza Stair} -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 220 34 260 34 282 37 295 40 312 49 323 56 337 70 350 83 365 94 377 100 386 104 386 128 220 128 -fill {} -tags {floor1 room}]
    set floorLabels($i) {Plaza Deck}
    set {floorItems(Plaza Deck)} $i
    $w create text 303 81 -text {Plaza Deck} -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 257 336 77 336 6 336 6 301 77 301 77 310 257 310 -fill {} -tags {floor1 room}]
    set floorLabels($i) 106
    set {floorItems(106)} $i
    $w create text 131.5 318.5 -text 106 -fill $color -anchor c -tags {floor1 label}
    set i [$w create polygon 146 110 162 110 162 91 130 91 130 115 95 115 95 128 114 128 114 151 157 151 157 153 112 153 112 130 97 130 97 168 175 168 175 131 146 131 -fill {} -tags {floor1 room}]
    set floorLabels($i) 119
    set {floorItems(119)} $i
    $w create text 143.5 133 -text 119 -fill $color -anchor c -tags {floor1 label}
    $w create line 155 191 155 189 -fill $color -tags {floor1 wall}
    $w create line 155 177 155 169 -fill $color -tags {floor1 wall}
    $w create line 96 129 96 169 -fill $color -tags {floor1 wall}
    $w create line 78 169 176 169 -fill $color -tags {floor1 wall}
    $w create line 176 247 176 129 -fill $color -tags {floor1 wall}
    $w create line 340 206 307 206 -fill $color -tags {floor1 wall}
    $w create line 340 187 340 170 -fill $color -tags {floor1 wall}
    $w create line 340 210 340 201 -fill $color -tags {floor1 wall}
    $w create line 340 247 340 224 -fill $color -tags {floor1 wall}
    $w create line 340 241 307 241 -fill $color -tags {floor1 wall}
    $w create line 376 246 376 170 -fill $color -tags {floor1 wall}
    $w create line 307 247 307 170 -fill $color -tags {floor1 wall}
    $w create line 376 170 307 170 -fill $color -tags {floor1 wall}
    $w create line 315 129 315 170 -fill $color -tags {floor1 wall}
    $w create line 147 129 176 129 -fill $color -tags {floor1 wall}
    $w create line 202 133 176 133 -fill $color -tags {floor1 wall}
    $w create line 398 129 315 129 -fill $color -tags {floor1 wall}
    $w create line 258 352 258 387 -fill $color -tags {floor1 wall}
    $w create line 60 387 60 391 -fill $color -tags {floor1 wall}
    $w create line 0 337 0 391 -fill $color -tags {floor1 wall}
    $w create line 60 391 0 391 -fill $color -tags {floor1 wall}
    $w create line 3 114 3 337 -fill $color -tags {floor1 wall}
    $w create line 258 387 60 387 -fill $color -tags {floor1 wall}
    $w create line 52 237 52 273 -fill $color -tags {floor1 wall}
    $w create line 52 189 52 225 -fill $color -tags {floor1 wall}
    $w create line 52 140 52 177 -fill $color -tags {floor1 wall}
    $w create line 395 306 395 311 -fill $color -tags {floor1 wall}
    $w create line 531 254 398 254 -fill $color -tags {floor1 wall}
    $w create line 475 178 475 238 -fill $color -tags {floor1 wall}
    $w create line 502 162 398 162 -fill $color -tags {floor1 wall}
    $w create line 398 129 398 188 -fill $color -tags {floor1 wall}
    $w create line 383 188 376 188 -fill $color -tags {floor1 wall}
    $w create line 408 188 408 194 -fill $color -tags {floor1 wall}
    $w create line 398 227 398 254 -fill $color -tags {floor1 wall}
    $w create line 408 227 398 227 -fill $color -tags {floor1 wall}
    $w create line 408 222 408 227 -fill $color -tags {floor1 wall}
    $w create line 408 206 408 210 -fill $color -tags {floor1 wall}
    $w create line 408 208 475 208 -fill $color -tags {floor1 wall}
    $w create line 484 278 484 311 -fill $color -tags {floor1 wall}
    $w create line 484 311 508 311 -fill $color -tags {floor1 wall}
    $w create line 508 327 508 311 -fill $color -tags {floor1 wall}
    $w create line 559 327 508 327 -fill $color -tags {floor1 wall}
    $w create line 644 391 559 391 -fill $color -tags {floor1 wall}
    $w create line 644 389 644 391 -fill $color -tags {floor1 wall}
    $w create line 514 205 475 205 -fill $color -tags {floor1 wall}
    $w create line 496 189 496 187 -fill $color -tags {floor1 wall}
    $w create line 559 129 484 129 -fill $color -tags {floor1 wall}
    $w create line 484 162 484 129 -fill $color -tags {floor1 wall}
    $w create line 725 133 559 133 -fill $color -tags {floor1 wall}
    $w create line 559 129 559 133 -fill $color -tags {floor1 wall}
    $w create line 725 149 725 167 -fill $color -tags {floor1 wall}
    $w create line 725 129 802 129 -fill $color -tags {floor1 wall}
    $w create line 802 389 802 129 -fill $color -tags {floor1 wall}
    $w create line 739 167 802 167 -fill $color -tags {floor1 wall}
    $w create line 396 188 408 188 -fill $color -tags {floor1 wall}
    $w create line 0 337 9 337 -fill $color -tags {floor1 wall}
    $w create line 58 337 21 337 -fill $color -tags {floor1 wall}
    $w create line 43 391 43 337 -fill $color -tags {floor1 wall}
    $w create line 105 337 75 337 -fill $color -tags {floor1 wall}
    $w create line 91 387 91 337 -fill $color -tags {floor1 wall}
    $w create line 154 337 117 337 -fill $color -tags {floor1 wall}
    $w create line 139 387 139 337 -fill $color -tags {floor1 wall}
    $w create line 227 337 166 337 -fill $color -tags {floor1 wall}
    $w create line 258 337 251 337 -fill $color -tags {floor1 wall}
    $w create line 258 328 302 328 -fill $color -tags {floor1 wall}
    $w create line 302 355 302 311 -fill $color -tags {floor1 wall}
    $w create line 395 311 302 311 -fill $color -tags {floor1 wall}
    $w create line 484 278 395 278 -fill $color -tags {floor1 wall}
    $w create line 395 294 395 278 -fill $color -tags {floor1 wall}
    $w create line 473 278 473 275 -fill $color -tags {floor1 wall}
    $w create line 473 256 473 254 -fill $color -tags {floor1 wall}
    $w create line 533 257 531 254 -fill $color -tags {floor1 wall}
    $w create line 553 276 551 274 -fill $color -tags {floor1 wall}
    $w create line 698 276 553 276 -fill $color -tags {floor1 wall}
    $w create line 559 391 559 327 -fill $color -tags {floor1 wall}
    $w create line 802 389 644 389 -fill $color -tags {floor1 wall}
    $w create line 741 314 741 389 -fill $color -tags {floor1 wall}
    $w create line 698 280 698 167 -fill $color -tags {floor1 wall}
    $w create line 707 280 698 280 -fill $color -tags {floor1 wall}
    $w create line 802 280 731 280 -fill $color -tags {floor1 wall}
    $w create line 741 280 741 302 -fill $color -tags {floor1 wall}
    $w create line 698 167 727 167 -fill $color -tags {floor1 wall}
    $w create line 725 137 725 129 -fill $color -tags {floor1 wall}
    $w create line 514 254 514 175 -fill $color -tags {floor1 wall}
    $w create line 496 175 514 175 -fill $color -tags {floor1 wall}
    $w create line 502 175 502 162 -fill $color -tags {floor1 wall}
    $w create line 475 166 475 162 -fill $color -tags {floor1 wall}
    $w create line 496 176 496 175 -fill $color -tags {floor1 wall}
    $w create line 491 189 496 189 -fill $color -tags {floor1 wall}
    $w create line 491 205 491 189 -fill $color -tags {floor1 wall}
    $w create line 487 238 475 238 -fill $color -tags {floor1 wall}
    $w create line 487 240 487 238 -fill $color -tags {floor1 wall}
    $w create line 487 252 487 254 -fill $color -tags {floor1 wall}
    $w create line 315 133 304 133 -fill $color -tags {floor1 wall}
    $w create line 256 133 280 133 -fill $color -tags {floor1 wall}
    $w create line 78 247 270 247 -fill $color -tags {floor1 wall}
    $w create line 307 247 294 247 -fill $color -tags {floor1 wall}
    $w create line 214 133 232 133 -fill $color -tags {floor1 wall}
    $w create line 217 247 217 266 -fill $color -tags {floor1 wall}
    $w create line 217 309 217 291 -fill $color -tags {floor1 wall}
    $w create line 217 309 172 309 -fill $color -tags {floor1 wall}
    $w create line 154 309 148 309 -fill $color -tags {floor1 wall}
    $w create line 175 300 175 309 -fill $color -tags {floor1 wall}
    $w create line 151 300 175 300 -fill $color -tags {floor1 wall}
    $w create line 151 247 151 309 -fill $color -tags {floor1 wall}
    $w create line 78 237 78 265 -fill $color -tags {floor1 wall}
    $w create line 78 286 78 309 -fill $color -tags {floor1 wall}
    $w create line 106 309 78 309 -fill $color -tags {floor1 wall}
    $w create line 130 309 125 309 -fill $color -tags {floor1 wall}
    $w create line 99 309 99 247 -fill $color -tags {floor1 wall}
    $w create line 127 299 99 299 -fill $color -tags {floor1 wall}
    $w create line 127 309 127 299 -fill $color -tags {floor1 wall}
    $w create line 155 191 137 191 -fill $color -tags {floor1 wall}
    $w create line 137 169 137 191 -fill $color -tags {floor1 wall}
    $w create line 78 171 78 169 -fill $color -tags {floor1 wall}
    $w create line 78 190 78 218 -fill $color -tags {floor1 wall}
    $w create line 86 192 86 169 -fill $color -tags {floor1 wall}
    $w create line 86 192 78 192 -fill $color -tags {floor1 wall}
    $w create line 52 301 3 301 -fill $color -tags {floor1 wall}
    $w create line 52 286 52 301 -fill $color -tags {floor1 wall}
    $w create line 52 252 3 252 -fill $color -tags {floor1 wall}
    $w create line 52 203 3 203 -fill $color -tags {floor1 wall}
    $w create line 3 156 52 156 -fill $color -tags {floor1 wall}
    $w create line 8 25 8 114 -fill $color -tags {floor1 wall}
    $w create line 63 114 3 114 -fill $color -tags {floor1 wall}
    $w create line 75 114 97 114 -fill $color -tags {floor1 wall}
    $w create line 108 114 129 114 -fill $color -tags {floor1 wall}
    $w create line 129 114 129 89 -fill $color -tags {floor1 wall}
    $w create line 52 114 52 128 -fill $color -tags {floor1 wall}
    $w create line 132 89 88 89 -fill $color -tags {floor1 wall}
    $w create line 88 25 88 89 -fill $color -tags {floor1 wall}
    $w create line 88 114 88 89 -fill $color -tags {floor1 wall}
    $w create line 218 89 144 89 -fill $color -tags {floor1 wall}
    $w create line 147 111 147 129 -fill $color -tags {floor1 wall}
    $w create line 162 111 147 111 -fill $color -tags {floor1 wall}
    $w create line 162 109 162 111 -fill $color -tags {floor1 wall}
    $w create line 162 96 162 89 -fill $color -tags {floor1 wall}
    $w create line 218 89 218 94 -fill $color -tags {floor1 wall}
    $w create line 218 89 218 119 -fill $color -tags {floor1 wall}
    $w create line 8 25 88 25 -fill $color -tags {floor1 wall}
    $w create line 258 337 258 328 -fill $color -tags {floor1 wall}
    $w create line 113 129 96 129 -fill $color -tags {floor1 wall}
    $w create line 302 355 258 355 -fill $color -tags {floor1 wall}
    $w create line 386 104 386 129 -fill $color -tags {floor1 wall}
    $w create line 377 100 386 104 -fill $color -tags {floor1 wall}
    $w create line 365 94 377 100 -fill $color -tags {floor1 wall}
    $w create line 350 83 365 94 -fill $color -tags {floor1 wall}
    $w create line 337 70 350 83 -fill $color -tags {floor1 wall}
    $w create line 337 70 323 56 -fill $color -tags {floor1 wall}
    $w create line 312 49 323 56 -fill $color -tags {floor1 wall}
    $w create line 295 40 312 49 -fill $color -tags {floor1 wall}
    $w create line 282 37 295 40 -fill $color -tags {floor1 wall}
    $w create line 260 34 282 37 -fill $color -tags {floor1 wall}
    $w create line 253 34 260 34 -fill $color -tags {floor1 wall}
    $w create line 386 128 386 104 -fill $color -tags {floor1 wall}
    $w create line 113 152 156 152 -fill $color -tags {floor1 wall}
    $w create line 113 152 156 152 -fill $color -tags {floor1 wall}
    $w create line 113 152 113 129 -fill $color -tags {floor1 wall}
}
source $tk_library/demos/mkfloor2.tcl
