Exemplo n.º 1
0
    def draw_grid(self, amt, start, width, height, space, audio_items, canvas):
        # the lines are drawn incorrectly, the horiz lines get drawn on top of
        # vertical lines

        # self.main_lines.clear()
        # lines that are added to main_lines could be put in
        # an InstructionGroup and edited later for line spacing

        # Draw horizontal lines on the bottom first
        self.main_lines.clear()
        startax = start
        for ax in range(int(amt)):
            Color(*theme.grid_line_tick_color)
            # Color(1,0,0,1)
            # horizontal line
            L = Line(points=[0, startax, width, startax])
            self.main_lines.append(L)
            startax+=space

        # Draw vertical lines on top of horizontal lines
        for x in range(int(amt)):
            if x % self.beats_per_bar == 0:
                # vertical line - thick width
                # Color(.2,.2,.2)
                Color(*theme.grid_bar_color)
                L = Line(points=[start*2, height, start*2, 0])
                L.width = 2.5
                self.main_lines.append(L)
            elif x % self.ticks_per_beat == 0:
                # vertical line - thick width
                Color(*theme.grid_bar_sep_color)
                L = Line(points=[start*2, height, start*2, 0])
                L.width = 2
                self.main_lines.append(L)
            else:
                Color(*theme.grid_line_tick_color)
                # vertical line - normal width
                L = Line(points=[start*2, height, start*2, 0])
                self.main_lines.append(L)
            start+=space
        
        print("mainlines len: ", len(self.main_lines))


        # this will redraw audio_items so they are not lost when redrawing grid
        for item in audio_items:
            Color(*item.color)
            canvas.add(item.shape)
Exemplo n.º 2
0
def DrawLine(obj, width, DrawCallback, projObjs, tileCode, tileZoom, projInfo, dash_length = 1., dash_offset = 0.):

	xyPairs = []
	projCode = projInfo[0]

	if projCode == "wgs84":
		for node in obj[0]:
			if nodePos is None: continue #Missing node

			x, y = Proj(nodePos[0], nodePos[1], projObjs)
			#print nodePos, x, y
			xyPairs.append(x)
			xyPairs.append(y)

	if projCode == "tile":
		tileSize = projObjs['tile_size']
		dataResolutionWidth = projInfo[1]
		dataResolutionHeight = projInfo[2]
		xyPairs = obj[0]

	li = Line(points=xyPairs, width=width)

	if dash_length != 1. or dash_offset != 0.:
		li.width = 1.0 #Kivy only supports dashes with width of 1
		li.dash_length = 10.
		li.dash_offset = 10.
	DrawCallback(li)
Exemplo n.º 3
0
        def draw_grid(amt, start, width, height, space):

            Color(1, 1, 1)
            # lines that are added to main_lines could be put in
            # an InstructionGroup and edited later for line spacing
            for x in range(int(amt)):
                if x % 4 == 0:
                    # every 4th line is darker
                    # vertical line - thick width
                    Color(.2, .2, .2)
                    L = Line(points=[0 + start, height, 0 + start, 0])
                    L.width = 2
                    self.main_lines.append(L)
                else:
                    Color(.2, .2, .2)
                    # vertical line - normal width
                    L = Line(points=[0 + start, height, 0 + start, 0])
                    self.main_lines.append(L)
                start += space

                Color(.2, .2, .2)
                # horizontal line
                L = Line(points=[0, start, width, start])
                self.main_lines.append(L)