34 CONN_ENDPOINT, CONN_MIDPOINT = xrange(2)
42 Connection = collections.namedtuple(
'Connection', [
43 'x',
'y',
'type',
'path0',
'ob0',
'path1',
'ob1',
'whichend0',
'whichend1'
60 x1 = data.x + data.width
61 y1 = data.y + data.height
63 for component
in reversed(path):
64 data = component.data()
75 elif data.angle == 180:
78 elif data.angle == 270:
87 return (x0, x1), (y0, y1)
101 return x0 == x
and x1 == x
and y > min(y0, y1)
and y < max(y0, y1) \
102 or y0 == y
and y1 == y
and x > min(x0, x1)
and x < max(x0, x1)
110 for ob
in rev.toplevel_objects():
137 horizontal_instances,
145 path0 = path; del path
159 def can_connect((path0, ob0), (path1, ob1)):
167 if path0 != path1
and not data0.is_pin
or not data1.is_pin:
171 elif path0
and not path1:
176 elif not path0
and path1:
183 for path1, ob1
in instances_by_endpoint.get((x0[end], y0[end]), []):
198 if not can_connect((path0, ob0), (path1, ob1)):
208 if x0[w0] == x1[w1]
and y0[w0] == y1[w1] \
209 and data0.is_bus == data1.is_bus:
211 x = x0[w0], y = y0[w0], type = CONN_ENDPOINT,
212 path0 = path0, ob0 = ob0, whichend0 = w0,
213 path1 = path1, ob1 = ob1, whichend1 = w1)
215 x = x0[w0], y = y0[w0], type = CONN_ENDPOINT,
216 path0 = path1, ob0 = ob1, whichend0 = w1,
217 path1 = path0, ob1 = ob0, whichend1 = w0)
221 vertical_instances.get(x0[end], []) + \
222 horizontal_instances.get(y0[end], []):
237 if not can_connect((path0, ob0), (path1, ob1)):
248 not data1.is_pin
and (
249 (
not data0.is_pin
and not data0.is_bus
and data1.is_bus)
250 or data0.is_bus == data1.is_bus):
252 x = x0[w0], y = y0[w0], type = CONN_MIDPOINT,
253 path0 = path0, ob0 = ob0, whichend0 = w0,
254 path1 = path1, ob1 = ob1, whichend1 = -1)
256 x = x0[w0], y = y0[w0], type = CONN_MIDPOINT,
257 path0 = path1, ob0 = ob1, whichend0 = -1,
258 path1 = path0, ob1 = ob0, whichend1 = w0)
260 def _append_or_create(d, key, item):
282 if rev.is_transient():
285 if self.
rev is not None:
294 modified_objects = []
295 added_objects = rev.rev.get_objects()
298 removed_instances = [instance
299 for ob
in removed_objects + modified_objects
303 for instance
in removed_instances:
306 if not instance[1].data().is_pin:
314 if (conn.path0, conn.ob0) == instance
or \
315 (conn.path1, conn.ob1) == instance:
316 self.connections.remove(conn)
322 added_instances = [instance
323 for ob
in modified_objects + added_objects
327 for instance
in added_instances:
330 if not instance[1].data().is_pin:
337 for instance
in added_instances:
344 self.connections.append(conn)
353 for conn
in self.connection_dict.get(instance, []):
354 if (conn.path1, conn.ob1)
not in result_set:
355 result.append((conn.path1, conn.ob1))
356 result_set.add((conn.path1, conn.ob1))
def s_conn_update_line_object
Return all connections of a net instance.
Schematic net segment, bus segment, or pin.
def all_net_instances_in_object
Returns all net instances in a given object.
def s_conn_check_midpoint
Checks if a point is on an orthogonal net segment and between its endpoints.
def get_added_objects
Return a list of objects which are in one revision but not in another.
High-level revision proxy class.
def get_removed_objects
Return a list of objects which are in one revision but not in another.
tuple Connection
A single connection between two objects.
High-level object proxy class.
High-level proxy classes for the storage backend.
Tracks the connections of the net segments in a revision at a time.
def get_modified_objects
Return a list of objects which exist in two revisions but have different type or data.
def endpoints
Return the absolute coordinates of the endpoints of a net instance.
def all_net_instances_in_revision
Returns all net instances in a given revision.
def connected_to
Return all net instances directly connected to a net instance.