draw horizontal/vertical constraints connecting multiple shapes
This commit is contained in:
parent
a24179d38f
commit
62dcd76efc
@ -335,12 +335,24 @@ class SketchWidget(object):
|
|||||||
glVertex(x + s, y - s)
|
glVertex(x + s, y - s)
|
||||||
glEnd()
|
glEnd()
|
||||||
|
|
||||||
def drawHorizontal(self, con):
|
def drawStippleConnect(self, pt1, pt2):
|
||||||
l = 15.0
|
self.drawHandle(*pt1)
|
||||||
|
self.drawHandle(*pt2)
|
||||||
glPushAttrib(GL_LINE_BIT)
|
glPushAttrib(GL_LINE_BIT)
|
||||||
glEnable(GL_LINE_STIPPLE)
|
glEnable(GL_LINE_STIPPLE)
|
||||||
glLineStipple(3, 0x5555)
|
glLineStipple(3, 0x5555)
|
||||||
|
glBegin(GL_LINES)
|
||||||
|
glVertex(*pt1)
|
||||||
|
glVertex(*pt2)
|
||||||
|
glEnd()
|
||||||
|
glPopAttrib()
|
||||||
|
|
||||||
|
def drawHorizontal(self, con):
|
||||||
if con.shape1 == con.shape2 and isinstance(con.shape1, Line):
|
if con.shape1 == con.shape2 and isinstance(con.shape1, Line):
|
||||||
|
l = 15.0
|
||||||
|
glPushAttrib(GL_LINE_BIT)
|
||||||
|
glEnable(GL_LINE_STIPPLE)
|
||||||
|
glLineStipple(3, 0x5555)
|
||||||
pt = self.ptToScreenPt(con.shape1.getPt(2))
|
pt = self.ptToScreenPt(con.shape1.getPt(2))
|
||||||
glBegin(GL_LINES)
|
glBegin(GL_LINES)
|
||||||
glVertex(pt[0] - l/2, pt[1] + self.line_width * 2)
|
glVertex(pt[0] - l/2, pt[1] + self.line_width * 2)
|
||||||
@ -348,14 +360,18 @@ class SketchWidget(object):
|
|||||||
glVertex(pt[0] - l/2, pt[1] - self.line_width * 2)
|
glVertex(pt[0] - l/2, pt[1] - self.line_width * 2)
|
||||||
glVertex(pt[0] + l/2, pt[1] - self.line_width * 2)
|
glVertex(pt[0] + l/2, pt[1] - self.line_width * 2)
|
||||||
glEnd()
|
glEnd()
|
||||||
glPopAttrib()
|
glPopAttrib()
|
||||||
|
else:
|
||||||
|
pt1 = self.ptToScreenPt(con.shape1.getPt(con.pt1))
|
||||||
|
pt2 = self.ptToScreenPt(con.shape2.getPt(con.pt2))
|
||||||
|
self.drawStippleConnect(pt1, pt2)
|
||||||
|
|
||||||
def drawVertical(self, con):
|
def drawVertical(self, con):
|
||||||
l = 15.0
|
|
||||||
glPushAttrib(GL_LINE_BIT)
|
|
||||||
glEnable(GL_LINE_STIPPLE)
|
|
||||||
glLineStipple(3, 0x5555)
|
|
||||||
if con.shape1 == con.shape2 and isinstance(con.shape1, Line):
|
if con.shape1 == con.shape2 and isinstance(con.shape1, Line):
|
||||||
|
l = 15.0
|
||||||
|
glPushAttrib(GL_LINE_BIT)
|
||||||
|
glEnable(GL_LINE_STIPPLE)
|
||||||
|
glLineStipple(3, 0x5555)
|
||||||
pt = self.ptToScreenPt(con.shape1.getPt(2))
|
pt = self.ptToScreenPt(con.shape1.getPt(2))
|
||||||
glBegin(GL_LINES)
|
glBegin(GL_LINES)
|
||||||
glVertex(pt[0] - self.line_width * 2, pt[1] + l/2)
|
glVertex(pt[0] - self.line_width * 2, pt[1] + l/2)
|
||||||
@ -363,7 +379,11 @@ class SketchWidget(object):
|
|||||||
glVertex(pt[0] + self.line_width * 2, pt[1] + l/2)
|
glVertex(pt[0] + self.line_width * 2, pt[1] + l/2)
|
||||||
glVertex(pt[0] + self.line_width * 2, pt[1] - l/2)
|
glVertex(pt[0] + self.line_width * 2, pt[1] - l/2)
|
||||||
glEnd()
|
glEnd()
|
||||||
glPopAttrib()
|
glPopAttrib()
|
||||||
|
else:
|
||||||
|
pt1 = self.ptToScreenPt(con.shape1.getPt(con.pt1))
|
||||||
|
pt2 = self.ptToScreenPt(con.shape2.getPt(con.pt2))
|
||||||
|
self.drawStippleConnect(pt1, pt2)
|
||||||
|
|
||||||
def set_mode(self, mode_name):
|
def set_mode(self, mode_name):
|
||||||
if mode_name not in self.modes:
|
if mode_name not in self.modes:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user