ProcessPlaceRatings(herePlace, mapsPlace);
- ProcessPlaceRated(herePlace, mapsPlace);
+ ProcessPlaceRelated(herePlace, mapsPlace);
ProcessPlaceAttributes(herePlace, mapsPlace);
+ ProcessPlaceSupplier(herePlace, mapsPlace);
+
if (!isPending)
m_PlaceList.push_back(mapsPlace);
maps_item_list_h mapsImageList;
maps_place_image_h mapsImage;
maps_place_link_object_h mapsImageUser;
- LinkObject hereImageUser;
+ maps_place_media_h mapsImageMedia;
int error;
- bool is_valid, is_valid2;
+ bool is_valid;
if (hereImageList.empty()) return;
is_valid = false;
/* here not supported
- // maps_place_image_set_height(maps_place_image_h mapsPlace, const int height); */
-
- /* here not supported
- // maps_place_image_set_media(maps_place_image_h mapsPlace, maps_place_media_h media); */
+ maps_place_image_set_height(maps_place_image_h mapsPlace, const int height);
+ maps_place_image_set_width(maps_place_image_h mapsPlace, const int height);
+ */
if (!hereImage->GetSource().empty()) {
error = maps_place_image_set_url(mapsImage, (char*)hereImage->GetSource().c_str());
is_valid |= (error == MAPS_ERROR_NONE);
}
- hereImageUser = hereImage->GetUser();
if (maps_place_link_object_create(&mapsImageUser) == MAPS_ERROR_NONE) {
- is_valid2 = false;
-
- if (!hereImageUser.GetId().empty()) {
- error = maps_place_link_object_set_id(mapsImageUser,
- (char*)hereImageUser.GetId().c_str());
- is_valid2 |= (error == MAPS_ERROR_NONE);
- }
-
- if (!hereImageUser.GetTitle().empty()) {
- error = maps_place_link_object_set_name(mapsImageUser,
- (char*)hereImageUser.GetTitle().c_str());
- is_valid2 |= (error == MAPS_ERROR_NONE);
- }
-
- if (!hereImageUser.GetHref().empty()) {
- error = maps_place_link_object_set_string(mapsImageUser,
- (char*)hereImageUser.GetHref().c_str());
- is_valid2 |= (error == MAPS_ERROR_NONE);
- }
-
- if (!hereImageUser.GetType().empty()) {
- error = maps_place_link_object_set_type(mapsImageUser,
- (char*)hereImageUser.GetType().c_str());
- is_valid2 |= (error == MAPS_ERROR_NONE);
- }
-
- if (is_valid2) {
+ if (ProcessPlaceLinkObject(hereImage->GetUser(), mapsImageUser)) {
maps_place_image_set_user_link(mapsImage, mapsImageUser);
- is_valid |= is_valid2;
+ is_valid = true;
}
maps_place_link_object_destroy(mapsImageUser);
}
+ if (maps_place_media_create(&mapsImageMedia) == MAPS_ERROR_NONE) {
+ if (ProcessPlaceMedia(*hereImage, mapsImageMedia)) {
+ maps_place_image_set_media(mapsImage, mapsImageMedia);
+ is_valid = true;
+ }
+ maps_place_media_destroy(mapsImageMedia);
+ }
+
if (is_valid)
maps_item_list_append(mapsImageList, mapsImage, maps_place_image_clone);
maps_item_list_h mapsReviewList;
LinkObject hereReviewUser;
maps_place_link_object_h mapsReviewUser;
+ maps_place_media_h mapsReviewMedia;
int error;
- bool is_valid, is_valid2;
+ bool is_valid;
if (hereReviewList.empty()) return;
is_valid |= (error == MAPS_ERROR_NONE);
}
- /* maps_place_review_set_media(mapsReview, maps_place_media_h media) */
-
maps_place_review_set_rating(mapsReview, hereReview->GetRating());
if (!hereReview->GetTitle().empty()) {
is_valid |= (error == MAPS_ERROR_NONE);
}
- hereReviewUser = hereReview->GetUser();
if (maps_place_link_object_create(&mapsReviewUser) == MAPS_ERROR_NONE) {
- is_valid2 = false;
-
- if (!hereReviewUser.GetId().empty()) {
- error = maps_place_link_object_set_id(mapsReviewUser,
- (char*)hereReviewUser.GetId().c_str());
- is_valid2 |= (error == MAPS_ERROR_NONE);
- }
-
- if (!hereReviewUser.GetTitle().empty()) {
- error = maps_place_link_object_set_name(mapsReviewUser,
- (char*)hereReviewUser.GetTitle().c_str());
- is_valid2 |= (error == MAPS_ERROR_NONE);
- }
-
- if (!hereReviewUser.GetHref().empty()) {
- error = maps_place_link_object_set_string(mapsReviewUser,
- (char*)hereReviewUser.GetHref().c_str());
- is_valid2 |= (error == MAPS_ERROR_NONE);
- }
-
- if (!hereReviewUser.GetType().empty()) {
- error = maps_place_link_object_set_type(mapsReviewUser,
- (char*)hereReviewUser.GetType().c_str());
- is_valid2 |= (error == MAPS_ERROR_NONE);
- }
-
- if (is_valid2) {
+ if (ProcessPlaceLinkObject(hereReview->GetUser(), mapsReviewUser)) {
maps_place_review_set_user_link(mapsReview, mapsReviewUser);
- is_valid |= is_valid2;
+ is_valid = true;
}
-
maps_place_link_object_destroy(mapsReviewUser);
}
+ if (maps_place_media_create(&mapsReviewMedia) == MAPS_ERROR_NONE) {
+ if (ProcessPlaceMedia(*hereReview, mapsReviewMedia)) {
+ maps_place_review_set_media(mapsReview, mapsReviewMedia);
+ is_valid = true;
+ }
+ maps_place_media_destroy(mapsReviewMedia);
+ }
+
if (is_valid)
maps_item_list_append(mapsReviewList, mapsReview, maps_place_review_clone);
maps_place_rating_destroy(mapsRating);
}
-void HerePlace::ProcessPlaceRated(PlaceDetails herePlace, maps_place_h mapsPlace)
+void HerePlace::ProcessPlaceRelated(PlaceDetails herePlace, maps_place_h mapsPlace)
{
RelatedItem hereRelated = herePlace.GetRelatedItem();
maps_place_link_object_h mapsRelated;
if (maps_place_link_object_create(&mapsRelated) != MAPS_ERROR_NONE) return;
- //need to check if GetId() exist
- //maps_place_link_object_set_id(mapsRelated, hereRelated.GetId());
+ maps_place_link_object_set_id(mapsRelated, "recommended");
if (!hereRelated.GetTitle().empty()) {
error = maps_place_link_object_set_name(mapsRelated,
maps_item_list_destroy(mapsAttributeList);
}
+void HerePlace::ProcessPlaceSupplier(PlaceDetails herePlace, maps_place_h mapsPlace)
+{
+ maps_place_link_object_h mapsLinkObject;
+
+ if (maps_place_link_object_create(&mapsLinkObject) == MAPS_ERROR_NONE) {
+ if (ProcessPlaceLinkObject(herePlace.GetBaseContent().GetSupplier(), mapsLinkObject))
+ maps_place_set_supplier_link(mapsPlace, mapsLinkObject);
+ maps_place_link_object_destroy(mapsLinkObject);
+ }
+}
+
+bool HerePlace::ProcessPlaceMedia(BaseContent hereContent, maps_place_media_h mapsMedia)
+{
+ int error;
+ bool is_valid = false;
+ maps_place_link_object_h mapsLinkObject;
+
+ if (!hereContent.GetAttribution().empty()) {
+ error = maps_place_media_set_attribution(mapsMedia,
+ (char*)hereContent.GetAttribution().c_str());
+ is_valid = (error == MAPS_ERROR_NONE);
+ }
+
+ if (maps_place_link_object_create(&mapsLinkObject) == MAPS_ERROR_NONE) {
+ if (ProcessPlaceLinkObject(hereContent.GetSupplier(), mapsLinkObject)) {
+ maps_place_media_set_supplier(mapsMedia, mapsLinkObject);
+ is_valid = true;
+ }
+ maps_place_link_object_destroy(mapsLinkObject);
+ }
+
+ if (maps_place_link_object_create(&mapsLinkObject) == MAPS_ERROR_NONE) {
+ if (ProcessPlaceLinkObject(hereContent.GetVia(), mapsLinkObject)) {
+ maps_place_media_set_via(mapsMedia, mapsLinkObject);
+ is_valid = true;
+ }
+ maps_place_link_object_destroy(mapsLinkObject);
+ }
+ return is_valid;
+}
+
+bool HerePlace::ProcessPlaceLinkObject(LinkObject hereLinkObject, maps_place_link_object_h mapsLinkObject)
+{
+ int error;
+ bool is_valid = false;
+
+ if (!hereLinkObject.GetId().empty()) {
+ error = maps_place_link_object_set_id(mapsLinkObject,
+ (char*)hereLinkObject.GetId().c_str());
+ is_valid |= (error == MAPS_ERROR_NONE);
+ }
+
+ if (!hereLinkObject.GetTitle().empty()) {
+ error = maps_place_link_object_set_name(mapsLinkObject,
+ (char*)hereLinkObject.GetTitle().c_str());
+ is_valid |= (error == MAPS_ERROR_NONE);
+ }
+
+ if (!hereLinkObject.GetHref().empty()) {
+ error = maps_place_link_object_set_string(mapsLinkObject,
+ (char*)hereLinkObject.GetHref().c_str());
+ is_valid |= (error == MAPS_ERROR_NONE);
+ }
+
+ if (!hereLinkObject.GetType().empty()) {
+ error = maps_place_link_object_set_type(mapsLinkObject,
+ (char*)hereLinkObject.GetType().c_str());
+ is_valid |= (error == MAPS_ERROR_NONE);
+ }
+ return is_valid;
+}
+
void HerePlace::__flushReplies(int error)
{
maps_place_h mapsPlace;