Ejemplo n.º 1
0
    protected function arrayFromMapFeature(MapFeature $feature) {
        $category = $feature->getCategory();
        if (!is_array($category)) {
            $category = explode(MAP_CATEGORY_DELIMITER, $category);
        }
        $result = array(
            'title' => $feature->getTitle(),
            'subtitle' => $feature->getSubtitle(),
            'id' => $feature->getIndex(),
            'category' => $category,
            'description' => $feature->getDescription(),
            );

        $geometry = $feature->getGeometry();
        if ($geometry) {
            $center = $geometry->getCenterCoordinate();
            if ($geometry instanceof MapPolygon) {
                $serializedGeometry = $geometry->getRings();
            } elseif ($geometry instanceof MapPolyline) {
                $serializedGeometry = $geometry->getPoints();
            } elseif ($geometry) {
                $serializedGeometry = $geometry->getCenterCoordinate();
            }
            $result['geometry'] = $serializedGeometry;
            $result['lat'] = $center['lat'];
            $result['lon'] = $center['lon'];
        }

        return $result;
    }
Ejemplo n.º 2
0
function shortArrayFromMapFeature(MapFeature $feature) {
    $category = $feature->getCategory();
    if (is_array($category)) {
        $category = implode(MAP_CATEGORY_DELIMITER, $category);
    }
    return array(
        'featureindex' => $feature->getIndex(),
        'category' => $category,
        );
}
Ejemplo n.º 3
0
function shortArrayFromMapFeature(MapFeature $feature) {
    return array(
        'featureindex' => $feature->getIndex(),
        'category' => $feature->getCategory(),
        );
}