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()); }
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; }
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)); }
std::vector<Eegeo::v4> HighlightColorMapper::GetColors(const Search::SdkModel::SearchResultModel& result) const { return GetColorsFromJson(result.GetJsonData()); }