function draw_line($line, &$params) { $ret = ""; $a = explode("(", $line, 2); while (count($a) < 2) { $a[] = ""; } $command = trim(strtolower(array_shift($a))); $values = trim(str_replace(")", "", array_shift($a))); if ($command == "addregs" || $command == "include") { $values = explode(",", $values); $params->expand_ids($values, $this->id); foreach ($values as $v) { $v = $this->fullid($v); $ng = new geo(); $ng->set_from_id($v, $params); $ret .= $ng->draw($params); } } elseif ($command == "polygon" || $command == "polyline") { if (!$this->draw_this($params)) { return $ret; } $data = array(); $values = explode(",", $values); $params->expand_ids($values, $this->id); foreach ($values as $v) { $v = $this->fullid($v); $ng = new geo(); $ng->set_from_id($v, $params); $b = $ng->get_data($params); $this->add_reordered_data($data, $b); } $style = $this->get_current_style($params); if ($command == "polygon") { $ret .= "<polygon {$style} points=\""; } if ($command == "polyline") { $ret .= "<polyline {$style} points=\""; } foreach ($data as $a) { $x = $a[0]; $y = $a[1]; $this->xsum += $x; $this->ysum += $y; $this->count++; $ret .= "{$x},{$y} "; } $ret = trim($ret) . "\"/>\n"; } return $ret; }