コード例 #1
0
 def __init__(self, x, y, maxlen, stroke, color, **kwargs):
     super(SvgComposedPoly, self).__init__(x, y, **kwargs)
     self.maxlen = maxlen
     self.plotData = gui.SvgPolyline(self.maxlen)
     self.append(self.plotData)
     self.set_stroke(stroke, color)
     self.set_fill(color)
     self.circle_radius = stroke
     self.circles_list = list()
     self.x_factor = 1.0
     self.y_factor = 1.0
コード例 #2
0
    def main(self, name='world'):
        self.wid = gui.VBox(margin='0px auto')
        self.wid.set_size(620, 620)

        self.svgplot = SvgPlot(600, 600)
        self.svgplot.style['margin'] = '10px'
        self.plotData1 = gui.SvgPolyline(500)
        self.plotData1.set_stroke(2.0, 'rgba(255,0,0,0.8)')
        self.plotData2 = gui.SvgPolyline(500)
        self.plotData2.set_stroke(1.0, 'green')
        self.plotData3 = gui.SvgPolyline(300)
        self.plotData3.set_stroke(3.0, 'orange')
        self.svgplot.append_poly(
            [self.plotData1, self.plotData2, self.plotData3])

        self.wid.append(self.svgplot)

        self.count = 0
        self.add_data()

        # returning the root widget
        return self.wid
コード例 #3
0
ファイル: toolbox_EPICS.py プロジェクト: zyscqfd/remi
 def __init__(self, epics_pv_name='', max_values_count=100, *args, **kwargs):
     w = kwargs.get("style", {}).get("width", kwargs.get("width", 100))
     h = kwargs.get("style", {}).get("height", kwargs.get("height", 100))
     if 'width' in kwargs.keys():
         del kwargs["width"]
     if 'height' in kwargs.keys():
         del kwargs["height"]
     default_style = {'position':'absolute','left':'10px','top':'10px', 'overflow':'hidden', 'background-color':'lightgray', 'margin':'10px'}
     default_style.update(kwargs.get('style',{}))
     kwargs['style'] = default_style
     super(EPICSPlotPV, self).__init__(w, h, *args, **kwargs)
     self.values = gui.SvgPolyline(max_values_count)
     self.epics_pv_name = epics_pv_name
コード例 #4
0
    def main(self, robot, appCallback):
        self.robot = robot

        root = gui.VBox(width=600)

        self.fieldWidth = 500
        self.fieldHeight = 450
        self.fieldSvg = gui.Svg(self.fieldWidth, self.fieldHeight)
        root.append(self.fieldSvg)
        self.arrow = gui.SvgPolyline()
        self.fieldSvg.append(self.arrow)
        self.arrow.add_coord(0, 0)
        self.arrow.add_coord(30, 30)
        self.arrow.add_coord(-30, 30)
        self.arrow.style['fill'] = 'gray'

        self._c_resetPosition(None)

        resetButton = gui.Button("Reset")
        resetButton.set_on_click_listener(self._c_resetPosition)
        root.append(resetButton)

        appCallback(self)
        return root
コード例 #5
0
ファイル: test_widget.py プロジェクト: yuntiaoOS/remi
 def test_init(self):
     widget = gui.SvgPolyline()
     assertValidHTML(widget.repr())
