Пример #1
0
 /**
  * Returns the singleton instance of geometric class of the given type.
  *
  * @param string $type type of the geometric object
  *
  * @return GISGeometry the singleton instance of geometric class
  *                          of the given type
  *
  * @access public
  * @static
  */
 public static function factory($type)
 {
     $type_lower = strtolower($type);
     $file = './libraries/gis/GIS' . ucfirst($type_lower) . '.php';
     if (!PMA_isValid($type_lower, PMA\libraries\Util::getGISDatatypes()) || !file_exists($file)) {
         return false;
     }
     if (include_once $file) {
         switch (strtoupper($type)) {
             case 'MULTIPOLYGON':
                 return GISMultipolygon::singleton();
             case 'POLYGON':
                 return GISPolygon::singleton();
             case 'MULTIPOINT':
                 return GISMultipoint::singleton();
             case 'POINT':
                 return GISPoint::singleton();
             case 'MULTILINESTRING':
                 return GISMultilinestring::singleton();
             case 'LINESTRING':
                 return GISLinestring::singleton();
             case 'GEOMETRYCOLLECTION':
                 return GISGeometrycollection::singleton();
             default:
                 return false;
         }
     } else {
         return false;
     }
 }
Пример #2
0
 /**
  * test case for prepareRowAsOl() method
  *
  * @param string $spatial    GIS MULTILINESTRING object
  * @param int    $srid       spatial reference ID
  * @param string $label      label for the GIS MULTILINESTRING object
  * @param string $line_color color for the GIS MULTILINESTRING 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, $line_color, $scale_data, $output
 ) {
     $this->assertEquals(
         $output,
         $this->object->prepareRowAsOl(
             $spatial, $srid, $label, $line_color, $scale_data
         )
     );
 }
 /**
  * Returns the singleton instance of geometric class of the given type.
  *
  * @param string $type type of the geometric object
  *
  * @return GISGeometry the singleton instance of geometric class
  *                          of the given type
  *
  * @access public
  * @static
  */
 public static function factory($type)
 {
     switch (strtoupper($type)) {
         case 'MULTIPOLYGON':
             return GISMultipolygon::singleton();
         case 'POLYGON':
             return GISPolygon::singleton();
         case 'MULTIPOINT':
             return GISMultipoint::singleton();
         case 'POINT':
             return GISPoint::singleton();
         case 'MULTILINESTRING':
             return GISMultilinestring::singleton();
         case 'LINESTRING':
             return GISLinestring::singleton();
         case 'GEOMETRYCOLLECTION':
             return GISGeometrycollection::singleton();
         default:
             return false;
     }
 }