Hi, <br> I have written a plugin which colors the polygon of my map.The following is the code wriiteen for c:\wamp\www\cartoweb3\plugins\ctr\server\ServerCtr.php.<br><br> Before this code there was no problem with the map the map is displaying after writing this I was getting the following exception.
<br><br> I have also made one more changes previously my project name is ctr and i used to execute it as <a href="http://ctr.php.As">ctr.php.As</a> my plugin name and my project names are same i changed it to chittoor.
<br><br> Now I want to know where the problem actually is.Is it in the code or in Renaming my file names.No doubt i have renamed everything required.<br><br> The Exception is<br><br><br>
<b>Fatal error</b>: Uncaught exception 'CartocommonException' with
message 'Error [2, Cannot modify header information - headers already
sent by (output started at
C:\wamp\www\cartoweb3\plugins\ctr\server\ServerCtr.php:123),
C:\wamp\www\cartoweb3\client\FormRenderer.php, 301]
Backtrace:
file: UNKNOWN - UNKNOWN
call: Common::cartowebErrorHandler(2, "Cannot modify header information
- headers already sent by (outp...",
"C:\wamp\www\cartoweb3\client\FormRenderer.php", 301, Array(1))
file: 301 - C:\wamp\www\cartoweb3\client\FormRenderer.php
call: header("HTTP/1.1 500 Internal Server Error")
file: 1032 - C:\wamp\www\cartoweb3\client\Cartoclient.php
call: FormRenderer->showFailure(Object(SoapFaultWrapper))
file: 38 - C:\wamp\www\cartoweb3\htdocs\client.php
call: Cartoclient->main()
file: 3 - C:\wamp\www\cartoweb3\htdocs\chittoor.php
call: require_once("C:\wamp\www\cartoweb3\htdocs\client.php")
' in C:\wamp\www\cartoweb3\common\Common.php:275
Stack trace:
#0 [internal function]: Common::cartowebErrorHandler(2, 'Cannot modify
h... in <b>C:\wamp\www\cartoweb3\common\Common.php</b> on line <b>275</b><br>
<br><br> Here is my code<br><br>ServerCtr.php<br>------------------<br><?php <br> <br>require_once(CARTOWEB_HOME . 'common/BasicTypes.php');<br>require_once('DB.php');<br><br>class ServerCtr extends ClientResponderAdapter
<br> implements InitProvider<br>{<br><br> <br> private $log;<br> <br> public function __construct()<br> {<br> parent::__construct();<br> $this->log =& LoggerManager::getLogger(__CLASS__);
<br> }<br><br> <br> public function getInit()<br> {<br> // Things to learn from the LayerInit<br> }<br> <br> public function getValues($id)<br> {<br> $values = array();<br> for($k=0;$k=1105;$k++)
<br> {<br> $values[k] = rand(0,100);<br> }<br> return $values;<br> } <br> <br> public function initializeRequest($requ)<br> { <br> $msMapObj = $this->serverContext->getMapObj();
<br> <br> $resultArray = $this->getValues($requ->dataElement_id);<br> $msLayer = $msMapObj->getLayerByName('chittoot');<br> $no_intervals = 5;<br> $color = "Reds"; //dont't think this is necessary
<br> $this->colorMapFromData($resultArray, $msLayer, $no_intervals, $color); <br> }<br> <br> public function buildClassExpressions($numberOfIntervals,$resultArray)<br> {<br> $max_val = max($resultArray);
<br> $min_val = min($resultArray);<br> $intervalLength = ceil(($max_val - $min_val)/$numberOfIntervals);<br> $idsPerClass = array();<br> foreach($resultArray as $id => $value)<br> {<br>
$classNo = floor($value/$intervalLength);<br> $idsPerClass[$classNo] .= $id. ",";<br> <br> }<br> <br> $classes = array();<br> for($i=0;$i < $numberOfIntervals+1;$i++)
<br> {<br> if ($classNo[$i])<br> $classIds = substr($classNo[$i],o,-1);<br> else<br> $classIds = "";<br> <br> $classes[$i] = "([".$idcol. "] IN '" . $classIds . "')";
<br> }<br> <br> return $classes; <br> }<br> <br> public function colorMapFromData($resultArray, $msLayer, $numberOfIntervals, $colorScheme)<br> {<br> $expressions = $this->buildClassExpressions($numberOfIntervals,$resultArray);
<br> $r = 10;<br> $g = 10;<br> $b = 10;<br> <br> for($i=0;$i<numberOfIntervals;$i++)<br> {<br> $msClass = ms_newClassObj($msLayer);<br> $msClass->setexpression($expressions[$i]);
<br> $msStyle = ms_newStyleObj($msClass);<br> $msStyle->color->setRGB($r,$g,$b);<br> $r = $r + 10;<br> $g = $g + 10;<br> $b = $b + 10;<br> }<br> }<br>
}<br>?><br><br><br> ctr.ini consists of <br>id_col="ID"<br><br> Please give me the solution how to solve this problem.<br> Thanks in Advance,
<br><br>Regards,<br>Venu.<br><br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>
<br> <br> <br> <br> <br> <br> <br><br>