Lev*_*lun 16 javascript php jquery openseadragon
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);
}
}
});
Run Code Online (Sandbox Code Playgroud)
我可以直接添加注释:http://annotorious.github.io/demos/openseadragon-preview.html
用户添加注释后,我存储在我的数据库中.当用户刷新页面时,我使用ajax call(H_AnnotationHandler.php)从数据库加载已保存的数据.返回数据是真的,但我无法在jpeg2000图像上使用绘制注释anno.addAnnotation,我该如何绘制它?
参考:添加注释API.
您在方法中缺少src属性anno.addAnnotation,问题是我真的不知道那里应该放什么值,文档中没有任何内容,我在互联网上唯一能找到的就是这个插件:
https://github.com/dgutman/OpenSeadragon-Plugins/tree/master/annotationState_Code
你可以尝试这样做。
我实际上设法以编程方式在演示页面上附加事件,那里的开放海龙模块注册为 a dzi://openseadragon/something,知道这一点您可以调用该函数
anno.addAnnotation({
src : 'dzi://openseadragon/something',
text : 'My annotation',
shapes : [{
type : 'rect',
geometry : { x : 0.8, y: 0.8, width : 0.2, height: 0.2 }
}]
});
Run Code Online (Sandbox Code Playgroud)
从控制台(或在 ajax-success 循环中的代码中),它将被添加到图像中。然而,命名方法相当......好吧,我在源代码中发现了这个:
annotorious.mediatypes.openseadragon.OpenSeadragonModule.prototype.getItemURL = function(item) {
// TODO implement something decent!
return 'dzi://openseadragon/something';
}
Run Code Online (Sandbox Code Playgroud)
所以请放心,这种情况将来可能会改变。
| 归档时间: |
|
| 查看次数: |
2394 次 |
| 最近记录: |