Hi, list. I try development the sample by <br>
<h1 style="font-weight: normal;"><font><font size="2"><a title="Click to do a full-text search for this title" href="http://www.cartoweb.org/cwiki/HowToDisplayOnTheMapAPointFromADatabaseQuery?action=fullsearch&value=linkto%3A%22HowToDisplayOnTheMapAPointFromADatabaseQuery%22&context=180" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
</a>HowToDisplayOnTheMapAPointFromADatabaseQuery on <a href="http://www.cartoweb.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">www.cartoweb.org</a>, but my page gives the next error:<br>
</font></font></h1>
<span style="font-weight: bold;">Fatal error: Class 'ShapeStyle' not
found in
/var/geo/www/cartoweb3/plugins/YourPluingName/client/ClientYourPluingName.php
on line 75</span><br>
<br>
I put my archives in<br>
<br>
/cartoweb3/plugins/YourPluingNa
<div>me/client/ClientYourPluingName.php<br>
/cartoweb3/plugins/YourPluingName/common/YourPluingName.php<br>
/cartoweb3/plugins/YourPluingName/common/YourPluingName.wsdl.inc<br>
/cartoweb3/plugins/YourPluingName/server/ServerYourPluingName.php<br>
<br>
**************************************************************************************<br>
<br>
My ClientYourPluingName.php is<br>
<br>
<br>
<?php<br>
class ClientYourPluingName extends ClientPlugin<br>
implements
ServerCaller // 20060609 tirei e funcionou Pascoal pus de nova
pra fazer a query<br>
{<br>
<br>
private $vehiculeCoords;<br>
<br>
public function initialize()<br>
{<br>
$this->vehiculeCoords = array();<br>
// get coord from db<br>
$db = $this->getDb();<br>
<br>
$sql = "SELECT x, y FROM
s_ocr_geo_rel WHERE gid = 5062"; //ocorrrencia no bairro guaira rua
alagoas - Pascoal<br>
// $sql = 'SELECT * FROM
"your_table_with_values" WHERE any_condition_you_want'; //linha original<br>
<br>
$result = $db->query($sql);<br>
if (DB::isError($result))<br>
{<br>
throw new CartoclientException($result->getMessage());<br>
}<br>
$row = NULL;<br>
while ($result->fetchInto($row, DB_FETCHMODE_ASSOC))<br>
{<br>
$this->vehiculeCoords['x'] = $row['x'];<br>
$this->vehiculeCoords['y'] = $row['y'];<br>
// print $this->vehiculeCoords['x']."<br>";<br>
// print $this->vehiculeCoords['y'];<br>
<br>
//
$this->vehiculeCoordsY['y'] =
$row['name_of_the_y_coord_column'];
// linha original<br>
}<br>
}<br>
<br>
private function getDb()<br>
{<br>
<br>
if (is_null($this->db))<br>
{<br>
<br>
<br>
$dsn = "pgsql://demo:demo@localhost/demo_plugins";<br>
// $dsn = $this->getConfig()->databaseDsn;<br>
// print "dsn= ".$dsn."<br>";<br>
<br>
if (!$dsn)<br>
{<br>
throw new CartoclientException('Search database DSN not found');<br>
}<br>
<br>
$this->db = DB::connect($dsn);<br>
<br>
//check for db connection error, throw exception if needed<br>
Utils::checkDbError($dsn," "); // erro aqui -
faltavam parametros do checkdberror ($db e $msg) - pascoal<br>
<br>
}<br>
return $this->db;<br>
}<br>
<br>
/**<br>
* @see ServerCaller::buildRequest()<br>
*/<br>
public function buildRequest()<br>
{<br>
<br>
// we call for a new shape only if we have a x and y<br>
if ($this->vehiculeCoords['x'] != '' and $this->vehiculeCoords['y'] != '')<br>
{<br>
<br>
$newElement = new
Point($this->vehiculeCoords['x'],$this->vehiculeCoords['y']);<br>
//tinha um erro aqui - pascoal - original - $newElement =
new Point($this->vehiculeCoords['x'],
$this->$this->vehiculeCoords['y']);<br>
<br>
$styledShape = new StyledShape();<br>
$styledShape->shape = $newElement;<br>
<br>
$shapeStyle = new ShapeStyle();<br>
<br>
$shapeStyle->symbol = 2;<br>
//
$shapeStyle->symbol =
$this->type;
<br>
<br>
$shapeStyle->size = 20;<br>
$shapeStyle->color->setFromRGB(51, 0, 204);<br>
$shapeStyle->outlineColor->setFromRGB(0, 0, 0);<br>
<br>
$styledShape->shapeStyle = $shapeStyle;<br>
<br>
$YourPluingNameRequest = new YourPluingNameRequest();<br>
$YourPluingNameRequest->shapes = array($styledShape);<br>
<br>
return $YourPluingNameRequest;<br>
}<br>
}<br>
<br>
<br>
/**<br>
* @see ServerCaller::initializeResult()<br>
*/<br>
public function initializeResult($YourPluingNameResult)<br>
{<br>
}<br>
<br>
<br>
/**<br>
* @see ServerCaller::handleResult()<br>
*/<br>
public function handleResult($YourPluingNameResult)<br>
{<br>
}<br>
}?><br>
<b><br>
</b><br>
**************************************************************************************<br>
<br>
My YourPluingName.php is<br>
<br>
<?php<br>
<br>
class YourPluingNameRequest extends CwSerializable<br>
{<br>
<br>
/**<br>
* Styled shapes to be drawn<br>
* @var array<br>
*/<br>
public $shapes;<br>
<br>
/**<br>
* @see CwSerializable::unserialize()<br>
*/<br>
public function unserialize($struct)<br>
{<br>
$this->shapes = self::unserializeObjectMap($struct, 'shapes','StyledShape');<br>
}<br>
}<br>
/**<br>
* Result<br>
* @package Plugins<br>
*/<br>
class YourPluingNameResult<br>
{<br>
}<br>
?><br>
<br>
**************************************************************************************<br>
<br>
My YourPluingName.wsdl.inc is<br>
<br>
<!-- outline --><br>
<br>
<complexType name="Color"><br>
<all><br>
<element name="r" type="xsd:int"/><br>
<element name="g" type="xsd:int"/><br>
<element name="b" type="xsd:int"/><br>
</all><br>
</complexType><br>
<br>
<complexType name="ShapeStyle"><br>
<all><br>
<element name="symbol" type="xsd:int"/><br>
<element name="size" type="xsd:int"/><br>
<element name="color" type="types:Color"/><br>
<element name="outlineColor" type="types:Color"/><br>
<element name="backgroundColor" type="types:Color"/><br>
<element name="transparency" type="xsd:int"/><br>
</all><br>
</complexType><br>
<br>
<complexType name="LabelStyle"><br>
<all><br>
<element name="font" type="xsd:int"/><br>
<element name="size" type="xsd:int"/><br>
<element name="color" type="types:Color"/><br>
<element name="outlineColor" type="types:Color"/><br>
<element name="backgroundColor" type="types:Color"/><br>
</all><br>
</complexType><br>
<br>
<complexType name="StyledShape"><br>
<all><br>
<element name="shapeStyle" type="types:ShapeStyle"/><br>
<element name="labelStyle" type="types:LabelStyle"/><br>
<element name="shape" type="types:Shape"/><br>
<element name="label" type="xsd:string"/><br>
</all><br>
</complexType><br>
<br>
<complexType name="ArrayOfStyledShape"><br>
<complexContent><br>
<restriction base="enc11:Array"><br>
<attribute ref="enc11:arrayType"
wsdl:arrayType="types:StyledShape[]"/><br>
</restriction><br>
</complexContent><br>
</complexType><br>
<br>
<complexType name="OutlineRequest"><br>
<all><br>
<element name="className" type="xsd:string"/><br>
<element name="shapes" type="types:ArrayOfStyledShape"/><br>
<element name="maskMode" type="xsd:boolean"/><br>
</all><br>
</complexType><br>
<br>
<complexType name="OutlineResult"><br>
<all><br>
<element name="className" type="xsd:string"/><br>
<element name="area" type="xsd:double"/><br>
</all><br>
</complexType><br>
<br>
<br>
**************************************************************************************<br>
<br>
My ServerYourPluingName.php is<br>
<br>
<?php<br>
class ServerYourPluingName extends ClientResponderAdapter<br>
{<br>
<br>
/**<br>
* @var Logger<br>
*/<br>
private $log;<br>
<br>
/**<br>
* @var objet<br>
*/<br>
private $shapes;<br>
<br>
<br>
/**<br>
* Constructor<br>
*/<br>
function __construct()<br>
{<br>
parent::__construct();<br>
$this->log =& LoggerManager::getLogger(__CLASS__);<br>
}<br>
<br>
<br>
/**<br>
* @see ClientResponder::initializeRequest()<br>
*/<br>
function initializeRequest($requ)<br>
{<br>
if ($requ) $this->shapes = $requ->shapes;<br>
}<br>
<br>
<br>
/**<br>
* Result is set in initializeRequest but Outline must be called<br>
* in handlePreDrawing<br>
* @see ClientResponder::handlePreDrawing()<br>
*/<br>
function handlePreDrawing($requ)<br>
{<br>
if ($requ)<br>
{<br>
$pluginManager = $this->serverContext->getPluginManager();<br>
if (empty($pluginManager->outline))<br>
throw new CartoserverException("outline plugin not loaded, "."and
needed to draw the new element");<br>
$pluginManager->outline->draw($this->shapes);<br>
}<br>
}<br>
}?><br>
<br>
***************************************************************************************<br>
<br>
What's wrong?<br>
<br>
Thank you<br>
<br>
Alessandro Simplício - Brazil</div>