> <?
> $size_x=1000;
> $size_y=1000;
> $ECODE=12;
>
> file://$filename='list.txt';
> echo "<p style=\"font-family : 'Courier New';font-size : 'x-small'\">";
> $id=1;
> $i=1;
> echo "<h1>?? ?????? $filename ?? ????? ETNA</h1>";
> if ($fp=fopen($filename, "r"))
> {
>   while (!feof($fp))
>   {
>     $trimmed_line=trim($line=fgets($fp, 80));
>     if (strstr($trimmed_line, "Handle"))
>     {
>       $handle=substr($trimmed_line, 9, 4);
>       $trimmed_line=trim($line=fgets($fp, 80));
>       if (!strstr($trimmed_line, "from point"))
>         $trimmed_line=trim($line=fgets($fp, 80));
>       $from_x=trim(substr($trimmed_line, 14, 9));
>       $from_y=trim(substr($trimmed_line, 27, 9));
>       $trimmed_line=trim($line=fgets($fp, 80));
>       if (!strstr($trimmed_line, "to point"))
>         $trimmed_line=trim($line=fgets($fp, 80));
>       $to_x=trim(substr($trimmed_line, 12, 9));
>       $to_y=trim(substr($trimmed_line, 25, 9));
>       $pipes[$i][0]=($from_x);
>       $pipes[$i++][1]=($from_y);
>       $pipes[$i][0]=($to_x);
>       $pipes[$i++][1]=($to_y);

So, like, are you sure that ++ really happens after the array assignment is
done?...
I'm probably just a Luddite, but I don't trust ++ and assignment operations
*that* far.

>       $id++;
>     }
>   }
> }
>
> $nodes=array_values(array_unique($pipes));
> for ($i=0;$i<sizeof($nodes);$i++)
> {
>   $k=$i+1;
>   echo "$k,";
>   echo $nodes[$i][0];
>   echo ",";
>   echo $nodes[$i][1];
>   echo "/<br>";
> }
> echo "-1//<br>";
> $temp_pipes=$pipes;
>
> $i=sizeof($temp_pipes);
> $size=$i;
> $pipe_id=1;
> while(!empty($temp_pipes))
> {
>   $current_node=array_shift($temp_pipes);
>   reset($nodes);
>   while((current($nodes))!=$current_node)
>   {next($nodes);}

This looks suspicous...  I'm not quite sure what's going on here, but I'm
expecting you'd want to walk from node to node, or maybe skip any
duplicates, but why are you zipping through the entire array looking for the
node that you are on?...
There's got to be a better way to track this -- maybe just using an indexed
array for your nodes, and knowing that you are currently on $node_index or
something...
Is a "node" an array?  I wouldn't be using == on two arrays...  Maybe it's
fine, but again that Luddite factor works in, and I'd be testing the
elements individually...

>   $pipes_nodes[$size-$i+1][0]=key($nodes)+1;
>   echo ($pipe_id++).",$ECODE,".$pipes_nodes[$size-$i+1][0];
>
>   $current_node=array_shift($temp_pipes);
>   reset($nodes);
>   while((current($nodes))!=$current_node)
>   {next($nodes);}

Same here...

>   $pipes_nodes[$size-$i+1][1]=key($nodes)+1;
>
>   echo ",".$pipes_nodes[$size-$i+1][1]."/<br>";
> }
> echo "-1//<br>";
> if (!isset($pressure_drop_nodes))
>

