Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / libraries / gis / pma_gis_factory.php
blob1184ae3460eda42e2e2db72331597d03ce54717b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Contains the factory class that handles the creation of geometric objects
6 * @package PhpMyAdmin-GIS
7 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 /**
14 * Factory class that handles the creation of geometric objects.
16 * @package PhpMyAdmin-GIS
18 class PMA_GIS_Factory
20 /**
21 * Returns the singleton instance of geometric class of the given type.
23 * @param string $type type of the geometric object
25 * @return object the singleton instance of geometric class of the given type
26 * @access public
27 * @static
29 public static function factory($type)
31 include_once './libraries/gis/pma_gis_geometry.php';
33 $type_lower = strtolower($type);
34 if (! file_exists('./libraries/gis/pma_gis_' . $type_lower . '.php')) {
35 return false;
37 if (include_once './libraries/gis/pma_gis_' . $type_lower . '.php') {
38 switch(strtoupper($type)) {
39 case 'MULTIPOLYGON' :
40 return PMA_GIS_Multipolygon::singleton();
41 case 'POLYGON' :
42 return PMA_GIS_Polygon::singleton();
43 case 'MULTIPOINT' :
44 return PMA_GIS_Multipoint::singleton();
45 case 'POINT' :
46 return PMA_GIS_Point::singleton();
47 case 'MULTILINESTRING' :
48 return PMA_GIS_Multilinestring::singleton();
49 case 'LINESTRING' :
50 return PMA_GIS_Linestring::singleton();
51 case 'GEOMETRYCOLLECTION' :
52 return PMA_GIS_Geometrycollection::singleton();
53 default :
54 return false;
56 } else {
57 return false;