Changeset 1739
- Timestamp:
- 12/01/09 19:39:20 (2 years ago)
- Files:
-
- branches/qt_gui/src/ex/gui/lib/lattice_overlay_base.cc (modified) (1 diff)
- branches/qt_gui/src/ex/gui/lib/rlist_overlay.cc (modified) (13 diffs)
- branches/qt_gui/src/ex/gui/lib/rlist_overlay.hh (modified) (6 diffs)
- branches/qt_gui/src/ex/gui/pymod/export_overlays.cc (modified) (1 diff)
- branches/qt_gui/src/ex/proc/diff/dm/dm.py (modified) (3 diffs)
- branches/qt_gui/src/ex/proc/diff/dm/view_tilt.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/qt_gui/src/ex/gui/lib/lattice_overlay_base.cc
r1685 r1739 115 115 qpoly << QPoint(static_cast<int>(v2[0]),static_cast<int>(v2[1])); 116 116 qpoly << QPoint(static_cast<int>(v3[0]),static_cast<int>(v3[1])); 117 pnt.drawPoly line(qpoly);117 pnt.drawPolygon(qpoly); 118 118 } 119 119 } branches/qt_gui/src/ex/gui/lib/rlist_overlay.cc
r1734 r1739 14 14 */ 15 15 16 #include <algorithm> 16 17 #include <boost/format.hpp> 17 18 … … 37 38 38 39 RListOverlaySettings::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, 40 42 QWidget* p): 41 43 PointlistOverlayBaseSettings(ac,pc,ssize,sstr,p), … … 44 46 color1(c1), 45 47 color2(c2), 46 color3(c3) 48 color3(c3), 49 rlim_list_(rlim_l) 47 50 { 48 51 QPixmap pm(32,32); … … 63 66 hb->addWidget(c2_b_); 64 67 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); 65 91 66 92 QCheckBox* cb1 = new QCheckBox("Display Resolution Limits"); … … 71 97 connect(cb2,SIGNAL(stateChanged(int)),this,SLOT(OnSymRel(int))); 72 98 73 QVBoxLayout* vb = new QVBoxLayout;74 99 vb->addLayout(hb); 100 vb->addLayout(hb2); 75 101 vb->addWidget(cb1); 76 102 vb->addWidget(cb2); … … 122 148 } 123 149 } 124 150 void RListOverlaySettings::OnLimAdd() 151 { 152 new QListWidgetItem(rlim_edit_->text(), rlim_widget_); 153 rlim_list_.push_back(rlim_edit_->text().toDouble()); 154 } 155 156 void 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 } 125 165 126 166 ///////////////////////////// … … 132 172 color2_(QColor(QColor(255,255,0))), 133 173 color3_(QColor(QColor(32,147,172))), 134 res_limit_flag_( true),174 res_limit_flag_(false), 135 175 rlim_list_(), 136 176 sym_points_flag_(true), … … 144 184 SetReferenceCell(rlist_.GetUnitCell()); 145 185 146 // hardcoded for now147 rlim_list_.push_back(20.0);148 rlim_list_.push_back(4.0);149 186 } 150 187 … … 154 191 RListOverlaySettings set(active_color_,passive_color_,symbolsize_,symbolstrength_, 155 192 res_limit_flag_,sym_points_flag_,color1_,color2_,color3_, 193 rlim_list_, 156 194 e->parentWidget()); 157 195 if(set.exec()==QDialog::Accepted) { … … 159 197 res_limit_flag_=set.res_lim; 160 198 sym_points_flag_=set.sym_rel; 199 rlim_list_=set.rlim_list_; 161 200 color1_=set.color1; 162 201 color2_=set.color2; … … 262 301 void RListOverlay::DrawResolutionCircles(QPainter& pnt, DataViewerPanel* dvp, const QColor& color) 263 302 { 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]; 267 305 268 306 pnt.setPen(color); … … 273 311 274 312 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()); 276 315 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)); 279 318 } 280 319 } … … 310 349 } 311 350 351 void RListOverlay::AddResolutionRing(double value) 352 { 353 rlim_list_.push_back(value); 354 } 355 356 void 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 364 void RListOverlay::DisplayResolutionRings(bool flag) 365 { 366 res_limit_flag_=flag; 367 } 368 312 369 }}}//ns branches/qt_gui/src/ex/gui/lib/rlist_overlay.hh
r1644 r1739 17 17 #define IPLT_EX_GUI_RLIST_OVERLAY_HH 18 18 19 #include <QListWidget> 19 20 #include <iplt/ex/lattice.hh> 20 21 #include <iplt/ex/reflection_list.hh> … … 36 37 RListOverlaySettings(const QColor& ac, const QColor& pc, int ssize, int sstr, 37 38 bool rl, bool sl, const QColor& c1, const QColor& c2, const QColor& c3, 39 const std::vector<double>& rlim_list, 38 40 QWidget* p); 39 41 … … 44 46 void OnColor2(); 45 47 void OnColor3(); 48 void OnLimAdd(); 49 void OnLimRemove(); 46 50 47 51 public: … … 49 53 bool sym_rel; 50 54 QColor color1,color2,color3; 55 std::vector<double> rlim_list_; 51 56 52 57 private: … … 54 59 QPushButton* c2_b_; 55 60 QPushButton* c3_b_; 61 QListWidget* rlim_widget_; 62 QLineEdit* rlim_edit_; 56 63 }; 57 64 … … 68 75 69 76 ReflectionList GetReflectionList() const; 77 78 virtual void AddResolutionRing(double value); 79 virtual void RemoveResolutionRing(double value); 80 virtual void DisplayResolutionRings(bool flag); 70 81 71 82 protected: branches/qt_gui/src/ex/gui/pymod/export_overlays.cc
r1639 r1739 57 57 58 58 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) 59 62 .def("GetReflectionList",&RListOverlay::GetReflectionList) 60 63 ; branches/qt_gui/src/ex/proc/diff/dm/dm.py
r1725 r1739 210 210 QObject.connect(self.pb_,SIGNAL("clicked()"),self.OnPrev) 211 211 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_) 212 215 self.setLayout(vb) 213 216 def OnNext(self): … … 231 234 else: 232 235 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_() 233 258 234 259 def check_vis(self): … … 333 358 self.verify_lattice_view_=VerifyLattice(self.pinfo_,self.im_list_w_) 334 359 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()) 336 361 337 362 def OnLoadVerifiedLattice(self,im_list_entry): branches/qt_gui/src/ex/proc/diff/dm/view_tilt.py
r1696 r1739 37 37 sigiobs=rp.Get("sigiobs") 38 38 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())) 40 40 41 41 pd1=gui.PlotData() … … 140 140 141 141 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) 142 147 self.rov_.SetReferenceCell(self.suc_) 143 148