>     echo "<form action='convert.php' method='post' name='form_convert'
id='1'>";
>     echo "<TABLE border=0 width='80%'>";
>     echo
> "
>   <TR>";
>     echo "      <TD width='30%'>?????? ????? ??????? ??????? ?????
> ??????:</TD>";
>     echo "      <TD width='50%'><INPUT size=50 value=''
> name=pressure_drop_nodes></TD>";
>     echo "  </TR>";
>     echo "  <TR>";
>     echo "      <TD width='30%'>&nbsp;</TD>";
>     echo "      <TD width='50%'>(?? ?????? ?? ?????????? ?? ?????, ?.?.
> '1,2,12,5')</TD>";
>     echo "  </TR>";
>     echo "  <TR>";
>     echo "      <TD width='30%'>?????????????? ??? ??????:</TD>";
>     echo "      <TD width='50%'>1,".sizeof($nodes).",1,'ELD','DI',<INPUT
> size=4 value='' name=diameter>,'RK',<INPUT size=6 value=''
> name=traxitita></TD>";
>     echo "  </TR>";
>     echo "  <TR>";
>     echo "      <TD width='30%'>&nbsp;</TD>";
>     echo "      <TD width='50%'>&nbsp;</TD>";
>     echo "  </TR>";
>     echo "  <TR>";
>     echo "      <TD width='30%'></TD>";
>     echo "      <TD width='50%'></TD>";
>     echo "  </TR>";
>     echo "</table>";
>     echo "  <INPUT type='Hidden' value='$filename' name='filename'>";
> }
>
// -------------------------------------------------------------------------
> ----
> file://phpinfo();
> if (isset($pressure_drop_nodes))
> {
>     echo "1/<br>";
>     $individual_nodes=explode(",", $pressure_drop_nodes);
>     for($i=0;$i<sizeof($individual_nodes);$i++)
>     {
>         echo "$individual_nodes[$i]/<br>";
>     }
>     echo "-1//<br>";
>     echo
>
"1,".sizeof($nodes).",1,'ELD','DI',".$diameter.",'RK',".$traxitita."/<br>";
> }
> echo "-1//<br>";
> echo "-1/<br>";
> echo "-1/<br>";
> echo "-1/<br>";
> echo "-1/<br>";
> echo "1,0/<br>";
>
> if (!isset($pressure_drop_nodes))
>

