Move SSD existing truth area copy to typed Kotlin
ober
f849ddbbd20d4c214eb40b6075932bea924121bb
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -4580,6 +4580,7 @@ detectorSourceWithTruth detectionTruthNote detectionOcrNote detectionLearnedNote shouldLoadLocalTruth localTruthForDetection existingTruthForDetection + copyExistingTruthSsdArea shouldUseExistingTruth shouldApplyExistingTruth shouldUseExistingTruthObject shouldApplyExistingTruthObject shouldApplyLearnedGuesses learnedGuessesForDetection @@ -5311,6 +5312,11 @@ (if (truthPresent localTruth) localTruth (truthStoreLoadTruth store session))) + (def (copyExistingTruthSsdArea (session : SsdSession) + (truth : (Nullable JSONObject))) : Unit + (if (truthPresent truth) + (SsdSession-ssdArea-set! session (nullableTruthSsdAreaRect truth)) + (begin))) (def (shouldUseExistingTruth (existingTruthGroupCount : Int32) (forceDetect : Bool)) : Bool (and (> existingTruthGroupCount (int32 0)) @@ -7119,15 +7125,13 @@ " var detectorNote = \"\"" " var detectorSource = \"unknown\"" "" - " if (shouldUseExistingTruthObject(existingTruth, existingTruthGroupCount, forceDetect)) {" - " detectorSource = \"local-truth\"" - " session.ssdArea = nullableTruthSsdAreaRect(existingTruth)" - " truthStore.applyTruth(session)" - " ssdSessionPruneGroupsOutsideSsdArea(session)" + " if (shouldUseExistingTruthObject(existingTruth, existingTruthGroupCount, forceDetect)) {" + " detectorSource = \"local-truth\"" + " copyExistingTruthSsdArea(session, existingTruth)" + " truthStore.applyTruth(session)" + " ssdSessionPruneGroupsOutsideSsdArea(session)" " } else {" - " if (truthPresent(existingTruth)) {" - " session.ssdArea = nullableTruthSsdAreaRect(existingTruth)" - " }" + " copyExistingTruthSsdArea(session, existingTruth)" " val nativeDetection = SsdVisionBridge.detect(bitmap)" " val detectedCells: List<SsdCell>" " if (nativeDetectionPresent(nativeDetection)) {"