Exemple #1
0
def update_scene1(vertical_parcent, outer_circle):
    """オブジェクトの位置とキャンバスを返します
    """

    # RGBバー
    bar_box = BarBox()
    bar_box.rates = vertical_parcent
    height1 = int(bar_box.rates[0] * 10 * GRID_UNIT)
    height2 = int(bar_box.rates[1] * 10 * GRID_UNIT)
    height3 = int(bar_box.rates[2] * 10 * GRID_UNIT)
    bar_box.top = BAR_TOP1
    bar_box.upper_y = bar_box.top + height1
    bar_box.lower_y = bar_box.upper_y + height2
    bar_box.bottom = bar_box.lower_y + height3
    bar_box.label_gap = int(0.25 * GRID_UNIT)
    bar_box.left = BAR_BOX_LEFT
    bar_box.right = bar_box.left + 90
    bar_box.font_scale = FONT_SCALE
    bar_box.line_type = 2
    bar_box.font = cv2.FONT_HERSHEY_SIMPLEX

    # レールとなる円 circle rail
    circle_rail = CircleRail()
    circle_rail.top = bar_box.upper_y
    circle_rail.range1 = int(height2 / 2)
    circle_rail.border_left = GRID_UNIT
    circle_rail.border_right = bar_box.left - GRID_UNIT

    circle_rail.center = (bar_box.left - CIRCLE_DISTANCE,
                          circle_rail.top + circle_rail.range1)  # x, y
    circle_rail.point_range = 4

    outer_circle.origin = (circle_rail.center[0], circle_rail.center[1])
    outer_circle.area_size = (int(7 * GRID_UNIT), int(7 * GRID_UNIT))
    outer_circle.phases = PHASE_COUNTS

    inscribed_triangle = InscribedTriangle()

    return bar_box, circle_rail, outer_circle, inscribed_triangle
Exemple #2
0
def update_scene1(vertical_parcent, outer_circle):
    """オブジェクトの位置とキャンバスを返します
    """

    bar_box = BarBox()
    circle_rail = CircleRail()
    inscribed_triangle = InscribedTriangle()

    # バー
    # RGBバーの1段目、2段目、3段目の高さ(20分率)
    bar_box.top1 = BAR_TOP1
    bar_box.rates = vertical_parcent
    bar_box.height1 = int(bar_box.rates[0] * 10 * GRID_UNIT)
    bar_box.height2 = int(bar_box.rates[1] * 10 * GRID_UNIT)
    bar_box.height3 = int(bar_box.rates[2] * 10 * GRID_UNIT)
    bar_box.one_width = 30  # フォント1文字の横幅が 10 と想定
    bar_box.y_axis_label_gap = int(0.25 * GRID_UNIT)
    bar_box.rate_text_gap = int(0.2 * GRID_UNIT)

    # バー箱の左
    bar_box.left = BAR_BOX_LEFT
    # バーの筋
    bar_box.font_scale = FONT_SCALE
    bar_box.line_type = 2
    bar_box.font = cv2.FONT_HERSHEY_SIMPLEX
    bar_box.red_left = bar_box.left
    bar_box.green_left = bar_box.red_left + bar_box.one_width
    bar_box.blue_left = bar_box.green_left + bar_box.one_width
    bar_box.right = bar_box.blue_left + bar_box.one_width
    # レールとなる円 circle rail
    circle_rail.top = BAR_TOP1 + bar_box.height1

    # 円レール
    circle_rail.range1 = int(bar_box.height2 / 2)
    circle_rail.border_left = GRID_UNIT
    circle_rail.border_right = bar_box.left - GRID_UNIT

    circle_rail.center = (bar_box.left - CIRCLE_DISTANCE,
                          circle_rail.top + circle_rail.range1)  # x, y
    outer_circle.origin = (circle_rail.center[0], circle_rail.center[1])
    circle_rail.point_range = 4
    # RGBバー2段目
    bar_box.top2 = circle_rail.top
    bar_box.rank1_rect.left_top = (bar_box.left, BAR_TOP1)
    bar_box.rank1_rect.right_bottom = (bar_box.right, bar_box.top2)
    # バー2段目(レールとなる円と水平線を合わす)
    bar_box.top3 = bar_box.top2 + bar_box.height2
    bar_box.bottom = bar_box.top3 + bar_box.height3
    bar_box.height = bar_box.height1 + bar_box.height2 + bar_box.height3
    # print(f"bar_box.height={bar_box.height}")
    # RGBバー2段目領域
    bar_box.rank2_rect.left_top = (bar_box.left, bar_box.top2)
    bar_box.rank2_rect.right_bottom = (bar_box.right, bar_box.top3)
    # RGBバー3段目
    bar_box.rank3_rect.left_top = (bar_box.left, bar_box.top3)
    bar_box.rank3_rect.right_bottom = (bar_box.right, bar_box.bottom)

    outer_circle.area_size = (int(7 * GRID_UNIT), int(7 * GRID_UNIT))
    outer_circle.phases = PHASE_COUNTS

    return bar_box, circle_rail, outer_circle, inscribed_triangle