Beispiel #1
0
 /**
  * @inheritDoc
  */
 public function init()
 {
     $features = array();
     if ($view = $this->getOption('view', FALSE)) {
         list($views_id, $display_id) = explode(':', $view, 2);
         $view = views_get_view($views_id);
         if ($view && $view->access($display_id)) {
             $view->set_display($display_id);
             if (empty($view->current_display) || !empty($display_id) && $view->current_display != $display_id) {
                 if (!$view->set_display($display_id)) {
                     return FALSE;
                 }
             }
             $view->pre_execute();
             $view->init_style();
             $view->execute();
             // Do not render the map, just return the features.
             $view->style_plugin->options['skipMapRender'] = TRUE;
             $features = array_merge($features, $view->style_plugin->render());
             $view->post_execute();
         }
     }
     $this->setOption('features', $features);
     return parent::init();
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function optionsFormSubmit($form, &$form_state)
 {
     if ($form_state['values']['options']['url'] == '') {
         unset($form_state['item']->options['url']);
     }
     if ($form_state['values']['options']['crossOrigin'] == '') {
         unset($form_state['item']->options['crossOrigin']);
     }
     parent::optionsFormSubmit($form, $form_state);
 }
 /**
  * {@inheritDoc}
  */
 public function optionsToObjects()
 {
     $import = parent::optionsToObjects();
     if ($source = $this->getOption('source')) {
         $source = Openlayers::load('source', $source);
         // This source is a dependency of the current one, we need a lighter weight.
         $this->setWeight($source->getWeight() + 1);
         $import = array_merge($source->getCollection()->getFlatList(), $import);
     }
     return $import;
 }
Beispiel #4
0
 /**
  * {@inheritdoc}
  */
 public function optionsToObjects()
 {
     $import = parent::optionsToObjects();
     foreach ($this->getOptions() as $geometry_type => $data) {
         if ($styles = $this->getOption(array($geometry_type, 'styles'), array())) {
             foreach ($styles as $style) {
                 $style = Openlayers::load('style', $style);
                 // This source is a dependency of the current one,
                 // we need a lighter weight.
                 $this->setWeight($style->getWeight() + 1);
                 $import = array_merge($style->getCollection()->getFlatList(), $import);
             }
         }
     }
     return $import;
 }
Beispiel #5
0
 /**
  * {@inheritdoc}
  */
 public function attached()
 {
     $attached = parent::attached();
     $plugin = $this->getPluginDefinition();
     $plugin['path'] = $this->getClassDirectory();
     if ($this->getOption('devMode')) {
         // @TODO Find a way how to do this just once per map / collection.
         $attached['library']['system.ui.dialog'] = array('system', 'ui.dialog');
         $attached['library']['system.jquery.cookie'] = array('system', 'jquery.cookie');
         $attached['js'][$plugin['path'] . '/js/geojson_dev.js']['weight'] = Config::get('openlayers.js_css.weight') + 1;
     } else {
         unset($attached['js'][$plugin['path'] . '/js/geojson_dev.js']);
         unset($attached['css'][$plugin['path'] . '/css/geojson_dev.css']);
     }
     return $attached;
 }