>     echo "<TABLE border=0 width='80%'>";
>     echo "  <TR>";
>     echo "      <TD width='30%'>?????? ??????:</TD>";
>     echo "      <TD align=right width='50%'></TD>";
>     echo "  </TR>";
>     $y=0;
>     for($i=0;$i<sizeof($nodes);$i++)
>     {
>         $y=$i+1;
>         echo "  <TR>\n";
>         echo "      <TD width='30%'>$y</TD>\n";
>         echo "      <TD width='50%' align=right >\n";
>         echo "          $y,<INPUT siz
> e=4 value='' nam
> e=to_node".$y.">,1,'\n";
>         echo "          <select name=type".$y.">\n";
>         echo "              <option value='PRE' selected>PRE</option>\n";
>         echo "              <option value='DIS'>DIS</option>\n";
>         echo "          </select>',\n";
>         echo "          '<select name=units".$y.">\n";
>         echo "              <option value='BAR' selected>BAR</option>\n";
>         echo "              <option value='M3H'>M3/H</option>\n";
>         echo "          </select>',\n";
>         echo "          <INPUT size=4 value='' name=pre_dis".$y.">\n";
>         echo "      </TD>\n";
>         echo "  </TR>\n";
>     }
>     echo "  <TR>";
>     echo "      <TD width='30%'></TD>";
>     echo "      <TD width='50%'><input type='submit' value='Continue'
> name='submit'>&nbsp;<input type='Reset'></TD>";
>     echo "  </TR>";
>     echo "  <INPUT type='Hidden' value='$y' name='no_of_loads'>";
>     echo "</table>";
>     echo "</form>";
> }
> else if (isset($pressure_drop_nodes))
> {
>
>   for ($i=1;$i<=$no_of_loads;$i++)
>   {
>     $to_node='to_node'.$i;
>     $type='type'.$i;
>     $units='units'.$i;
>     $value='pre_dis'.$i;
>     $to_node =$HTTP_POST_VARS[$to_node];
>     $type    =$HTTP_POST_VARS[$type];
>     $units   =$HTTP_POST_VARS[$units];
>     $value   =$HTTP_POST_VARS[$value];
>
>     if ($type=='PRE')
>     {
>         if($to_node!='')
>         {
>             echo "$i, $to_node, $type, $units, $value<br>\n";
>             $temp=$to_node;
>         }
>         else if ($to_node!=='')
>         {
>             if ($i<=$temp)
>             {
>               echo "$i, $i, $type, $units, $value<br>\n";
>             }
>         }
>     }
>   }
>
>   for ($i=1;$i<=$no_of_loads;$i++)
>   {
>     $to_node='to_node'.$i;
>     $type='type'.$i;
>     $units='units'.$i;
>     $value='pre_dis'.$i;
>     $to_node =$HTTP_POST_VARS[$to_node];
>     $type    =$HTTP_POST_VARS[$type];
>     $units   =$HTTP_POST_VARS[$units];
>     $value   =$HTTP_POST_VARS[$value];
>
>     if ($type=='DIS')
>     {
>         if($to_node!='')
>         {
>             echo "$i, $to_node, $type, $units, $value<br>\n";
>             $temp=$to_node;
>         }
>         else if ($to_node!=='')
>         {
>             if ($i<=$temp)
>             {
>               echo "$i, $i, $type, $units, $value<br>\n";
>             }
>         }
>      }
>   }
>
> }
>
>
> echo "-1/<br>";
> echo "-1/<br>";
> echo "-1/<br>";
>
> for ($i=1;$i<=sizeof($nodes);$i++)
> {
>   $temp1[2*($i-1)]=$nodes[$i][0];
>   $temp2[2*($i-1)]=$nodes[$i][1];
> }
> $merged=array_merge($temp1, $temp2);
> $max=max($merged);
> $min=min($merged);
> $points=$pipes;
> for ($i=1;$i<=sizeof($points);$i++)
> {
>   $points[$i][0]=floor( ($points[$i][0]*($size_x-10)/$max) );
>   $points[$i][1]=floor( ($points[$i][1]*($size_y-10)/$max) );
> }
>
> $point_ids=$nodes;
> for ($i=0;$i<sizeof($point_ids);$i++)
> {
>   $point_ids[$i][0]=floor( ($point_ids[$i][0]*($size_x-10)/$max) );
>   $point_ids[$i][1]=floor( ($point_ids[$i][1]*($size_y-10)/$max) );
> }
>
>
> @fclose($fp);
>
> for ($i=1;$i<=sizeof($points);$i++)
> {
>   $string=$string."&x".$i."=".$points[$i][0]."&y".$i."=".$points[$i][1];
> }
> for ($i=0;$i<sizeof($point_ids);$i++)
> {
>
>
$string=$string."&id_x".$i."=".$point_ids[$i][0]."&id_y".$i."=".$point_ids[$
> i][1];
> }
> $string=substr($string,
> 1)."&size=".sizeof($points)."&size_ids=".sizeof($point_ids);
> $string="display.php?".$string."&size_x=".$size_x."&size_y=".$size_y;
>
> echo "<MAP name=\"map\">";
> for ($i=0;$i<sizeof($point_ids);$i++)
> {
>   echo "<AREA coords='".($point_ids[$i][0]+2).",";
>   echo ($point_ids[$i][1]+2).",".
> ($point_ids[$i][0]-2).",".($point_ids[$i][1]-2);
> //  echo "' alt=\"".($i+1)."\" href=\"".$i."\">";
> echo "' alt=\"".($i+1)."\"
>
href=\"".$string."&zoom_x=".($point_ids[$i][0])."&zoom_y=".($point_ids[$i][1
> ])."\">";
>
> }
> echo "</MAP>";
>
> echo "<img src='$string' usemap='#map' style='border-color:black'>";
> file://echo "<a href='$string' usemap='#map'>link</a>";
>
> display.php
> <?
> $factor=3.5;
>
> for ($i=1;$i<=$size;$i++)
> {
>   $x='x'.$i;
>   $y='y'.$i;
>   $points[$i][0]=$HTTP_GET_VARS[$x];
>   $points[$i][1]=$HTTP_GET_VARS[$y];
> }
>
> for ($i=0;$i<$size_ids;$i++)
> {
>   $x='id_x'.$i;
>   $y='id_y'.$i;
>   $point_ids[$i][0]=$HTTP_GET_VARS[$x];
>   $point_ids[$i][1]=$HTTP_GET_VARS[$y];
> }
>
> if (isset($zoom_x) && isset($zoom_y))
> {
>   for($i=0;$i<sizeof($point_ids);$i++)
>   {
>  $x=($point_ids[$i][0]-($zoom_x-$size_x/2))*$factor-(($size_x/4)*$factor);
>  $y=($point_ids[$i][1]-($zoom_y-$size_y/2))*$factor-(($size_y/4)*$factor);
>     if ((($x>0)&&($x<$size_x))&&(($y>0)&&($y<$size_y)))
>  {
>    $n_point_ids[$i][0]=$x;
>    $n_point_ids[$i][1]=$y;
>  }
>  else
>  {
>    $n_point_ids[$i][0]=-1;
>    $n_point_ids[$i][1]=-1;
>  }
>   }
>   for($i=1;$i<=sizeof($points);$i++)
>   {
>  $x=($points[$i][0]-($zoom_x-$size_x/2))*$factor-(($size_x/4)*$factor);
>  $y=($points[$i][1]-($zoom_y-$size_y/2))*$factor-(($size_y/4)*$factor);
>     if ((($x>0)&&($x<$size_x))&&(($y>0)&&($y<$size_y)))
>  {
>    $points[$i][0]=$x;
>    $points[$i][1]=$y;
>  }
>  else
>  {
>    $points[$i][0]=-1;
>    $points[$i][1]=-1;
>  }
>   }
> }
>
> file://Header("Content-type: image/gif");
>
> $im=@imagecreate($size_x, $size_y);
> $background_color = ImageColorAllocate ($im, 255, 255, 255);
> $orange = ImageColorAllocate($im, 220, 210, 60);
> $black  = ImageColorAllocate($im, 0, 0, 0);
> $red    = ImageColorAllocate($im, 255, 0, 0);
> $green  = ImageColorAllocate($im, 0, 255, 0);
>
> if (!isset($zoom_x))
> {
>   for ($i=1;$i<=sizeof($points);$i=$i+2)
>   {
>    imageline($im, $points[$i][0], $points[$i][1], $points[$i+1][0],
> $points[$i+1][1], $orange);
>     ImageString($im, 7, ($points[$i][0]+$points[$i+1][0])/2-5,
> ($points[$i][1]+$points[$i+1][1])/2, ($i+1)/2,   $red);
>   }
>   for ($i=0;$i<sizeof($point_ids);$i++)
>
>
>     $str=strval($i+1);
>     ImageString($im, 7, $point_ids[$i][0]+1,   $point_ids[$i][1]+1,
$str,
> $black);
>     ImageRectangle($im,$point_ids[$i][0]+2,  $point_ids[$i][1]+2,
> $point_ids[$i][0]-2,  $point_ids[$i][1]-2,  $black);
>     imagefilltoborder ($im,$point_ids[$i][0],$point_ids[$i][1], $black,
> $black);
>   }
> }
> if (isset($zoom_x))
> {
>   for ($i=1;$i<=sizeof($points);$i=$i+2)
>   {
>     if(($points[$i][0]>0)&&($points[$i+1][0]>0))
>  {
>       imageline($im, $points[$i][0], $points[$i][1], $points[$i+1][0],
> $points[$i+1][1], $orange);
>       ImageString($im, 7, ($points[$i][0]+$points[$i+1][0])/2-5,
> ($points[$i][1]+$points[$i+1][1])/2, ($i+1)/2,   $red);
>     }
>   }
>   for ($i=0;$i<sizeof($n_point_ids);$i++)
>
>
>     if($n_point_ids[$i][0]>0)
>  {
>       $str=strval($i+1);
>       ImageString($im, 7, $n_point_ids[$i][0]+1,   $n_point_ids[$i][1]+1,
> $str,   $black);
>       ImageRectangle($im,$n_point_ids[$i][0]+5,  $n_point_ids[$i][1]+5,
> $n_point_ids[$i][0]-5,  $n_point_ids[$i][1]-5,  $black);
>       file://imagefilltoborder
($im,$n_point_ids[$i][0],$n_point_ids[$i][1],
> $black, $black);
>  }
>   }
> }
> Imagepng($im);
> Imagepng($im, "map.png");
> ?>
> ?>
> > > I create from the array the image from the network.When the txt file
is
> > > >21Kb there is no image, else all works perfect{with a smaller txt
> file).I
> > > am using php4,apache(sometimes my system hangs with this server) or
OMNI
> > > httpd(works fine).
> > > If anybody know sth PLEASE HELP ME
> > > I am newbie in php programming
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to