Revision: 54040
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54040&view=rev
Author:   bob1961
Date:     2012-12-11 17:04:12 +0000 (Tue, 11 Dec 2012)
Log Message:
-----------
This allows the multi-line segment creation mode to use existing points. Stub 
in a few methods for creating arcs, circles and bezier curves.

Modified Paths:
--------------
    brlcad/trunk/src/tclscripts/archer/SketchEditFrame.tcl

Modified: brlcad/trunk/src/tclscripts/archer/SketchEditFrame.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/SketchEditFrame.tcl      2012-12-11 
16:03:12 UTC (rev 54039)
+++ brlcad/trunk/src/tclscripts/archer/SketchEditFrame.tcl      2012-12-11 
17:04:12 UTC (rev 54040)
@@ -146,9 +146,14 @@
        method redrawSegments {}
 
        method circle_3pt {_x1 _y1 _x2 _y2 _x3 _y3 _cx_out _cy_out}
+       method continue_circle {_segment _state _coord_type _mx _my}
        method continue_line {_segment _state _coord_type _mx _my}
+       method continue_circle_pick {_segment _mx _my}
        method continue_line_pick {_segment _state _mx _my}
        method continue_move {_state _sx _sy}
+       method create_arc {}
+       method create_bezier {}
+       method create_circle {}
        method create_line {}
        method end_arc_radius_adjust {_segment _mx _my}
        method fix_vertex_references {_unused_vindices}
@@ -163,8 +168,14 @@
        method setup_move_segment {}
        method setup_move_selected {}
        method start_arc_radius_adjust {_segment _mx _my}
+       method start_arc {_coord_type _x _y}
+       method start_bezier {_coord_type _x _y}
+       method start_circle {_coord_type _x _y}
        method start_line {_coord_type _x _y}
        method start_line_guts {}
+       method start_arc_pick {_x _y}
+       method start_bezier_pick {_x _y}
+       method start_circle_pick {_x _y}
        method start_line_pick {_x _y}
        method start_move_arbitrary {_sx _sy _rflag}
        method start_move_point {_sx _sy}
@@ -532,10 +543,13 @@
            create_line
        } \
        $createCircle {
+           create_circle
        } \
        $createArc {
+           create_arc
        } \
        $createBezier {
+           create_bezier
        }
 
     GeometryEditFrame::initEditState
@@ -772,6 +786,10 @@
 }
 
 
+::itcl::body SketchEditFrame::continue_circle {_segment _state _coord_type _mx 
_my} {
+}
+
+
 ::itcl::body SketchEditFrame::continue_line {_segment _state _coord_type _mx 
_my} {
     switch -- $_coord_type {
        0 {
@@ -788,6 +806,10 @@
        2 {
            # use index numbers
            $_segment set_vars E $index2
+
+           set vert [lindex $VL $index2]
+           set ex [lindex $vert 0]
+           set ey [lindex $vert 1]
        }
        default {
            $::ArcherCore::application putString "continue_line: unrecognized 
coord type - $_coord_type"
@@ -801,17 +823,22 @@
     $_segment draw ""
     $itk_component(canvas) configure -scrollregion [$itk_component(canvas) 
bbox all]
 
-    if {$_state == 1 || $_state == 3} {
-       if {$_state == 1} {
-           create_line
+    if {$_state == 1} {
+       create_line
+       write_sketch_to_db
+    } elseif {$_state == 3} {
+       if {$_coord_type != 2} {
+           # The new segment is using a new vertex for its start point
+           set index1 [expr {[llength $VL] - 1}]
        } else {
-           # Here we have another segment (i.e., $_state == 3)
-           set index1 [expr {[llength $VL] - 1}]
-           set index2 [llength $VL]
-           lappend VL "$ex $ey"
-           start_line_guts
+           # The new segment is using an existing vertex for its start point
+           set index1 $index2
        }
 
+       set index2 [llength $VL]
+       lappend VL "$ex $ey"
+
+       start_line_guts
        write_sketch_to_db
     }
 
@@ -819,6 +846,10 @@
 }
 
 
+::itcl::body SketchEditFrame::continue_circle_pick {_segment _mx _my} {
+}
+
+
 ::itcl::body SketchEditFrame::continue_line_pick {_segment _state _mx _my} {
     set index [pick_vertex $_mx $_my]
     if {$index == -1} return
@@ -868,6 +899,36 @@
 }
 
 
+::itcl::body SketchEditFrame::create_arc {} {
+    bind $itk_component(canvas) <B1-Motion> {}
+    bind $itk_component(canvas) <ButtonPress-1> {}
+    bind $itk_component(canvas) <Shift-ButtonRelease-1> {}
+    bind $itk_component(canvas) <Shift-ButtonRelease-3> {}
+    bind $itk_component(canvas) <ButtonRelease-1> [code $this start_arc 1 %x 
%y]
+    bind $itk_component(canvas) <ButtonRelease-3> [code $this start_arc_pick 
%x %y]
+}
+
+
+::itcl::body SketchEditFrame::create_bezier {} {
+    bind $itk_component(canvas) <B1-Motion> {}
+    bind $itk_component(canvas) <ButtonPress-1> {}
+    bind $itk_component(canvas) <Shift-ButtonRelease-1> {}
+    bind $itk_component(canvas) <Shift-ButtonRelease-3> {}
+    bind $itk_component(canvas) <ButtonRelease-1> [code $this start_bezier 1 
%x %y]
+    bind $itk_component(canvas) <ButtonRelease-3> [code $this 
start_bezier_pick %x %y]
+}
+
+
+::itcl::body SketchEditFrame::create_circle {} {
+    bind $itk_component(canvas) <B1-Motion> {}
+    bind $itk_component(canvas) <ButtonPress-1> {}
+    bind $itk_component(canvas) <Shift-ButtonRelease-1> {}
+    bind $itk_component(canvas) <Shift-ButtonRelease-3> {}
+    bind $itk_component(canvas) <ButtonRelease-1> [code $this start_circle 1 
%x %y]
+    bind $itk_component(canvas) <ButtonRelease-3> [code $this 
start_circle_pick %x %y]
+}
+
+
 ::itcl::body SketchEditFrame::create_line {} {
     bind $itk_component(canvas) <B1-Motion> {}
     bind $itk_component(canvas) <ButtonPress-1> {}
@@ -1141,6 +1202,18 @@
 }
 
 
+::itcl::body SketchEditFrame::start_arc {_coord_type _mx _my} {
+}
+
+
+::itcl::body SketchEditFrame::start_bezier {_coord_type _mx _my} {
+}
+
+
+::itcl::body SketchEditFrame::start_circle {_coord_type _mx _my} {
+}
+
+
 ::itcl::body SketchEditFrame::start_line {_coord_type _mx _my} {
     bind $itk_component(canvas) <ButtonPress-1> {}
     if {$_coord_type == 1} {
@@ -1182,6 +1255,18 @@
 }
 
 
+::itcl::body SketchEditFrame::start_arc_pick {_mx _my} {
+}
+
+
+::itcl::body SketchEditFrame::start_bezier_pick {_mx _my} {
+}
+
+
+::itcl::body SketchEditFrame::start_circle_pick {_mx _my} {
+}
+
+
 ::itcl::body SketchEditFrame::start_line_pick {_mx _my} {
     set index [pick_vertex $_mx $_my]
     if {$index == -1} return

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


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to