1 /* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "marker_constructor.h"
20 extern int _maps_view_object_create(const maps_view_object_type_e type, maps_view_object_h *object);
22 extern int _maps_view_object_marker_set_type(maps_view_object_h marker, maps_view_marker_type_e type);
24 maps_view_object_h view::marker_constructor::construct(maps_coordinates_h coordinates,
25 const char *image_file_path, maps_view_marker_type_e type)
27 if (!coordinates || !image_file_path) {
28 __error = MAPS_ERROR_INVALID_PARAMETER;
32 if ((type < MAPS_VIEW_MARKER_PIN) || (type > MAPS_VIEW_MARKER_STICKER)) {
33 __error = MAPS_ERROR_INVALID_PARAMETER;
37 __error = MAPS_ERROR_NONE;
39 maps_view_object_h marker = NULL;
41 /* 1. Create a visual object for marker */
42 __error = _maps_view_object_create(MAPS_VIEW_OBJECT_MARKER, &marker);
43 if (__error != MAPS_ERROR_NONE)
46 /* 2. Set the marker image file pathe */
47 __error = maps_view_object_marker_set_image_file(marker, image_file_path);
48 if (__error != MAPS_ERROR_NONE)
51 /* 3. Set the marker type */
52 __error = _maps_view_object_marker_set_type(marker, type);
53 if (__error != MAPS_ERROR_NONE)
56 /* 4 Move the marker to the given coordinates */
57 __error = maps_view_object_marker_set_coordinates(marker, coordinates);
58 if (__error != MAPS_ERROR_NONE)
65 /* FAILURE: Releasing objects */
66 maps_view_object_destroy(marker);