Changeset 1739

Show
Ignore:
Timestamp:
12/01/09 19:39:20 (2 years ago)
Author:
andreas
Message:

fixed display of lattice vectors in LatticeOverlay? / made ResolutionRings? in RlistOverlay? customizable / some tweaks in giplt_dm

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/qt_gui/src/ex/gui/lib/lattice_overlay_base.cc

    r1685 r1739  
    115115    qpoly << QPoint(static_cast<int>(v2[0]),static_cast<int>(v2[1])); 
    116116    qpoly << QPoint(static_cast<int>(v3[0]),static_cast<int>(v3[1])); 
    117     pnt.drawPolyline(qpoly); 
     117    pnt.drawPolygon(qpoly); 
    118118  } 
    119119} 
  • branches/qt_gui/src/ex/gui/lib/rlist_overlay.cc

    r1734 r1739  
    1414*/ 
    1515 
     16#include <algorithm> 
    1617#include <boost/format.hpp> 
    1718 
     
    3738 
    3839RListOverlaySettings::RListOverlaySettings(const QColor& ac, const QColor& pc, int ssize, int sstr,  
    39                                            bool rl, bool sl, const QColor& c1, const QColor& c2, const QColor& c3,  
     40                                           bool rl, bool sl, const QColor& c1, const QColor& c2, const QColor& c3, 
     41                                           const std::vector<double>& rlim_l, 
    4042                                           QWidget* p): 
    4143  PointlistOverlayBaseSettings(ac,pc,ssize,sstr,p), 
     
    4446  color1(c1), 
    4547  color2(c2), 
    46   color3(c3) 
     48  color3(c3), 
     49  rlim_list_(rlim_l) 
    4750{ 
    4851  QPixmap pm(32,32); 
     
    6366  hb->addWidget(c2_b_); 
    6467  hb->addWidget(c3_b_); 
     68 
     69  rlim_edit_=new QLineEdit(this); 
     70  rlim_edit_->setValidator(new QDoubleValidator(0.0,100.0,2,rlim_edit_)); 
     71  rlim_widget_=new QListWidget(this); 
     72  for(std::vector<double>::const_iterator it=rlim_list_.begin();it!=rlim_list_.end();++it){ 
     73    new QListWidgetItem(QString::number(*it), rlim_widget_); 
     74  } 
     75  QPushButton* b=new QPushButton("Add Resolution Ring"); 
     76  connect(b,SIGNAL(pressed()), this, SLOT(OnLimAdd())); 
     77  QPushButton* b2=new QPushButton("Remove Resolution Ring"); 
     78  connect(b2,SIGNAL(pressed()), this, SLOT(OnLimRemove())); 
     79   
     80   
     81  QVBoxLayout* vb = new QVBoxLayout; 
     82  QHBoxLayout* hb2 = new QHBoxLayout; 
     83  QVBoxLayout* vb2 = new QVBoxLayout; 
     84  QVBoxLayout* vb3 = new QVBoxLayout; 
     85  vb3->addWidget(rlim_edit_); 
     86  vb3->addWidget(rlim_widget_); 
     87  hb2->addLayout(vb3); 
     88  vb2->addWidget(b); 
     89  vb2->addWidget(b2); 
     90  hb2->addLayout(vb2); 
    6591 
    6692  QCheckBox* cb1 = new QCheckBox("Display Resolution Limits"); 
     
    7197  connect(cb2,SIGNAL(stateChanged(int)),this,SLOT(OnSymRel(int))); 
    7298 
    73   QVBoxLayout* vb = new QVBoxLayout; 
    7499  vb->addLayout(hb); 
     100  vb->addLayout(hb2); 
    75101  vb->addWidget(cb1); 
    76102  vb->addWidget(cb2); 
     
    122148  } 
    123149} 
    124  
     150void RListOverlaySettings::OnLimAdd() 
     151
     152  new QListWidgetItem(rlim_edit_->text(), rlim_widget_); 
     153  rlim_list_.push_back(rlim_edit_->text().toDouble()); 
     154
     155 
     156void RListOverlaySettings::OnLimRemove() 
     157
     158  double val=rlim_widget_->currentItem()->text().toDouble(); 
     159  delete rlim_widget_->currentItem(); 
     160  std::vector<double>::iterator pos=std::find(rlim_list_.begin(),rlim_list_.end(),val); 
     161  if(pos!=rlim_list_.end()){ 
     162    rlim_list_.erase(pos); 
     163  } 
     164
    125165 
    126166///////////////////////////// 
     
    132172  color2_(QColor(QColor(255,255,0))), 
    133173  color3_(QColor(QColor(32,147,172))), 
    134   res_limit_flag_(true), 
     174  res_limit_flag_(false), 
    135175  rlim_list_(), 
    136176  sym_points_flag_(true), 
     
    144184  SetReferenceCell(rlist_.GetUnitCell()); 
    145185 
    146   // hardcoded for now 
    147   rlim_list_.push_back(20.0); 
    148   rlim_list_.push_back(4.0); 
    149186} 
    150187 
     
    154191    RListOverlaySettings set(active_color_,passive_color_,symbolsize_,symbolstrength_, 
    155192                             res_limit_flag_,sym_points_flag_,color1_,color2_,color3_, 
     193                             rlim_list_, 
    156194                             e->parentWidget()); 
    157195    if(set.exec()==QDialog::Accepted) { 
     
    159197      res_limit_flag_=set.res_lim; 
    160198      sym_points_flag_=set.sym_rel; 
     199      rlim_list_=set.rlim_list_; 
    161200      color1_=set.color1; 
    162201      color2_=set.color2; 
     
    262301void RListOverlay::DrawResolutionCircles(QPainter& pnt, DataViewerPanel* dvp, const QColor& color) 
    263302{ 
    264   //Vec3 sampling = dvp->GetPixelSampling(); 
    265   // bad hack: assume uniform sampling 
    266   double sampling = dvp->GetPixelSampling()[0]; 
     303  double sampling_x = dvp->GetPixelSampling()[0]; 
     304  double sampling_y = dvp->GetPixelSampling()[1]; 
    267305   
    268306  pnt.setPen(color); 
     
    273311   
    274312  for(std::vector<double>::const_iterator it=rlim_list_.begin();it!=rlim_list_.end();++it) { 
    275     int radius = static_cast<int>(1.0/((*it)*sampling)*dvp->GetZoomScale()); 
     313    int radius_x = static_cast<int>(1.0/((*it)*sampling_x)*dvp->GetZoomScale()); 
     314    int radius_y = static_cast<int>(1.0/((*it)*sampling_y)*dvp->GetZoomScale()); 
    276315     
    277     pnt.drawEllipse(center,radius,radius); 
    278     pnt.drawText(center.x()+radius+10,center.y(),QString("%1").arg(*it,0,'f',2)); 
     316    pnt.drawEllipse(center,radius_x,radius_y); 
     317    pnt.drawText(center.x()+radius_x+10,center.y(),QString("%1").arg(*it,0,'f',2)); 
    279318  } 
    280319} 
     
    310349} 
    311350 
     351void RListOverlay::AddResolutionRing(double value) 
     352{ 
     353  rlim_list_.push_back(value); 
     354} 
     355 
     356void RListOverlay::RemoveResolutionRing(double value) 
     357{ 
     358    std::vector<double>::iterator pos=find(rlim_list_.begin(),rlim_list_.end(),value); 
     359    if(pos!=rlim_list_.end()){ 
     360        rlim_list_.erase(pos); 
     361    } 
     362} 
     363 
     364void RListOverlay::DisplayResolutionRings(bool flag) 
     365{ 
     366  res_limit_flag_=flag; 
     367} 
     368 
    312369}}}//ns 
  • branches/qt_gui/src/ex/gui/lib/rlist_overlay.hh

    r1644 r1739  
    1717#define IPLT_EX_GUI_RLIST_OVERLAY_HH 
    1818 
     19#include <QListWidget> 
    1920#include <iplt/ex/lattice.hh> 
    2021#include <iplt/ex/reflection_list.hh> 
     
    3637  RListOverlaySettings(const QColor& ac, const QColor& pc, int ssize, int sstr,  
    3738                       bool rl, bool sl, const QColor& c1, const QColor& c2, const QColor& c3, 
     39                       const std::vector<double>& rlim_list, 
    3840                       QWidget* p); 
    3941 
     
    4446  void OnColor2(); 
    4547  void OnColor3(); 
     48  void OnLimAdd(); 
     49  void OnLimRemove(); 
    4650 
    4751public: 
     
    4953  bool sym_rel; 
    5054  QColor color1,color2,color3; 
     55  std::vector<double> rlim_list_; 
    5156 
    5257private: 
     
    5459  QPushButton* c2_b_; 
    5560  QPushButton* c3_b_; 
     61  QListWidget* rlim_widget_; 
     62  QLineEdit* rlim_edit_; 
    5663}; 
    5764 
     
    6875 
    6976  ReflectionList GetReflectionList() const; 
     77   
     78  virtual void AddResolutionRing(double value); 
     79  virtual void RemoveResolutionRing(double value); 
     80  virtual void DisplayResolutionRings(bool flag); 
    7081 
    7182protected: 
  • branches/qt_gui/src/ex/gui/pymod/export_overlays.cc

    r1639 r1739  
    5757 
    5858  class_<RListOverlay,bases<LatticeOverlayBase>,boost::noncopyable>("RListOverlay",init<const ReflectionList&, optional<const string&> >()) 
     59    .def("AddResolutionRing",&RListOverlay::AddResolutionRing) 
     60    .def("RemoveResolutionRing",&RListOverlay::RemoveResolutionRing) 
     61    .def("DisplayResolutionRings",&RListOverlay::DisplayResolutionRings) 
    5962    .def("GetReflectionList",&RListOverlay::GetReflectionList) 
    6063    ; 
  • branches/qt_gui/src/ex/proc/diff/dm/dm.py

    r1725 r1739  
    210210        QObject.connect(self.pb_,SIGNAL("clicked()"),self.OnPrev) 
    211211        vb.addWidget(self.pb_) 
     212        self.jb_=QPushButton("Jump to Pattern") 
     213        QObject.connect(self.jb_,SIGNAL("clicked()"),self.OnJump) 
     214        vb.addWidget(self.jb_) 
    212215        self.setLayout(vb) 
    213216    def OnNext(self): 
     
    231234        else: 
    232235            self.emit(SIGNAL("LoadImage"),self.im_list_[self.current_]) 
     236 
     237    def OnJump(self): 
     238        (name,ok)=QInputDialog.getText(self,"Jump to Image","Image Name:") 
     239        if not ok: 
     240          return 
     241        self.DoJump(name) 
     242 
     243    def DoJump(self,name): 
     244        i=0 
     245        for (imname,filename) in self.im_list_: 
     246            if name == imname: 
     247                if os.path.isfile(os.path.join(self.wdir_,self.im_list_[i][0],"ignore")): 
     248                    return 
     249                self.current_=i 
     250                self.check_vis() 
     251                print self.im_list_[self.current_] 
     252                self.emit(SIGNAL("LoadImage"),self.im_list_[self.current_]) 
     253                return  
     254            i+=1 
     255        msg_box=QMessageBox() 
     256        msg_box.setText("The image %s could not be found." % (name) ) 
     257        msg_box.exec_() 
    233258             
    234259    def check_vis(self): 
     
    333358        self.verify_lattice_view_=VerifyLattice(self.pinfo_,self.im_list_w_) 
    334359        QObject.connect(self.im_list_w_,SIGNAL("LoadImage"),self.OnLoadVerifiedLattice) 
    335         self.im_list_w_.OnNext(
     360        self.im_list_w_.DoJump(self.w_im_label_.text()
    336361 
    337362    def OnLoadVerifiedLattice(self,im_list_entry): 
  • branches/qt_gui/src/ex/proc/diff/dm/view_tilt.py

    r1696 r1739  
    3737        sigiobs=rp.Get("sigiobs") 
    3838        blist1.Add(rr,iobs,1.0/(sigiobs*sigiobs)) 
    39         pd2.AddXYE(rr,iobs,sigiobs,[str(rp.GetIndex())]
     39        pd2.AddXYE(rr,iobs,sigiobs,str(rp.GetIndex())
    4040 
    4141    pd1=gui.PlotData() 
     
    140140 
    141141        self.rov_=exgui.RListOverlay(rlist) 
     142        self.rov_.AddResolutionRing(5.0) 
     143        self.rov_.AddResolutionRing(4.0) 
     144        self.rov_.AddResolutionRing(3.0) 
     145        self.rov_.AddResolutionRing(2.0) 
     146        self.rov_.DisplayResolutionRings(True) 
    142147        self.rov_.SetReferenceCell(self.suc_) 
    143148