Example #1
0
 def get_parts_at(self, x, y, sz_type=SelectPart.SZ_SELECT):
     """ Check if any part is at canvas location provided
     If found list of parts
     :Returns: SelectPart[]
     """
     parts = []
     for part in self.parts:
         if not isinstance(part, SelectPart):
             SlTrace.lg("part(%s) is not SelectPart" % part)
         if part.is_over(x, y, sz_type=sz_type):
             parts.append(part)
     if len(parts) > 1:
         SlTrace.lg("get_parts at (%d, %d) sz_type=%d" % (x, y, sz_type),
                    "get_parts")
         for part in parts:
             c1x, c1y, c3x, c3y = part.get_rect(sz_type=sz_type)
             SlTrace.lg(
                 "    %s : c1x:%d, c1y:%d, c3x:%d, c3y:%d" %
                 (part, c1x, c1y, c3x, c3y), "get_parts")
         SlTrace.lg("", "get_parts")
         olap_rect = SelectPart.get_olaps(parts,
                                          sz_type=SelectPart.SZ_SELECT)
         if olap_rect is not None:
             if SlTrace.trace("overlapping"):
                 SlTrace.lg(
                     "Overlapping %d,%d, %d,%d" %
                     (olap_rect[0][0], olap_rect[0][1], olap_rect[1][0],
                      olap_rect[1][1]), "overlapping")
                 SlTrace.lg("")
     return parts
Example #2
0
 def get_parts_at(self, x, y, sz_type=SelectPart.SZ_SELECT):
     """ Check if any part is at canvas location provided
     If found list of parts
     :Returns: SelectPart[]
     """
     parts = []
     for part in self.parts:
         if part.is_over(x, y, sz_type=sz_type):
             parts.append(part)
     if len(parts) > 1:
         print("get_parts at (%d, %d) sz_type=%d" % (x, y, sz_type))
         for part in parts:
             c1x, c1y, c3x, c3y = part.get_rect(sz_type=sz_type)
             print("    %s : c1x:%d, c1y:%d, c3x:%d, c3y:%d" %
                   (part, c1x, c1y, c3x, c3y))
         print()
         olap_rect = SelectPart.get_olaps(parts,
                                          sz_type=SelectPart.SZ_SELECT)
         if olap_rect is not None:
             print("Overlapping %d,%d, %d,%d" %
                   (olap_rect[0][0], olap_rect[0][1], olap_rect[1][0],
                    olap_rect[1][1]))
             print()
     return parts