1. Check existence of mb_string, mysql and xml extensions before installation.
[openemr.git] / phpmyadmin / libraries / gis / GIS_Factory.class.php
blob4c27cd1e3cae397f29aec4b4c2fc97254d5a17c8
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 PMA_GIS_Geometry the singleton instance of geometric class
26 * of the given type
28 * @access public
29 * @static
31 public static function factory($type)
33 include_once './libraries/gis/GIS_Geometry.class.php';
35 $type_lower = strtolower($type);
36 $file = './libraries/gis/GIS_' . ucfirst($type_lower) . '.class.php';
37 if (! PMA_isValid($type_lower, PMA_Util::getGISDatatypes())
38 || ! file_exists($file)
39 ) {
40 return false;
42 if (include_once $file) {
43 switch(strtoupper($type)) {
44 case 'MULTIPOLYGON' :
45 return PMA_GIS_Multipolygon::singleton();
46 case 'POLYGON' :
47 return PMA_GIS_Polygon::singleton();
48 case 'MULTIPOINT' :
49 return PMA_GIS_Multipoint::singleton();
50 case 'POINT' :
51 return PMA_GIS_Point::singleton();
52 case 'MULTILINESTRING' :
53 return PMA_GIS_Multilinestring::singleton();
54 case 'LINESTRING' :
55 return PMA_GIS_Linestring::singleton();
56 case 'GEOMETRYCOLLECTION' :
57 return PMA_GIS_Geometrycollection::singleton();
58 default :
59 return false;
61 } else {
62 return false;