예제 #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
 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
	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
    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
    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))
 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
 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