map.php File Reference


Functions

 dcmPix2Geo ($nPixPos, $dfPixMax, $dfGeoMin, $dfGeoMax, $boolOrientation)

Variables

 $strMessages = ''
 $gszCommand = ""
 break
case acceptedLandmarkMove
 $strUpdate
 $strUpdate
 $gszCommand = "LANDMARK"
 $strMessages = $strMessages._("Moved Landmark.")
 break
 $nClickPixX = NULL
 $nClickPixY = NULL
 $dfMinX = NULL
 $dfMinY = NULL
 $dfMaxX = NULL
 $dfMaxY = NULL
 $nClickGeoX = NULL
 $nClickGeoY = NULL
 $nClickGeoY
 $toolLandmark
 break
case LANDMARK
 $numImageWidth = doubleval($_REQUEST["imagewidth"])
 $numImageHeight = doubleval($_REQUEST["imageheight"])
 $numBoxMinX
 $numBoxMinY
 $numBoxMaxX
 $numBoxMaxY
 $wktPolygon
 $strQuery
 $objResult = pg_query($strQuery)
 $numRows = pg_numrows($objResult)
 $objResult = pg_query($strUpdate)
 $_SESSION ["NewWorkorderID"] = $row[0]
 $result = pg_query($strQuery)
 $numRows = pg_numrows($result)
 $_SESSION ["NewWorkorderID"] = $row[0]
 $strInsert
 $result = pg_exec($strInsert)
 $strInsert
 $result = pg_exec($strInsert)
 $arrTransferredValues
 $strScript
 $dcmPage = new DcmPage(basename(__FILE__))
 $gpoMap
 $dfTmpDeltaX = 0
 $dfTmpDeltaY = 0
 $dfMapExtMinX = $gpoMap->extent->minx
 $dfMapExtMinY = $gpoMap->extent->miny
 $dfMapExtMaxX = $gpoMap->extent->maxx
 $dfMapExtMaxY = $gpoMap->extent->maxy
 $dfMaxExtMinX = $gpoMap->extent->minx - $dfTmpDeltaX
 $dfMaxExtMinY = $gpoMap->extent->miny - $dfTmpDeltaY
 $dfMaxExtMaxX = $gpoMap->extent->maxx + $dfTmpDeltaX
 $dfMaxExtMaxY = $gpoMap->extent->maxy + $dfTmpDeltaY
</td >< td > & nbsp
</td ></tr >< tr >< td ><
inputtype="checkbox"name="pressurizedmain"value="Y"<
?phpif(GMapGetStatus("pressurizedmain")==1){echo("checked=\"CHECKED\"");}?><
/td >< td >< imgsrc="images/water_network.png"width="20"height="15"></td >< td ><
aname="#water_network"title="<
?=_("DisplaytheWaternetwork")?><
?=_("WaterNetwork")?></a><
/td></tr><?phpif((array_key_exists("boolHasSewer",$_SESSION))&&($_SESSION["boolHasSewer"]==true)){?><tr><td><inputtype="checkbox"name="gravitymain"value="Y"<?phpif(GMapGetStatus("gravitymain")==1){echo"checked=\"CHECKED\"";}?></td >< tdalign="CENTER">< imgsrc="images/sewer_network.png"width="20"height="15"></td >< td ><
aname="#sewer_network"title="<
?=_("Displaythesewernetwork")?><
?=_("SewerNetwork")?></a><
/td></tr><?php}?><tr><tdalign="CENTER"><inputtype="checkbox"name="Maintenance"value="Y"<?phpif(GMapGetStatus("Maintenance")==1){echo"checked=\"CHECKED\"";}?></td >< tdalign="CENTER">< imgsrc="images/repair.gif"width="7"height="7"><
/td >< td >< ahref="workorderlist.php?action=list&status=1"title="<
?=_("Displaytherepairslocations")?><
?=_("Maintenance")?></a><
/td></tr><tr><tdalign="CENTER"><
inputtype="checkbox"name="Landmark"value="Y"disabled="disabled"checked="checked"/><
/td><tdalign="CENTER"><imgsrc="images/landmark.png"width="7"height="7"></td><td><ahref="zoom.php"title="<?=_("Clickthislinktozoomtoalandmark.")?><
?=_("Landmark")?></a ></tr ><
tr >< tdalign="CENTER"><
inputtype="IMAGE"src="images/stock_refresh.png"width="24"height="24"name="redraw"border="0"/></td >< tdcolspan="2"><
aname="#"title="<?=_("Refreshthemapdisplay")?><
?=_("RedrawMap")?></a></td><
/tr></table></td></tr><tr><
td><selectname="ViewRegion"onChange="ProvinceSelected()"><
option><?=_("QuickView")?><
/option><option></option><
?php$strDescription="name";$query="selectextent(the_geom)
fromadministrativearea";$result=pg_query($query);$numrows=pg_numrows($result);for($i=0;$i<$numrows;$i++){$r=pg_fetch_row($result,$i);$box3d=$r[0];$box3d=str_replace("BOX(","",$box3d);$token=strtok($box3d,"");$minx=(int)$token;$token=strtok(",
");$miny=(int)$token;$token=strtok("");$maxx=(int)$token+1;$token=strtok(")");$maxy=(int)$token+1;?><optionvalue="<
?=$minx.",".$miny.",".$maxx.",
".$maxy?><?=_("FullView")?><
/option ><?php}$query="selectextent(the_geom),".pg_localize('name')."fromadministrativeareagroupby".pg_localize('name')."orderby".pg_localize('name');$result=pg_query($query);$numrows=pg_numrows($result);for($i=0;$i<$numrows;$i++){$r=pg_fetch_row($result, $i);$box3d=$r[0];$box3d=str_replace("BOX(","", $box3d);$token=strtok($box3d,"");$minx=(int)$token;$token=strtok(",
");$miny=(int)$token;$token=strtok("");$maxx=(int)$token+1;$token=strtok(")");$maxy=(int)$token+1;?>< optionvalue="<
?=$minx.",".$miny.",".$maxx.",
".$maxy?><?=$r[1]?></option><
?php}?></select><br/><SELECTname="MapSize"onChange="MapSizeSelected()"title="<?=_("Selectthemapsizefromthelist.")?><
OPTION ><?=_("MapSize")?><
/OPTION >< OPTION ></OPTION ><
OPTIONvalue="400,300"<?phpif(($gpoMap-> 
width
Area & nbsp
of & nbsp

Function Documentation

dcmPix2Geo nPixPos,
dfPixMax,
dfGeoMin,
dfGeoMax,
boolOrientation
 

Convert pixel position to geographic position

Parameters:
$nPixPos 
$dfPixMax 
$dfGeoMin 
$dfGeoMax 
$boolOrientation 
Returns:
the geographic position
Todo:
restructure (make class member), instead of $boolOrientation, use two functions (x and y)


Variable Documentation

$_SESSION["NewWorkorderID"] = $row[0]
 

$_SESSION["NewWorkorderID"] = $row[0]
 

$arrTransferredValues
 

Initial value:

 array("minx", "miny", "maxx", "maxy",
        "gravitymain", "pressurizedmain", "Maintenance")

$dcmPage = new DcmPage(basename(__FILE__))
 

$dfMapExtMaxX = $gpoMap->extent->maxx
 

$dfMapExtMaxY = $gpoMap->extent->maxy
 

$dfMapExtMinX = $gpoMap->extent->minx
 

$dfMapExtMinY = $gpoMap->extent->miny
 

$dfMaxExtMaxX = $gpoMap->extent->maxx + $dfTmpDeltaX
 

$dfMaxExtMaxY = $gpoMap->extent->maxy + $dfTmpDeltaY
 

$dfMaxExtMinX = $gpoMap->extent->minx - $dfTmpDeltaX
 

$dfMaxExtMinY = $gpoMap->extent->miny - $dfTmpDeltaY
 

$dfMaxX = NULL
 

$dfMaxY = NULL
 

$dfMinX = NULL
 

$dfMinY = NULL
 

$dfTmpDeltaX = 0
 

$dfTmpDeltaY = 0
 

$gpoMap
 

Initial value:

 ms_newMapObj(sprintf($_SESSION["strMapFile"], 
  substr($_SESSION['language'], 0, 2)))

$gszCommand = "LANDMARK"
 

$gszCommand = ""
 

$nClickGeoX = NULL
 

$nClickGeoY
 

Initial value:

 dcmPix2Geo($nClickPixY, doubleval($_REQUEST["imageheight"]),
    $dfMinY, $dfMaxY, FALSE)

$nClickGeoY = NULL
 

$nClickPixX = NULL
 

$nClickPixY = NULL
 

$numBoxMaxX
 

Initial value:

$numBoxMaxY
 

Initial value:

$numBoxMinX
 

Initial value:

$numBoxMinY
 

Initial value:

$numImageHeight = doubleval($_REQUEST["imageheight"])
 

$numImageWidth = doubleval($_REQUEST["imagewidth"])
 

Check if landmark exists at location, switch to ADD_LANDMARK or EDIT_LANDMARK

$numRows = pg_numrows($result)
 

$numRows = pg_numrows($objResult)
 

$objResult = pg_query($strUpdate)
 

$objResult = pg_query($strQuery)
 

$result = pg_exec($strInsert)
 

$result = pg_exec($strInsert)
 

Todo:
: Error checking.

$result = pg_query($strQuery)
 

$strInsert
 

Initial value:

 'insert into Maintenance (ID, Status, StartDate) values ('.
              $row[0].', 1, date_trunc(\'second\', now()))'

$strInsert
 

Initial value:

 'insert into Workorder(ID,ReceivedDate,DcmmsUser) '.
              "values ($row[0], date_trunc('second',now()), current_user)"

$strMessages = $strMessages._("Moved Landmark.")
 

$strMessages = ''
 

$strQuery
 

Initial value:

 "select gid from Landmark where the_geom && GeometryFromText('".
        $wktPolygon->toWkt()."', -1) limit 1"

$strScript
 

Initial value:

 <<<EOD
<script language="JavaScript" type="text/javascript">

function ProvinceSelected()
{
    if (document.forms["mapform"].ViewRegion.selectedIndex != 0 &&
        document.forms["mapform"].ViewRegion.selectedIndex !=1)
     document.forms["mapform"].submit();
}
function MapSizeSelected()
{
    if (document.forms["mapform"].MapSize.selectedIndex != 0 &&
        document.forms["mapform"].MapSize.selectedIndex !=1)
     document.forms["mapform"].submit();
}
</script>
EOD

$strUpdate
 

Initial value:

 "update landmark set administra = (select max(".
        "administrativearea.codedvalue) from administrativearea, landmark ".
        "where landmark.gid=$strLandmarkID and  ".
        "administrativearea.the_geom && 'BOX3D(".($_REQUEST["LandmarkX"]-1)." ".
        ($_REQUEST["LandmarkY"]-1).",".($_REQUEST["LandmarkX"]+1)." ".
        ($_REQUEST["LandmarkY"]+1).")'::box3d and ".
        "distance(administrativearea.the_geom, landmark.the_geom) = 0 ".
        "), village = (select max(".
        "village.codedvalue) from village,landmark where ".
        " landmark.gid=$strLandmarkID and ".
        "administrativearea.the_geom && 'BOX3D(".($_REQUEST["LandmarkX"]-1)." ".
        ($_REQUEST["LandmarkY"]-1).",".($_REQUEST["LandmarkX"]+1)." ".
        ($_REQUEST["LandmarkY"]+1).
        ")'::box3d and ".
        "distance(village.the_geom, landmark.the_geom) = 0 ".
        ") where ID=$strLandmarkID"

$strUpdate
 

Initial value:

 "update Landmark set the_geom=GeometryFromText('POINT(".
        $_REQUEST["LandmarkX"]." ".$_REQUEST["LandmarkY"].")', -1) where GID=".
        $strLandmarkID

$toolLandmark
 

Initial value:

$wktPolygon
 

Initial value:

case acceptedLandmarkMove
 

break
 

break
 

break
 

case LANDMARK
 

of& nbsp
 

Area& nbsp
 

</td><td> & nbsp
 

</td></tr><tr><td><inputtype="checkbox"name="pressurizedmain"value="Y"<?phpif(GMapGetStatus("pressurizedmain")==1){echo("checked=\"CHECKED\"");}?></td><td><imgsrc="images/water_network.png"width="20"height="15"></td><td><aname="#water_network"title="<?=_("DisplaytheWaternetwork")?><?=_("WaterNetwork")?></a></td></tr><?phpif((array_key_exists("boolHasSewer",$_SESSION))&&($_SESSION["boolHasSewer"]==true)){?><tr><td><inputtype="checkbox"name="gravitymain"value="Y"<?phpif(GMapGetStatus("gravitymain")==1){echo"checked=\"CHECKED\"";}?></td><tdalign="CENTER"><imgsrc="images/sewer_network.png"width="20"height="15"></td><td><aname="#sewer_network"title="<?=_("Displaythesewernetwork")?><?=_("SewerNetwork")?></a></td></tr><?php}?><tr><tdalign="CENTER"><inputtype="checkbox"name="Maintenance"value="Y"<?phpif(GMapGetStatus("Maintenance")==1){echo"checked=\"CHECKED\"";}?></td><tdalign="CENTER"><imgsrc="images/repair.gif"width="7"height="7"></td><td><ahref="workorderlist.php?action=list&status=1"title="<?=_("Displaytherepairslocations")?><?=_("Maintenance")?></a></td></tr><tr><tdalign="CENTER"><inputtype="checkbox"name="Landmark"value="Y"disabled="disabled"checked="checked"/></td><tdalign="CENTER"><imgsrc="images/landmark.png"width="7"height="7"></td><td><ahref="zoom.php"title="<?=_("Clickthislinktozoomtoalandmark.")?><?=_("Landmark")?></a></tr><tr><tdalign="CENTER"><inputtype="IMAGE"src="images/stock_refresh.png"width="24"height="24"name="redraw"border="0"/></td><tdcolspan="2"><aname="#"title="<?=_("Refreshthemapdisplay")?><?=_("RedrawMap")?></a></td></tr></table></td></tr><tr><td><selectname="ViewRegion"onChange="ProvinceSelected()"><option><?=_("QuickView")?></option><option></option><?php$strDescription="name";$query="selectextent(the_geom)fromadministrativearea";$result=pg_query($query);$numrows=pg_numrows($result);for($i=0;$i<$numrows;$i++){$r=pg_fetch_row($result,$i);$box3d=$r[0];$box3d=str_replace("BOX(","",$box3d);$token=strtok($box3d,"");$minx=(int)$token;$token=strtok(",");$miny=(int)$token;$token=strtok("");$maxx=(int)$token+1;$token=strtok(")");$maxy=(int)$token+1;?><optionvalue="<?=$minx.",".$miny.",".$maxx.",".$maxy?><?=_("FullView")?></option><?php}$query="selectextent(the_geom),".pg_localize('name')."fromadministrativeareagroupby".pg_localize('name')."orderby".pg_localize('name');$result=pg_query($query);$numrows=pg_numrows($result);for($i=0;$i<$numrows;$i++){$r=pg_fetch_row($result,$i);$box3d=$r[0];$box3d=str_replace("BOX(","",$box3d);$token=strtok($box3d,"");$minx=(int)$token;$token=strtok(",");$miny=(int)$token;$token=strtok("");$maxx=(int)$token+1;$token=strtok(")");$maxy=(int)$token+1;?><optionvalue="<?=$minx.",".$miny.",".$maxx.",".$maxy?><?=$r[1]?></option><?php}?></select><br/><SELECTname="MapSize"onChange="MapSizeSelected()"title="<?=_("Selectthemapsizefromthelist.")?><OPTION><?=_("MapSize")?></OPTION><OPTION></OPTION><OPTIONvalue="400,300"<?phpif(($gpoMap-> width
 

Initial value:

= 400) && ($gpoMap->height == 300))
                 echo "SELECTED"


Generated on Sat Jul 1 21:19:25 2006 for DCMMS by  doxygen 1.4.6-NO