Commit 1d8acb5d authored by Stephen Thompson's avatar Stephen Thompson

Issue #1 implemented colour and searching

[ci skip]
parent 749cf878
Pipeline #3817 skipped
......@@ -16,6 +16,6 @@
"map" : "data/full",
"model to world" : "configuration/model_to_world.txt",
"logo" : false,
"search radius" : 10000
"search radius" : 1000
}
......@@ -200,8 +200,10 @@ def random_targets(count):
"""
Create a list of targets
"""
list_a = []
for i in range(count):
list_a.append(i)
list_a = range(count)
shuffle(list_a)
return list_a
......@@ -43,6 +43,9 @@ class OverlayApp(OverlayBaseApp):
self._pointer = VTKConeModel(10.0, 5.0, (1.0, 1.0, 1.0), "pointer")
self.vtk_overlay_window.add_vtk_actor(self._pointer.actor)
self.vtk_overlay_window.add_vtk_models(self._models)
for model in self._models:
model.actor.GetProperty().SetColor(1.0, 1.0, 1.0)
if maps is not None:
self.vtk_overlay_window.add_vtk_models(maps)
......@@ -66,6 +69,7 @@ class OverlayApp(OverlayBaseApp):
self._targets = random_targets(len(self._locators))
self._target_index = 0
self._models[self._targets[self._target_index]].actor.GetProperty().SetColor(1.0, 0.0, 0.0)
def update(self):
"""Update the background renderer with a new frame,
......@@ -96,9 +100,17 @@ class OverlayApp(OverlayBaseApp):
self._locators,
self._search_radius)
self._text.set_text([str(index), str(distance),
str(tracking[ph_index]), ""])
str(tracking[ph_index]),
str(self._target_index)])
if self._target_index < len(self._locators):
if index == self._targets[self._target_index]:
print("hit")
self._models[index].actor.SetVisibility(False)
self._target_index = self._target_index + 1
self._models[self._targets[self._target_index]].actor.GetProperty().SetColor(1.0, 0.0, 0.0)
else:
self._text.set_text([str(index), str(distance),
str(tracking[ph_index]),
str("Finished")])
if index == self._targets[self._target_index]:
print("hit")
self._models[index].actor.SetVisibility(False)
self._target_index = self._target_index + 1
Markdown is supported
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