Changeset 37011
- Timestamp:
- 2022-12-10T18:21:36+13:00 (12 months ago)
- Location:
- gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/js/document_viewer.js
r36997 r37011 1 function load_gv_dococr_json(json_file, 1 function load_gv_dococr_json(json_file,doc_sec_id,callback) { 2 2 3 3 var http_assocfilepath = gs.collectionMetadata["httpPath"]+"/index/assoc/"+gs.documentMetadata["assocfilepath"]; … … 13 13 }) 14 14 .done(function(gv_ocr_json_result) { 15 callback(gv_ocr_json_result );15 callback(gv_ocr_json_result,doc_sec_id); 16 16 17 17 }); … … 19 19 } 20 20 21 function display_gv_ocr_bounding_boxes(gv_ocr_json )21 function display_gv_ocr_bounding_boxes(gv_ocr_json,doc_sec_id) 22 22 { 23 23 console.log(gv_ocr_json); … … 71 71 72 72 73 display_scaled_div_bounding_boxes( bounding_box_rects, page_x_dim,page_y_dim);73 display_scaled_div_bounding_boxes(doc_sec_id, bounding_box_rects, page_x_dim,page_y_dim); 74 74 75 75 } … … 82 82 83 83 84 function display_scaled_div_bounding_boxes( bounding_box_rects,fullsize_x_dim,fullsize_y_dim)84 function display_scaled_div_bounding_boxes(doc_sec_id, bounding_box_rects,fullsize_x_dim,fullsize_y_dim) 85 85 { 86 86 var screen_x_dim = gs.variables.screenImageWidth; … … 93 93 //console.log("scale y = " + scale_y); 94 94 95 var docID = gs.variables.d; 96 var screen_image_id = "small"+docID; 95 var screen_image_id = "small"+doc_sec_id; 97 96 98 97 var $boundingbox_overlay = $("<div>") 99 .attr("id","ocr-boundingbox-overlay-"+doc ID)98 .attr("id","ocr-boundingbox-overlay-"+doc_sec_id) 100 99 .attr("class","ocr-boundingbox-overlay"); 101 100 -
gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes/transform/pages/document.xsl
r36997 r37011 38 38 <xsl:attribute name="href"> 39 39 <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']"/> 40 <xsl:text>/index/assoc/</xsl:text><xsl:value-of disable-output-escaping="yes" select="$assocfilepath" /><xsl:text>/</xsl:text> enable_document_ocrgoogle-vision-output.json40 <xsl:text>/index/assoc/</xsl:text><xsl:value-of disable-output-escaping="yes" select="$assocfilepath" /><xsl:text>/</xsl:text>gv_document_ocrgoogle-vision-output.json 41 41 </xsl:attribute> 42 enable_document_ocrgoogle-vision-output.json42 gv_document_ocrgoogle-vision-output.json 43 43 </a> 44 44 </div> 45 <gsf:variable name="GVDocumentOCRJSON"><gsf:metadata name="GVDocumentOCRJSON"/></gsf:variable> 46 <gsf:variable name="docSectionID"><xsl:value-of select="util:replace(@nodeID, '.', '_')}"/></gsf:variable> 45 47 <gsf:script> 46 load_gv_dococr_json( "enable_document_ocrgoogle-vision-output.json",display_gv_ocr_bounding_boxes);48 load_gv_dococr_json(gs.variables.GVDocumentOCRJSON,gs.variables.docSectionID,display_gv_ocr_bounding_boxes); 47 49 </gsf:script> 48 50 </xsl:template> 49 51 50 <!--51 <xsl:template name="sectionPre">52 OCR'd Text:53 </xsl:template>54 52 55 <xsl:template name="documentPre"> 56 OCR'd Text: 57 </xsl:template> 58 --> 53 <xsl:template name="wrappedSectionPost"> 59 54 60 <xsl:template name="sectionPost">61 55 <!-- add in IIIF Server link for section image --> 62 56 <xsl:variable name="nodeID" select="@nodeID"/> … … 64 58 <xsl:with-param name="identifier" select="$nodeID" /> 65 59 </xsl:call-template> 60 66 61 <!-- add in Google Vision OCR JSON link for section image --> 67 62 <xsl:call-template name="googlevision-ocr-json"> 68 63 <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" select="root"/></xsl:with-param> 69 64 </xsl:call-template> 65 66 </xsl:template> 67 68 69 <xsl:template name="sectionContent"> 70 <xsl:call-template name="wrappedSectionImage"/> 71 <div style="padding: 10px 0px 10px 0px">Ocr'd Text:</div> 72 <i> 73 <xsl:call-template name="wrappedSectionText"/> 74 </i> 75 <xsl:call-template name="wrappedSectionPost"/> 76 </xsl:template> 77 78 <xsl:template name="sectionContentForEditing"> 79 <xsl:call-template name="wrappedSectionImage"/> 80 <xsl:call-template name="wrappedSectionTextForEditing"/> 70 81 </xsl:template> 71 82 … … 89 100 90 101 <xsl:template name="documentPost"> 91 <!-- add in IIIF Server link for simple page image -->92 102 <xsl:if test="@docType='simple'"> 103 <!-- add in IIIF Server link for simple page image --> 93 104 <xsl:call-template name="iiif-links"> 94 105 <xsl:with-param name="identifier" select="$docID" /> 95 106 </xsl:call-template> 96 <!-- add in Google Vision OCR JSON link for simple page image --> 97 <xsl:call-template name="googlevision-ocr-json"> 98 <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param> 99 </xsl:call-template> 107 108 <!-- 109 <gsf:switch> 110 <gsf:metadata name='HasGoogleVisionDocumentOCRJSON";'/> 111 <gsf:when test='equals' test-value="1"> 112 --> 113 114 <!-- add in Google Vision OCR JSON link for simple page image --> 115 <xsl:call-template name="googlevision-ocr-json"> 116 <xsl:with-param name="assocfilepath"><gsf:metadata name="assocfilepath" pos="first"/></xsl:with-param> 117 </xsl:call-template> 118 <!-- 119 </gsf:when> 120 </gsf:switch> 121 --> 122 100 123 </xsl:if> 101 124 </xsl:template>
Note:
See TracChangeset
for help on using the changeset viewer.