Example #1
0
 def openDXF(self, fileName):
     d = self.getView().getDrawing()
     for et in dxfreader.getEtt(fileName):
         if et["0"] == "LINE":
             x0 = float(et["10"])
             y0 = float(et["20"])
             p0 = pyHPoint(x0, y0)
             x1 = float(et["11"])
             y1 = float(et["21"])
             p1 = pyHPoint(x1, y1)
             l = pyHPolylineFigure()
             l.addPoint(p0)
             l.addPoint(p1)
             d.addFigure(l)
         if et["0"] == "CIRCLE":
             x0 = float(et["10"])
             y0 = float(et["20"])
             r = float(et["40"])
             c = pyHEllipseFigure(x0 - r, y0 - r, 2 * r, 2 * r)
             d.addFigure(c)
         if et["0"] == "POINT":
             x0 = float(et["10"])
             y0 = float(et["20"])
             r = 2
             c = pyHEllipseFigure(x0 - r, y0 - r, 2 * r, 2 * r)
             d.addFigure(c)
         if et["0"] == "ARC":
             x0 = float(et["10"])
             y0 = float(et["20"])
             r = float(et["40"])
             ans = float(et["50"])
             ane = float(et["51"])
             c = pyHArcFigure(x0 - r, y0 - r, 2 * r, 2 * r, ans, ane)
             d.addFigure(c)
         if et["0"] == "LWPOLYLINE":
             xs = et["10"]
             ys = et["20"]
             c = pyHPolylineFigure()
             for i, x in enumerate(xs):
                 p = pyHPoint(float(x), float(ys[i]))
                 c.addPoint(p)
             d.addFigure(c)
         if et["0"] == "SPLINE":
             xs = et["10"]
             ys = et["20"]
             c = pyHSplineFigure()
             for i, x in enumerate(xs):
                 p = pyHPoint(float(x), float(ys[i]))
                 c.addPoint(p)
             d.addFigure(c)
     self.fillTree()
 def openDXF(self,fileName):
     d=self.getView().getDrawing()
     for et in dxfreader.getEtt(fileName):
         if et["0"]=="LINE":
             x0=float(et["10"])
             y0=float(et["20"])
             p0=pyHPoint(x0,y0)
             x1=float(et["11"])
             y1=float(et["21"])
             p1=pyHPoint(x1,y1)
             l=pyHPolylineFigure()
             l.addPoint(p0)
             l.addPoint(p1)
             d.addFigure(l)
         if et["0"]=="CIRCLE":
             x0=float(et["10"])
             y0=float(et["20"])
             r =float(et["40"])
             c=pyHEllipseFigure(x0-r,y0-r,2*r,2*r)
             d.addFigure(c)
         if et["0"]=="POINT":
             x0=float(et["10"])
             y0=float(et["20"])
             r =2
             c=pyHEllipseFigure(x0-r,y0-r,2*r,2*r)
             d.addFigure(c)
         if et["0"]=="ARC":
             x0=float(et["10"])
             y0=float(et["20"])
             r =float(et["40"])
             ans=float(et["50"])
             ane=float(et["51"])
             c=pyHArcFigure(x0-r,y0-r,2*r,2*r,ans,ane)
             d.addFigure(c)
         if et["0"]=="LWPOLYLINE":
             xs=et["10"]
             ys=et["20"]
             c=pyHPolylineFigure()
             for i,x in enumerate(xs):
                 p=pyHPoint(float(x),float(ys[i]))
                 c.addPoint(p)
             d.addFigure(c)
         if et["0"]=="SPLINE":
             xs=et["10"]
             ys=et["20"]
             c=pyHSplineFigure()
             for i,x in enumerate(xs):
                 p=pyHPoint(float(x),float(ys[i]))
                 c.addPoint(p)
             d.addFigure(c)
     self.fillTree()
Example #3
0
 def __init__(self, x0, y0, w, h, text="pyHotDraw", border=False):
     super(pyHNodePoseMeasureFigure, self).__init__(x0, y0, w, h, text,
                                                    border)
     self.e = pyHEllipseFigure(x0, y0, w, h)
     self.e.setColor(0, 100, 0)
     self.e.setFillColor(255, 255, 50, 100)
     self.e.setWidth(3)
Example #4
0
    def _create_node_figure(self, x, y, w, h):
        f = pyHEllipseFigure(x, y, w, h)
        f.setAttribute('FILL', pyHAttributeFillColor(187, 198, 221,
                                                     255))  # blue
        f.setAttribute('WIDTH', pyHAttributeWidth(3))
        f.setColor(pyHAttributeColor(127, 135, 151, 255))  # dark blue

        f_text = MathTextFigure(x, y)
        f_text.setColor(pyHAttributeColor(255, 0, 0, 0))
        f_text.setFillColor(0, 0, 0, 0)

        self.addFigure(f)
        self.addFigure(f_text)
 def __init__(self,owner,point,i):
     '''
     Constructor
     '''
     pos=i % 3
     if i==0 or i==3:
         #curve points
         self.rf=pyHRectangleFigure(point.getX()-1,point.getY()-1,2,2)
     else:
         #control points
         self.rf=pyHEllipseFigure(point.getX()-1,point.getY()-1,2,2)
     self.owner=owner
     self.point=point
     self.i=i #index of point
 def __init__(self, owner, point, i):
     '''
     Constructor
     '''
     pyHAbstractHandle.__init__(self)
     pos = i % 3
     if i == 0 or i == 3:
         #curve points
         self.rf = pyHRectangleFigure(point.getX() - 1,
                                      point.getY() - 1, 2, 2)
     else:
         #control points
         self.rf = pyHEllipseFigure(point.getX() - 1,
                                    point.getY() - 1, 2, 2)
     self.owner = owner
     self.point = point
     self.i = i  #index of point
Example #7
0
 def creatingEllipse(self):
     f=pyHEllipseFigure(0,0,1.5,1.5)
     self.setCurrentTool(pyHCreationDropTool(self.getView(),f))
 def creatingEllipse(self):
     self.setCurrentTool(pyHCreationTool(self.getView(),pyHEllipseFigure(0,0,10,10)))
 def creatingEllipse(self):
     self.setCurrentTool(
         pyHCreationTool(self.getView(), pyHEllipseFigure(0, 0, 10, 10)))
 def __init__(self, x0, y0, w, h, text="pyHotDraw", border=True):
     super(pyHNodePosePredictionFigure,
           self).__init__(x0, y0, w, h, text, border)
     self.e = pyHEllipseFigure(x0, y0, w, h)