|
|
|
@ -426,6 +426,8 @@ CGroupMap::CGroupMap(const TCtorParam ¶m)
|
|
|
|
|
//
|
|
|
|
|
_TargetLM = NULL;
|
|
|
|
|
_HomeLM = NULL;
|
|
|
|
|
_LandmarkFilter.clear();
|
|
|
|
|
_MatchedLandmarkCount = 0;
|
|
|
|
|
//
|
|
|
|
|
_ScaleMax = 8.f;
|
|
|
|
|
_ScaleMaxR2 = 8.f;
|
|
|
|
@ -711,9 +713,11 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
_ScaleMax = ClientCfg.MaxMapScale;
|
|
|
|
|
ptr = (char*) xmlGetProp( cur, (xmlChar*)"scale_max" );
|
|
|
|
|
if (ptr) fromString((const char *) ptr, _ScaleMax);
|
|
|
|
|
//
|
|
|
|
|
_ScaleMaxR2 = ClientCfg.R2EDMaxMapScale;
|
|
|
|
|
ptr = (char*) xmlGetProp( cur, (xmlChar*)"scale_max_r2" );
|
|
|
|
|
if (ptr) fromString((const char *) ptr, _ScaleMaxR2);
|
|
|
|
|
//
|
|
|
|
@ -900,9 +904,19 @@ void CGroupMap::updateCoords()
|
|
|
|
|
// bool newLandMarkShown = false;
|
|
|
|
|
uint i;
|
|
|
|
|
for (i = 0; i < _ContinentLM.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (_ContinentLM[i]->SearchMatch)
|
|
|
|
|
_ContinentLM[i]->setActive(true);
|
|
|
|
|
else
|
|
|
|
|
setupFromZoom(_ContinentLM[i], _ContinentLM[i]->Type, _MeterPerPixel);
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < _ContinentText.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (_ContinentText[i]->SearchMatch)
|
|
|
|
|
_ContinentText[i]->setActive(true);
|
|
|
|
|
else
|
|
|
|
|
setupFromZoom(_ContinentText[i], _ContinentText[i]->Type, _MeterPerPixel);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
updateLandMarkList(_ContinentLM);
|
|
|
|
|
updateLandMarkTextList(_ContinentText);
|
|
|
|
@ -2357,6 +2371,12 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
|
|
|
|
|
worldToMap(mapPos, rCLM.Pos);
|
|
|
|
|
|
|
|
|
|
const ucstring ucsTmp(CStringManagerClient::getPlaceLocalizedName(rCLM.TitleTextID));
|
|
|
|
|
const ucstring lcTitle = toLower(ucsTmp);
|
|
|
|
|
|
|
|
|
|
bool searchMatch = _LandmarkFilter.size() > 0 && filterLandmark(lcTitle);
|
|
|
|
|
if (searchMatch)
|
|
|
|
|
_MatchedLandmarkCount++;
|
|
|
|
|
|
|
|
|
|
// Add button if not a region nor a place
|
|
|
|
|
if ((rCLM.Type != CContLandMark::Region) && (rCLM.Type != CContLandMark::Place) &&
|
|
|
|
|
(rCLM.Type != CContLandMark::Street))
|
|
|
|
@ -2366,6 +2386,7 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
|
|
|
|
|
else
|
|
|
|
|
addLandMark(_ContinentLM, mapPos, CI18N::get("uiStable"), _ContinentLMOptions);
|
|
|
|
|
_ContinentLM.back()->Type = rCLM.Type;
|
|
|
|
|
_ContinentLM.back()->SearchMatch = searchMatch;
|
|
|
|
|
}
|
|
|
|
|
else // just add a text
|
|
|
|
|
{
|
|
|
|
@ -2384,6 +2405,7 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
|
|
|
|
|
pNewText->setShadowColor(CRGBA(0,0,0,255));
|
|
|
|
|
pNewText->setModulateGlobalColor(false);
|
|
|
|
|
pNewText->Type = rCLM.Type;
|
|
|
|
|
pNewText->SearchMatch = searchMatch;
|
|
|
|
|
_ContinentText.push_back(pNewText);
|
|
|
|
|
addView(pNewText);
|
|
|
|
|
}
|
|
|
|
@ -2413,6 +2435,8 @@ void CGroupMap::createContinentLandMarks()
|
|
|
|
|
{
|
|
|
|
|
uint32 k;
|
|
|
|
|
|
|
|
|
|
_MatchedLandmarkCount = 0;
|
|
|
|
|
|
|
|
|
|
if (_MapMode != MapMode_Normal) return;
|
|
|
|
|
if (_CurMap == NULL) return;
|
|
|
|
|
|
|
|
|
@ -2444,8 +2468,24 @@ void CGroupMap::createContinentLandMarks()
|
|
|
|
|
NLMISC::CVector2f mapPos;
|
|
|
|
|
worldToMap(mapPos, _CurContinent->UserLandMarks[k].Pos);
|
|
|
|
|
|
|
|
|
|
if (filterLandmark(_CurContinent->UserLandMarks[k].Title))
|
|
|
|
|
{
|
|
|
|
|
addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, getUserLandMarkOptions(k));
|
|
|
|
|
_MatchedLandmarkCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// update visible landmark count
|
|
|
|
|
CInterfaceGroup *gc = getParentContainer();
|
|
|
|
|
if (gc)
|
|
|
|
|
{
|
|
|
|
|
CViewText *pVT = dynamic_cast<CViewText *>(gc->getView("lm_count"));
|
|
|
|
|
if (pVT)
|
|
|
|
|
{
|
|
|
|
|
pVT->setText(toString(_MatchedLandmarkCount));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
invalidateCoords();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2464,6 +2504,20 @@ static void hideTeleportButtonsInPopupMenuIfNotEnoughPriv()
|
|
|
|
|
if(ie) ie->setActive(showTeleport);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//============================================================================================================
|
|
|
|
|
void CGroupMap::setLandmarkFilter(const std::string &s)
|
|
|
|
|
{
|
|
|
|
|
_LandmarkFilter.clear();
|
|
|
|
|
|
|
|
|
|
if (!s.empty()) {
|
|
|
|
|
ucstring ucs;
|
|
|
|
|
ucs.fromUtf8(s);
|
|
|
|
|
splitUCString(toLower(s), ucstring(" "), _LandmarkFilter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// recreate landmarks
|
|
|
|
|
createContinentLandMarks();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//============================================================================================================
|
|
|
|
|
void CGroupMap::updateUserLandMarks()
|
|
|
|
@ -2549,6 +2603,22 @@ void CGroupMap::updateLandMarkButton(CLandMarkButton *lmb, const CLandMarkOption
|
|
|
|
|
lmb->setColorPushed(options.ColorPushed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//============================================================================================================
|
|
|
|
|
bool CGroupMap::filterLandmark(const ucstring &title) const
|
|
|
|
|
{
|
|
|
|
|
if (_LandmarkFilter.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
ucstring lcTitle = toLower(title);
|
|
|
|
|
for(uint i = 0; i< _LandmarkFilter.size(); ++i) {
|
|
|
|
|
if (lcTitle.find(_LandmarkFilter[i]) == ucstring::npos) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//============================================================================================================
|
|
|
|
|
void CGroupMap::addLandMark(TLandMarkButtonVect &destList, const NLMISC::CVector2f &pos, const ucstring &title, const CLandMarkOptions &options)
|
|
|
|
|
{
|
|
|
|
@ -3302,6 +3372,32 @@ SMap *CGroupMap::getParentMap(SMap *map)
|
|
|
|
|
// ACTION HANDLERS //
|
|
|
|
|
/////////////////////
|
|
|
|
|
|
|
|
|
|
//=========================================================================================================
|
|
|
|
|
// Set landmark filter
|
|
|
|
|
class CAHLandMarkFilter : public IActionHandler
|
|
|
|
|
{
|
|
|
|
|
virtual void execute (CCtrlBase * /* pCaller */, const string ¶ms )
|
|
|
|
|
{
|
|
|
|
|
string id = getParam(params, "map");
|
|
|
|
|
|
|
|
|
|
CGroupMap* map = dynamic_cast<CGroupMap*>(CWidgetManager::getInstance()->getElementFromId(id));
|
|
|
|
|
if (!map) return;
|
|
|
|
|
|
|
|
|
|
string text = getParam(params, "text");
|
|
|
|
|
if (text.empty() && params.find("text=") == std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
string group = getParam(params, "group");
|
|
|
|
|
CGroupEditBox* eb = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(group));
|
|
|
|
|
if (!eb) return;
|
|
|
|
|
|
|
|
|
|
text = eb->getInputString().toUtf8();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map->setLandmarkFilter(text);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
REGISTER_ACTION_HANDLER(CAHLandMarkFilter, "land_mark_filter");
|
|
|
|
|
|
|
|
|
|
//=========================================================================================================
|
|
|
|
|
// A land mark button has been pushed
|
|
|
|
|
class CAHLandMarkSelected : public IActionHandler
|
|
|
|
|