/**
  * Convert a definition to a geo json feature.
  *
  * @param Definition $definition The leaflet definition object.
  * @param mixed      $model      The corresponding definition model.
  *
  * @return GeoJsonFeature
  * @throws \RuntimeException If a definition type is not supported.
  */
 public function convertToGeoJsonFeature(Definition $definition, $model)
 {
     if ($definition instanceof GeoJsonFeature) {
         $feature = $definition;
     } elseif ($definition instanceof ConvertsToGeoJsonFeature) {
         $feature = $definition->toGeoJsonFeature();
     } else {
         throw new \RuntimeException(sprintf('Definition of class "%s" could not be converted to a geo json feature.', get_class($definition)));
     }
     $event = new ConvertToGeoJsonEvent($definition, $feature, $model);
     $this->eventDispatcher->dispatch($event::NAME, $event);
     return $feature;
 }