mapstorage.cc
changeset 151 72f1c33f89d4
parent 135 84996003b01c
child 172 fc1e478697d3
equal deleted inserted replaced
25:70b6ffe2bcf9 26:d2fc3acd7fa3
   317   if (!arrow_pos_read_ok)
   317   if (!arrow_pos_read_ok)
   318   {
   318   {
   319     arrow_pos_read_ok = false;
   319     arrow_pos_read_ok = false;
   320     for (EdgeIt e(graph); e != INVALID; ++e)
   320     for (EdgeIt e(graph); e != INVALID; ++e)
   321     {
   321     {
   322       arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0);
   322       if (graph.source(e) == graph.target(e))
       
   323       {
       
   324         arrow_pos.set(e, coords[graph.source(e)] + XY(0.0, 80.0));
       
   325       }
       
   326       else
       
   327       {
       
   328         arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0);
       
   329       }
   323     }
   330     }
   324   }
   331   }
   325 
   332 
   326   // fill in the default values for the maps
   333   // fill in the default values for the maps
   327   for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
   334   for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
   362       }
   369       }
   363       if (max > std::numeric_limits<double>::min())
   370       if (max > std::numeric_limits<double>::min())
   364         edgemap_default["label"] = max + 1.0;
   371         edgemap_default["label"] = max + 1.0;
   365       else
   372       else
   366         edgemap_default["label"] = 1.0;
   373         edgemap_default["label"] = 1.0;
   367     }
       
   368   }
       
   369 
       
   370   // filter loop edges
       
   371   for (EdgeIt e(graph); e != INVALID; ++e)
       
   372   {
       
   373     if (graph.source(e) == graph.target(e))
       
   374     {
       
   375       std::cerr << "Removed loop edge " << (*edgemap_storage["label"])[e]
       
   376         << " (from " << (*nodemap_storage["label"])[graph.source(e)]
       
   377         << ", to " << (*nodemap_storage["label"])[graph.target(e)] << ")."
       
   378         << std::endl;
       
   379 
       
   380       graph.erase(e);
       
   381     }
   374     }
   382   }
   375   }
   383 
   376 
   384   return 0;
   377   return 0;
   385 }
   378 }