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; }
function shortArrayFromMapFeature(MapFeature $feature) { $category = $feature->getCategory(); if (is_array($category)) { $category = implode(MAP_CATEGORY_DELIMITER, $category); } return array( 'featureindex' => $feature->getIndex(), 'category' => $category, ); }
function shortArrayFromMapFeature(MapFeature $feature) { return array( 'featureindex' => $feature->getIndex(), 'category' => $feature->getCategory(), ); }