Changeset 157:7e6ad28aeb9e in glemon-0.x
- Timestamp:
- 10/02/06 20:52:00 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@2970
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas-edge.cc
r147 r157 2 2 #include <cmath> 3 3 4 const int minimum_edge_width=2; 4 5 5 6 int GraphDisplayerCanvas::resetEdgeWidth (Edge edge) … … 25 26 w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH)); 26 27 } 28 if(zoomtrack) 29 { 30 double actual_ppu=get_pixels_per_unit(); 31 w=(int)(w/actual_ppu*fixed_zoom_factor); 32 } 27 33 edgesmap[i]->setLineWidth(w); 28 34 } … … 55 61 double v=fabs((*actual_map)[i]); 56 62 int w; 57 if(min==max) 58 { 59 w=(int)(edge_property_defaults[E_WIDTH]); 60 } 61 else 62 { 63 w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH)); 63 if(autoscale) 64 { 65 if(min==max) 66 { 67 w=(int)(edge_property_defaults[E_WIDTH]); 68 } 69 else 70 { 71 w=(int)(minimum_edge_width+(v-min)/(max-min)*(edge_width-minimum_edge_width)); 72 } 73 } 74 else 75 { 76 w=(int)(v*edge_width); 77 } 78 if(w<minimum_edge_width) 79 { 80 w=minimum_edge_width; 81 } 82 if(zoomtrack) 83 { 84 double actual_ppu=get_pixels_per_unit(); 85 w=(int)(w/actual_ppu*fixed_zoom_factor); 64 86 } 65 87 edgesmap[i]->setLineWidth(w); -
graph_displayer_canvas-node.cc
r156 r157 2 2 #include <cmath> 3 3 4 const int minimum_node_radius= 0;4 const int minimum_node_radius=5; 5 5 6 6 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node) … … 26 26 else 27 27 { 28 w=(int)(minimum_node_radius+(v-min)/(max-min)*(radius_ max-minimum_node_radius));28 w=(int)(minimum_node_radius+(v-min)/(max-min)*(radius_size-minimum_node_radius)); 29 29 } 30 30 } 31 31 else 32 32 { 33 w=(int)(v*radius_ max);34 } 35 36 if(w< 5)37 { 38 w= 5;33 w=(int)(v*radius_size); 34 } 35 36 if(w<minimum_node_radius) 37 { 38 w=minimum_node_radius; 39 39 } 40 40 -
graph_displayer_canvas-zoom.cc
r156 r157 9 9 { 10 10 propertyChange(false, N_RADIUS); 11 propertyChange(true, E_WIDTH); 11 12 } 12 13 } … … 18 19 if(zoomtrack) 19 20 { 21 propertyChange(true, E_WIDTH); 20 22 propertyChange(false, N_RADIUS); 21 23 } … … 43 45 if(zoomtrack) 44 46 { 47 propertyChange(true, E_WIDTH); 45 48 propertyChange(false, N_RADIUS); 46 49 } … … 54 57 if(zoomtrack) 55 58 { 59 propertyChange(true, E_WIDTH); 56 60 propertyChange(false, N_RADIUS); 57 61 } -
graph_displayer_canvas.cc
r156 r157 6 6 nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0), 7 7 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), 8 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_ min(10), radius_max(40), radius_unit(1), mytab(mainw)8 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), mytab(mainw) 9 9 { 10 10 //base event handler is move tool … … 228 228 } 229 229 230 void GraphDisplayerCanvas::set NodeView(bool autoscale_p, bool zoomtrack_p, double min_p, double max_p, double unit_p)230 void GraphDisplayerCanvas::setView(bool autoscale_p, bool zoomtrack_p, double width_p, double radius_p) 231 231 { 232 232 autoscale=autoscale_p; 233 radius_min=min_p; 234 radius_max=max_p; 235 radius_unit=unit_p; 233 edge_width=width_p; 234 radius_size=radius_p; 236 235 237 236 if((!zoomtrack) && zoomtrack_p) … … 243 242 244 243 propertyChange(false, N_RADIUS); 245 } 246 247 void GraphDisplayerCanvas::getNodeView(bool & autoscale_p, bool & zoomtrack_p, double& min_p, double& max_p, double& unit_p) 244 propertyChange(true, E_WIDTH); 245 } 246 247 void GraphDisplayerCanvas::getView(bool & autoscale_p, bool & zoomtrack_p, double& width_p, double& radius_p) 248 248 { 249 249 autoscale_p=autoscale; 250 250 zoomtrack_p=zoomtrack; 251 min_p=radius_min; 252 max_p=radius_max; 253 unit_p=radius_unit; 254 } 251 width_p=edge_width; 252 radius_p=radius_size; 253 } -
graph_displayer_canvas.h
r156 r157 288 288 289 289 ///Sets node representation settings 290 void set NodeView(bool, bool, double, double, double);290 void setView(bool, bool, double, double); 291 291 292 292 ///Gets node representation settings 293 void get NodeView(bool &, bool &, double&, double&, double&);293 void getView(bool &, bool &, double&, double&); 294 294 295 295 ///draws the graph … … 393 393 double fixed_zoom_factor; 394 394 395 ///Minimum node radius 396 double radius_min; 397 398 ///Maximum node radius 399 double radius_max; 400 401 ///Node radius unit 402 double radius_unit; 395 ///Node radius size 396 double radius_size; 397 398 ///Edge width 399 double edge_width; 403 400 404 401 private: -
main_win.cc
r156 r157 209 209 table2.attach(*auto_scale, 0,2,0,1); 210 210 211 Gtk::Label * unit_label= new Gtk::Label("Unit:");212 // table2.attach(*unit_label, 2,3,0,1);211 Gtk::Label * width_label= new Gtk::Label("Edge Width:"); 212 table2.attach(*width_label, 0,1,1,2); 213 213 214 Gtk::Adjustment * adjustment_unit=new Gtk::Adjustment(20, 5, 200, 5, 10); 215 216 radius_unit = new Gtk::SpinButton(*adjustment_unit, 5,0); 217 radius_unit->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); 218 // table2.attach(*radius_unit, 3,4,0,1); 219 220 Gtk::Label * min_label= new Gtk::Label("Min:"); 221 // table2.attach(*min_label, 0,1,1,2); 214 Gtk::Adjustment * adjustment_width=new Gtk::Adjustment(20, 1, 200, 5, 10); 222 215 223 Gtk::Adjustment * adjustment_min=new Gtk::Adjustment(20, 5, 200, 5, 10); 224 225 radius_min = new Gtk::SpinButton(*adjustment_min, 5,0); 226 radius_min->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); 227 // table2.attach(*radius_min, 1,2,1,2); 228 229 Gtk::Label * max_label= new Gtk::Label("Size:"); 230 table2.attach(*max_label, 2,3,1,2); 216 edge_width = new Gtk::SpinButton(*adjustment_width, 5,0); 217 edge_width->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); 218 table2.attach(*edge_width, 1,2,1,2); 219 220 Gtk::Label * radius_label= new Gtk::Label("Node Radius:"); 221 table2.attach(*radius_label, 2,3,1,2); 231 222 232 Gtk::Adjustment * adjustment_ max=new Gtk::Adjustment(20, 0, 200, 5, 10);233 234 radius_ max = new Gtk::SpinButton(*adjustment_max, 5,0);235 radius_ max->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));236 table2.attach(*radius_ max, 3,4,1,2);223 Gtk::Adjustment * adjustment_radius=new Gtk::Adjustment(20, 0, 500, 5, 10); 224 225 radius_size = new Gtk::SpinButton(*adjustment_radius, 5,0); 226 radius_size->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); 227 table2.attach(*radius_size, 3,4,1,2); 237 228 238 229 zoom_track = new Gtk::CheckButton("Zoom tracking"); … … 242 233 243 234 244 //vbox.pack_start(hbox, Gtk::PACK_SHRINK);245 235 table.attach(table2, 1, 2, 0, 2, Gtk::SHRINK, Gtk::SHRINK); 246 236 … … 253 243 active_tool = MOVE; 254 244 255 //vbox.pack_start(notebook);256 245 table.attach(notebook,0,2,2,3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL); 257 246 … … 369 358 bool autoscale; 370 359 bool zoomtrack; 371 double min;372 double max;360 double width; 361 double radius; 373 362 double unit; 374 tabs[active_tab]->getNodeView(autoscale, zoomtrack, min, max, unit); 375 radius_min->set_value(min); 376 radius_max->set_value(max); 377 radius_unit->set_value(unit); 363 tabs[active_tab]->getView(autoscale, zoomtrack, width, radius); 364 edge_width->set_value(width); 365 radius_size->set_value(radius); 378 366 zoom_track->set_active(zoomtrack); 379 367 auto_scale->set_active(autoscale); … … 544 532 void MainWin::nodeViewChanged() 545 533 { 546 double min=radius_min->get_value();547 double max=radius_max->get_value();548 double unit =radius_unit->get_value();534 double width=edge_width->get_value(); 535 double radius=radius_size->get_value(); 536 double unit; 549 537 bool zoomtrack=zoom_track->get_active(); 550 538 bool autoscale=auto_scale->get_active(); 551 tabs[active_tab]->set NodeView(autoscale, zoomtrack, min, max, unit);552 } 539 tabs[active_tab]->setView(autoscale, zoomtrack, width, radius); 540 } -
main_win.h
r156 r157 35 35 36 36 ///Minimum and maximum node radius entry 37 Gtk::SpinButton * radius_ min, * radius_max, * radius_unit;37 Gtk::SpinButton * radius_size, * edge_width; 38 38 39 39 ///The notebook that has tabs (\ref NoteBookTab) with different graphs. -
nbtab.cc
r156 r157 219 219 } 220 220 221 void NoteBookTab::set NodeView(bool autoscale, bool zoomtrack, double min, double max, double unit)222 { 223 gd_canvas->set NodeView(autoscale, zoomtrack, min, max, unit);224 } 225 226 void NoteBookTab::get NodeView(bool & autoscale, bool & zoomtrack, double& min, double& max, double& unit)227 { 228 gd_canvas->get NodeView(autoscale, zoomtrack, min, max, unit);229 } 221 void NoteBookTab::setView(bool autoscale, bool zoomtrack, double width, double radius) 222 { 223 gd_canvas->setView(autoscale, zoomtrack, width, radius); 224 } 225 226 void NoteBookTab::getView(bool & autoscale, bool & zoomtrack, double& width, double& radius) 227 { 228 gd_canvas->getView(autoscale, zoomtrack, width, radius); 229 } -
nbtab.h
r156 r157 159 159 160 160 ///Sets node representation settings 161 void set NodeView(bool, bool, double, double, double);161 void setView(bool, bool, double, double); 162 162 163 163 ///Gets node representation settings 164 void get NodeView(bool &, bool &, double&, double&, double&);164 void getView(bool &, bool &, double&, double&); 165 165 }; 166 166
Note: See TracChangeset
for help on using the changeset viewer.