def _draw_handles(self, controlPoints): handleCenters = list(controlPoints) if len(self.handles) > 0: assert len(self.handles) == len(controlPoints) i = 0 for i in range(len(self.handles)): self.handles[i].draw(hCenter = handleCenters[i]) else: for hCenter in handleCenters: handle = ResizeHandle(self, self.glpane, hCenter) handle.draw() handle.setType('') if handle not in self.handles: self.handles.append(handle)
def _draw_handles(self, cornerPoints): """ Draw the handles that permit the geometry resizing. Example: For a plane, there will be 8 small squares along the border... 4 at plane corners and remaining in the middle of each side of the plane. The handles will be displayed only when the geometry is selected. @param cornerPoints: List of 4 corner points(V). The handles will be drawn at these corners PLUS in the middle of each side of the Plane. @type cornerPoints: list of 4 L{V} """ handleCenters = list(cornerPoints) cornerHandleCenters = list(cornerPoints) midBtm = (handleCenters[0] + handleCenters[1]) * 0.5 midRt = (handleCenters[1] + handleCenters[2]) * 0.5 midTop = (handleCenters[2] + handleCenters[3]) * 0.5 midLft = (handleCenters[3] + handleCenters[0]) * 0.5 for midpt in [midBtm, midRt, midTop, midLft]: handleCenters.append(midpt) if len(self.handles) == 8: assert len(self.handles) == len(handleCenters) i = 0 for i in range(len(self.handles)): self.handles[i].draw(hCenter=handleCenters[i]) else: hdlIndex = 0 for hCenter in handleCenters: handle = ResizeHandle(self, self.glpane, hCenter) handle.draw() if handle not in self.handles: self.handles.append(handle) #handleIndex = 0, 1, 2, 3 --> #--> bottomLeft, bottomRight, topRight, topLeft corners respt #handleIndex = 4, 5, 6, 7 --> #-->midBottom, midRight, midTop, midLeft Handles respt. if hdlIndex == 5 or hdlIndex == 7: handle.setType('Width-Handle') elif hdlIndex == 4 or hdlIndex == 6: handle.setType('Height-Handle') else: handle.setType('Corner') hdlIndex += 1
def _draw_handles(self, cornerPoints): """ Draw the handles that permit the geometry resizing. Example: For a plane, there will be 8 small squares along the border... 4 at plane corners and remaining in the middle of each side of the plane. The handles will be displayed only when the geometry is selected. @param cornerPoints: List of 4 corner points(V). The handles will be drawn at these corners PLUS in the middle of each side of the Plane. @type cornerPoints: list of 4 L{V} """ handleCenters = list(cornerPoints) cornerHandleCenters = list(cornerPoints) midBtm = (handleCenters[0] + handleCenters[1]) * 0.5 midRt = (handleCenters[1] + handleCenters[2]) * 0.5 midTop = (handleCenters[2] + handleCenters[3]) * 0.5 midLft = (handleCenters[3] + handleCenters[0]) * 0.5 for midpt in [midBtm, midRt, midTop, midLft]: handleCenters.append(midpt) if len(self.handles) == 8: assert len(self.handles) == len(handleCenters) i = 0 for i in range(len(self.handles)): self.handles[i].draw(hCenter = handleCenters[i]) else: hdlIndex = 0 for hCenter in handleCenters: handle = ResizeHandle(self, self.glpane, hCenter) handle.draw() if handle not in self.handles: self.handles.append(handle) #handleIndex = 0, 1, 2, 3 --> #--> bottomLeft, bottomRight, topRight, topLeft corners respt #handleIndex = 4, 5, 6, 7 --> #-->midBottom, midRight, midTop, midLeft Handles respt. if hdlIndex == 5 or hdlIndex == 7: handle.setType('Width-Handle') elif hdlIndex == 4 or hdlIndex == 6: handle.setType('Height-Handle') else: handle.setType('Corner') hdlIndex +=1