map_win.cc
branchgui
changeset 35 79bffdf6aea2
parent 30 f70bbee5350a
child 38 9cab23d9b124
equal deleted inserted replaced
5:88871e5dfb40 6:60bb42ef3154
    21 
    21 
    22   table=new Gtk::Table(EDGE_PROPERTY_NUM, 2, false);
    22   table=new Gtk::Table(EDGE_PROPERTY_NUM, 2, false);
    23 
    23 
    24   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    24   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    25   {
    25   {
    26 
       
    27     std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
       
    28     std::set<int> props;
       
    29 
       
    30     int actprop;
       
    31 
       
    32     //here we find out, which map is the default in MapStorage for this property, which are not
       
    33     for(int j=0;j<ms.numOfEdgeMaps();j++)
       
    34     {
       
    35       //this is the default value for this property
       
    36       if(emsi->second==&(ms.default_edgemaps[i]))
       
    37       {
       
    38 	actprop=j;
       
    39       }
       
    40       //these are the maps NOT to show for this property
       
    41       for(int k=0;k<EDGE_PROPERTY_NUM;k++)
       
    42       {
       
    43 	if(emsi->second==&(ms.default_edgemaps[k]))
       
    44 	{
       
    45 	  props.insert(j);
       
    46 	}
       
    47       }
       
    48       emsi++;
       
    49     }
       
    50 
       
    51     //filling in combo box with choices
    26     //filling in combo box with choices
    52     std::list<Glib::ustring> listStrings;
    27     std::list<Glib::ustring> listStrings;
    53 
    28 
    54     listStrings.push_back("Default");
    29     listStrings.push_back("Default");
    55 
    30 
    56     emsi=ms.beginOfEdgeMaps();
    31     std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
    57 
    32     for(;emsi!=ms.endOfEdgeMaps();emsi++)
    58     for(int j=0;j<ms.numOfEdgeMaps();j++)
    33     {
    59     {
       
    60       if( ( props.find(j) )==( props.end() ) )
       
    61       {
       
    62 	listStrings.push_back(emsi->first);
    34 	listStrings.push_back(emsi->first);
    63       }
       
    64       emsi++;
       
    65     }
    35     }
    66 
    36 
    67     e_combo_array[i].set_popdown_strings(listStrings);
    37     e_combo_array[i].set_popdown_strings(listStrings);
    68 
    38 
    69     //Restrict it to these choices only:
    39     //Restrict it to these choices only:
   100 
    70 
   101   table=new Gtk::Table(NODE_PROPERTY_NUM, 2, false);
    71   table=new Gtk::Table(NODE_PROPERTY_NUM, 2, false);
   102 
    72 
   103   for(int i=0;i<NODE_PROPERTY_NUM;i++)
    73   for(int i=0;i<NODE_PROPERTY_NUM;i++)
   104   {
    74   {
   105 
       
   106     std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
       
   107     std::set<int> props;
       
   108 
       
   109     int actprop;
       
   110 
       
   111     //here we find out, which map is the default in MapStorage for this property, which are not
       
   112     for(int j=0;j<ms.numOfNodeMaps();j++)
       
   113     {
       
   114       //these are the maps NOT to show for this property
       
   115       if(emsi->second==&(ms.default_nodemaps[i]))
       
   116       {
       
   117 	actprop=j;
       
   118       }
       
   119       //this is the other maps to show for this property
       
   120       for(int k=0;k<NODE_PROPERTY_NUM;k++)
       
   121       {
       
   122 	if(emsi->second==&(ms.default_nodemaps[k]))
       
   123 	{
       
   124 	  props.insert(j);
       
   125 	}
       
   126       }
       
   127       emsi++;
       
   128     }
       
   129 
       
   130     //filling in combo box with choices
    75     //filling in combo box with choices
   131     std::list<Glib::ustring> listStrings;
    76     std::list<Glib::ustring> listStrings;
   132 
    77 
   133     listStrings.push_back("Default");
    78     listStrings.push_back("Default");
   134 
    79 
   135     emsi=ms.beginOfNodeMaps();
    80     std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
   136 
    81 
   137     for(int j=0;j<ms.numOfNodeMaps();j++)
    82     for(;emsi!=ms.endOfNodeMaps();emsi++)
   138     {
    83     {
   139       if( ( props.find(j) )==( props.end() ) )
    84       listStrings.push_back(emsi->first);
   140       {
       
   141 	listStrings.push_back(emsi->first);
       
   142       }
       
   143       emsi++;
       
   144     }
    85     }
   145 
    86 
   146     n_combo_array[i].set_popdown_strings(listStrings);
    87     n_combo_array[i].set_popdown_strings(listStrings);
   147 
    88 
   148     //Restrict it to these choices only:
    89     //Restrict it to these choices only:
   186   if(entry)
   127   if(entry)
   187   {
   128   {
   188     Glib::ustring mapname = entry->get_text();
   129     Glib::ustring mapname = entry->get_text();
   189     if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   130     if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   190     {
   131     {
   191       if(mapname=="Default")
   132       if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
   192       {
       
   193 	mapname=edge_property_strings[prop];
       
   194       }
       
   195 
       
   196       if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
       
   197       {
   133       {
   198 	switch(prop)
   134 	switch(prop)
   199 	{
   135 	{
   200           case E_WIDTH:
   136           case E_WIDTH:
   201 	    gdc.changeEdgeWidth(mapname);
   137 	    gdc.changeEdgeWidth(mapname);
   222   if(entry)
   158   if(entry)
   223   {
   159   {
   224     Glib::ustring mapname = entry->get_text();
   160     Glib::ustring mapname = entry->get_text();
   225     if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   161     if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   226     {
   162     {
   227       if(mapname=="Default")
   163       if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
   228       {
       
   229 	mapname=node_property_strings[prop];
       
   230       }
       
   231 
       
   232       if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
       
   233       {
   164       {
   234 	switch(prop)
   165 	switch(prop)
   235 	{
   166 	{
   236           case N_RADIUS:
   167           case N_RADIUS:
   237 	    gdc.changeNodeRadius(mapname);
   168 	    gdc.changeNodeRadius(mapname);
   259       if(entry)
   190       if(entry)
   260 	{
   191 	{
   261 	  Glib::ustring mapname = entry->get_text();
   192 	  Glib::ustring mapname = entry->get_text();
   262 	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   193 	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   263 	    {
   194 	    {
   264 	      if(mapname=="Default")
   195 	      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
   265 		{
       
   266 		  mapname=node_property_strings[i];
       
   267 		}
       
   268 
       
   269 	      if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
       
   270 		{
   196 		{
   271 		  switch(i)
   197 		  switch(i)
   272 		    {
   198 		    {
   273 		    case N_RADIUS:
   199 		    case N_RADIUS:
   274 		      //gdc.changeNodeRadius(mapname, node);
   200 		      gdc.changeNodeRadius(mapname, node);
   275 		      std::cout << "If default map-value problem is solved, uncomment line in MapWin::node_update!" << std::endl;
       
   276 		      break;
   201 		      break;
   277 		    case N_COLOR:
   202 		    case N_COLOR:
   278 		      gdc.changeNodeColor(mapname, node);
   203 		      gdc.changeNodeColor(mapname, node);
   279 		      break;
   204 		      break;
   280 		    case N_TEXT:
   205 		    case N_TEXT:
   299       if(entry)
   224       if(entry)
   300 	{
   225 	{
   301 	  Glib::ustring mapname = entry->get_text();
   226 	  Glib::ustring mapname = entry->get_text();
   302 	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   227 	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   303 	    {
   228 	    {
   304 	      if(mapname=="Default")
   229 
   305 		{
   230 	      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
   306 		  mapname=edge_property_strings[i];
       
   307 		}
       
   308 
       
   309 	      if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
       
   310 		{
   231 		{
   311 		  switch(i)
   232 		  switch(i)
   312 		    {
   233 		    {
   313 		    case E_WIDTH:
   234 		    case E_WIDTH:
   314 		      //gdc.changeEdgeWidth(mapname, edge);
   235 		      gdc.changeEdgeWidth(mapname, edge);
   315 		      std::cout << "If default map-value problem is solved, uncomment line in MapWin::edge_update!" << std::endl;
       
   316 		      break;
   236 		      break;
   317 		    case E_COLOR:
   237 		    case E_COLOR:
   318 		      gdc.changeEdgeColor(mapname, edge);
   238 		      gdc.changeEdgeColor(mapname, edge);
   319 		      break;
   239 		      break;
   320 		    case E_TEXT:
   240 		    case E_TEXT: