Project

General

Profile

Revision a1063f68

Added by Jocelyn Delande over 10 years ago

The one-step upload now handles as well the tiles generation and stops on generation errors if needed

View differences:

class/site_point.class.php
96 96
	                $p['altitude'], $p['titre']));
97 97
  }
98 98

  
99
  public function has_tiles(){
100
	  if (file_exists($this->tiles_path())) {
101
         $pano_files = scandir($this->tiles_path());
102
        foreach($pano_files as $filename) {
103
          if (preg_match('/.*\.jpg/', $filename)) {
104
	          return true;
105
          }
106
        }
107
      } else {
108
	      return false;
109
      }
110
  }
111

  
99 112
  public function get_name() {
100 113
    return basename($this->base_dir);
101 114
  }
......
151 164
    return array($d, $cap*180/M_PI, $e*180/M_PI);   // les r├ęsultats sont en degr├ęs
152 165
  }
153 166

  
167
  public function get_generate_url($source_file) {
168
	  /**
169
	   * @param $source_file : the name of the source file within the upload dir.
170
	   */
171
	  return sprintf('genererPano.php?wizard=1&name='.$source_file);
172
  }
173

  
174
  public function src_path(){
175
	  /** @returns the basename of the src image, or false if it's no longer available
176
	   */
177
	  $extensions = array('jpg', 'tif', 'png', 'bmp', 'jpeg', 'pnm',
178
	                      'JPG', 'TIF', 'PNG', 'BMP', 'JPEG', 'PNM');
179

  
180
	  foreach ($extensions as $ext) {
181
		  $tried_name = sprintf('%s/%s.%s', UPLOAD_PATH, $this->get_name(),$ext);
182
		  if (file_exists($tried_name)) {
183
			  return $tried_name;
184
		  }
185
	  }
186
	  return false;
187
  }
188

  
154 189
  public function get_url($cap=false, $ele=false) {
155 190
	  $o = sprintf('panorama.php?dir=%s&panorama=%s',
156 191
	                  PANORAMA_FOLDER, $this->get_name());
......
160 195
	  return $o;
161 196
  }
162 197

  
198
  public function get_map_url($cap=0) {
199
	  $encoded_title = base64_encode($this->get_name());
200
	  $script_name = 'show_capline.php';
201
	  $lat = $this->get_params()['latitude'];
202
	  $lon = $this->get_params()['longitude'];
203

  
204
	  $o = sprintf('%s?title=%s&cap=%s&org_lat=%.5f&org_lon=%.5f&dist=120000',
205
	               $script_name, $encoded_title, $cap, $lat, $lon);
206
	  return $o;
207
  }
208

  
163 209
  public function set_reference($ref_point, $x, $y) {
164 210
	  /**
165 211
	   * Registers (for saving) the position of a reference point within a

Also available in: Unified diff