Changeset 3746
- Timestamp:
- Jul 5, 2013 9:53:57 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field3dresult.tcl
r3684 r3746 57 57 array set flags $args 58 58 set servers "" 59 puts stderr "field3d: args=$args"60 59 switch -- $flags(-mode) { 61 60 "auto" - "nanovis" - "flowvis" { -
trunk/gui/scripts/xyresult.tcl
r3727 r3746 381 381 # ---------------------------------------------------------------------- 382 382 itcl::body Rappture::XyResult::scale {args} { 383 set g $itk_component(plot) 384 385 383 386 set allx [$itk_component(plot) x2axis use] 384 387 lappend allx x ;# fix main x-axis too … … 387 390 lappend ally y ;# fix main y-axis too 388 391 catch {unset _limits} 392 393 eval $g element delete [$g element names] 394 foreach dataobj $args { 395 set label [$dataobj hints label] 396 foreach {mapx mapy} [GetAxes $dataobj] break 397 foreach comp [$dataobj components] { 398 set xv [$dataobj mesh $comp] 399 set yv [$dataobj values $comp] 400 401 if {[info exists _dataobj2type($dataobj)]} { 402 set type $_dataobj2type($dataobj) 403 } else { 404 set type "line" 405 } 406 if {[info exists _dataobj2barwidth($dataobj)]} { 407 set barwidth $_dataobj2barwidth($dataobj) 408 } else { 409 set barwidth 1.0 410 } 411 if {[info exists _dataobj2width($dataobj)]} { 412 set lwidth $_dataobj2width($dataobj) 413 } else { 414 set lwidth 2 415 } 416 if {([$xv length] <= 1) || ($lwidth == 0)} { 417 set sym square 418 set pixels 2 419 } else { 420 set sym "" 421 set pixels 6 422 } 423 set elem "elem[incr _nextElement]" 424 set _elem2dataobj($elem) $dataobj 425 switch -- $type { 426 "line" - "scatter" { 427 $g element create $elem -x $xv -y $yv \ 428 -symbol $sym -pixels $pixels -linewidth $lwidth \ 429 -mapx $mapx -mapy $mapy 430 } "bar" { 431 $g bar create $elem -x $xv -y $yv \ 432 -barwidth $barwidth \ 433 -mapx $mapx -mapy $mapy 434 } 435 } 436 } 437 } 438 foreach axis {x y} { 439 if { [info exists _limits({$axis}log)] } { 440 set type "log" 441 $g axis configure -logscale 1 442 } else { 443 set type "lin" 444 } 445 foreach {min max} [$g axis limits $axis] break 446 set _limits(${axis}-min) $min 447 set _limits(${axis}-max) $max 448 set min [$dataobj hints ${axis}min] 449 set max [$dataobj hints ${axis}max] 450 if {"" != $min } { 451 set _limits(${axis}-min) $min 452 } 453 if {"" != $max } { 454 set _limits(${axis}-max) $max 455 } 456 } 457 eval $g element delete [$g element names] 458 if 0 { 389 459 foreach dataobj $args { 390 460 # Find the axes for this dataobj (e.g., {x y2}) … … 415 485 } 416 486 } 487 } 417 488 } 418 489 ResetLimits … … 540 611 } 541 612 613 itcl::body Rappture::XyResult::BuildMarkers { dataobj elem } { 614 set g $itk_component(plot) 615 616 foreach m [$dataobj xmarkers] { 617 foreach {at label style} $m break 618 set id [$g marker create line -coords [list $at $ymin $at $ymax]] 619 $g marker bind $id <Enter> \ 620 [itcl::code $this EnterMarker $g x-$label $at $ymin $at] 621 $g marker bind $id <Leave> \ 622 [itcl::code $this LeaveMarker $g x-$label] 623 set options [GetLineMarkerOptions $style] 624 $g marker configure $id -element $elem 625 if { $options != "" } { 626 eval $g marker configure $id $options 627 } 628 if { $label != "" } { 629 set id [$g marker create text -anchor nw \ 630 -text $label -coords [list $at $ymax]] 631 $g marker configure $id -element $elem 632 set options [GetTextMarkerOptions $style] 633 if { $options != "" } { 634 eval $g marker configure $id $options 635 } 636 } 637 } 638 foreach m [$dataobj ymarkers] { 639 foreach {at label style} $m break 640 set id [$g marker create line -coords [list $xmin $at $xmax $at]] 641 $g marker configure $id -element $elem 642 $g marker bind $id <Enter> \ 643 [itcl::code $this EnterMarker $g y-$label $at $xmin $at] 644 $g marker bind $id <Leave> \ 645 [itcl::code $this LeaveMarker $g y-$label] 646 set options [GetLineMarkerOptions $style] 647 if { $options != "" } { 648 eval $g marker configure $id $options 649 } 650 if { $label != "" } { 651 set id [$g marker create text -anchor se \ 652 -text $label -coords [list $xmax $at]] 653 $g marker configure $id -element $elem 654 set options [GetTextMarkerOptions $style] 655 if { $options != "" } { 656 eval $g marker configure $id $options 657 } 658 } 659 } 660 } 661 662 # ---------------------------------------------------------------------- 663 # USAGE: BuildElementsAndMarkers 664 # 665 # This does what "Rebuild" used to. It (re)creates all the 666 # the elements and markers for the graph based on the data objects 667 # given. The axes are also set if min and max have been set for 668 # any data object. 669 # data in the widget. Clears any existing data and rebuilds the 670 # widget to display new data. 671 # ---------------------------------------------------------------------- 672 itcl::body Rappture::XyResult::BuildElementsAndMarkers { dlist } { 673 set g $itk_component(plot) 674 675 # First clear out the widget and hide the axes. 676 eval $g element delete [$g element names] 677 eval $g marker delete [$g marker names] 678 foreach label [array names _label2axis] { 679 set axis $_label2axis($label) 680 switch -- $axis { 681 "x" - "x2" - "y" - "y2" { 682 # Do nothing 683 $g axis configure $axis -hide yes 684 } 685 default { 686 $g axis delete $axis 687 } 688 } 689 array unset _label2axis 690 array unset _limits 691 692 # Scan through all objects and create a list of all axes. 693 # The first x-axis gets mapped to "x". The second, to "x2". 694 # Beyond that, we must create new axes "x3", "x4", etc. 695 # We do the same for y. 696 697 set anum(x) 0 698 set anum(y) 0 699 foreach dataobj $dlist { 700 foreach axis {x y} { 701 set label [$dataobj hints ${axis}label] 702 if { $label == "" } { 703 continue 704 } 705 # Collect the limits (if set for the axis) 706 set min [$dataobj hints ${axis}min] 707 set max [$dataobj hints ${axis}max] 708 if { $min != "" && (![info exists _limits(${label}-min)] || 709 $_limits(${label}-min) > $min) } { 710 set _limits(${label}-min} $min 711 } 712 if { $max != "" && (![info exists _limits(${label}-max)] || 713 $_limits(${label}-max) < $max) } { 714 set _limits(${label}-max} $max 715 } 716 if {[$dataobj hints ${axis}scale] == "log"} { 717 set _limits(${axis}log) 1 718 } 719 if {![info exists _label2axis($label)]} { 720 switch [incr anum($axis)] { 721 1 { set axisName $axis } 722 2 { set axisName ${axis}2 } 723 default { 724 set axis $axis$anum($axis) 725 catch {$g axis create $axisName} 726 } 727 } 728 $g axis configure $axisName -title $label -hide no \ 729 -checklimits no 730 set _label2axis($label) $axisName 731 732 # if this axis has a description, add it as a tooltip 733 set desc [string trim [$dataobj hints ${axis}desc]] 734 Rappture::Tooltip::text $g-$axisName $desc 735 } 736 } 737 } 738 739 # Next set the axes based on what we've found. 740 foreach label [array names _label2axis] { 741 if { [info exist _limits(${label}log)] } { 742 set logscale 1 743 } else { 744 set logscale 0 745 } 746 set amin "" 747 if { [info exists _limits(${label}-min)] } { 748 set amin $_limits(${label}-min) 749 } 750 set amax "" 751 if { [info exists _limits(${label}-max)] } { 752 set amax $_limits(${label}-max) 753 } 754 set axis $_label2axis($label) 755 $g axis configure $axis \ 756 -hide no -checklimits no \ 757 -command [itcl::code $this GetFormattedValue $axis] \ 758 -min $amin -max $amax -logscale $logscale 759 $g axis bind $axis <Enter> \ 760 [itcl::code $this Axis hilite $axis on] 761 $g axis bind $axis <Leave> \ 762 [itcl::code $this Axis hilite $axis off] 763 $g axis bind $axis <ButtonPress-1> \ 764 [itcl::code $this Axis click $axis %x %y] 765 $g axis bind $axis <B1-Motion> \ 766 [itcl::code $this Axis drag $axis %x %y] 767 $g axis bind $axis <ButtonRelease-1> \ 768 [itcl::code $this Axis release $axis %x %y] 769 $g axis bind $axis <KeyPress> \ 770 [list ::Rappture::Tooltip::tooltip cancel] 771 } 772 773 # Generate all the data elements and markers, but mark them as hidden. 774 # The Rebuild method will un-hide them. 775 set count 0 776 foreach dataobj $dlist { 777 set label [$dataobj hints label] 778 foreach {mapx mapy} [GetAxes $dataobj] break 779 foreach comp [$dataobj components] { 780 set xv [$dataobj mesh $comp] 781 set yv [$dataobj values $comp] 782 783 if {[info exists _dataobj2color($dataobj)]} { 784 set color $_dataobj2color($dataobj) 785 } else { 786 set color black 787 } 788 if {[info exists _dataobj2type($dataobj)]} { 789 set type $_dataobj2type($dataobj) 790 } else { 791 set type "line" 792 } 793 if {[info exists _dataobj2barwidth($dataobj)]} { 794 set barwidth $_dataobj2barwidth($dataobj) 795 } else { 796 set barwidth 1.0 797 } 798 if {[info exists _dataobj2width($dataobj)]} { 799 set lwidth $_dataobj2width($dataobj) 800 } else { 801 set lwidth 2 802 } 803 if {[info exists _dataobj2dashes($dataobj)]} { 804 set dashes $_dataobj2dashes($dataobj) 805 } else { 806 set dashes "" 807 } 808 if {([$xv length] <= 1) || ($lwidth == 0)} { 809 set sym square 810 set pixels 2 811 } else { 812 set sym "" 813 set pixels 6 814 } 815 816 set elem "elem[incr _nextElement]" 817 set _elem2dataobj($elem) $dataobj 818 lappend label2elem($label) $elem 819 switch -- $type { 820 "line" - "scatter" { 821 $g element create $elem -x $xv -y $yv \ 822 -symbol $sym -pixels $pixels -linewidth $lwidth \ 823 -label $label \ 824 -color $color -dashes $dashes \ 825 -mapx $mapx -mapy $mapy -hide yes 826 } "bar" { 827 $g bar create $elem -x $xv -y $yv \ 828 -barwidth $barwidth \ 829 -label $label \ 830 -color $color \ 831 -mapx $mapx -mapy $mapy -hide yes 832 } 833 } 834 if { [$dataobj info class] == "Rappture::Curve" } { 835 BuildMarkers $dataobj $elem 836 } 837 } 838 } 839 # Fix duplicate labels by appending the simulation number 840 foreach label [array names label2elem] { 841 if { [llength $label2elem($label)] == 1 } { 842 continue 843 } 844 foreach elem $label2elem($label) { 845 set dataobj $_elem2dataobj($elem) 846 regexp {^::curve(?:Value)?([0-9]+)$} $dataobj match suffix 847 incr suffix 848 set elabel [format "%s \#%d" $label $suffix] 849 $g element configure $elem -label $elabel 850 } 851 } 852 $itk_component(legend) reset 853 } 854 542 855 # ---------------------------------------------------------------------- 543 856 # USAGE: Rebuild … … 563 876 } 564 877 set amin "" 565 if { [info exists _limits(${axis} ${type}-min)] } {566 set amin $_limits(${axis} ${type}-min)878 if { [info exists _limits(${axis}-min)] } { 879 set amin $_limits(${axis}-min) 567 880 } 568 881 set amax "" 569 if { [info exists _limits(${axis} ${type}-max)] } {570 set amax $_limits(${axis} ${type}-max)882 if { [info exists _limits(${axis}-max)] } { 883 set amax $_limits(${axis}-max) 571 884 } 572 885 $g axis configure $axis \ -
trunk/lang/R/Makefile.in
r3741 r3746 23 23 coresrcdir = ${PWD}/$(srcdir)/../../src/core 24 24 corelibdir = ${PWD}/../../src/core 25 R_flags = --configure-args='--with-rappture-include=$( coresrcdir) \26 --with-rappture-lib=$( corelibdir)'25 R_flags = --configure-args='--with-rappture-include=$(includedir) \ 26 --with-rappture-lib=$(libdir)' 27 27 28 28 RLIB = R
Note: See TracChangeset
for help on using the changeset viewer.