Changeset 1509:f9113440b667 in lemon-0.x
- Timestamp:
- 06/23/05 19:56:24 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1992
- Location:
- gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/graph_displayer_canvas.cc
r1505 r1509 96 96 { 97 97 for (EdgeIt i(g); i!=INVALID; ++i) 98 { 99 int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i]; 100 edgesmap[i]->property_width_pixels().set_value(w); 101 } 98 { 99 int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i]; 100 if(w>=0) 101 { 102 edgesmap[i]->property_width_pixels().set_value(w); 103 } 104 } 102 105 return 0; 103 106 }; … … 142 145 143 146 for (EdgeIt i(g); i!=INVALID; ++i) 144 { 145 if(mapname!="Text") 146 { 147 double number=(*(mapstorage.edgemap_storage)[mapname])[i]; 148 int length=(int)(floor(log(number)/log(10)))+1; 149 int maxpos=(int)(pow(10,length-1)); 150 int strl=length+1+RANGE; 151 char * str=new char[strl]; 152 str[length]='.'; 153 str[strl]='\0'; 147 { 148 if(mapname!="Text") 149 { 150 double number=(*(mapstorage.edgemap_storage)[mapname])[i]; 151 int length=1; 152 //if number is smaller than one, length would be negative, or invalid 153 if(number>=1) 154 { 155 length=(int)(floor(log(number)/log(10)))+1; 156 } 157 int maxpos=(int)(pow(10,length-1)); 158 int strl=length+1+RANGE; 159 char * str=new char[strl]; 160 str[length]='.'; 161 str[strl]='\0'; 154 162 155 156 157 if(j!=length)158 159 int digit=(int)(number/maxpos);160 str[j]=(digit+'0');161 number-=digit*maxpos;162 number*=10;163 164 163 for(int j=0;j<strl;j++) 164 { 165 if(j!=length) 166 { 167 int digit=(int)(number/maxpos); 168 str[j]=(digit+'0'); 169 number-=digit*maxpos; 170 number*=10; 171 } 172 } 165 173 166 167 168 else169 170 171 172 }174 edgetextmap[i]->property_text().set_value(str); 175 } 176 else 177 { 178 edgetextmap[i]->property_text().set_value(""); 179 } 180 } 173 181 return 0; 174 182 }; … … 475 483 476 484 active_node=NodeIt(g,g.addNode()); 485 486 //initiating values corresponding to new node in maps 487 477 488 478 489 window_to_world (e->button.x, e->button.y, clicked_x, clicked_y); … … 517 528 { 518 529 case GDK_BUTTON_PRESS: 519 //in edge creati noright button has special meaning530 //in edge creation right button has special meaning 520 531 if(e->button.button!=3) 521 532 { … … 570 581 //creating new edge 571 582 active_edge=EdgeIt(g,g.addEdge(active_node, target_node)); 583 584 //initiating values corresponding to new edge in maps 585 mapstorage.init_maps_for_edge(active_edge); 572 586 573 587 //calculating coordinates of new edge -
gui/mapstorage.cc
r1442 r1509 87 87 } 88 88 89 void MapStorage::init_maps_for_edge(Graph::Edge e) 90 { 91 e=e; 92 // beragad, aztan csovez 93 // std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it; 94 // for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++) 95 // { 96 // std::cout << "szevasz\n"; 97 // (*((*ems_it).second))[e]=0; 98 // } 99 // std::cout << std::endl; 100 101 // g_closure_invoke... 102 // for(int i=0;i<PROPERTY_NUM;i++) 103 // { 104 // (default_edgemaps[i])[e]=property_defaults[i]; 105 // } 106 } -
gui/mapstorage.h
r1442 r1509 81 81 ///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage. 82 82 std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();}; 83 84 ///This function sets a default base value for the newly created node 85 void init_maps_for_node(NodeIt); 86 87 ///This function sets a default base value for the newly created node 88 void init_maps_for_edge(Graph::Edge); 83 89 }; 84 90
Note: See TracChangeset
for help on using the changeset viewer.