message: Smaller improvements
diff: #
  # This work is licensed under the terms of the MIT license.
  # For a copy, see <https://opensource.org/licenses/MIT>.
  -import math
  import numpy as np
  import matplotlib.pyplot as plt
  -from bark.core.geometry import *
  from bark.core.models.dynamic import *
  -from bark.core.world.opendrive import *
  -from bark.core.world.goal_definition import *
  from bark.core.world.renderer import *
  from bark.runtime.commons.parameters import ParameterServer
  from bark.runtime.viewer.buffered_viewer import BufferedViewer
  @@ -22,20 +18,17 @@ class BufferedMPViewer(BufferedViewer):
  super().__init__(params=params)
  self._ax = ax or plt.subplots()[1]
  self._vparams = self._params["Visualization"]
  - self._view_dx = self._vparams["dx", "view range x", 20]
  - self._view_dy = self._vparams["dy", "view range y", 20]
  - self._world = None
  + self._dx = self._vparams["dx", "view range x", 20]
  + self._dy = self._vparams["dy", "view range y", 20]
  def drawWorld(self, world, eval_agent_ids=None, scenario_idx=None):
  self._ax.clear()
  super().drawWorld(world, eval_agent_ids, scenario_idx)
  - self._world = world
  - self.render()
  - self._world.renderer.Clear()
  + self.render(world)
  + world.renderer.Clear()
  - def render(self):
  - # assert self._world == None, "World has not been drawn yet."
  - for type_name, primitives in self._world.renderer.primitives.items():
  + def render(self, world):
  + for type_name, primitives in world.renderer.primitives.items():
  if type_name == "EGO_AGENT_STATE":
  self.ProcessEgoState(primitives)
  elif type_name == "MAP_LINE" or type_name == "LINES":
  @@ -49,10 +42,8 @@ class BufferedMPViewer(BufferedViewer):
  def ProcessEgoState(self, primitives):
  ego_state = primitives[-1].object
  - self._ax.set_xlim(
  - [ego_state[1] - self._view_dx, ego_state[1] + self._view_dx])
  - self._ax.set_ylim(
  - [ego_state[2] - self._view_dy, ego_state[2] + self._view_dy])
  + self._ax.set_xlim([ego_state[1] - self._dx, ego_state[1] + self._dx])
  + self._ax.set_ylim([ego_state[2] - self._dy, ego_state[2] + self._dy])
  def DrawLines(self, primitives):
  for primitive in primitives:
  @@ -67,7 +58,6 @@ class BufferedMPViewer(BufferedViewer):
  self._ax.plot(np_poly[:, 0], np_poly[:, 1], color=color)
  def DrawPoints(self, primitives):
  - for primitive in primitives:
  + for p in primitives:
  color = np.array(primitive.conf["stroke_color"])/255
  - plt.plot(
  - primitive.object.x(), primitive.object.y(), marker='*', color=color)
  \ No newline at end of file
  + plt.plot(p.object.x(), p.object.y(), marker='*', color=color)
  \ No newline at end of file
  