Пример #1
0
void TrajectoriesJPSV05::WriteFrame(int frameNr, Building* building)
{
     string data;
     char tmp[CLENGTH] = "";
     double RAD2DEG = 180.0 / M_PI;

     sprintf(tmp, "<frame ID=\"%d\">\n", frameNr);
     data.append(tmp);

     const vector< Pedestrian* >& allPeds = building->GetAllPedestrians();
     for(unsigned int p=0;p<allPeds.size();p++)
     {
          Pedestrian* ped = allPeds[p];
          Room* r = building->GetRoom(ped->GetRoomID());
          string caption = r->GetCaption();
          char s[CLENGTH] = "";
          int color=ped->GetColor();
          double a = ped->GetLargerAxis();
          double b = ped->GetSmallerAxis();
          double phi = atan2(ped->GetEllipse().GetSinPhi(), ped->GetEllipse().GetCosPhi());
          sprintf(s, "<agent ID=\"%d\"\t"
                    "x=\"%.6f\"\ty=\"%.6f\"\t"
                    "z=\"%.6f\"\t"
                    "rA=\"%.2f\"\trB=\"%.2f\"\t"
                    "eO=\"%.2f\" eC=\"%d\"/>\n",
                    ped->GetID(), (ped->GetPos()._x) * FAKTOR,
                    (ped->GetPos()._y) * FAKTOR,(ped->GetElevation()) * FAKTOR ,a * FAKTOR, b * FAKTOR,
                    phi * RAD2DEG, color);
          data.append(s);
     }
     data.append("</frame>\n");
     _outputHandler->Write(data);
}
Пример #2
0
void TrajectoriesFLAT::WriteFrame(int frameNr, Building* building)
{
     char tmp[CLENGTH] = "";

     const vector< Pedestrian* >& allPeds = building->GetAllPedestrians();
     for(unsigned int p=0;p<allPeds.size();p++){
          Pedestrian* ped = allPeds[p];
          double x = ped->GetPos()._x;
          double y = ped->GetPos()._y;
          double z = ped->GetElevation();
          sprintf(tmp, "%d\t%d\t%0.2f\t%0.2f\t%0.2f", ped->GetID(), frameNr, x, y,z);
          Write(tmp);
     }

}
Пример #3
0
void TrajectoriesJPSV06::WriteFrame(int frameNr, Building* building)
{
     string data;
     char tmp[CLENGTH] = "";
     double RAD2DEG = 180.0 / M_PI;
     vector<string> rooms_to_plot;

     sprintf(tmp, "<frame ID=\"%d\">\n", frameNr);
     data.append(tmp);


     const vector< Pedestrian* >& allPeds = building->GetAllPedestrians();
     for(unsigned int p=0;p<allPeds.size();++p)
     {
          Pedestrian* ped = allPeds[p];
          Room* r = building->GetRoom(ped->GetRoomID());
          string caption = r->GetCaption();

          if (!IsElementInVector(rooms_to_plot, caption)) {
               if (!rooms_to_plot.empty()) {
                    continue;
               }
          }

          char tmp1[CLENGTH] = "";

          int color=ped->GetColor();
          double a = ped->GetLargerAxis();
          double b = ped->GetSmallerAxis();
          double phi = atan2(ped->GetEllipse().GetSinPhi(), ped->GetEllipse().GetCosPhi());
          sprintf(tmp1, "<agent ID=\"%d\"\t"
                    "x=\"%.6f\"\ty=\"%.6f\"\t"
                    "z=\"%.6f\"\t"
                    "rA=\"%.2f\"\trB=\"%.2f\"\t"
                    "eO=\"%.2f\" eC=\"%d\"/>\n",
                    ped->GetID(), (ped->GetPos()._x) * FAKTOR,
                    (ped->GetPos()._y) * FAKTOR,(ped->GetElevation()) * FAKTOR ,a * FAKTOR, b * FAKTOR,
                    phi * RAD2DEG, color);
          data.append(tmp1);

     }

     data.append("</frame>\n");
     Write(data);
}