/**
  * 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;
     }
 }
Exemplo n.º 3
0
 /**
  * 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;
     }
 }
Exemplo n.º 4
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     $this->object = PMA_GIS_Point::singleton();
 }
Exemplo n.º 5
0
 // Delete the .dbf file extracted to 'TempDir'
 if ($temp_dbf_file) {
     unlink($dbf_file_path);
 }
 $esri_types = array(0 => 'Null Shape', 1 => 'Point', 3 => 'PolyLine', 5 => 'Polygon', 8 => 'MultiPoint', 11 => 'PointZ', 13 => 'PolyLineZ', 15 => 'PolygonZ', 18 => 'MultiPointZ', 21 => 'PointM', 23 => 'PolyLineM', 25 => 'PolygonM', 28 => 'MultiPointM', 31 => 'MultiPatch');
 include_once './libraries/gis/pma_gis_geometry.php';
 switch ($shp->shapeType) {
     // ESRI Null Shape
     case 0:
         $gis_obj = null;
         break;
         // ESRI Point
     // ESRI Point
     case 1:
         include_once './libraries/gis/pma_gis_point.php';
         $gis_obj = PMA_GIS_Point::singleton();
         break;
         // ESRI PolyLine
     // 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