コード例 #1
0
ファイル: Text.py プロジェクト: agold/svgchart
    def __init__(self,
                 position=Coordinate(),
                 text=u'',
                 fontsize=12.0,
                 id=None,
                 classes=None):
        """
		@param position: A Coordinate defining the position in the SVG document
		@type position: Coordinate
		@param text: The text of the element
		@type text: string
		@param fontsize: the fontsize of the text (for calculating width/height)
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings
		"""

        if isinstance(position, Coordinate):
            Shape.__init__(self, tag=u'text', id=id, classes=classes)
            self.position = position
            self.text = text
            self.fontsize = fontsize
        else:
            raise TypeError("position must be of type 'Coordinate'")
コード例 #2
0
 def __init__(self, center, inner_radius, outer_radius, img_name, rot=None):
     Shape.__init__(self,
                    center=center,
                    rot=rot,
                    painter=RingPainter(self, img_name))
     self.inner_radius = inner_radius
     self.outer_radius = outer_radius
コード例 #3
0
ファイル: Circle.py プロジェクト: MannyIOI/Air-Hockey-Game-Py
 def __init__(self, pos=[0, 0, 0], radius=0.2, color=[0, 1, 0]):
     Shape.__init__(self)
     self.radius = radius
     self.pos = self.pos = np.array(pos + color, np.float32)
     self.drawing_type = GL_TRIANGLE_FAN
     self.color = color
     self.setup_shaders()
     self.build_buffer()
コード例 #4
0
 def __init__(self,
              master_shape,
              slave_shape,
              radius,
              orbit_time,
              init_angle=0.0):
     Shape.__init__(self, painter=OrbitPainter(self))
     self.radius = radius
     self.init_angle = init_angle
     # time it takes to complete 1 orbit
     self.orbit_time = orbit_time
     self.master_shape = master_shape
     self.slave_shape = slave_shape
コード例 #5
0
ファイル: ShapeGroup.py プロジェクト: agold/svgchart
	def __init__(self, shapes=(), id=None, classes=None):
		"""
		@param shapes: Shapes to be included in the group
		@type shapes: sequence of Shapes
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings
		"""

		for shape in shapes:
			if  not isinstance(shape, Shape):
				raise TypeError("shapes must contain only objects of type 'Shape'")

		Shape.__init__(self, tag=u'g', id=id, classes=classes)
		self.shapes = tuple(shapes)
コード例 #6
0
ファイル: Path.py プロジェクト: agold/svgchart
	def __init__(self, coordinates=(), id=None, classes=None):
		"""
		@param coordinates: The coordinates of the path's vertices
		@type coordinates: Sequence of Coordinates
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings

		"""

		for coord in coordinates:
			if not isinstance(coord, Coordinate):
				raise TypeError("Coordinates must be of type 'Coordinate'")

		Shape.__init__(self, tag=u'path', id=id, classes=classes)
		self.coordinates = tuple(coordinates)
コード例 #7
0
    def __init__(self, coordinates=(), id=None, classes=None):
        """
		@param coordinates: The coordinates of the path's vertices
		@type coordinates: Sequence of Coordinates
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings

		"""

        for coord in coordinates:
            if not isinstance(coord, Coordinate):
                raise TypeError("Coordinates must be of type 'Coordinate'")

        Shape.__init__(self, tag=u'path', id=id, classes=classes)
        self.coordinates = tuple(coordinates)
コード例 #8
0
ファイル: ShapeGroup.py プロジェクト: agold/svgchart
    def __init__(self, shapes=(), id=None, classes=None):
        """
		@param shapes: Shapes to be included in the group
		@type shapes: sequence of Shapes
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings
		"""

        for shape in shapes:
            if not isinstance(shape, Shape):
                raise TypeError(
                    "shapes must contain only objects of type 'Shape'")

        Shape.__init__(self, tag=u'g', id=id, classes=classes)
        self.shapes = tuple(shapes)
コード例 #9
0
ファイル: Rectangle.py プロジェクト: agold/svgchart
	def __init__(self, position=Coordinate(), width=1.0, height=1.0, id=None, classes=None):
		"""Keyword arguments:
		@param position: A Coordinate defining the position in the SVG document
		@type position: Coordinate
		@param width: The width of the rectangle
		@param height: The height of the rectangle
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings
		"""

		if isinstance(position, Coordinate):
			Shape.__init__(self, tag=u'rect', id=id, classes=classes)
			self.position = position
			self.width = float(width)
			self.height = float(height)
		else:
			raise TypeError("position must be of type 'Coordinate'")
