2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Contains the factory class that handles the creation of geometric objects
6 * @package PhpMyAdmin-GIS
9 if (! defined('PHPMYADMIN')) {
14 * Factory class that handles the creation of geometric objects.
16 * @package PhpMyAdmin-GIS
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
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')) {
37 if (include_once './libraries/gis/pma_gis_' . $type_lower . '.php') {
38 switch(strtoupper($type)) {
40 return PMA_GIS_Multipolygon
::singleton();
42 return PMA_GIS_Polygon
::singleton();
44 return PMA_GIS_Multipoint
::singleton();
46 return PMA_GIS_Point
::singleton();
47 case 'MULTILINESTRING' :
48 return PMA_GIS_Multilinestring
::singleton();
50 return PMA_GIS_Linestring
::singleton();
51 case 'GEOMETRYCOLLECTION' :
52 return PMA_GIS_Geometrycollection
::singleton();