mapstorage.cc
changeset 184 4e8704aae278
parent 177 40f3006fba2e
child 191 af2ed974ab68
equal deleted inserted replaced
29:e27b375c30f0 30:518f19d189e3
    15  * purpose.
    15  * purpose.
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 #include "mapstorage.h"
    19 #include "mapstorage.h"
       
    20 #include "nbtab.h"
    20 #include "gui_writer.h"
    21 #include "gui_writer.h"
    21 #include "gui_reader.h"
    22 #include "gui_reader.h"
    22 #include <limits>
    23 #include <limits>
    23 #include <cmath>
    24 #include <cmath>
    24 #include <gtkmm.h>
    25 #include <gtkmm.h>
    25 
    26 
    26 const double i_d=20;
    27 const double i_d=20;
    27 const double a_d=0.05;
    28 const double a_d=0.05;
    28 const double p_d=40000;
    29 const double p_d=40000;
    29 
    30 
    30 MapStorage::MapStorage() : modified(false), file_name(""), arrow_pos_read_ok(false), iterations(i_d), attraction(a_d), propulsation(p_d)
    31 MapStorage::MapStorage(NoteBookTab& tab) : mytab(tab), modified(false), file_name(""), arrow_pos_read_ok(false), iterations(i_d), attraction(a_d), propulsation(p_d), background_set(false)
    31 {
    32 {
    32   nodemap_storage["coordinates_x"] = new Graph::NodeMap<double>(graph);
    33   nodemap_storage["coordinates_x"] = new Graph::NodeMap<double>(graph);
    33   coords.setXMap(*nodemap_storage["coordinates_x"]);
    34   coords.setXMap(*nodemap_storage["coordinates_x"]);
    34   nodemap_storage["coordinates_y"] = new Graph::NodeMap<double>(graph);
    35   nodemap_storage["coordinates_y"] = new Graph::NodeMap<double>(graph);
    35   coords.setYMap(*nodemap_storage["coordinates_y"]);
    36   coords.setYMap(*nodemap_storage["coordinates_y"]);
   550 
   551 
   551 void MapStorage::redesign_data_changed()
   552 void MapStorage::redesign_data_changed()
   552 {
   553 {
   553   signal_design_win.emit(attraction, propulsation, iterations);
   554   signal_design_win.emit(attraction, propulsation, iterations);
   554 }
   555 }
       
   556 
       
   557 void MapStorage::setBackground(const std::string& file_name)
       
   558 {
       
   559   if (file_name == background_file_name) return;
       
   560   if (file_name == "")
       
   561   {
       
   562     background_file_name = "";
       
   563     background_set = false;
       
   564   }
       
   565   else
       
   566   {
       
   567     background_file_name = file_name;
       
   568     background_set = true;
       
   569   }
       
   570   mytab.gd_canvas->setBackground();
       
   571 }
       
   572 
       
   573 const std::string& MapStorage::getBackgroundFilename()
       
   574 {
       
   575   return background_file_name;
       
   576 }
       
   577 
       
   578 bool MapStorage::isBackgroundSet()
       
   579 {
       
   580   return background_set;
       
   581 }
       
   582 
       
   583 double MapStorage::getBackgroundScaling()
       
   584 {
       
   585   return background_scaling;
       
   586 }
       
   587 
       
   588 void MapStorage::setBackgroundScaling(double scaling)
       
   589 {
       
   590   background_scaling = scaling;
       
   591 }