コード例 #1
0
            void SearchResultPoiView::CreateAndShowGeoNamesPoiView(const Search::SdkModel::SearchResultModel& model, bool isPinned)
            {
            	const std::string viewClass = "com/eegeo/searchresultpoiview/GeoNamesSearchResultPoiView";
            	m_uiViewClass = CreateJavaClass(viewClass);
            	m_uiView = CreateJavaObject(m_uiViewClass);

            	AndroidSafeNativeThreadAttachment attached(m_nativeState);
            	JNIEnv* env = attached.envForThread;

            	jstring titleStr = env->NewStringUTF(model.GetTitle().c_str());
            	jstring addressStr = env->NewStringUTF(model.GetSubtitle().c_str());
            	jstring categoryStr = env->NewStringUTF(model.GetCategory().c_str());

            	jmethodID displayPoiInfoMethod = env->GetMethodID(m_uiViewClass, "displayPoiInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V");
            	env->CallVoidMethod(
            			m_uiView,
						displayPoiInfoMethod,
						titleStr,
						addressStr,
						categoryStr,
						isPinned
            	);

            	env->DeleteLocalRef(categoryStr);
            	env->DeleteLocalRef(addressStr);
            	env->DeleteLocalRef(titleStr);
            }
コード例 #2
0
            void SearchResultPoiView::CreateAndShowYelpPoiView(const Search::SdkModel::SearchResultModel& model, bool isPinned)
            {
            	const std::string viewClass = "com/eegeo/searchresultpoiview/YelpSearchResultPoiView";
            	m_uiViewClass = CreateJavaClass(viewClass);
            	m_uiView = CreateJavaObject(m_uiViewClass);

            	Search::Yelp::SdkModel::YelpSearchResultModel yelpModel;
            	yelpModel = Search::Yelp::SdkModel::TransformToYelpSearchResult(model);

            	AndroidSafeNativeThreadAttachment attached(m_nativeState);
            	JNIEnv* env = attached.envForThread;

            	jobjectArray humanReadableCategoriesArray = CreateJavaArray(model.GetHumanReadableCategories());
            	jobjectArray reviewsArray = CreateJavaArray(yelpModel.GetReviews());

            	jstring titleStr = env->NewStringUTF(model.GetTitle().c_str());
            	jstring addressStr = env->NewStringUTF(model.GetSubtitle().c_str());
            	jstring phoneStr = env->NewStringUTF(yelpModel.GetPhone().c_str());
            	jstring urlStr = env->NewStringUTF(yelpModel.GetWebUrl().c_str());
            	jstring categoryStr = env->NewStringUTF(model.GetCategory().c_str());
            	jstring imageUrlStr = env->NewStringUTF(yelpModel.GetImageUrl().c_str());
            	jstring ratingImageUrlStr = env->NewStringUTF(yelpModel.GetRatingImageUrl().c_str());
            	jstring vendorStr = env->NewStringUTF(model.GetVendor().c_str());

            	jmethodID displayPoiInfoMethod = env->GetMethodID(m_uiViewClass, "displayPoiInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;IZ)V");
            	env->CallVoidMethod(
            			m_uiView,
						displayPoiInfoMethod,
						titleStr,
						addressStr,
						phoneStr,
						urlStr,
						categoryStr,
						humanReadableCategoriesArray,
						imageUrlStr,
						ratingImageUrlStr,
						vendorStr,
						reviewsArray,
						yelpModel.GetReviewCount(),
						isPinned
            	);

            	env->DeleteLocalRef(vendorStr);
            	env->DeleteLocalRef(ratingImageUrlStr);
            	env->DeleteLocalRef(imageUrlStr);
            	env->DeleteLocalRef(categoryStr);
            	env->DeleteLocalRef(urlStr);
            	env->DeleteLocalRef(phoneStr);
            	env->DeleteLocalRef(addressStr);
            	env->DeleteLocalRef(titleStr);
            	env->DeleteLocalRef(reviewsArray);
            	env->DeleteLocalRef(humanReadableCategoriesArray);
            }
