/** * Returns the singleton instance of geometric class of the given type. * * @param string $type type of the geometric object * * @return PMA_GIS_Geometry the singleton instance of geometric class * of the given type * * @access public * @static */ public static function factory($type) { include_once './libraries/gis/pma_gis_geometry.php'; $type_lower = strtolower($type); if (!file_exists('./libraries/gis/pma_gis_' . $type_lower . '.php')) { return false; } if (include_once './libraries/gis/pma_gis_' . $type_lower . '.php') { switch (strtoupper($type)) { case 'MULTIPOLYGON': return PMA_GIS_Multipolygon::singleton(); case 'POLYGON': return PMA_GIS_Polygon::singleton(); case 'MULTIPOINT': return PMA_GIS_Multipoint::singleton(); case 'POINT': return PMA_GIS_Point::singleton(); case 'MULTILINESTRING': return PMA_GIS_Multilinestring::singleton(); case 'LINESTRING': return PMA_GIS_Linestring::singleton(); case 'GEOMETRYCOLLECTION': return PMA_GIS_Geometrycollection::singleton(); default: return false; } } else { return false; } }
/** * Returns the singleton instance of geometric class of the given type. * * @param string $type type of the geometric object * * @return PMA_GIS_Geometry the singleton instance of geometric class * of the given type * * @access public * @static */ public static function factory($type) { include_once './libraries/gis/GIS_Geometry.class.php'; $type_lower = strtolower($type); $file = './libraries/gis/GIS_' . ucfirst($type_lower) . '.class.php'; if (!PMA_isValid($type_lower, PMA_Util::getGISDatatypes()) || !file_exists($file)) { return false; } if (include_once $file) { switch (strtoupper($type)) { case 'MULTIPOLYGON': return PMA_GIS_Multipolygon::singleton(); case 'POLYGON': return PMA_GIS_Polygon::singleton(); case 'MULTIPOINT': return PMA_GIS_Multipoint::singleton(); case 'POINT': return PMA_GIS_Point::singleton(); case 'MULTILINESTRING': return PMA_GIS_Multilinestring::singleton(); case 'LINESTRING': return PMA_GIS_Linestring::singleton(); case 'GEOMETRYCOLLECTION': return PMA_GIS_Geometrycollection::singleton(); default: return false; } } else { return false; } }
/** * Returns the singleton instance of geometric class of the given type. * * @param string $type type of the geometric object * * @return PMA_GIS_Geometry the singleton instance of geometric class * of the given type * * @access public * @static */ public static function factory($type) { include_once './libraries/gis/GIS_Geometry.class.php'; /** @var PMA_String $pmaString */ $pmaString = $GLOBALS['PMA_String']; $file = './libraries/gis/GIS_' . ucfirst($pmaString->strtolower($type)) . '.class.php'; if (!file_exists($file)) { return false; } if (include_once $file) { switch ($pmaString->strtoupper($type)) { case 'MULTIPOLYGON': return PMA_GIS_Multipolygon::singleton(); case 'POLYGON': return PMA_GIS_Polygon::singleton(); case 'MULTIPOINT': return PMA_GIS_Multipoint::singleton(); case 'POINT': return PMA_GIS_Point::singleton(); case 'MULTILINESTRING': return PMA_GIS_Multilinestring::singleton(); case 'LINESTRING': return PMA_GIS_Linestring::singleton(); case 'GEOMETRYCOLLECTION': return PMA_GIS_Geometrycollection::singleton(); default: return false; } } else { return false; } }
/** * Returns the singleton. * * @return PMA_GIS_Multipoint the singleton * @access public */ public static function singleton() { if (!isset(self::$_instance)) { $class = __CLASS__; self::$_instance = new $class(); } return self::$_instance; }
/** * test case for prepareRowAsOl() method * * @param string $spatial GIS MULTIPOINT object * @param int $srid spatial reference ID * @param string $label label for the GIS MULTIPOINT object * @param string $point_color color for the GIS MULTIPOINT object * @param array $scale_data array containing data related to scaling * @param string $output expected output * * @return void * @dataProvider providerForPrepareRowAsOl */ public function testPrepareRowAsOl( $spatial, $srid, $label, $point_color, $scale_data, $output ) { $this->assertEquals( $output, $this->object->prepareRowAsOl( $spatial, $srid, $label, $point_color, $scale_data ) ); }
/** * test getShape method * * @return void */ public function testGetShape() { $gis_data = array( 'numpoints' => 2, 'points' => array( 0 => array('x' => 5.02, 'y' => 8.45), 1 => array('x' => 6.14, 'y' => 0.15) ) ); $this->assertEquals( $this->object->getShape($gis_data), 'MULTIPOINT(5.02 8.45,6.14 0.15)' ); }
// ESRI PolyLine case 3: include_once './libraries/gis/pma_gis_multilinestring.php'; $gis_obj = PMA_GIS_Multilinestring::singleton(); break; // ESRI Polygon // ESRI Polygon case 5: include_once './libraries/gis/pma_gis_multipolygon.php'; $gis_obj = PMA_GIS_Multipolygon::singleton(); break; // ESRI MultiPoint // ESRI MultiPoint case 8: include_once './libraries/gis/pma_gis_multipoint.php'; $gis_obj = PMA_GIS_Multipoint::singleton(); break; default: $error = true; if (!isset($esri_types[$shp->shapeType])) { $message = PMA_Message::error(__('You tried to import an invalid file or the imported file contains invalid data')); } else { $message = PMA_Message::error(__('MySQL Spatial Extension does not support ESRI type "%s".')); $message->addParam($param); } return; } $num_rows = count($shp->records); // If .dbf file is loaded, the number of extra data columns $num_data_cols = isset($shp->DBFHeader) ? count($shp->DBFHeader) : 0; $rows = array();