78 |
lineconn = GLRen.createLineConnector(0,0) |
lineconn = GLRen.createLineConnector(0,0) |
79 |
|
|
80 |
class XuPDFBuoy: |
class XuPDFBuoy: |
81 |
def __init__(self, linkindex, link, enfoverlap): |
def __init__(self, linkindex, link, enfoverlap, cellview, win): |
82 |
self.cursor = None |
self.cursor = None |
83 |
self.link = link |
self.link = link |
84 |
self.linkindex = linkindex |
self.linkindex = linkindex |
85 |
self.linkspan = link[linkindex].getList()[0] |
self.linkspan = link[linkindex].getList()[0] |
86 |
|
self.cellview = cellview |
87 |
|
self.win = win |
88 |
self.mat = enfoverlap.getMatches(link[linkindex]) |
self.mat = enfoverlap.getMatches(link[linkindex]) |
89 |
l = [m for m in self.mat] |
l = [m for m in self.mat] |
90 |
if len(l) == 0: |
if len(l) == 0: |
96 |
if ispdf(self.cell): |
if ispdf(self.cell): |
97 |
self.view = getCellPDFView(self.cell) |
self.view = getCellPDFView(self.cell) |
98 |
|
|
99 |
p = self.linkspan.getLocation() |
p = self.linkspan.getLocation() |
100 |
d = self.linkspan.getSize() |
d = self.linkspan.getSize() |
101 |
o = self.linkspan.offset() |
o = self.linkspan.offset() |
102 |
# print "page, loc, size: ", linkspan.offset(), p, d |
# print "page, loc, size: ", linkspan.offset(), p, d |
103 |
# print "P0, P1: ",p0, p1 |
# print "P0, P1: ",p0, p1 |
104 |
|
|
105 |
self.p0 = self.view.paperpoint(o, p.x, p.y) |
self.p0 = self.view.paperpoint(o, p.x, p.y) |
106 |
self.p1 = self.view.paperpoint(o, p.x+d.width, p.y+d.height) |
self.p1 = self.view.paperpoint(o, p.x+d.width, p.y+d.height) |
107 |
self.pctr = [0.5 * (self.p0[i] + self.p1[i]) for i in range(0,2)] |
self.pctr = [0.5 * (self.p0[i] + self.p1[i]) for i in range(0,2)] |
108 |
|
else: |
109 |
|
pass |
110 |
|
|
111 |
self.eye = 0.2 |
self.eye = 0.2 |
112 |
self.buoyscale = 400 |
self.buoyscale = 400 |
151 |
# cs1 = vs.coords.buoyOnCircle(main_end_cs, *buoyparams) |
# cs1 = vs.coords.buoyOnCircle(main_end_cs, *buoyparams) |
152 |
# vs.matcher.add(cs1, cell.getId()+"__buo") |
# vs.matcher.add(cs1, cell.getId()+"__buo") |
153 |
|
|
154 |
cs1_zoom= vs.coords.distort(cs1, 0, 0, self.eye, self.eye, self.buoyscale, self.buoyscale) |
if hasattr(self, 'pctr'): |
155 |
vs.matcher.add(cs1_zoom, cell.getId()+"__bulg") |
cs1_zoom= vs.coords.distort(cs1, 0, 0, self.eye, self.eye, self.buoyscale, self.buoyscale) |
156 |
|
vs.matcher.add(cs1_zoom, cell.getId()+"__bulg") |
157 |
|
|
158 |
cs1_trans = vs.coords.translateXY(cs1_zoom, -self.pctr[0], -self.pctr[1]) |
cs1_trans = vs.coords.translateXY(cs1_zoom, -self.pctr[0], -self.pctr[1]) |
159 |
# cs1_trans = vs.coords.translateXY(cs1_zoom, 0, 0) |
# cs1_trans = vs.coords.translateXY(cs1_zoom, 0, 0) |
160 |
vs.matcher.add(cs1_trans, cell.getId()+"__trans") |
vs.matcher.add(cs1_trans, cell.getId()+"__trans") |
161 |
|
|
162 |
self.cliprect = (self.p0[0], self.p0[1], self.p1[0], self.p1[1]) |
self.cliprect = (self.p0[0], self.p0[1], self.p1[0], self.p1[1]) |
163 |
|
|
164 |
self.view.placepapers(vs, cs1_trans, cliprect = self.cliprect, |
self.view.placepapers(vs, cs1_trans, cliprect = self.cliprect, |
165 |
fancy = globalusefancypaper, showTessel = globalshowtessel) |
fancy = globalusefancypaper, showTessel = globalshowtessel) |
166 |
|
|
167 |
# Then, the xu link connector |
# Then, the xu link connector |
168 |
|
|
169 |
link_end_cs = vs.coords.coordsys(cs1_trans, -20, self.pctr[0], self.pctr[1], 0, 0) |
link_end_cs = vs.coords.coordsys(cs1_trans, -20, self.pctr[0], self.pctr[1], 0, 0) |
170 |
|
|
171 |
|
else: |
172 |
|
d = java.awt.Dimension() |
173 |
|
self.cellview.getDefaultSize(1.1, d) |
174 |
|
cs1_text = vs.coords.translateXY(cs1, -d.width/2.0, -d.height/2.0) |
175 |
|
vs.matcher.add(cs1_text, cell.getId()+"__text") |
176 |
|
self.cellview.place(cell, vs, cs1_text, d.width, d.height, self.win, 1) |
177 |
|
|
178 |
|
link_end_cs = vs.coords.coordsys(cs1, -20, 0, 0, 0, 0) |
179 |
|
|
180 |
vs.matcher.add(main_end_cs, "link"+str(self.link)+str(self.linkindex)) |
vs.matcher.add(main_end_cs, "link"+str(self.link)+str(self.linkindex)) |
181 |
vs.matcher.add(link_end_cs, "link"+str(self.link)+str(1-self.linkindex)) |
vs.matcher.add(link_end_cs, "link"+str(self.link)+str(1-self.linkindex)) |
514 |
if self.modes[0].context: |
if self.modes[0].context: |
515 |
for forwlink in globalforw: |
for forwlink in globalforw: |
516 |
b = XuPDFBuoy(1, (getattr(forwlink, "from"), forwlink.to), |
b = XuPDFBuoy(1, (getattr(forwlink, "from"), forwlink.to), |
517 |
enfoverlap = enfoverlap) |
enfoverlap = enfoverlap, cellview=self.cv, win=self.win) |
518 |
b.add(vs, 1, bfforw, maincs = cs1_trans, |
b.add(vs, 1, bfforw, maincs = cs1_trans, |
519 |
globalview = self.view, |
globalview = self.view, |
520 |
globalusefancypaper = self.usefancypaper, |
globalusefancypaper = self.usefancypaper, |
523 |
self.buoys.append(b) |
self.buoys.append(b) |
524 |
for backlink in globalback: |
for backlink in globalback: |
525 |
b = XuPDFBuoy(0,(getattr(backlink,"from"), backlink.to), |
b = XuPDFBuoy(0,(getattr(backlink,"from"), backlink.to), |
526 |
enfoverlap = enfoverlap) |
enfoverlap = enfoverlap, cellview=self.cv, win=self.win) |
527 |
b.add(vs, 1, bf, maincs = cs1_trans, |
b.add(vs, 1, bf, maincs = cs1_trans, |
528 |
globalview = self.view, |
globalview = self.view, |
529 |
globalusefancypaper = self.usefancypaper, |
globalusefancypaper = self.usefancypaper, |