コード例 #6
0
ファイル: gauge_app.py プロジェクト: mohsenuss91/remi
    def __init__(self, width, height, _min, _max):
        super(Gauge, self).__init__(width, height)
        self.width = width
        self.height = height
        self.min = _min
        self.max = _max
        self.scale_angle_range = math.pi * 2 - 1.0
        self.scale_value_range = _max - _min
        self.base_angle = 0  #-self.scale_angle_range/2.0

        self.radius = min(width, height) / 2.0
        circle = gui.SvgCircle(width / 2.0, height / 2.0, self.radius)
        self.append(circle)
        circle.set_fill('gray')
        circle.set_stroke(1, 'lightgray')

        circle = gui.SvgCircle(width / 2.0, height / 2.0,
                               self.radius * 92.0 / 100.0)
        self.append(circle)
        circle.set_fill('lightgray')
        circle.set_stroke(1, 'lightgray')

        font_size = self.radius * 10.0 / 100.0
        xy = self.value_to_xy_tuple(_min, self.radius * 90.0 / 100.0)
        textMin = gui.SvgText(xy[0], xy[1], str(_min))
        xy = self.value_to_xy_tuple(_max, self.radius * 90.0 / 100.0)
        textMax = gui.SvgText(xy[0], xy[1], str(_max))
        textMin.style['font-size'] = gui.to_pix(font_size)
        textMax.style['font-size'] = gui.to_pix(font_size)
        textMin.style['text-anchor'] = "end"
        textMax.style['text-anchor'] = "end"
        textMin.set_fill('red')
        textMax.set_fill('green')

        for i in range(0, 11):
            xy1 = self.value_to_xy_tuple(
                self.min + self.scale_value_range / 10 * i,
                self.radius * 92.0 / 100.0)
            xy2 = self.value_to_xy_tuple(
                self.min + self.scale_value_range / 10 * i, self.radius)
            tick = gui.SvgLine(xy1[0], xy1[1], xy2[0], xy2[1])
            tick.set_stroke(2, 'white')
            self.append(tick)

        self.append(textMin)
        self.append(textMax)

        self.arrow = gui.SvgPolyline()
        self.arrow.add_coord(-self.radius * 20.0 / 100.0, 0)
        self.arrow.add_coord(-self.radius * 23.0 / 100.0,
                             self.radius * 10.0 / 100.0)
        self.arrow.add_coord(0, 0)
        self.arrow.add_coord(-self.radius * 23.0 / 100.0,
                             -self.radius * 10.0 / 100.0)
        self.arrow.add_coord(-self.radius * 20.0 / 100.0, 0)
        self.arrow.style['fill'] = 'white'
        self.arrow.set_stroke(1.0, 'white')
        self.append(self.arrow)

        self.arrow_preview = gui.SvgPolyline()
        self.arrow_preview.add_coord(-self.radius * 10.0 / 100.0, 0)
        self.arrow_preview.add_coord(-self.radius * 13.0 / 100.0,
                                     self.radius * 5.0 / 100.0)
        self.arrow_preview.add_coord(0, 0)
        self.arrow_preview.add_coord(-self.radius * 13.0 / 100.0,
                                     -self.radius * 5.0 / 100.0)
        self.arrow_preview.add_coord(-self.radius * 10.0 / 100.0, 0)
        self.arrow_preview.style['fill'] = 'beige'
        self.arrow_preview.set_stroke(1.0, 'beige')
        self.append(self.arrow_preview)

        self.set_value(_min)
