662 |
mapper(self.corners[2], self.corners[3]) |
mapper(self.corners[2], self.corners[3]) |
663 |
)] |
)] |
664 |
print "Mapped: ", self.corners |
print "Mapped: ", self.corners |
665 |
def imgmapanchor(self): |
def getTarget(self): |
666 |
|
"""Returns jlink's target with "full path", |
667 |
|
but without .foo postfix.""" |
668 |
|
ts = self.name.split(".") |
669 |
|
target = (settings['javadoc']+"/"+"/".join(ts)) |
670 |
|
return (target) |
671 |
|
def imgmapanchor(self, zoom=100): |
672 |
ts = self.name.split(".") |
ts = self.name.split(".") |
673 |
if re.search("html", ts[-1]): |
if re.search("html", ts[-1]): |
674 |
target = self.name |
target = self.name |
681 |
+"/".join(ts) |
+"/".join(ts) |
682 |
+ ".html") |
+ ".html") |
683 |
return """<area href="%s" shape="rect" coords="%s" target="_top" title="%s" alt="%s" />\n""" % ( |
return """<area href="%s" shape="rect" coords="%s" target="_top" title="%s" alt="%s" />\n""" % ( |
684 |
target, ",".join(["%s"%c for c in self.corners]), self.name, self.name) |
target, ",".join(["%s"%(int(c*(zoom*0.01))) for c in self.corners]), self.name, self.name) |
685 |
|
|
686 |
|
|
687 |
def roundDown(x): |
def roundDown(x): |
706 |
"-xsize", self.w * scale, "-ysize", self.h * scale, |
"-xsize", self.w * scale, "-ysize", self.h * scale, |
707 |
"-xborder", 0, "-yborder", 0]] |
"-xborder", 0, "-yborder", 0]] |
708 |
|
|
709 |
def run(prefix_in, prefix_out=""): |
def run(prefix_in, prefix_out="", zoom=100): |
710 |
if prefix_out == "": prefix_out = prefix_in |
if prefix_out == "": prefix_out = prefix_in |
711 |
if not prefix_out.endswith(".gen"): prefix_out = prefix_out + ".gen" |
if not prefix_out.endswith(".gen"): prefix_out = prefix_out + ".gen" |
712 |
|
|
788 |
</HTML> |
</HTML> |
789 |
""" % { "prefix_in": prefix_in, |
""" % { "prefix_in": prefix_in, |
790 |
"filename": prefix_out+".png", |
"filename": prefix_out+".png", |
791 |
"links": " ".join([l.imgmapanchor() for l in links]) } |
"links": " ".join([l.imgmapanchor(zoom) for l in links]) } |
792 |
html = open(path+prefix_out+".html", "w") |
html = open(path+prefix_out+".html", "w") |
793 |
html.write(htmlcode) |
html.write(htmlcode) |
794 |
html.close() |
html.close() |
795 |
|
|
796 |
|
targets = [] |
797 |
|
for l in links: |
798 |
|
targets.append(l.getTarget()) |
799 |
|
return targets |