Fixed: Not selecting a datalabel used to issue a notice(undefined offset)
[phpmyadmin/ammaryasirr.git] / libraries / gis / pma_gis_factory.php
blobf6f723253f06e464ec1d7b7c93d5c81e3661ff96
1 <?php
2 /**
3 * Factory class that handles the creation of geometric objects.
5 * @package phpMyAdmin-GIS
6 */
7 class PMA_GIS_Factory
9 /**
10 * Returns the singleton instance of geometric class of the given type.
12 * @param string $type type of the geometric object
14 * @throws Exception
16 * @return the singleton instance of geometric class of the given type
18 public static function factory($type)
20 include_once './libraries/gis/pma_gis_geometry.php';
22 $type_lower = strtolower($type);
23 if (! file_exists('./libraries/gis/pma_gis_' . $type_lower . '.php')) {
24 return false;
26 if (include_once './libraries/gis/pma_gis_' . $type_lower . '.php') {
27 switch($type) {
28 case 'MULTIPOLYGON' :
29 return PMA_GIS_Multipolygon::singleton();
30 case 'POLYGON' :
31 return PMA_GIS_Polygon::singleton();
32 case 'MULTIPOINT' :
33 return PMA_GIS_Multipoint::singleton();
34 case 'POINT' :
35 return PMA_GIS_Point::singleton();
36 case 'MULTILINESTRING' :
37 return PMA_GIS_Multilinestring::singleton();
38 case 'LINESTRING' :
39 return PMA_GIS_Linestring::singleton();
40 case 'GEOMETRYCOLLECTION' :
41 return PMA_GIS_Geometrycollection::singleton();
42 default :
43 return false;
45 } else {
46 return false;