示例#1
0
<p><b><?php 
echo Yii::t('waterrequest', 'Involved Service Areas');
?>
:</b></p>
<?php 
$cities = array();
$margin = array();
foreach ($model->geometries() as $geom) {
    $cs = $geom->city_state;
    $sas = Geometry::Get_Service_Area_ByID($geom->id);
    if (count($sas)) {
        if (array_key_exists('desc_area', $sas[0])) {
            $sa = $sas[0]['desc_area'];
            $water_supply = DummySAOperativeMargin::model()->find('lower(area)=:area AND scenario IS NULL', array(':area' => strtolower($sas[0]['area'])), array('limit' => 1));
            $margin[$sa] = $water_supply->margin;
        } else {
            $sa = 'unnamed';
            $margin[$sa] = 0;
        }
    } else {
        $sa = 'unknown';
        $margin[$sa] = 0;
    }
    //$sa = $geom->service_area;
    if (array_key_exists($cs, $cities)) {
        if (array_key_exists($sa, $cities[$cs])) {
            $cities[$cs][$sa] += $geom->geom_water_demand;
        } else {
            $cities[$cs][$sa] = $geom->geom_water_demand;
        }
    } else {
示例#2
0
文件: Geometry.php 项目: Gnafu/wiz
 /**
  * Calculate the service area holding the geometry passed as id or wkt.
  * @param object $id_or_wkt ID as integer or WKT as string 
  * @return array The service area info row, NULL if none is found.
  */
 public static function Get_Service_Area_Detailed($id_or_wkt)
 {
     if (!is_numeric($id_or_wkt)) {
         $sas = Geometry::Get_Service_Area_ByWKT($id_or_wkt);
     } else {
         $sas = Geometry::Get_Service_Area_ByID($id_or_wkt);
     }
     if (count($sas)) {
         return $sas[0];
     } else {
         return null;
     }
 }