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