コード例 #3
0
 ExampleApp::Search::SdkModel::SearchResultModel MutateMeetingRoomAvailability(const Search::SdkModel::SearchResultModel& searchResultModel, const std::string& updatedAvailability)
 {
     rapidjson::Document json;
     if (!json.Parse<0>(searchResultModel.GetJsonData().c_str()).HasParseError())
     {
         json[SearchConstants::AVAILABILITY_FIELD_NAME.c_str()] = rapidjson::Value(updatedAvailability.c_str(), json.GetAllocator()).Move();
     }
     
     rapidjson::StringBuffer strbuf;
     rapidjson::Writer<rapidjson::StringBuffer> writer(strbuf);
     json.Accept(writer);
     
     return Search::SdkModel::SearchResultModel(ExampleApp::Search::SdkModel::SearchResultModel::CurrentVersion,
                                                searchResultModel.GetIdentifier(),
                                                searchResultModel.GetTitle(),
                                                searchResultModel.GetSubtitle(),
                                                searchResultModel.GetLocation(),
                                                0.0f,
                                                true,
                                                searchResultModel.GetBuildingId(),
                                                searchResultModel.GetFloor(),
                                                Search::Lax::SearchConstants::DEFIBRILLATOR_CATEGORY_NAME,
                                                std::vector<std::string>(),
                                                Search::EegeoVendorName,
                                                strbuf.GetString(),
                                                searchResultModel.GetCreationTimestamp());
 }
コード例 #4
0
 Eegeo::v4 HighlightColorMapper::GetColor(const Search::SdkModel::SearchResultModel& result, const std::string highlightColorData) const
 {
     rapidjson::Document json;
     Eegeo::v4 highlightColor = m_defaultColor;
     
     if (!json.Parse<0>(result.GetJsonData().c_str()).HasParseError() && json.HasMember(highlightColorData.c_str()))
     {
         highlightColor = GetColorFromValue(json[highlightColorData.c_str()]);
     }
     
     return highlightColor;
 }
コード例 #5
0
 bool TryParseImageDetails(const Search::SdkModel::SearchResultModel& searchResultModel, std::string& out_imageUrl)
 {
     const std::string& vendor = searchResultModel.GetVendor();
     if(vendor == YelpVendorName)
     {
         return Yelp::SdkModel::TryParseImageDetails(searchResultModel, out_imageUrl);
     }
     else if(vendor == EegeoVendorName)
     {
         return EegeoPois::SdkModel::TryParseImageDetails(searchResultModel, out_imageUrl);
     }
     
     return false;
 }
コード例 #6
0
 LaxTransitionResultModel TransformToLaxTransitionResult(const Search::SdkModel::SearchResultModel& searchResultModel)
 {
     rapidjson::Document json;
     
     std::string targetInteriorID("");
     int targetInteriorFloor = 0;
     double targetLatitudeDegrees = 0.0;
     double targetLongitudeDegrees = 0.0;
     
     if (!json.Parse<0>(searchResultModel.GetJsonData().c_str()).HasParseError())
     {
         if(json.HasMember(SearchConstants::TARGET_INTERIOR_ID_FIELD_NAME.c_str()) && json[SearchConstants::TARGET_INTERIOR_ID_FIELD_NAME.c_str()].IsString())
         {
             targetInteriorID = json[SearchConstants::TARGET_INTERIOR_ID_FIELD_NAME.c_str()].GetString();
         }
         
         if(json.HasMember(SearchConstants::TARGET_INTERIOR_FLOOR_FIELD_NAME.c_str()) && json[SearchConstants::TARGET_INTERIOR_FLOOR_FIELD_NAME.c_str()].IsNumber())
         {
             targetInteriorFloor = json[SearchConstants::TARGET_INTERIOR_FLOOR_FIELD_NAME.c_str()].GetInt();
         }
         
         if(json.HasMember(SearchConstants::TARGET_LATITUDE_DEGREES_FIELD_NAME.c_str()) && json[SearchConstants::TARGET_LATITUDE_DEGREES_FIELD_NAME.c_str()].IsNumber())
         {
             targetLatitudeDegrees = (float)json[SearchConstants::TARGET_LATITUDE_DEGREES_FIELD_NAME.c_str()].GetDouble();
         }
         
         if(json.HasMember(SearchConstants::TARGET_LONGITUDE_DEGREES_FILED_NAME.c_str()) && json[SearchConstants::TARGET_LONGITUDE_DEGREES_FILED_NAME.c_str()].IsNumber())
         {
             targetLongitudeDegrees = (float)json[SearchConstants::TARGET_LONGITUDE_DEGREES_FILED_NAME.c_str()].GetDouble();
         }
     }
     else
     {
         Eegeo_ASSERT(false, "JSON parse error transforming search result model to Lax transition model");
     }
     
     return LaxTransitionResultModel(Eegeo::Resources::Interiors::InteriorId(targetInteriorID),
                                         targetInteriorFloor,
                                         Eegeo::Space::LatLong::FromDegrees(targetLatitudeDegrees, targetLongitudeDegrees));
 }
コード例 #7
0
 std::vector<Eegeo::v4> HighlightColorMapper::GetColors(const Search::SdkModel::SearchResultModel& result) const
 {
     return GetColorsFromJson(result.GetJsonData());
 }