/** * Returns the KML for the query result. * * @since 0.7.3 * * @param SMWQueryResult $res * @param integer $outputmode * * @return string */ protected function getKML(SMWQueryResult $res, $outputmode) { $queryHandler = new SMQueryHandler($res, $outputmode, $this->params['linkabsolute'], $this->params['pagelinktext'], false); $queryHandler->setText($this->params['text']); $queryHandler->setTitle($this->params['title']); $queryHandler->setSubjectSeparator(''); $formatter = new MapsKMLFormatter($this->params); $shapes = $queryHandler->getShapes(); $formatter->addPlacemarks($shapes['locations']); return $formatter->getKML(); }
/** * Converts the data in the coordinates parameter to JSON-ready objects. * These get stored in the locations parameter, and the coordinates on gets deleted. * * @since 1.0 * * @param array &$params * @param SMQueryHandler $queryHandler */ protected function handleMarkerData(array &$params, SMQueryHandler $queryHandler) { if (is_object($params['centre'])) { $params['centre'] = $params['centre']->getJSONObject(); } $iconUrl = MapsMapper::getFileUrl($params['icon']); $visitedIconUrl = MapsMapper::getFileUrl($params['visitedicon']); $params['locations'] = $this->getJsonForStaticLocations($params['staticlocations'], $params, $iconUrl, $visitedIconUrl); unset($params['staticlocations']); $this->addShapeData($queryHandler->getShapes(), $params, $iconUrl, $visitedIconUrl); if ($params['format'] === 'openlayers') { $params['layers'] = MapsDisplayMapRenderer::evilOpenLayersHack($params['layers']); } }