Hello,
you may check in your mapfile that you have a layer for outlining points.
If you have
pointLayer = cartoweb_point_outline
in your project server-side outline.ini, you should have something like
LAYER
NAME "cartoweb_point_outline"
TYPE POINT
CLASS
STYLE
COLOR 0 255 0
SYMBOL "circle"
SIZE 10
END
END
END
in your mapfile.
A tutorial on how to write plugins is available in the doc:
http://cartoweb.org/doc/cw3.2/xhtml/dev.newplugin.html
AS
Alessandro Simplicio wrote:
Alex
I tried to use your code, only using client in folder vehiclePosition
(new plugin). The program function, but it's don't show the point. Why?
<?php
// plugin is named, say, "vehiclePosition"
class ClientVehiclePosition extends ClientOutline {
/**
* @see PluginManager::replacePlugin()
*/
public function replacePlugin() {
return 'outline';
}
/**
* @see ClientOutline::buildRequest()
*/
public function buildRequest() {
$vehiclePositions = $this->getVehiclePositions();
$shapes = array();
if ($vehiclePositions) {
foreach ($vehiclePositions as $pos) {
$shape = new StyledShape;
$shape->shape = new Point($pos->x, $pos->y);
$shapes[] = $shape;
}
}
$this->outlineState->shapes = $shapes;
return parent::buildRequest();
}
function getDb() {
$dsn = "pgsql://demo:[EMAIL PROTECTED]/demo_plugins";
if (!$dsn)
{
throw new CartoclientException('Search database DSN not
found');
}
$this->db = DB::connect($dsn);
//check for db connection error, throw exception if needed
Utils::checkDbError($dsn," "); // erro aqui - faltavam
parametros do checkdberror ($db e $msg) - pascoal
return $this->db;
}
protected function getVehiclePositions() {
$this->vehiclePositions = array();
// get coord from db
$db = $this->getDb();
$sql = "SELECT x, y FROM s_ocr_geo_rel WHERE gid = 5062";
//ocorrrencia no bairro guaira rua alagoas - Pascoal
$result = $db->query($sql);
if (DB::isError($result))
{
throw new CartoclientException($result->getMessage());
}
$row = NULL;
while ($result->fetchInto($row, DB_FETCHMODE_ASSOC))
{
$this->vehiclePositions['x'] = $row['x'];
$this->vehiclePositions['y'] = $row['y'];
print $this->vehiclePositions['x']."<br>";
print $this->vehiclePositions['y'];
}
}
}
?>
Thank you
Alessandro
_______________________________________________
Cartoweb-users mailing list
[email protected]
http://lists.maptools.org/mailman/listinfo/cartoweb-users