MapTools.org

[maplab-users] Creating new graphic adding my own php script

Hisaji Ono hi-ono@mn.xdsl.ne.jp
Wed, 12 Mar 2003 05:40:50 +0900
Hello.

 I've tried to display geometries by MapLab generated scripts adding my own
scripts.

 In following way, I've added my scripts in test(Map Name).php.


function drawMainMap( $urlMainMap, $nRosa, $szCommand, $oSession,
                      $PrevStateKey, $aszRosaTools )
{
    // get the current map object
    $oMap = $oSession->getMapObj();

    // get the selected toolbar button
    $szButton = checkSelected($szCommand);

   //******************************
    include_once( "./drawline.php" ); <--- added for including my own script
  //********************************

    // draw the the map as an applet of ROSA is on
    if ( $nRosa == 1 || !isset( $nRosa ) )


 And my script is as follows.

<?php
  $layer = ms_newLayerObj($oMapSession->oMap);
  $layer->name = "linexxx";
  $shp = ms_newShapeObj(MS_SHAPE_LINE);

  $extent = $oMapSession->oMap->extent;

  $line = ms_newLineObj();

  $p = ms_newPointObj();

  $p->setXY($extent->minx,$extent->maxy);
  $line->add($p);
  $p->setXY($extent->maxx,$extent->miny);
  $line->add($p);
  $shp->add($line);

  $p->setXY($extent->minx,$extent->miny);
  $line->add($p);
  $p->setXY($extent->maxx,$extent->maxy);
  $line->add($p);
  $shp->add($line);

  $layer->set("type",MS_LAYER_LINE);
  $layer->set("status",MS_ON);
  $poClass = ms_newClassObj($oMapSession->oMap->getLayer(4));
  $poClass->set("color",$oMapSession->oMap->addColor(255,0,0));
  $poClass->set("outlinecolor",$oMapSession->oMap->addColor(255,0,0));
?>

 After issued this script, But I've got no geometries.

 Could you tell me why graphics not display?

 Best Regards.






This archive was generated by Pipermail.