Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function optionsToObjects()
 {
     $import = array();
     foreach (Openlayers::getPluginTypes(array('map')) as $type) {
         foreach ($this->getOption($type . 's', array()) as $weight => $object) {
             if ($merge_object = Openlayers::load($type, $object)) {
                 $merge_object->setWeight($weight);
                 $import[] = $merge_object;
             }
         }
     }
     return $import;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  *
  * !Attention! This function will remove any option that is named after a
  * plugin type e.g.: layers, controls, styles, interactions, components .
  */
 public function getJS()
 {
     $export = $this->getExport();
     array_map(function ($type) use($export) {
         unset($export->options[$type . 's']);
     }, Openlayers::getPluginTypes());
     $js = array('mn' => $export->machine_name, 'fs' => $export->factory_service);
     if (!empty($export->options)) {
         $js['opt'] = $export->options;
     }
     return $js;
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function optionsToObjects()
 {
     $import = array();
     // TODO: Simplify this.
     // Add the objects from the configuration.
     foreach (Openlayers::getPluginTypes(array('map')) as $weight_type => $type) {
         foreach ($this->getOption($type . 's', array()) as $weight => $object) {
             if ($col_object = $this->getCollection()->getObjectById($type, $object)) {
                 //$col_object->setWeight($weight_type . '.' . $weight);
                 //$import[] = $col_object;
             } else {
                 if ($merge_object = Openlayers::load($type, $object)) {
                     $merge_object->setWeight($weight_type . '.' . $weight);
                     $import[$type . '_' . $merge_object->getMachineName()] = $merge_object;
                 }
             }
         }
     }
     foreach ($this->getCollection()->getFlatList() as $object) {
         $import[$object->getType() . '_' . $object->getMachineName()] = $object;
     }
     return $import;
 }