Skip to content
Snippets Groups Projects
Commit f4b58fc4 authored by Michael Utama's avatar Michael Utama
Browse files

Merge branch 'april-tag' into 'dev'

refactoring: konten omr dipindah ke json config

See merge request !54
parents db59a0e9 9002e6f2
2 merge requests!57feat: merge release sprint 4,!54refactoring: konten omr dipindah ke json config
{ {
"omrConfigs": { "omrConfigs": {
"102": { "102": {
"contents": {
"FIRST": "Anis",
"SECOND": "Bowo",
"THIRD": "Janggar"
},
"contourOMRHelperConfig": { "contourOMRHelperConfig": {
"darkIntensityThreshold": 200, "darkIntensityThreshold": 200,
"darkPercentageThreshold": 0.9, "darkPercentageThreshold": 0.9,
......
package com.k2_9.omrekap.data.models package com.k2_9.omrekap.data.models
import com.k2_9.omrekap.data.configs.omr.ContourOMRHelperConfig import com.k2_9.omrekap.data.configs.omr.ContourOMRHelperConfig
import com.k2_9.omrekap.data.configs.omr.OMRSection
import com.k2_9.omrekap.data.configs.omr.TemplateMatchingOMRHelperConfig import com.k2_9.omrekap.data.configs.omr.TemplateMatchingOMRHelperConfig
/** /**
...@@ -11,6 +12,7 @@ data class OMRBaseConfiguration( ...@@ -11,6 +12,7 @@ data class OMRBaseConfiguration(
) )
data class OMRConfigurationParameter( data class OMRConfigurationParameter(
val contents: Map<OMRSection, String>,
val contourOMRHelperConfig: ContourOMRHelperConfig, val contourOMRHelperConfig: ContourOMRHelperConfig,
val templateMatchingOMRHelperConfig: TemplateMatchingOMRHelperConfig, val templateMatchingOMRHelperConfig: TemplateMatchingOMRHelperConfig,
) )
...@@ -62,7 +62,8 @@ class ImageDataViewModel : ViewModel() { ...@@ -62,7 +62,8 @@ class ImageDataViewModel : ViewModel() {
loadedConfig.templateMatchingOMRHelperConfig.setTemplate(circleTemplateLoader) loadedConfig.templateMatchingOMRHelperConfig.setTemplate(circleTemplateLoader)
val contourOMRHelper = ContourOMRHelper(loadedConfig.contourOMRHelperConfig) val contourOMRHelper = ContourOMRHelper(loadedConfig.contourOMRHelperConfig)
val templateMatchingOMRHelper = TemplateMatchingOMRHelper(loadedConfig.templateMatchingOMRHelperConfig) val templateMatchingOMRHelper =
TemplateMatchingOMRHelper(loadedConfig.templateMatchingOMRHelperConfig)
val result: MutableMap<OMRSection, Int?> = mutableMapOf() val result: MutableMap<OMRSection, Int?> = mutableMapOf()
...@@ -78,21 +79,19 @@ class ImageDataViewModel : ViewModel() { ...@@ -78,21 +79,19 @@ class ImageDataViewModel : ViewModel() {
} }
} }
// TODO: move this to april tag val pageContent = loadedConfig.contents
val customMap = mutableMapOf<OMRSection, String>()
customMap[OMRSection.FIRST] = "Anis"
customMap[OMRSection.SECOND] = "Bowo"
customMap[OMRSection.THIRD] = "Janggar"
val stringKeyResult = mutableMapOf<String, Int?>() val stringKeyResult = mutableMapOf<String, Int?>()
result.let { result.let {
for ((section, value) in it) { for ((section, value) in it) {
stringKeyResult[customMap[section]!!] = value stringKeyResult[pageContent[section]!!] = value
annotatedImage = ImageAnnotationHelper.annotateOMR(annotatedImage, contourOMRHelper.getSectionPosition(section), value) annotatedImage = ImageAnnotationHelper.annotateOMR(
Log.d("Result", "${customMap[section]}: $value") annotatedImage,
contourOMRHelper.getSectionPosition(section),
value
)
Log.d("Result", "${pageContent[section]}: $value")
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment