====== Example : Search Panorama Photos ====== This example assumes you have successfully [[example_embed|embedded the component]] and [[example_checklicense|validated the license]]. Steps to take : - Wait for the publication to load. - Search for panorama photos inside a boundingbox. - Search for panorama photos close to a location. - Open a panorama photo. ===== 1. Wait for the publication to load. ===== Before we can start retrieving panorama photo's we must first wait for the publication to be loaded. The example below shows how to wait for a publication to load succesfully. Note that we use the second argument of the ''loadPublication()'' to prevent the initial panorama viewer from being opened. client.addEventListener(orbit.webclient.LoadPublicationEvent.SUCCESS, function(e) { console.log("Publication is loaded."); }); ===== 2. Search for panorama photos inside a boundingbox. ===== The example below shows how to search for photo positions using a geometrical bounding-box. The ''searchPhotoPositions()'' method takes 5 arguments : * minX : The minimum X value. * minY : The maximum Y value. * maxX : The minimum X value. * maxY : The maximum Y value. * crs : The CRS code defining the CRS of the specified boundingbox. Photo positions are returned in the Publication CRS or in a custom CRS if one was set using the ''setCRS()'' function. client.addEventListener(orbit.webclient.LoadPublicationEvent.SUCCESS, function(e) { client.getPanorama().searchPhotoPositions(133810,206161,133860,206211,"31370", function (result) { console.log("Found photo positions: ", result); client.getPanorama().openViewer(result[0]); }, function(fault) { }); }); ===== 3. Search for panorama photos around a position ===== The example below shows how to search for photo positions close to a specific position. The ''searchPhotoPositionsAround()'' method takes 4 arguments : * x : The coordinate X value. * y : The coordinate Y value. * crs : The coordinate CRS. * distance : The search distance. Photo positions are returned in the Publication CRS or in a custom CRS if one was set using the ''setCRS()'' function. Photo positions are sorted on distance, with the first photo being the closest to the provided coordinate. client.addEventListener(orbit.webclient.LoadPublicationEvent.SUCCESS, function(e) { client.getPanorama().searchPhotoPositionsAround(133810,206161,"31370",30, function (result) { console.log("Found photo positions: ", result); client.getPanorama().openViewer(result[0]); }, function(fault) { }); }); ===== 4. Open a panorama photo. ===== The returned panorama photo objects can be used directly to open a photo : client.getPanorama().openViewer(result[0]); ===== Complete Example ======
===== Result ===== Please open the **JavaScript Console** of your browser to see debug messages.