本文整理汇总了C++中Transition::GetUniqueID方法的典型用法代码示例。如果您正苦于以下问题:C++ Transition::GetUniqueID方法的具体用法?C++ Transition::GetUniqueID怎么用?C++ Transition::GetUniqueID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transition
的用法示例。
在下文中一共展示了Transition::GetUniqueID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateFlowAtDoors
void Simulation::UpdateFlowAtDoors(const Pedestrian& ped) const
{
if (_config->ShowStatistics()) {
Transition* trans = _building->GetTransitionByUID(ped.GetExitIndex());
if (trans) {
//check if the pedestrian left the door correctly
if (trans->DistTo(ped.GetPos())>0.5) {
Log->Write("WARNING:\t pedestrian [%d] left room/subroom [%d/%d] in an unusual way. Please check",
ped.GetID(), ped.GetRoomID(), ped.GetSubRoomID());
Log->Write(" :\t distance to last door (%d | %d) is %f. That should be smaller.",
trans->GetUniqueID(), ped.GetExitIndex(),
trans->DistTo(ped.GetPos()));
Log->Write(" :\t correcting the door statistics");
//ped.Dump(ped.GetID());
//checking the history and picking the nearest previous destination
double biggest = 0.3;
bool success = false;
for (const auto& dest:ped.GetLastDestinations()) {
if (dest!=-1) {
Transition* trans_tmp = _building->GetTransitionByUID(dest);
if (trans_tmp && trans_tmp->DistTo(ped.GetPos())<biggest) {
biggest = trans_tmp->DistTo(ped.GetPos());
trans = trans_tmp;
Log->Write(" :\t Best match found at door %d", dest);
success = true;//at least one door was found
}
}
}
if (!success) {
Log->Write("WARNING :\t correcting the door statistics");
return; //todo we need to check if the ped is in a subroom neighboring the target. If so, no problems!
}
}
//#pragma omp critical
trans->IncreaseDoorUsage(1, ped.GetGlobalTime());
}
}
}
示例2: sprintf
void TrajectoriesJPSV04::WriteGeometry(Building* building)
{
// just put a link to the geometry file
string embed_geometry;
embed_geometry.append("\t<geometry>\n");
char file_location[CLENGTH] = "";
sprintf(file_location, "\t<file location= \"%s\"/>\n", building->GetGeometryFilename().c_str());
embed_geometry.append(file_location);
embed_geometry.append("\t</geometry>\n");
//Write(embed_geometry);
//return;
//
string geometry;
geometry.append("\t<geometry>\n");
bool plotHlines = true;
bool plotCrossings = true;
bool plotTransitions = true;
bool plotPlayingField=false;
vector<string> rooms_to_plot;
unsigned int i;
// first the rooms
//to avoid writing navigation line twice
vector<int> navLineWritten;
//rooms_to_plot.push_back("U9");
for (const auto& it:building->GetAllRooms())
{
auto&& r = it.second;
string caption = r->GetCaption(); //if(r->GetID()!=1) continue;
if (!rooms_to_plot.empty() && !IsElementInVector(rooms_to_plot, caption))
continue;
for(auto&& sitr: r->GetAllSubRooms())
{
auto&& s = sitr.second; //if(s->GetSubRoomID()!=7) continue;
geometry.append(s->WriteSubRoom());
// the hlines
if (plotHlines) {
const vector<Hline*>& hlines = s->GetAllHlines();
for (i = 0; i < hlines.size(); i++) {
Hline* hline = hlines[i];
int uid1 = hline->GetUniqueID();
if (!IsElementInVector(navLineWritten, uid1)) {
navLineWritten.push_back(uid1);
if (rooms_to_plot.empty()
|| IsElementInVector(rooms_to_plot, caption)) {
geometry.append(hline->GetDescription());
}
}
}
// the crossings
if (plotCrossings) {
const vector<Crossing*>& crossings = s->GetAllCrossings();
for (i = 0; i < crossings.size(); i++) {
Crossing* crossing = crossings[i];
int uid1 = crossing->GetUniqueID();
if (!IsElementInVector(navLineWritten, uid1)) {
navLineWritten.push_back(uid1);
if (rooms_to_plot.empty()
|| IsElementInVector(rooms_to_plot,
caption)) {
geometry.append(crossing->GetDescription());
}
}
}
}
// the transitions
if (plotTransitions) {
const vector<Transition*>& transitions =
s->GetAllTransitions();
for (i = 0; i < transitions.size(); i++) {
Transition* transition = transitions[i];
int uid1 = transition->GetUniqueID();
if (!IsElementInVector(navLineWritten, uid1)) {
navLineWritten.push_back(uid1);
if (rooms_to_plot.empty()) {
geometry.append(transition->GetDescription());
} else {
Room* room1 = transition->GetRoom1();
Room* room2 = transition->GetRoom2();
string caption1 = room1->GetCaption();
if (room2) {
string caption2 = room2->GetCaption();
if (IsElementInVector(rooms_to_plot,
caption1)
|| IsElementInVector(rooms_to_plot,
caption2)) {
geometry.append(transition->GetDescription());
}
} else {
if (IsElementInVector(rooms_to_plot,
caption1)) {
//.........这里部分代码省略.........