lemon/graph_to_eps.h
changeset 290 f6899946c1ac
parent 280 e7f8647ce760
child 291 d901321d6555
equal deleted inserted replaced
15:af91a112a0b4 16:efc912bbb19e
    38 #include<lemon/core.h>
    38 #include<lemon/core.h>
    39 #include<lemon/dim2.h>
    39 #include<lemon/dim2.h>
    40 #include<lemon/maps.h>
    40 #include<lemon/maps.h>
    41 #include<lemon/color.h>
    41 #include<lemon/color.h>
    42 #include<lemon/bits/bezier.h>
    42 #include<lemon/bits/bezier.h>
       
    43 #include<lemon/error.h>
    43 
    44 
    44 
    45 
    45 ///\ingroup eps_io
    46 ///\ingroup eps_io
    46 ///\file
    47 ///\file
    47 ///\brief A well configurable tool for visualizing graphs
    48 ///\brief A well configurable tool for visualizing graphs
  1164 ///\sa graphToEps(G &g, std::ostream& os)
  1165 ///\sa graphToEps(G &g, std::ostream& os)
  1165 template<class G>
  1166 template<class G>
  1166 GraphToEps<DefaultGraphToEpsTraits<G> >
  1167 GraphToEps<DefaultGraphToEpsTraits<G> >
  1167 graphToEps(G &g,const char *file_name)
  1168 graphToEps(G &g,const char *file_name)
  1168 {
  1169 {
       
  1170   std::ostream* os = new std::ofstream(file_name);
       
  1171   if (!(*os)) {
       
  1172     delete os;
       
  1173     throw IoError(file_name, "Cannot write file");
       
  1174   }
  1169   return GraphToEps<DefaultGraphToEpsTraits<G> >
  1175   return GraphToEps<DefaultGraphToEpsTraits<G> >
  1170     (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name),true));
  1176     (DefaultGraphToEpsTraits<G>(g,*os,true));
  1171 }
  1177 }
  1172 
  1178 
  1173 ///Generates an EPS file from a graph
  1179 ///Generates an EPS file from a graph
  1174 
  1180 
  1175 ///\ingroup eps_io
  1181 ///\ingroup eps_io
  1180 ///\sa graphToEps(G &g, std::ostream& os)
  1186 ///\sa graphToEps(G &g, std::ostream& os)
  1181 template<class G>
  1187 template<class G>
  1182 GraphToEps<DefaultGraphToEpsTraits<G> >
  1188 GraphToEps<DefaultGraphToEpsTraits<G> >
  1183 graphToEps(G &g,const std::string& file_name)
  1189 graphToEps(G &g,const std::string& file_name)
  1184 {
  1190 {
       
  1191   std::ostream* os = new std::ofstream(file_name.c_str());
       
  1192   if (!(*os)) {
       
  1193     delete os;
       
  1194     throw IoError(file_name, "Cannot write file");
       
  1195   }
  1185   return GraphToEps<DefaultGraphToEpsTraits<G> >
  1196   return GraphToEps<DefaultGraphToEpsTraits<G> >
  1186     (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name.c_str()),true));
  1197     (DefaultGraphToEpsTraits<G>(g,*os,true));
  1187 }
  1198 }
  1188 
  1199 
  1189 } //END OF NAMESPACE LEMON
  1200 } //END OF NAMESPACE LEMON
  1190 
  1201 
  1191 #endif // LEMON_GRAPH_TO_EPS_H
  1202 #endif // LEMON_GRAPH_TO_EPS_H