Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/main/kotlin/solve/importer/FullParserForImport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object FullParserForImport {
fun fullParseDirectory(
project: ProjectAfterPartialParsing
): Project {
val landmarks = HashMap<Long, MutableList<LandmarkFile>>()
val landmarks = HashMap<Double, MutableList<LandmarkFile>>()
val frames = ArrayList<ProjectFrame>()
val layers = ArrayList<ProjectLayer>()

Expand All @@ -21,19 +21,19 @@ object FullParserForImport {
}

project.projectFrames.forEach {
val longName = it.image.name.toLong()
landmarks[longName] = mutableListOf()
val doubleName = it.image.name.toDouble()
landmarks[doubleName] = mutableListOf()
it.outputs.map { output ->
val currentLayer = ProjectLayer(output.kind, output.algorithmName, project.currentDirectory)
if (!layers.contains(currentLayer)) {
layers.add((currentLayer))
}
landmarks[longName]?.add(
landmarks[doubleName]?.add(
LandmarkFile(currentLayer, Path(output.path), ImagePlanesParser.extractUIDs(output.path))
)
}
landmarks[longName]?.toList()
?.let { landmark -> ProjectFrame(longName, Path(it.image.path), landmark) }
landmarks[doubleName]?.toList()
?.let { landmark -> ProjectFrame(doubleName, Path(it.image.path), landmark) }
?.let { it1 -> frames.add(it1) }
}
return Project(Path(project.currentDirectory), frames, layers)
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/solve/importer/ProjectParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object ProjectParser {
folder.listFiles()?.forEach {
val imageName = it.nameWithoutExtension

if (imageName.toLongOrNull() != null) {
if (imageName.toDoubleOrNull() != null) {
outputs.add(
OutputAfterPartialParsing(
imageName,
Expand All @@ -101,7 +101,7 @@ object ProjectParser {
createAlertForError(
"\"$errors\" ${if (countErrors == 1) "has" else "have"} incorrect " +
"${if (countErrors == 1) "name of file" else "names of files"} with markup. " +
"File name must support conversion to Long."
"File name must support conversion to Double."
)
}
}
Expand All @@ -111,7 +111,7 @@ object ProjectParser {
folder.listFiles()?.forEach {
val imageName = it.nameWithoutExtension

if (imageName.toLongOrNull() != null) {
if (imageName.toDoubleOrNull() != null) {
images.add(
ImageAfterPartialParsing(imageName, it.invariantSeparatorsPath, mutableListOf()).apply {
incorrectExtensionError(it, errors)
Expand All @@ -132,7 +132,7 @@ object ProjectParser {
"${errorImages.first()} and ${errorImages.count() - 1} others are"
}
} " +
"because the file name can't be converted to long"
"because the file name can't be converted to double"
)
}
}
Expand Down Expand Up @@ -188,7 +188,7 @@ object ProjectParser {

hasAnyErrors = hasAnyErrors || noSomeAlgorithmError(frames, layers)

frames.sortWith(compareBy { it.image.name.toLong() })
frames.sortWith(compareBy { it.image.name.toDouble() })

if (errorFolders.isNotEmpty()) {
alertErrorFolderMessage()
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/solve/project/model/ProjectFrame.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package solve.project.model
import java.nio.file.Path

data class ProjectFrame(
val timestamp: Long,
val timestamp: Double,
val imagePath: Path,
val landmarkFiles: List<LandmarkFile>
)
2 changes: 1 addition & 1 deletion src/main/kotlin/solve/scene/model/VisualizationFrame.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import javafx.scene.image.Image
* Frame data object.
*/
data class VisualizationFrame(
val timestamp: Long,
val timestamp: Double,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I copy timestamp from the frame and it was initially integer 1 I have 1.0 in the clipboard

val getImage: () -> Image,
val layers: List<Layer>
)
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class SceneFacadeTests : SceneTestsBase() {

val frameNumber = 5
val frame = scene.frames[frameNumber]
assertEquals(frameNumber.toLong(), frame.timestamp)
assertEquals(frameNumber.toDouble(), frame.timestamp)
assertEquals(1, frame.layers.size)

val frameLayer = frame.layers.single()
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/solve/interactive/scene/SceneTestsBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal open class SceneTestsBase : InteractiveTestClass() {
val frames = (0 until framesCount).map { i ->
val files = layers.map { LandmarkFile(it, keypointFiles[min(i, 9)].toPath(), listOf(i.toLong())) }
ProjectFrame(
i.toLong(),
i.toDouble(),
imageFiles[min(i, 9)].toPath(),
files
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal class FrameViewTests : InteractiveTestClass() {
Landmark.Keypoint(index.toLong(), settings, state, point)
}
val layer = Layer.PointLayer(layerName, settings) { keypoints }
frame = VisualizationFrame(1, { image }, listOf(layer))
frame = VisualizationFrame(1.0, { image }, listOf(layer))
robot.interact {
frameView = FrameView(size, scale, storage, 0, parameters, frame)
}
Expand Down Expand Up @@ -160,7 +160,7 @@ internal class FrameViewTests : InteractiveTestClass() {
Landmark.Keypoint(index.toLong(), settings, LayerState(layerName), point)
}
val layer = Layer.PointLayer(layerName, settings) { keypoints }
frame = VisualizationFrame(1, { image }, listOf(layer))
frame = VisualizationFrame(1.0, { image }, listOf(layer))
robot.interact {
frameView.setFrame(frame)
}
Expand Down Expand Up @@ -189,7 +189,7 @@ internal class FrameViewTests : InteractiveTestClass() {
Layer.PointLayer(secondLayerName, settings) { keypoints },
Layer.PointLayer(layerName, this.settings) { this.keypoints }
)
frame = VisualizationFrame(1, { image }, layers)
frame = VisualizationFrame(1.0, { image }, layers)
val scope = CoroutineScope(Dispatchers.JavaFx)
parameters = FrameViewParameters(
scope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ internal class VirtualizedFXGridTests : InteractiveTestClass() {
val framesCount = 100
val columnsNumber = 3
val outOfFramesLayer = OutOfFramesLayer()
val data = (0 until framesCount).map { VisualizationFrame(it.toLong(), { image }, listOf()) }
val data = (0 until framesCount).map { VisualizationFrame(it.toDouble(), { image }, listOf()) }
val scene = solve.scene.model.Scene(listOf(), listOf())
val cache = TestStorage()
val associationsManager = AssociationsManager<VisualizationFrame, Landmark.Keypoint>(
Expand Down
Loading