【发布时间】:2016-01-15 10:07:52
【问题描述】:
var viewer = OpenSeadragon({
id: "openseadragon1",
prefixUrl: "images/openseadragon/",
showNavigator: true,
navigatorPosition: "BOTTOM_RIGHT",
tileSources: '/fcgi-bin/iipsrv.fcgi?Deepzoom=<?=$plink?>.jp2.dzi',
crossOriginPolicy: 'Anonymous',
zoomInButton: "zoom-in",
zoomOutButton: "zoom-out",
homeButton: "home",
fullPageButton: "full-page"
});
anno.makeAnnotatable(viewer);
$.ajax({
url: "handlers/H_AnnotationHandler.php",
data: "case_id=<?=$case_id?>&plink=<?=$plink?>&mode=get",
type: "post",
dataType: "json",
success: function(response) {
if (!response.error) {
for (var i=0; i<response.annots.length; i++) {
console.log(response.annots[i].comment);
anno.addAnnotation({
text: response.annots[i].comment,
shapes: [{
type: 'rect',
geometry: {
x: response.annots[i].rect_x,
y: response.annots[i].rect_y,
width: response.annots[i].rect_w,
height: response.annots[i].rect_h
}
}]
});
}
} else {
console.log(response.error);
}
}
});
我可以实时添加注释:http://annotorious.github.io/demos/openseadragon-preview.html
用户添加注释后,我存储在我的数据库中。当用户刷新页面时,我正在使用 ajax 调用 (H_AnnotationHandler.php) 从数据库中加载保存的数据。返回数据是真的,但是我无法使用anno.addAnnotation在jpeg2000图像上绘制注释,我该如何绘制它?
参考:添加注解API。
【问题讨论】:
-
你能创建一个jsFiddle吗?
-
@Gavriel 您在预览页面上几乎有一对一的演示,无需摆弄这个
-
@MaciejKwas,我不这么认为。我可以,就像他在演示页面上写的那样做一个注释,但他的问题是从数据库中检索它并调用 API 再次显示它。我想看到一个“硬编码”字符串,它表示通过 api 调用从数据库中保存的值。
-
@Gavriel 你的浏览器中有一个控制台,我向你保证这就是你所需要的:)) anno.addAnnotation 的问题是它需要 src 参数作为图像而不需要 openseadragon正在考虑的模块。我认为这是脚本设计问题,因为 _modules 数组没有公开,因此您不能直接调用它的方法。
-
嗨,我可以使用 openseadragon.github.io/examples/ui-overlays 和我的 annotation.js 插件坐标添加矩形。但它们看起来不同(我的意思是css)。而且我的数据库坐标是真的,但是 anno.addAnnotation 对我不起作用...
标签: javascript php jquery openseadragon