Revision: 53412
          http://brlcad.svn.sourceforge.net/brlcad/?rev=53412&view=rev
Author:   bob1961
Date:     2012-11-01 11:30:38 +0000 (Thu, 01 Nov 2012)
Log Message:
-----------
Updated Archer to be able to select bot points using a rubberband rectangle.

Modified Paths:
--------------
    brlcad/trunk/src/tclscripts/archer/Archer.tcl
    brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
    brlcad/trunk/src/tclscripts/archer/BotEditFrame.tcl

Modified: brlcad/trunk/src/tclscripts/archer/Archer.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/Archer.tcl       2012-11-01 11:23:22 UTC 
(rev 53411)
+++ brlcad/trunk/src/tclscripts/archer/Archer.tcl       2012-11-01 11:30:38 UTC 
(rev 53412)
@@ -212,8 +212,10 @@
 
        # ArcherCore Override Section
        method buildCommandView {}
+       method compSelectCallback {_mstring}
        method dblClick {_tags}
        method handleTreeSelect {}
+       method initCompSelect {}
        method initDefaultBindings {{_comp ""}}
        method initGed {}
        method setActivePane {_pane}
@@ -1997,6 +1999,28 @@
 }
 
 
+::itcl::body Archer::compSelectCallback {_mstring} {
+    switch -- $mCompSelectMode \
+       $COMP_SELECT_LIST_MODE - \
+       $COMP_SELECT_LIST_PARTIAL_MODE {
+           putString $_mstring
+       } \
+       $COMP_SELECT_GROUP_ADD_MODE - \
+       $COMP_SELECT_GROUP_ADD_PARTIAL_MODE {
+           compSelectGroupAdd $_mstring
+       } \
+       $COMP_SELECT_GROUP_REMOVE_MODE - \
+       $COMP_SELECT_GROUP_REMOVE_PARTIAL_MODE {
+           compSelectGroupRemove $_mstring
+       } \
+       $COMP_SELECT_BOT_POINTS_MODE {
+           if {[info exists itk_component(botView)]} {
+               catch {$itk_component(botView) selectBotPts $_mstring} msg
+           }
+       }
+}
+
+
 ::itcl::body Archer::dblClick {tags} {
     return
 
@@ -2064,6 +2088,38 @@
 }
 
 
