hegyi@1510: #include hegyi@1510: #include hegyi@1510: #include hegyi@1510: hegyi@1510: hegyi@1512: int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge) hegyi@1510: { hegyi@1512: if(edge==INVALID) hegyi@1510: { hegyi@1512: for (EdgeIt i(g); i!=INVALID; ++i) hegyi@1512: { hegyi@1512: int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i]; hegyi@1512: if(w>=0) hegyi@1512: { hegyi@1512: edgesmap[i]->property_width_pixels().set_value(w); hegyi@1512: } hegyi@1512: } hegyi@1512: } hegyi@1512: else hegyi@1512: { hegyi@1512: int w=(int)(*(mapstorage.edgemap_storage)[mapname])[edge]; hegyi@1510: if(w>=0) hegyi@1510: { hegyi@1512: edgesmap[edge]->property_width_pixels().set_value(w); hegyi@1510: } hegyi@1510: } hegyi@1510: return 0; hegyi@1510: }; hegyi@1510: hegyi@1512: int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Graph::Edge edge) hegyi@1510: { hegyi@1510: hegyi@1510: //function maps the range of the maximum and hegyi@1510: //the minimum of the nodemap to the range of hegyi@1510: //green in RGB hegyi@1512: if(edge==INVALID) hegyi@1512: { hegyi@1510: hegyi@1512: for (EdgeIt i(g); i!=INVALID; ++i) hegyi@1512: { hegyi@1512: double w=(*(mapstorage.edgemap_storage)[mapname])[i]; hegyi@1512: double max=mapstorage.maxOfEdgeMap(mapname); hegyi@1512: double min=mapstorage.minOfEdgeMap(mapname); hegyi@1510: hegyi@1512: //std::cout<property_fill_color_gdk().set_value(color); hegyi@1512: } hegyi@1512: } hegyi@1512: else hegyi@1510: { hegyi@1512: double w=(*(mapstorage.edgemap_storage)[mapname])[edge]; hegyi@1512: double max=mapstorage.maxOfEdgeMap(mapname); hegyi@1512: double min=mapstorage.minOfEdgeMap(mapname); hegyi@1512: hegyi@1512: //std::cout<property_fill_color_gdk().set_value(color); hegyi@1510: } hegyi@1510: return 0; hegyi@1510: }; hegyi@1510: hegyi@1512: int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Graph::Edge edge) hegyi@1510: { hegyi@1510: hegyi@1510: //the number in the map will be written on the edge hegyi@1510: //EXCEPT when the name of the map is Text, because hegyi@1510: //in that case empty string will be written, because hegyi@1510: //that is the deleter map hegyi@1510: //\todo isn't it a bit woodcutter? hegyi@1510: hegyi@1512: if(edge==INVALID) hegyi@1510: { hegyi@1512: for (EdgeIt i(g); i!=INVALID; ++i) hegyi@1510: { hegyi@1512: if(mapname!=edge_property_strings[E_TEXT]) hegyi@1512: { hegyi@1512: double number=(*(mapstorage.edgemap_storage)[mapname])[i]; hegyi@1512: int length=1; hegyi@1512: //if number is smaller than one, length would be negative, or invalid hegyi@1512: if(number>=1) hegyi@1512: { hegyi@1512: length=(int)(floor(log(number)/log(10)))+1; hegyi@1512: } hegyi@1512: int maxpos=(int)(pow(10,length-1)); hegyi@1512: int strl=length+1+RANGE; hegyi@1512: char * str=new char[strl]; hegyi@1512: str[length]='.'; hegyi@1512: str[strl]='\0'; hegyi@1512: hegyi@1512: for(int j=0;jproperty_text().set_value(str); hegyi@1512: } hegyi@1512: else hegyi@1512: { hegyi@1512: edgetextmap[i]->property_text().set_value(""); hegyi@1512: } hegyi@1512: } hegyi@1512: hegyi@1512: } hegyi@1512: else hegyi@1512: { hegyi@1512: if(mapname!=edge_property_strings[E_TEXT]) hegyi@1512: { hegyi@1512: double number=(*(mapstorage.edgemap_storage)[mapname])[edge]; hegyi@1510: int length=1; hegyi@1510: //if number is smaller than one, length would be negative, or invalid hegyi@1510: if(number>=1) hegyi@1510: { hegyi@1510: length=(int)(floor(log(number)/log(10)))+1; hegyi@1510: } hegyi@1510: int maxpos=(int)(pow(10,length-1)); hegyi@1510: int strl=length+1+RANGE; hegyi@1510: char * str=new char[strl]; hegyi@1510: str[length]='.'; hegyi@1510: str[strl]='\0'; hegyi@1510: hegyi@1510: for(int j=0;jproperty_text().set_value(str); hegyi@1510: } hegyi@1510: else hegyi@1510: { hegyi@1512: edgetextmap[edge]->property_text().set_value(""); hegyi@1510: } hegyi@1512: hegyi@1510: } hegyi@1512: hegyi@1510: return 0; hegyi@1512: hegyi@1510: };