コード例 #7
0
    def Draw_a_drawing_of_one_sheet(self, nrOfOccs, occs, parent_id):
        ''' - parent_id: the ID of the whole occurrence(box)
            of which the occNames(occurrences) are parts.
        '''
        outputUID = '640019'  # output role
        inputUID = '640016'  # input role
        actorUID = '5036'  # actor role (supertype of mechanism)
        subOutputs, subOutputUIDs = self.gel_net.Determine_subtype_list(
            outputUID)
        subInputs, subInputUIDs = self.gel_net.Determine_subtype_list(inputUID)
        subActors, subActorUIDs = self.gel_net.Determine_subtype_list(actorUID)

        thickness = 2
        centerX = []  # X-Center of box[i] on canvas
        centerY = []  # Y-Center of box[i] on canvas
        midPts = []
        boxes_on_sheet = []
        lines_on_sheet = []

        box_width = 120  # pixels
        box_height = 80  # pixels
        self.boxW2 = box_width / 2  # 1/2Width of boxes
        self.boxH2 = box_height / 2  # 1/2Height of boxes

        deltaX = self.screen_width / (nrOfOccs + 1)
        deltaY = self.screen_height / (nrOfOccs + 1)
        dxC = 8  # corner rounding
        dyC = 8
        # dx = 8                 # shifted start point for line on box
        dy = 8

        # Initialize inputs, outputs, controls and mechanisms according to IDEF0.
        # occCon, occMech, occConUp and 0ccMechUp not yet used, but later exprected
        occIn = []
        occOut = []
        # occCon = []
        # occMech = []
        occInUp = []
        occOutUp = []
        # occConUp = []
        # occMechUp = []
        # Draw boxes (occurrences), return midpts[i] = N(x,y), S(x,y), E(x,y), W(x,y)
        for boxNr in range(0, nrOfOccs):
            centerX.append(deltaX +
                           boxNr * deltaX)  # X of center of box[i] on canvas
            centerY.append(deltaY +
                           boxNr * deltaY)  # Y of center of box[i] on canvas
            self.boxID = str(parent_id) + '.' + str(boxNr + 1)

            midPts.append(
                self.box_type_1(centerX[boxNr], centerY[boxNr],
                                occs[boxNr].name))

            # Debug print('NSEWPts:',boxNr,midPts[boxNr])
        self.boxes.append(boxes_on_sheet)

        # Initialize number of I/O/C/M down and upwards for each occurrence on sheet
        occIn = [0 for i in range(0, nrOfOccs)
                 ]  # input stream nr of deltas downward
        occOut = [0 for i in range(0, nrOfOccs)]
        # occCon = [0 for i in range(0, nrOfOccs)]  # control stream nr of deltas right
        # occMech = [0 for i in range(0, nrOfOccs)]
        occInUp = [0 for i in range(0, nrOfOccs)
                   ]  # input stream nr of deltas upward
        occOutUp = [0 for i in range(0, nrOfOccs)]
        # occConUp = [0 for i in range(0, nrOfOccs)]  # control stream nr of deltas left
        # occMechUp = [0 for i in range(0, nrOfOccs)]

        # Draw lines (streams)
        strNr = 0
        hor_size = 15  # horizontal half size of the rhombus polygon
        vert_size = 25  # vertical half size of the rhombus polygon
        left = True  # indicator for left or right streamTree.
        border = 5

        # Search for lines that have no begin/source occurrence (box),
        # but only a destination occurrence.
        for occur, involved, inv_role_kind, inv_kind_name in self.involv_table:
            # Debug print('ioRow[0]:', occur.uid, occur.name, involved.name, inv_role_kind.name)
            occUIDFrom = '0'
            # If inputStream to occurrence on this sheet, then
            if occur in occs and inv_role_kind.uid in subInputUIDs:
                # IndexTo is the nr of the occ that has stream as input.
                indexTo = occs.index(occur)

                # Verify whether found stream is an output of any box on sheet,
                # then set out = True
                origin = 'external'
                for occur_2, involved_2, inv_role_kind_2, inv_kind_name_2 in self.involv_table:
                    if involved == involved_2 and occur_2 in occs \
                       and inv_role_kind_2.uid in subOutputUIDs:
                        origin = 'box'
                        break

                if origin == 'external':
                    # Input comes from outside the sheet
                    streamUID = involved.uid
                    streamName = involved.name
                    streamKind = inv_kind_name
                    occIn[indexTo] += 1
                    occInUp[indexTo] += 1
                    strNr = strNr + 1
                    strID = str(strNr)
                    endPt = midPts[indexTo][3]
                    beginPt = [border, midPts[indexTo][3][1]]

                    # Draw rhombus at x,y and determine its end points
                    x = (beginPt[0] + endPt[0]) / 2
                    y = beginPt[1]
                    rhombus = self.RhombusPolygon(x, y, strID, hor_size,
                                                  vert_size)

                    # Draw two straight lines from the left hand side to the rhombus
                    # and from the rhombus to the box
                    lConnPt = rhombus[3]
                    rConnPt = rhombus[2]
                    line1Pts = [beginPt, lConnPt]
                    line2Pts = [rConnPt, endPt]
                    line1 = gui.SvgLine(line1Pts[0][0], line1Pts[0][1],
                                        line1Pts[1][0], line1Pts[1][1])
                    line1.set_stroke(width=thickness, color='black')
                    self.sheets[self.sheet_nr].append(line1)

                    line2 = gui.SvgLine(line2Pts[0][0], line2Pts[0][1],
                                        line2Pts[1][0], line2Pts[1][1])
                    line2.set_stroke(width=thickness, color='black')
                    self.sheets[self.sheet_nr].append(line2)
                    lines_on_sheet.append(line1)
                    lines_on_sheet.append(line2)

                    # Add an arrow head to line2
                    head = SvgPolygon(4)
                    arrow_height = 20
                    arrow_width = arrow_height / 3
                    recess = arrow_height / 5
                    head.add_arrow_coord(line2, arrow_height, arrow_width,
                                         recess)
                    head.set_stroke(width=thickness, color='black')
                    head.set_fill(color='blue')
                    self.sheets[self.sheet_nr].append(head)
                    # lines_on_sheet.append(head)

                    # Record stream in left or right stream table
                    values = [strID, streamName, streamUID, streamKind]
                    table_row = gui.TableRow(style={'text-align': 'left'})
                    for field in values:
                        item = gui.TableItem(text=field,
                                             style={
                                                 'text-align': 'left',
                                                 'background-color':
                                                 self.occ_color
                                             })
                        table_row.append(item)
                    if left is True:
                        # Debug print('Sheet nr:', self.sheet_nr)
                        self.left_str_tables[self.sheet_nr].append(table_row)
                        left = False
                    else:
                        self.right_str_tables[self.sheet_nr].append(table_row)
                        left = True
        # Find streams per occurrence (box) on this sheet in involv_table
        # involv_table: occur_obj, involved_obj, role_obj (of invObj), invKindName.
        # Debug print('subI/O-UIDs:',occs[0].name, subInputUIDs, subOutputUIDs)
        for occ, involved, inv_role_kind, inv_kind_name in self.involv_table:
            # Debug print(' ioRow2:', occs[0].name, occ.name, involved.name, inv_role_kind.uid)
            occUIDTo = '0'
            # If outputStream from occurrence on this sheet, then
            if occ in occs and inv_role_kind.uid in subOutputUIDs:
                # Debug print('**outputStream:', involved.name, inv_role_kind.name)
                strNr = strNr + 1
                strID = str(strNr)
                occUIDFrom = occ.uid
                streamUID = involved.uid
                streamName = involved.name
                streamKind = inv_kind_name
                # Verify if found streamUID is input in box on sheet.
                # If yes, then occUIDTo is known.
                for occ_2, involved_2, inv_role_kind_2, inv_kind_name_2 in self.involv_table:
                    if streamUID == involved_2.uid and occ_2 in occs \
                       and inv_role_kind_2.uid in subInputUIDs:
                        # Debug print('** inputStream:', occ_2.name,
                        #             inv_role_kind_2.name, inv_role_kind_2.name)
                        occUIDTo = occ_2.uid
                        # else occUIDTo remains '0'
                        break
                # Determine index (in list of occs) of boxFrom and boxTo
                indexFrom = -1
                indexTo = -1
                for index in range(0, len(occs)):
                    if occUIDFrom == occs[index].uid:
                        indexFrom = index
                    if occUIDTo == occs[index].uid:
                        indexTo = index

                # Determine the sequenceNr of the input and output of the occurrence box
                # and adjust Yin and Yout accordingly.
                # Draw the stream line from box occUIDFrom to occUIDTo or to edge of sheet.
                if indexTo == -1:
                    # No destination box, thus endPt is on rh side of the sheet.
                    ddyFrom = (occOut[indexFrom]) * dy
                    ddyTo = (occIn[indexTo]) * dy
                    if occOut[indexFrom] == 0:
                        # if not yet started downward, then middle becomes occupied.
                        occOutUp[indexFrom] += 1
                    occOut[indexFrom] += 1
                    # occOut[indexTo] += 1         # indexTo == -1
                    # midPts(occNr, East, x / y)
                    beginPt = [
                        midPts[indexFrom][2][0],
                        midPts[indexFrom][2][1] + ddyFrom
                    ]
                    endPt = [self.screen_width - border, beginPt[1]]
                    x = (beginPt[0] + endPt[0]) / 2
                    y = beginPt[1]
                    # Rhombus on vertical line
                    rhombus = self.RhombusPolygon(x, y, strID, hor_size,
                                                  vert_size)
                    lConnPt = rhombus[3]
                    rConnPt = rhombus[2]
                    line1Pts = [beginPt, lConnPt]
                    line2Pts = [rConnPt, endPt]

                elif indexFrom + 1 < indexTo:
                    # Destination box is behind next box.
                    ddyFrom = (occOut[indexFrom]) * dy
                    ddyTo = (occIn[indexTo]) * dy
                    occOut[indexFrom] += 1
                    occOut[indexTo] += 1
                    beginPt = [
                        midPts[indexFrom][2][0],
                        midPts[indexFrom][2][1] + ddyFrom
                    ]
                    endPt = [
                        midPts[indexTo][3][0], midPts[indexTo][3][1] + ddyTo
                    ]
                    mid1Pt = [
                        (beginPt[0] + midPts[indexFrom + 1][3][0]) / 2 - dxC,
                        beginPt[1]
                    ]
                    mid2Pt = [(beginPt[0] + midPts[indexFrom + 1][3][0]) / 2,
                              beginPt[1] + dyC]
                    mid3Pt = [(beginPt[0] + midPts[indexFrom + 1][3][0]) / 2,
                              endPt[1] - dyC]
                    mid4Pt = [
                        (beginPt[0] + midPts[indexFrom + 1][3][0]) / 2 + dxC,
                        endPt[1]
                    ]
                    x = mid2Pt[0]
                    y = (mid2Pt[1] + mid3Pt[1]) / 2
                    rhombus = self.RhombusPolygon(x, y, strID, hor_size,
                                                  vert_size)
                    uConnPt = rhombus[0]
                    lConnPt = rhombus[1]
                    line1Pts = [beginPt, mid1Pt, mid2Pt, uConnPt]
                    line2Pts = [lConnPt, mid3Pt, mid4Pt, endPt]

                elif indexFrom + 1 > indexTo:
                    # Destination box id before source box (or the box itself).
                    ddyUpFrom = (occOutUp[indexFrom]) * dy
                    ddyUpTo = (occInUp[indexTo]) * dy
                    occOutUp[indexFrom] += 1
                    occOutUp[indexTo] += 1
                    beginPt = [
                        midPts[indexFrom][2][0],
                        midPts[indexFrom][2][1] - ddyUpFrom
                    ]
                    endPt = [
                        midPts[indexTo][3][0], midPts[indexTo][3][1] - ddyUpTo
                    ]
                    mid1Pt = [
                        (beginPt[0] + midPts[indexFrom + 1][3][0]) / 2 - dxC,
                        beginPt[1]
                    ]
                    mid2Pt = [(beginPt[0] + midPts[indexFrom + 1][3][0]) / 2,
                              beginPt[1] - dyC]
                    mid3Pt = [(beginPt[0] + midPts[indexFrom + 1][3][0]) / 2,
                              endPt[1] - box_height + dyC]
                    mid4Pt = [
                        (beginPt[0] + midPts[indexFrom + 1][3][0]) / 2 - dxC,
                        endPt[1] - box_height
                    ]
                    mid5Pt = [(endPt[0] - box_width / 2) + dxC,
                              endPt[1] - box_height]
                    mid6Pt = [(endPt[0] - box_width / 2),
                              endPt[1] - box_height + dyC]
                    mid7Pt = [(endPt[0] - box_width / 2), endPt[1] - dyC]
                    mid8Pt = [(endPt[0] - box_width / 2) + dxC, endPt[1]]
                    x = mid2Pt[0]
                    y = (mid2Pt[1] + mid3Pt[1]) / 2
                    rhombus = self.RhombusPolygon(x, y, strID, hor_size,
                                                  vert_size)
                    uConnPt = rhombus[0]
                    lConnPt = rhombus[1]
                    line1Pts = [beginPt, mid1Pt, mid2Pt, lConnPt]
                    line2Pts = [
                        uConnPt, mid3Pt, mid4Pt, mid5Pt, mid6Pt, mid7Pt,
                        mid8Pt, endPt
                    ]

##                    if mid5Pt[1] < 0:
##                        self.sheets[self.sheet_nr].yview_scroll(int(-mid5Pt[1]) + 20, 'units')
                else:
                    # Destination box is next box
                    ddyFrom = (occOut[indexFrom]) * dy
                    ddyUpTo = (occIn[indexTo]) * dy
                    occOut[indexFrom] += 1
                    occOutUp[indexTo] += 1
                    beginPt = [
                        midPts[indexFrom][2][0],
                        midPts[indexFrom][2][1] + ddyFrom
                    ]
                    endPt = [
                        midPts[indexTo][3][0], midPts[indexTo][3][1] - ddyUpTo
                    ]
                    mid1Pt = [(beginPt[0] + endPt[0]) / 2 - dxC, beginPt[1]]
                    mid2Pt = [(beginPt[0] + endPt[0]) / 2, beginPt[1] + dyC]
                    mid3Pt = [(beginPt[0] + endPt[0]) / 2, endPt[1] - dyC]
                    mid4Pt = [(beginPt[0] + endPt[0]) / 2 + dxC, endPt[1]]
                    x = mid2Pt[0]
                    y = (mid2Pt[1] + mid3Pt[1]) / 2
                    rhombus = self.RhombusPolygon(x, y, strID, hor_size,
                                                  vert_size)
                    uConnPt = rhombus[0]
                    lConnPt = rhombus[1]
                    line1Pts = [beginPt, mid1Pt, mid2Pt, uConnPt]
                    line2Pts = [lConnPt, mid3Pt, mid4Pt, endPt]

                # Draw polyline 1 from box to rhombus and polyline 2 from rhombus to box
                # Debug print('  Stream:', indexFrom, indexTo, line1Pts)
                line1 = gui.SvgPolyline(_maxlen=4)
                for pt in line1Pts:
                    line1.add_coord(pt[0], pt[1])
                line1.set_stroke(width=thickness, color='black')
                self.sheets[self.sheet_nr].append(line1)

                line2 = gui.SvgPolyline(_maxlen=8)
                for pt in line2Pts:
                    line2.add_coord(pt[0], pt[1])
                line2.set_stroke(width=thickness, color='black')
                self.sheets[self.sheet_nr].append(line2)
                lines_on_sheet.append(line1)
                lines_on_sheet.append(line2)

                # Add an arrow head to line2
                head2 = SvgPolygon(4)
                arrow_height = 20
                arrow_width = arrow_height / 3
                recess = arrow_height / 5
                head2.add_arrow_coord(line2, arrow_height, arrow_width, recess)
                head2.set_stroke(width=thickness, color='black')
                head2.set_fill(color='blue')
                self.sheets[self.sheet_nr].append(head2)

                # Record stream in self.left_str_tables
                # or in self.right_str_tables[self.sheet_nr](s)
                values = [strID, streamName, streamUID, streamKind]
                table_row = gui.TableRow(style={'text-align': 'left'})
                for field in values:
                    item = gui.TableItem(text=field,
                                         style={
                                             'text-align': 'left',
                                             'background-color': self.occ_color
                                         })
                    table_row.append(item)
                if left is True:
                    self.left_str_tables[self.sheet_nr].append(table_row)
                    left = False
                else:
                    self.right_str_tables[self.sheet_nr].append(table_row)
                    left = True

        self.lines.append(lines_on_sheet)