+::itcl::body Archer::initCompSelect {} {
+    if {$mCompSelectMode != $COMP_SELECT_LIST_MODE &&
+       $mCompSelectMode != $COMP_SELECT_LIST_PARTIAL_MODE &&
+       $mCompSelectMode != $COMP_SELECT_BOT_POINTS_MODE} {
+       doSelectGroup
+    }
+
+    $itk_component(ged) clear_view_rect_callback_list
+    $itk_component(ged) add_view_rect_callback [::itcl::code $this 
compSelectCallback]
+    if {$mCompSelectMode == $COMP_SELECT_LIST_PARTIAL_MODE ||
+       $mCompSelectMode == $COMP_SELECT_GROUP_ADD_PARTIAL_MODE ||
+       $mCompSelectMode == $COMP_SELECT_GROUP_REMOVE_PARTIAL_MODE} {
+       $itk_component(ged) init_view_rect 1 1
+    } elseif {$mCompSelectMode == $COMP_SELECT_BOT_POINTS_MODE && 
$mSelectedObj != "" && $mSelectedObjType == "bot"} {
+       if {[info exists itk_component(botView)]} {
+           $itk_component(botView) clearEditState
+       }
+
+       $itk_component(ged) init_view_rect 1 0 $mSelectedObj
+    } else {
+       $itk_component(ged) init_view_rect 1 0
+    }
+    $itk_component(ged) init_button_no_op 2
+
+    # The rect lwidth should be a preference
+    $itk_component(ged) rect lwidth 1
+
+    # Update the toolbar buttons
+    set mDefaultBindingMode $COMP_SELECT_MODE
+}
+
+
 ::itcl::body Archer::initDefaultBindings {{_comp ""}} {
     if {$_comp == ""} {
        set _comp $itk_component(ged)
@@ -4352,6 +4408,9 @@
            [lindex $COMP_SELECT_MODE_NAMES 
$COMP_SELECT_GROUP_REMOVE_PARTIAL_MODE] {
                set mStatusStr "Remove the partially selected components from 
the specified group"
            } \
+           [lindex $COMP_SELECT_MODE_NAMES $COMP_SELECT_BOT_POINTS_MODE] {
+               set mStatusStr "Select BOT points from $mSelectedObj"
+           } \
            default {
                set mStatusStr ""
            }
@@ -5253,6 +5312,8 @@
                    -helpstr "Remove the selected components from group."
                radiobutton selectgroupadd -label [lindex 
$COMP_SELECT_MODE_NAMES $COMP_SELECT_GROUP_REMOVE_PARTIAL_MODE] \
                    -helpstr "Remove the selected components from group."
+               radiobutton selectbotpts -label [lindex $COMP_SELECT_MODE_NAMES 
$COMP_SELECT_BOT_POINTS_MODE] \
+                   -helpstr "Select BOT points from $mSelectedObj."
            }
            checkbutton quad -label "Quad View" \
                -helpstr "Toggle between single and quad display."
@@ -5608,6 +5669,11 @@
        -label [lindex $COMP_SELECT_MODE_NAMES 
$COMP_SELECT_GROUP_REMOVE_PARTIAL_MODE] \
        -value $COMP_SELECT_GROUP_REMOVE_PARTIAL_MODE \
        -variable [::itcl::scope mCompSelectMode]
+    $itk_component(${_prefix}compselectmenu) add radiobutton \
+       -command [::itcl::code $this initCompSelect] \
+       -label [lindex $COMP_SELECT_MODE_NAMES $COMP_SELECT_BOT_POINTS_MODE] \
+       -value $COMP_SELECT_BOT_POINTS_MODE \
+       -variable [::itcl::scope mCompSelectMode]
 
     $itk_component(${_prefix}modesmenu) add cascade \
        -label "Active Pane" \

Modified: brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2012-11-01 11:23:22 UTC 
(rev 53411)
+++ brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2012-11-01 11:30:38 UTC 
(rev 53412)
@@ -96,7 +96,8 @@
        common COMP_SELECT_GROUP_ADD_PARTIAL_MODE 3
        common COMP_SELECT_GROUP_REMOVE_MODE 4
        common COMP_SELECT_GROUP_REMOVE_PARTIAL_MODE 5
-       common COMP_SELECT_MODE_NAMES {"List" "List (Partial)" "Add to Group" 
"Add to Group (Partial)" "Remove from Group" "Remove from Group (Partial)"}
+       common COMP_SELECT_BOT_POINTS_MODE 6
+       common COMP_SELECT_MODE_NAMES {"List" "List (Partial)" "Add to Group" 
"Add to Group (Partial)" "Remove from Group" "Remove from Group (Partial)" 
"Select BOT Points"}
 
        common LIGHT_MODE_FRONT 1
        common LIGHT_MODE_FRONT_AND_BACK 2

Modified: brlcad/trunk/src/tclscripts/archer/BotEditFrame.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/BotEditFrame.tcl 2012-11-01 11:23:22 UTC 
(rev 53411)
+++ brlcad/trunk/src/tclscripts/archer/BotEditFrame.tcl 2012-11-01 11:30:38 UTC 
(rev 53412)
@@ -31,8 +31,6 @@
 # TODO
 #
 # -) Highlight selected points
-# -) Mass selection of points via rubberband
-# -) Select/deselect individual points, edges and faces via mouse
 # -) Delete points, faces and edges
 # -) Operations to create/extend surface mode bots
 #    - Three pts are specified to create a face.
@@ -77,6 +75,9 @@
            {Split Face}
        }
 
+       method clearEditState {}
+       method selectBotPts {_plist}
+
        # Override what's in GeometryEditFrame
        method initGeometry {_gdata}
        method updateGeometry {}
@@ -156,6 +157,24 @@
 
 
 
+::itcl::body BotEditFrame::clearEditState {} {
+    set mEditMode 0
+}
+
+
+::itcl::body BotEditFrame::selectBotPts {_plist} {
+    foreach item $_plist {
+       incr item
+
+       if {[lsearch $mCurrentBotPoints $item] == -1} {
+           lappend mCurrentBotPoints $item
+       }
+    }
+
+    selectCurrentBotPoints
+}
+
+
 ## - initGeometry
 #
 # Initialize the variables containing the object's specification.
@@ -592,8 +611,13 @@
 #    set mEditClass $EDIT_CLASS_SCALE
 #    configure -valueUnits "mm"
 
+    if {$itk_option(-mged) == ""} {
+       return
+    }
+
     set mEditPCommand [::itcl::code $this p]
     set mEditParam1 ""
+    $itk_option(-mged) rect lwidth 0
 
     switch -- $mEditMode \
        $movePoints {
@@ -641,7 +665,13 @@
        $splitEdge {
            set mEditCommand ""
            set mEditClass ""
-           $::ArcherCore::application initFindBotEdge 
$itk_option(-geometryObjectPath) 1 [::itcl::code $this botEdgeSplitCallback]
+           if {$mFrontPointsOnly} {
+               set zlist [ $::ArcherCore::application getZClipState]
+               set viewz [lindex $zlist 0]
+           } else {
+               set viewz -1.0
+           }
+           $::ArcherCore::application initFindBotEdge 
$itk_option(-geometryObjectPath) 1 $viewz [::itcl::code $this 
botEdgeSplitCallback]
        } \
        $splitFace {
            set mEditCommand ""

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to