コード例 #10
0
ファイル: Ellipse.py プロジェクト: agold/svgchart
	def __init__(self, center=Coordinate(), rx=1.0, ry=1.0, id=None, classes=None):
		"""
		@param center: -- a Coordinate defining the center coordinate in the SVG document
		@type center: Coordinate
		@param rx: -- the x-radius of the ellipse
		@param ry: -- the y-radius of the ellipse
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings
		"""
		
		if isinstance(center, Coordinate):
			Shape.__init__(self, tag=u'ellipse', id=id, classes=classes)
			self.center = center
			self.rx = float(rx)
			self.ry = float(ry)
		else:
			raise TypeError("center must be of type 'Coordinate'")
コード例 #11
0
ファイル: Text.py プロジェクト: agold/svgchart
	def __init__(self, position=Coordinate(), text=u'', fontsize=12.0,
				id=None, classes=None):
		"""
		@param position: A Coordinate defining the position in the SVG document
		@type position: Coordinate
		@param text: The text of the element
		@type text: string
		@param fontsize: the fontsize of the text (for calculating width/height)
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings
		"""

		if isinstance(position, Coordinate):
			Shape.__init__(self, tag=u'text', id=id, classes=classes)
			self.position = position
			self.text = text
			self.fontsize = fontsize
		else:
			raise TypeError("position must be of type 'Coordinate'")
コード例 #12
0
ファイル: polygon.py プロジェクト: rrydman/Asteroids
    def __init__(self, shape, position, rotation, color):
        Shape.__init__(self, position, rotation, color)
        self.cache_points = (None, None, None)

        # first, we find the shape's top-most left-most boundary, its origin
        (origin_x, origin_y) = (shape[0].x, shape[0].y)
        for p in shape:
            if p.x < origin_x:
                origin_x = p.x
            if p.y < origin_y:
                origin_y = p.y

        # then, we orient all of its points relative to its origin
        shifted = []
        for p in shape:
            shifted.append(Point(p.x - origin_x, p.y - origin_y))

        # now shift them all based on the center of gravity
        self.shape = shifted
        self.center = self._findCenter()
        self.shape = []
        for p in shifted:
            self.shape.append(Point(p.x - self.center.x, p.y - self.center.y))
コード例 #13
0
 def __init__(self, x, y, r, c):
     # super(Circle, self).__init__(x, y, r) # Call the parent constructor
     Shape.__init__(self, x, y, r)
     self.c = c  # Also deal with this new instance variable
コード例 #14
0
 def __init__(self, pose=Pose(), height=0, radius=0):
     Shape.__init__(self, pose)
     self.height = height
     self.radius = radius
コード例 #15
0
ファイル: Circle.py プロジェクト: rrydman/Asteroids
 def __init__(self, position, radius, rotation, color):
     Shape.__init__(self, position, rotation, color)
     self.radius = radius
コード例 #16
0
 def __init__(self, center, radius, rot=None, painter=None):
     Shape.__init__(self, center=center, rot=rot, painter=painter)
     self.radius = radius
コード例 #17
0
 def __init__(self, model_name, center=np.zeros(3), scale=np.ones(3), rot=None):
     self.model_name = model_name
     self.scene = assimp.load(model_name)
     Shape.__init__(self, center=center, scale=scale, rot=rot)
     self.painter = ModelPainter(self)
コード例 #18
0
 def __init__(self, pose=Pose(), radius=1):
     Shape.__init__(self, pose)
     self.radius = radius
コード例 #19
0
ファイル: Circle.py プロジェクト: rrydman/Asteroids
 def __init__(self, position, radius, rotation, color):
     Shape.__init__(self, position, rotation, color)
     self.radius = radius
コード例 #20
0
 def __init__(self, radius):
     Shape.__init__(self, radius, radius)
     self.radius = radius
コード例 #21
0
 def __init__(self, x, y, radius, drawAPI):
     Shape.__init__(self, drawAPI)
     self.__x = x
     self.__y = y
     self.__radius = radius
コード例 #22
0
ファイル: Rectangle.py プロジェクト: JBM291/PythonDemo
 def __str__(self, xcor, ycor, width, height):
     Shape.__init__(self, xcor, ycor)
     self.width = width
     self.height = height
コード例 #23
0
 def __init__(self):
     Shape.__init__(self,4,5,0)
コード例 #24
0
ファイル: Square.py プロジェクト: Czy2GitHub/Python
 def __init__(self, side):
     Shape.__init__(self, side, side)
     self.side = side