コード例 #8
0
    def Draw_a_drawing_of_one_sheet(self, nr_of_boxes, box_names):
        """ Draw a drawing with two boxes, each with a name inside
            and a polyline between the midpoints of the sides of the boxes,
            with half-way the polyline a rhombus with an id included.
        """
        thickness = 2  # Line thickness
        center_x = []  # x of the center of box[i] on canvas
        center_y = []  # y of the center of box[i] on canvas
        mid_points = []
        box_width = 100  # pixels
        box_height = 100  # pixels
        delta_x = self.screen_width / (nr_of_boxes + 1)
        delta_y = self.screen_height / (nr_of_boxes + 1)
        # Draw the boxes
        for box_nr in range(0, nr_of_boxes):
            center_x.append(delta_x + box_nr * delta_x)
            center_y.append(delta_y + box_nr * delta_y)
            name = box_names[box_nr]
            ident = str(box_nr + 1)
            # Draw one box at the specified location
            mid_points.append(
                self.box_type_1(center_x[box_nr], center_y[box_nr], name,
                                ident, box_width, box_height))

        # Draw a line with arrow head to the first box
        x2 = mid_points[0][3][0]
        y2 = mid_points[0][3][1]
        x1 = x2 - 150
        y1 = y2
        line_0 = gui.SvgLine(x1, y1, x2, y2)
        line_0.set_stroke(width=thickness, color='black')
        self.sheet.append(line_0)
        # Add an arrow head to line_0
        head_0 = SvgPolygon(4)
        arrow_height = 20
        arrow_width = arrow_height / 3
        recess = arrow_height / 5
        head_0.add_arrow_coord(line_0, arrow_height, arrow_width, recess)
        head_0.set_stroke(width=thickness, color='black')
        head_0.set_fill(color='blue')
        self.sheet.append(head_0)

        # Draw a rhombus polygon
        x = (center_x[0] + center_x[1]) / 2
        y = (center_y[0] + center_y[1]) / 2
        self.int_id += 1
        str_id = str(self.int_id)
        hor_size = 15  # pixels
        vert_size = 25  # pixels
        rhombus = self.rhombus_polygon(x, y, str_id, hor_size, vert_size)

        # Determine points of the first polyline
        line_1_points = []
        line_1_points.append(mid_points[0][2])
        corner = [rhombus[0][0], mid_points[0][2][1]]
        line_1_points.append(corner)
        line_1_points.append(rhombus[0])
        # Draw a polyline from box_1 to rhombus
        line1 = gui.SvgPolyline(_maxlen=4)
        for pt in line_1_points:
            line1.add_coord(*pt)
        line1.set_stroke(width=thickness, color='black')
        self.sheet.append(line1)

        # Determine points of the second polyline
        line_2_points = []
        line_2_points.append(rhombus[1])
        corner = [rhombus[1][0], mid_points[1][3][1]]
        line_2_points.append(corner)
        line_2_points.append(mid_points[1][3])
        # Drawa polyline from rhombus to box_2
        line2 = gui.SvgPolyline(_maxlen=4)
        for pt in line_2_points:
            line2.add_coord(pt[0], pt[1])
        line2.set_stroke(width=thickness, color='black')
        self.sheet.append(line2)

        # Add an arrow head to line2
        head = SvgPolygon(4)
        head.add_arrow_coord(line2, arrow_height, arrow_width, recess)
        head.set_stroke(width=thickness, color='black')
        head.set_fill(color='blue')
        self.sheet.append(head)