19 #if QT_VERSION < 0x040000 22 #include <QMouseEvent> 26 #include "msdevstudio/MSconfig.h" 62 #include <qapplication.h> 65 #if QT_VERSION < 0x040000 66 #include <qfiledialog.h> 70 #include <q3filedialog.h> 71 #include <QtGui/QImageWriter> 76 #include <qmessagebox.h> 78 #include <qsettings.h> 79 #include <qstatusbar.h> 80 #include <qwaitcondition.h> 112 #if QT_VERSION < 0x040000 114 const char * name, Qt::WFlags f )
117 const char * name, Qt::WFlags f )
121 m_image_dialog ( 0 ),
155 #if QT_VERSION < 0x040000 165 QString::null, &ok );
167 if ( ok ==
false )
return;
176 #if QT_VERSION < 0x040000 178 QObject * parent = ag -> parent ();
185 for (
unsigned int i = 0; i<5; i++){
188 QString::null, &ok );
191 if ((ok==
false) || ( entry ==
"" ))
return;
194 #if QT_VERSION < 0x040000 202 ag -> addAction ( action );
205 action -> setToggleAction (
true );
218 QString::null, &ok );
220 const string name ( entry.
latin1() );
241 const string fitter ( name.
latin1() );
249 controller -> setDefaultFitter ( name );
265 const vector < string > & fitters = controller -> getFitterNames ();
266 const string & def_fitter = controller -> getDefaultFitter ();
267 #if QT_VERSION < 0x040000 269 QObject * parent = ag -> parent ();
271 for (
unsigned int i = 0; i < fitters.size(); i++ ) {
272 #if QT_VERSION < 0x040000 273 const QString name ( fitters[i].c_str() );
280 const QString name ( fitters[i].c_str() );
282 ag -> addAction ( action );
284 action -> setToggleAction (
true );
285 if ( def_fitter == fitters[i] ) {
286 action -> setOn (
true );
300 if(
s_printer -> orientation() == QPrinter::Portrait )
326 std::list < ViewBase * > ::const_iterator first = views.begin();
327 for ( ; first != views.end(); ++first ) {
329 if ( view -> height () < 0 ||
330 view -> width () < 0 ) {
336 #if QT_VERSION < 0x040000 337 QCanvasView::ensureVisible ( 0, 0 );
339 Q3CanvasView::ensureVisible ( 0, 0 );
352 std::list < std::string > & missing_tuples =
354 std::list< std::string>::iterator it;
356 for ( it=missing_tuples.begin(); it!=missing_tuples.end(); ++it )
358 string shortFileName;
359 string::size_type pos1 = (*it).find_last_of (
"/");
360 string::size_type pos2 = (*it).find_last_of (
":");
361 shortFileName = (*it).substr(pos1+1);
363 QString cap (
"Select the DataSource: " );
364 cap += shortFileName.c_str();
365 QString filter (
"All files(*.*);;Text NTuple(*.tnt);;FITS file(*.fits);;Compressed FITS file(*.fits.gz);;ROOT file(*.root)");
368 #if QT_VERSION < 0x040000 375 Q3FileDialog::getOpenFileName ( QString::null,
382 string newFileName = filename.
latin1();
385 if ( ( pos2!= string::npos) && (pos2 != 1) ) {
386 ( *it ).replace (0, pos2, newFileName);
404 QString fn = filename.c_str ();
406 message =
QString(
"Unable to open document file:\n%1\n").
arg ( fn );
408 message +=
"\nFile could not be read\n";
411 message +=
"\nThere was a XML parsing error\n";
413 message +=
"\nThere were one or more referenced\n";
414 message +=
"NTuple files that could not be found.";
427 const list < ViewBase * > & view_list
443 for ( string::size_type i = 0; i <
size; i++ ) {
447 c !=
';' ) types += c;
450 string message (
"Attempt to save image to file:\n" );
452 message +=
"\nwhose suffix indicates unsupported image format.\n\n";
453 message +=
"Supported image formats are:\n";
457 "Image format error",
466 string message (
"The file:\n" );
468 message +=
"\nalready exists.\n\n";
469 message +=
"Over-write existing file?";
472 "Existing file warning",
478 return yes == QMessageBox::Yes;
488 const vector < const ViewBase * > & selViews =
selectedViews();
489 if ( selViews.empty () )
return;
491 vector < const ViewBase * > view_list;
502 const vector < const ViewBase * > & targets =
views ();
505 const list < ViewBase * > & pb_views
514 const vector < const ViewBase * > & targets =
views ();
517 const list < ViewBase * > & pb_views
519 list < ViewBase * >::const_iterator first = pb_views.begin ();
520 while ( first != pb_views.end () ) {
532 const vector < const ViewBase * > & selViews =
selectedViews();
533 if ( selViews.empty () )
return;
535 vector < const ViewBase * > view_list;
546 #ifdef ITERATOR_MEMBER_DEFECT 549 vector < const ViewBase * > ::const_iterator iter = view_list.begin();
552 while ( iter != view_list.end() ) {
553 const ViewBase * curview = ( * iter++ );
554 const QtView * view = dynamic_cast <
const QtView * > ( curview );
556 if (view) v = const_cast <
QtView * > ( view );
560 if (groupview) gv = const_cast <
QtGroupView * > (groupview);
584 #ifdef ITERATOR_MEMBER_DEFECT 587 vector < const ViewBase * > ::const_iterator first = views.begin();
588 while ( first != views.end() ) {
589 const QtView * view = dynamic_cast <
const QtView * > ( *first++ );
601 std::list < ViewBase * > ::const_iterator first = views.begin();
602 for ( ; first != views.end(); ++first ) {
624 QWidget * parent = parentWidget ();
642 controller -> updateActions ();
645 vector < PlotterBase * >
649 vector < PlotterBase * > plotters;
651 const vector < const ViewBase * > & viewList =
selectedViews ();
652 unsigned int size = viewList.size ();
653 for (
unsigned int i = 0; i <
size; i++ ) {
654 const ViewBase * view = viewList [ i ];
659 const vector <PlotterBase *> groupPlotters = groupView -> getPlotters ();
660 plotters.insert ( plotters.end(),
661 groupPlotters.begin(), groupPlotters.end() );
667 if ( plotter != 0 ) {
668 plotters.push_back ( plotter );
677 const vector < const ViewBase * > & viewList =
selectedViews ();
679 if ( viewList.size() != 1 )
684 PlotterBase * plotter = viewList[0]->getPlotter ();
698 vector < const ViewBase * > view_list;
717 #if QT_VERSION < 0x040000 720 Q3Canvas * can =
canvas();
722 int numpages =
static_cast<int> ( can -> height()
727 can -> resize ( static_cast<int> ( 1.2 *
m_upage_w ),
739 cs -> setOrientation (
s_printer -> orientation() );
746 int retval = cs -> exec ();
754 if ( cs -> orientation() !=
s_printer -> orientation() ) {
755 s_printer -> setOrientation( cs -> orientation() );
759 if( cs -> printerBounds() ==
false )
772 unsigned int columns = cs -> getWidthNumber ();
773 unsigned int rows = cs -> getHeightNumber ();
790 const vector < const ViewBase * > & allviews =
views();
792 for(
unsigned int i = 0; i < allviews.size(); i++ )
794 const ViewBase * curview = allviews[ i ];
795 const QtView * view = dynamic_cast <
const QtView * > ( curview );
797 v -> setDefaultFont( font );
798 v -> getPlotter() -> update();
809 if ( transform_aspect_ratio > 0.0 )
811 width = height * transform_aspect_ratio;
814 view -> setDrawRect ( 0.0, 0.0, width, height );
830 ViewBase * view = factory -> createView ( plotter );
832 qtview -> setSize ( -1, -1 );
852 double transform_aspect_ratio = plotter -> getAspectRatio();
858 #if QT_VERSION < 0x040000 861 sortViews ( Q3CanvasItem * first, Q3CanvasItem * second )
866 QRect frect = first -> boundingRect ();
867 QRect srect = second -> boundingRect ();
869 if ( frect.
left () < srect.
left () ) {
880 yes = frect.
top () < srect.
top ();
890 #if QT_VERSION < 0x040000 893 Q3Canvas temp_canvas;
895 #ifdef MEMFUN1_DEFECT 897 #if QT_VERSION < 0x040000 900 bind2nd ( mem_fun1 ( & Q3CanvasItem::setCanvas ),
905 #if QT_VERSION < 0x040000 908 bind2nd ( mem_fun ( & Q3CanvasItem::setCanvas ), &temp_canvas ) );
912 #if QT_VERSION < 0x040000 913 vector < QCanvasItem * > items (
m_items );
915 vector < Q3CanvasItem * > items (
m_items );
919 sort ( items.begin(), items.end(),
sortViews );
926 #if QT_VERSION < 0x040000 929 vector < QCanvasItem * >:: const_iterator first = items.begin();
931 placeItems (
const std::vector < Q3CanvasItem * > & items )
933 vector < Q3CanvasItem * >:: const_iterator first = items.begin();
937 vector <QtView *> textViews;
939 while ( first != items.end() )
944 if (plotter->isTextPlotter()) {
946 double x = view -> x ();
947 double y = view -> y ();
948 view->moveBy(-x, -y);
949 textViews.push_back(view);
958 vector <QtView *>::const_iterator it = textViews.begin();
959 while ( it != textViews.end() )
971 int y = contentsY ();
974 #if QT_VERSION < 0x040000 978 vector < QCanvasItem * > v_items;
979 QCanvasItemList:: const_iterator first = c_items.begin();
980 while ( first != c_items.end() ) {
983 Q3CanvasItemList c_items =
m_canvas -> collisions ( rect );
986 vector < Q3CanvasItem * > v_items;
987 Q3CanvasItemList:: const_iterator first = c_items.begin();
988 while ( first != c_items.end() ) {
989 Q3CanvasItem * item = *first++;
994 v_items.push_back ( item );
1005 QRect rect = target -> boundingRect ();
1006 double x = target -> x ();
1007 double y = target -> y ();
1008 x += 0.25 * rect.
width();
1009 y += 0.25 * rect.
height();
1011 view->moveBy ( x, y );
1014 std::pair<double, double>
1018 double xrel,
double yrel )
1021 QRect rect = sel_item->boundingRect ();
1022 double x = sel_item->x();
1023 double y = sel_item->y();
1024 x += xrel * rect.
width();
1025 y += yrel * rect.
height();
1027 view->moveBy ( x, y );
1030 QRect viewRect = view->boundingRect();
1031 double xLowerLeft = view->x();
1032 double yLowerLeft = view->y() + viewRect.
height();
1035 xLowerLeft = ( xLowerLeft - sel_item->x() ) / rect.
width();
1036 yLowerLeft = ( yLowerLeft - sel_item->y() ) / rect.
height();
1038 return std::make_pair(xLowerLeft, yLowerLeft);
1044 const std::string & s,
1045 const std::string & text )
1051 = display_controller->
createTextView ( factory, plotter, s, text );
1052 assert ( view != 0 );
1055 assert ( qtview != 0 );
1065 qtview->setZ(z+101.0);
1068 std::pair<double, double>
1071 const std::string &
type,
1072 const std::string & text,
1073 double x,
double y )
1079 = display_controller->
createTextView ( factory, plotter, type, text );
1083 std::pair<double, double> lowerLeftCorner
1088 return lowerLeftCorner;
1115 if ( view != 0 )
remove ( view );
1122 #if QT_VERSION < 0x040000 1124 QCanvasItemList::Iterator first = items.begin();
1125 while ( first != items.end() ) {
1129 Q3CanvasItemList::Iterator first = items.begin();
1130 while ( first != items.end() ) {
1131 Q3CanvasItem * item = *first++;
1135 item -> setVisible ( yes );
1159 const vector < const ViewBase * > &
1165 #if QT_VERSION < 0x040000 1166 vector < QCanvasItem * > :: const_iterator first =
m_selected_list.begin();
1170 vector < Q3CanvasItem * > :: const_iterator first =
m_selected_list.begin();
1172 Q3CanvasItem * item = *first++;
1179 if ( groupview != 0 ){
1191 #if QT_VERSION < 0x040000 1193 QCanvasItemList::Iterator it = item_list.begin();
1196 Q3CanvasItemList::Iterator it = item_list.begin();
1198 for ( ; it != item_list.end(); ++ it ) {
1199 const QtView * view = dynamic_cast <
const QtView * > ( *it );
1212 plotterlist.clear();
1214 const vector < const ViewBase * > & view_list =
views ();
1215 #ifdef ITERATOR_MEMBER_DEFECT 1218 vector < const ViewBase * >::const_iterator first = view_list.begin ();
1219 for ( ; first != view_list.end(); ++first ) {
1220 const QtView * qtview = dynamic_cast <
const QtView * > ( *first );
1221 plotterlist.push_back ( qtview->
getPlotter () );
1231 const vector < const ViewBase * > & all_views =
views ();
1232 vector < const ViewBase * > :: const_iterator first = all_views.begin();
1234 while ( first != all_views.end() ) {
1237 if ( plotter == target ) {
1238 const QtView * v = dynamic_cast <
const QtView * > ( vb );
1239 view = const_cast <
QtView * > ( v );
1251 #ifdef STRING_CLEAR_DEFECT 1257 const string eps (
"eps" );
1258 bool eps_inserted =
false;
1260 #if QT_VERSION < 0x040000 1262 QStringList::Iterator it = slist.begin();
1268 while ( it != slist.end() ) {
1271 #if QT_VERSION < 0x030100 1272 string low ( lower );
1274 string low = lower.
latin1();
1277 #else // not mac os x 1278 if ( low ==
"jpeg" ) low =
"jpg";
1282 #if QT_VERSION < 0x040000 1289 if ( eps_inserted ==
false ) {
1290 #if QT_VERSION < 0x040000 1295 eps_inserted =
true;
1297 #if QT_VERSION < 0x040000 1305 #if QT_VERSION < 0x040000 1311 #if QT_VERSION < 0x040000 1318 #if QT_VERSION < 0x040000 1330 #if QT_VERSION < 0x040000 1333 dialog->
setMode ( QFileDialog::AnyFile );
1335 Q3FileDialog * dialog =
new Q3FileDialog (
this );
1336 dialog->setFilters ( filters );
1337 dialog->setMode ( Q3FileDialog::AnyFile );
1353 #if QT_VERSION < 0x040000 1358 assert ( views.empty () == false );
1360 for (
unsigned int i = 0; i < views.size (); i++ ) {
1366 #if QT_VERSION < 0x040000 1376 = Q3FileDialog::getSaveFileName ( QString::null,
1384 if ( filename.isEmpty () )
return;
1388 #if QT_VERSION < 0x030100 1389 string fn ( filename );
1391 string fn = filename.latin1();
1394 int pos = filename.findRev (
'.' );
1396 string sf = sel_filt.
latin1();
1397 string::size_type pos1 = sf.find (
'(' );
1398 string::size_type pos2 = sf.find_last_of (
')' );
1399 string::size_type len = ( pos2 ) - ( pos1 + 2 );
1400 string suffix = sf.substr ( pos1 + 2, len );
1408 for (
unsigned int i = 0; i < views.size(); i++ ) {
1421 #if QT_VERSION < 0x040000 1426 if (views.empty()) {
1430 for (
unsigned int i = 0; i < views.size (); i++ ) {
1438 for (
unsigned int i = 0; i < views.size(); i++ ) {
1451 const vector < const ViewBase * > & view_list =
views ();
1452 vector < const ViewBase * > ::const_iterator first = view_list.begin ();
1454 while ( first != view_list.end() ) {
1457 controller -> setAllIntervalEnabled ( plotter, yes );
1467 const vector < const ViewBase * > & targets =
views ();
1469 const list < ViewBase * > &
views 1472 if ( views.empty() == false ) {
1482 #if QT_VERSION < 0x040000 1487 QtView * qtview = dynamic_cast <
QtView * > ( selItem );
1493 plotter -> toggleActivePlot ();
1500 const vector < const ViewBase * > & sel_views =
selectedViews ();
1502 view_list.resize ( sel_views.size() );
1503 copy ( sel_views.begin(), sel_views.end(), view_list.begin() );
1506 const vector < const ViewBase * > & all_views =
views ();
1508 controller->addTextViewToList ( view_list, all_views );
1514 if ( (e->
button() == Qt::RightButton) ||( e->
state() == Qt::RightButton)) {
1518 const vector < const ViewBase * > & sel_views =
selectedViews ();
1520 if ( ! sel_views.empty () ) {
1521 vector < const ViewBase * > view_list;
1536 if ( (e->
button() == Qt::RightButton) ||( e->
state() & Qt::RightButton)) {
1537 #if QT_VERSION < 0x040000 1542 if ( right_item == 0 )
return;
1544 #if QT_VERSION < 0x040000 1548 Q3CanvasRectangle * rect
1549 = dynamic_cast <Q3CanvasRectangle *> ( right_item );
1555 if ( ( p.x() >= rect->x() ) &&
1556 ( p.x() <= rect->x() + rect->width() ) &&
1557 ( p.y() >= rect->y() ) &&
1558 ( p.y() <= rect->y() + rect->height() ) ) {
1560 QtView * qtview = dynamic_cast <
QtView * > ( right_item );
1565 vector < ViewBase * >::const_iterator first = views.begin();
1566 for ( ; first != views.end(); ++first ) {
1568 if ( ( p.x() >= v->x() ) &&
1569 ( p.x() <= v->x() + v->
width() ) &&
1570 ( p.y() >= v->y() ) &&
1571 ( p.y() <= v->y() + v->
height() ) ) {
1576 if ( qtview == 0 )
return;
1580 vector < double > picked;
1582 if ( picked.empty () )
return;
1584 unsigned int size = picked.size();
1585 double datax = picked[1];
1586 double datay = picked[2];
1592 double unscaledDataX = picked[1];
1593 double unscaledDataY = picked[2];
1594 if ( std::abs ( picked[0] - 1.0 ) < 0.5 ) unscaledDataY = picked[3];
1603 tf_fits -> transform ( unscaledDataX, unscaledDataY );
1609 const QCursor cursor ( Qt::CrossCursor );
1614 (
"Coordinates are : ( %1, %2, %3 )" )
1621 sb->message ( qstr );
1628 map < const QtView*, PickTable * > ::iterator first
1644 if ( plotter == 0 )
return;
1659 if ( cut_low < plotter_low )
1661 Range currentRange =
Range ( plotter_low, cut_high );
1662 cut1d -> setCutRangeAt ( currentRange , 0 );
1664 if ( cut_high > plotter_high )
1666 Range currentRange =
Range ( cut_low , plotter_high );
1667 cut1d -> setCutRangeAt ( currentRange , 0 );
1675 double cut_low_x = cut2d->getCutRange().low();
1676 double cut_high_x = cut2d->getCutRange().high();
1677 double plotter_low_x = cut2d->getRange(
Axes::X,
true ).low();
1678 double plotter_high_x = cut2d->getRange(
Axes::X,
true ).high();
1679 double cut_low_y = cut2d->getCutRangeY().low();
1680 double cut_high_y = cut2d->getCutRangeY().high();
1681 double plotter_low_y = cut2d->getRange(
Axes::Y,
true ).low();
1682 double plotter_high_y = cut2d->getRange(
Axes::Y,
true ).high();
1686 if ( cut_low_x < plotter_low_x )
1688 Range currentRange =
Range ( plotter_low_x, cut_high_x );
1689 cut2d -> setCutRangeAt ( currentRange , 0 );
1691 if ( cut_high_x > plotter_high_x )
1693 Range currentRange =
Range ( cut_low_x , plotter_high_x );
1694 cut2d -> setCutRangeAt ( currentRange , 0 );
1697 if ( cut_low_y < plotter_low_y )
1699 Range currentRange =
Range ( plotter_low_y, cut_high_y );
1700 cut2d -> setCutRangeAt ( currentRange , 1 );
1702 if ( cut_high_y > plotter_high_y )
1704 Range currentRange =
Range ( cut_low_y , plotter_high_y );
1705 cut2d -> setCutRangeAt ( currentRange , 1 );
1716 Range oldRange = cut1d -> getCutRange ();
1717 double old_low = oldRange.
low();
1718 double old_high = oldRange.
high();
1720 if ( datax < ( old_low + old_high ) / 2 ) {
1721 Range currentRange =
Range ( datax , old_high );
1722 cut1d -> setCutRangeAt ( currentRange , 0 );
1727 Range currentRange =
Range ( old_low , datax );
1728 cut1d -> setCutRangeAt ( currentRange , 0 );
1735 Range oldRangeX = cut2d -> getCutRange ();
1736 Range oldRangeY = cut2d -> getCutRangeY ();
1737 double old_low_x = oldRangeX.
low();
1738 double old_high_x = oldRangeX.
high();
1739 double old_low_y = oldRangeY.
low();
1740 double old_high_y = oldRangeY.
high();
1743 double dis_low_x = std::abs ( datax - old_low_x );
1744 double dis_high_x = std::abs ( datax - old_high_x );
1745 double dis_low_y = std::abs ( datay - old_low_y );
1746 double dis_high_y = std::abs ( datay - old_high_y );
1749 if ( ( dis_low_x <= 0.1 * (old_high_x - old_low_x)) &&
1750 ( dis_low_y <= 0.1 * (old_high_y - old_low_y)) &&
1752 Range currentRange =
Range ( datax, old_high_x );
1753 cut2d -> setCutRangeAt ( currentRange, 0 );
1756 if ( e->
state() & Qt::ShiftButton) {
1757 int view_top = qtview->
toViewY(old_high_y);
1758 int view_left = qtview->
toViewX(datax);
1759 int view_right = qtview->
toViewX(old_high_x);
1760 int view_bottom = view_top + view_right - view_left;
1764 vector <double> adjusted;
1766 currentRange =
Range ( adjusted[2], old_high_y );
1769 currentRange =
Range ( datay, old_high_y );
1770 cut2d -> setCutRangeAt ( currentRange, 1 );
1775 else if ( ( dis_low_x <= 0.1 * (old_high_x - old_low_x)) &&
1776 ( dis_high_y <= 0.1 * (old_high_y - old_low_y)) &&
1778 Range currentRange =
Range ( datax, old_high_x );
1779 cut2d -> setCutRangeAt ( currentRange, 0 );
1782 if ( e->
state() & Qt::ShiftButton) {
1783 int view_bottom = qtview->
toViewY(old_low_y);
1784 int view_left = qtview->
toViewX(datax);
1785 int view_right = qtview->
toViewX(old_high_x);
1786 int view_top = view_bottom - view_right + view_left;
1790 vector <double> adjusted;
1792 currentRange =
Range ( old_low_y, adjusted[2]);
1795 currentRange =
Range ( old_low_y, datay );
1796 cut2d -> setCutRangeAt ( currentRange, 1 );
1801 else if ( ( dis_high_x <= 0.1 * (old_high_x - old_low_x)) &&
1802 ( dis_low_y <= 0.1 * (old_high_y - old_low_y)) &&
1804 Range currentRange =
Range ( old_low_x, datax );
1805 cut2d -> setCutRangeAt ( currentRange, 0 );
1808 if ( e->
state() & Qt::ShiftButton) {
1809 int view_top = qtview->
toViewY(old_high_y);
1810 int view_left = qtview->
toViewX(old_low_x);
1811 int view_right = qtview->
toViewX(datax);
1812 int view_bottom = view_top + view_right - view_left;
1816 vector <double> adjusted;
1818 currentRange =
Range ( adjusted[2], old_high_y );
1821 currentRange =
Range ( datay, old_high_y );
1822 cut2d -> setCutRangeAt ( currentRange, 1 );
1827 else if ( ( dis_high_x <= 0.1 * (old_high_x - old_low_x)) &&
1828 ( dis_high_y <= 0.1 * (old_high_y - old_low_y)) &&
1830 Range currentRange =
Range ( old_low_x, datax );
1831 cut2d -> setCutRangeAt ( currentRange, 0 );
1834 if ( e->
state() & Qt::ShiftButton) {
1835 int view_bottom = qtview->
toViewY(old_low_y);
1836 int view_left = qtview->
toViewX(old_low_x);
1837 int view_right = qtview->
toViewX(datax);
1838 int view_top = view_bottom - view_right + view_left;
1842 vector <double> adjusted;
1844 currentRange =
Range ( old_low_y, adjusted[2] );
1847 currentRange =
Range ( old_low_y, datay );
1848 cut2d -> setCutRangeAt ( currentRange, 1 );
1853 else if ( ( dis_low_x <= dis_high_x ) &&
1854 ( dis_low_x <= dis_low_y ) &&
1855 ( dis_low_x <= dis_high_y ) &&
1857 Range currentRange =
Range ( datax, old_high_x );
1858 cut2d -> setCutRangeAt ( currentRange, 0 );
1863 else if ( ( dis_high_x <= dis_low_x ) &&
1864 ( dis_high_x <= dis_low_y ) &&
1865 ( dis_high_x <= dis_high_y ) &&
1867 Range currentRange =
Range ( old_low_x, datax );
1868 cut2d -> setCutRangeAt ( currentRange, 0 );
1873 else if ( ( dis_low_y <= dis_high_x ) &&
1874 ( dis_low_y <= dis_low_x ) &&
1875 ( dis_low_y <= dis_high_y ) &&
1877 Range currentRange =
Range ( datay, old_high_y );
1878 cut2d -> setCutRangeAt ( currentRange, 1 );
1885 Range currentRange =
Range ( old_low_y, datay );
1886 cut2d -> setCutRangeAt ( currentRange, 1 );
1916 cut1d -> setCutRangeAt ( currentRange , 0 );
1939 cut2d -> setCutRangeAt ( currentRange, 0 );
1949 currentRange =
Range ( low, high );
1950 cut2d -> setCutRangeAt ( currentRange, 1 );
1962 Range oldRange = cut1d -> getCutRange ();
1963 double width, low, high;
1966 if ( (controller -> getLog ( plotter,
Axes::X )) ==
true )
1968 width = log10(oldRange.
high())-log10(oldRange.
low());
1969 low = pow ( 10., log10(datax) - ( width/2 ) );
1970 high = pow ( 10., log10(datax) + ( width/2 ) );
1976 width = oldRange.
high() - oldRange.
low();
1977 low = datax - width/2;
1978 high = datax + width/2;
1981 cut1d -> setCutRangeAt (currentRange, 0 );
1988 Range oldRangeX = cut2d -> getCutRange ();
1989 Range oldRangeY = cut2d -> getCutRangeY ();
1990 double width_x, width_y, low_x, high_x, low_y, high_y;
1993 if ( (controller -> getLog ( plotter,
Axes::X )) ==
true )
1995 width_x = log10(oldRangeX.
high())-log10(oldRangeX.
low());
1996 low_x = pow ( 10., log10(datax) - ( width_x/2 ) );
1997 high_x = pow ( 10., log10(datax) + ( width_x/2 ) );
2003 width_x = oldRangeX.
high() - oldRangeX.
low();
2004 low_x = datax - width_x/2;
2005 high_x = datax + width_x/2;
2009 if ( (controller -> getLog ( plotter,
Axes::Y )) ==
true )
2011 width_y = log10(oldRangeY.
high())-log10(oldRangeY.
low());
2012 low_y = pow ( 10., log10(datay) - ( width_y/2 ) );
2013 high_y = pow ( 10., log10(datay) + ( width_y/2 ) );
2019 width_y = oldRangeY.
high() - oldRangeY.
low();
2020 low_y = datay - width_y/2;
2021 high_y = datay + width_y/2;
2024 Range currentRange =
Range ( low_x, high_x );
2025 cut2d -> setCutRangeAt (currentRange, 0 );
2026 currentRange =
Range ( low_y, high_y );
2027 cut2d -> setCutRangeAt (currentRange, 1 );
2053 #if QT_VERSION < 0x040000 2059 if ( item->isActive () )
return;
2075 #if QT_VERSION < 0x040000 2079 Q3CanvasRectangle * rect
2080 = dynamic_cast <Q3CanvasRectangle *> ( item );
2084 if ( (e->
button() == Qt::LeftButton) ||
2085 ( e->
state() & Qt::LeftButton) ) {
2088 if ( ( p.
x() >= rect->x() ) &&
2089 ( p.
x() <= rect->x() + rect->width() ) &&
2090 ( p.
y() >= rect->y() ) &&
2091 ( p.
y() <= rect->y() + rect->height() ) ) {
2104 if (e->
state() & Qt::ShiftButton) {
2106 bo_right.
setY( top_left.
y() - bo_right.
x() + top_left.
x() );
2110 top_left.
setY( bo_right.
y() + bo_right.
x() - top_left.
x() );
2114 #if QT_VERSION < 0x040000 2121 QColor color (
"black" );
2122 QPen pen ( color, 1, Qt::DotLine );
2126 QString message (
"Can not do range zoom in a group view.\n" );
2127 message +=
"Please select a single plotter view.";
2150 const std::string & filename )
2152 if ( plotter == 0 )
return;
2154 string::size_type i = filename.find_last_of (
'.');
2155 if ( i != string::npos ) {
2156 string suffix ( filename.substr ( i + 1 ) );
2157 if ( suffix ==
"eps" ||
2163 assert ( view != 0 );
2165 QRect rect = view -> rect ();
2175 string::size_type
size = upper.size();
2176 for ( string::size_type i = 0; i <
size; i++ ) {
2177 upper[i] = std::tolower ( upper[i] );
2186 if (suffix==
"gz" || suffix==
"GZ")
return true;
2190 string star (
"*." + suffix );
2196 return i != string::npos;
2203 QString message (
"Sorry, this installation of " );
2205 message +=
" was not\n" 2206 "built with the optional FITS support.";
2216 string filename = fn;
2217 string::size_type i = filename.find_last_of (
'.' );
2219 if ( i == string::npos ) {
2222 string filt = s.
latin1();
2223 string::size_type ipos = filt.find (
"*." ) + 1;
2224 string::size_type epos = filt.find (
")" );
2225 string suffix ( filt.substr ( ipos, epos - ipos ) );
2231 i = filename.find_last_of (
'.' );
2234 string suffix ( filename.substr ( i + 1 ) );
2236 string base ( filename.substr ( 0, i - 1 ) );
2237 if ( base.empty () ) filename =
"image." + suffix;
2239 if ( check_existing ) {
2240 QString fn ( filename.c_str() );
2245 if ( yes ==
false )
return;
2250 if ( suffix ==
"eps" ||
2255 else if (suffix ==
"fits" ||
2282 const std::string & filename )
const 2285 if ( plotter -> isImageConvertable () ==
false ) {
2286 QString message (
"The contents of this plotter is not\n" 2287 "onvertable to a FITS image." );
2296 const std::vector <unsigned int> & fitsshape = p->
getShape();
2297 const std::vector <double> & fitsdata = p->
getZValues();
2315 QString message (
"No plot or more than one plot selected." );
2332 const std::string & filename )
const 2334 if ( plotter != 0 ) {
2336 assert ( view != 0 );
2338 QRect rect = view -> rect ();
2340 rect.
x(), rect.
y (),
2342 const Rect & marg_rect = view -> getMarginRect ();
2343 eps -> setMarginRect ( marg_rect );
2346 eps -> setPlotter ( p );
2347 eps -> setDrawRect ( rect.
x(), rect.
y(),
2350 eps -> closeFile ();
2365 const vector < const ViewBase * > & viewList =
selectedViews ();
2366 #ifdef ITERATOR_MEMBER_DEFECT 2369 vector < const ViewBase * > :: const_iterator first = viewList.begin();
2370 while ( first != viewList.end() ) {
2372 const QtView * view = dynamic_cast <
const QtView * > ( vb );
2376 eps_view -> setPlotter ( plotter );
2377 eps_view -> setDrawRect ( rect.
x(), rect.
y(),
2379 const Rect & marg_rect = view -> getMarginRect ();
2380 eps_view -> setMarginRect ( marg_rect );
2382 eps_view -> drawSelf ();
2385 eps_view -> closeFile ();
2394 saveAs (
const std::string & filename )
const 2396 const vector < const ViewBase * > & view_list =
views ();
2397 saveAs ( view_list, filename );
2402 saveAs (
const std::vector < PlotterBase * > & plotters,
2403 const std::string & filename )
2405 vector < const ViewBase * >
views;
2407 unsigned int size = plotters.size ();
2408 for (
unsigned int i = 0; i <
size; i++ ) {
2411 views.push_back ( view );
2413 saveAs ( views, filename );
2419 const std::string & filename )
2443 if ( tuples.empty () ) {
2444 QString message (
"There are no NTuples to be exported" );
2452 #if QT_VERSION < 0x040000 2457 "Save data source as ..." );
2459 Q3FileDialog::getSaveFileName ( QString::null,
2463 "Save data source as ..." );
2466 if ( filename == QString::null )
return;
2468 QString suffix ( data_suffix.c_str() );
2469 #if QT_VERSION < 0x030300 2472 if ( filename.
endsWith ( suffix ) ==
false &&
2473 filename.
endsWith ( suffix2 ) == false ) {
2474 filename += data_suffix;
2477 if ( filename.
endsWith ( suffix,
false ) == false ) {
2478 filename += data_suffix.c_str();
2482 const string tuple_name =
m_inspector -> getSelectedDataSourceName ();
2484 #if defined(QT_NO_STL) || QT_VERSION < 0x030100 2485 string tuple_file( filename );
2487 string tuple_file ( filename.
latin1() );
2493 controller -> changeName ( tuple_name, tuple_file );
2495 catch (
const std::exception & e ) {
2496 QString message (
"An error occurred in writing file.\n\n" );
2497 message += e.what();
2502 QMessageBox::NoButton,
2503 QMessageBox::NoButton );
2515 std::vector<double> picked;
2524 if (e->
button() == Qt::RightButton || e->
state() == Qt::RightButton) {
2526 #if QT_VERSION < 0x040000 2532 if ( right_item == 0 ) {
2536 qtview = dynamic_cast <
QtView * > ( right_item );
2543 vector < ViewBase * >::const_iterator first = views.begin();
2544 for ( ; first != views.end(); ++first ) {
2546 if ( ( p.
x() >= v->x() ) &&
2547 ( p.
x() <= v->x() + v->
width() ) &&
2548 ( p.
y() >= v->y() ) &&
2549 ( p.
y() <= v->y() + v->
height() ) ) {
2554 if ( qtview == 0 )
return;
2564 #if QT_VERSION < 0x040000 2568 Q3CanvasRectangle * rect
2569 = dynamic_cast <Q3CanvasRectangle *> ( qtview );
2573 if ( ( p.
x() >= rect->x() ) &&
2574 ( p.
x() <= rect->x() + rect->width() ) &&
2575 ( p.
y() >= rect->y() ) &&
2576 ( p.
y() <= rect->y() + rect->height() ) ) {
2578 vector < double > picked2;
2595 std::vector <double> zoom_top_left;
2596 std::vector <double> zoom_bo_right;
2635 #if QT_VERSION < 0x040000 2640 Q3CanvasRectangle * rect =
dynamic_cast<Q3CanvasRectangle *
>(selItem);
2644 if (!qtview)
return false;
2646 if ( ( p.
x() >= rect->x() ) &&
2647 ( p.
x() <= rect->x() + rect->width() ) &&
2648 ( p.
y() >= rect->y() ) &&
2649 ( p.
y() <= rect->y() + rect->height() ) ) {
2651 if (!picked.empty()) {
2662 if (!picked.empty()) {
2667 if (picked.size() == 4) {
2678 if (!picked.empty()){
2680 map < const QtView *, PickTable * > ::iterator first
2686 table -> addItem ( picked );
2697 const std::vector<double> & picked) {
2704 std::min(picked[1], start_picked[1]),
2705 std::max(picked[1], start_picked[1]) );
2708 std::min(picked[2], start_picked[2]),
2709 std::max(picked[2], start_picked[2]) );
2711 plotter -> setCurrentRangeSaved (
false );
2729 int i = plotter -> currentView();
2731 plotter -> setCurrentRangeSaved(
true );
2734 std::vector<double>&
2754 QString message (
"One must select a single plot before showing\n" 2755 "the pick table." );
2762 #if QT_VERSION < 0x040000 2767 QtView * qtview = dynamic_cast <
QtView * > ( selItem );
2768 if ( qtview == 0 ) {
2769 QString message (
"Can not show pick table of a group view.\n" );
2770 message +=
"Please select a single plotter view.";
2776 map < const QtView *, PickTable * > ::iterator first
2794 const std::vector<double> &
2798 #if QT_VERSION < 0x040000 2811 std::string about =
"<h2>HippoDraw version: ";
2813 about +=
"<h3> Built on ";
2815 about +=
"<li> Qt ";
2816 about += QT_VERSION_STR;
2818 about +=
"<li> CFITSIO ";
2820 about += fits_version.c_str();
2824 about +=
"<li> C++ Minuit";
2828 about +=
"<li> Minuit2";
2832 about +=
"<li> ROOT ";
2834 about += root_version.c_str();
2838 about +=
"<li> WCSlib ";
2843 about +=
"<h3>Contributors...";
2845 about +=
"<li> Stephane Bonneaud";
2846 about +=
"<li> James Chiang";
2847 about +=
"<li> Johann Cohen-Tanugi";
2848 about +=
"<li> Xie Fang";
2849 about +=
"<li> Kaustuv";
2850 about +=
"<li> Paul F. Kunz";
2851 about +=
"<li> Sanket B. Malde";
2852 about +=
"<li> Matthew D. Langston";
2853 about +=
"<li> Joy Rajiv";
2854 about +=
"<li> Matan Shacham";
2855 about +=
"<li> Oded Wurman";
2861 QMessageBox::Information, 1, 0, 0,
this, 0, false );
2880 #if QT_VERSION < 0x040000 2888 if ( view == 0 )
return 0;
2908 if ( tuples.empty () ) {
2909 QString message (
"There are no NTuples to be used as source" );
2929 const QtView * view = dynamic_cast <
const QtView * > ( selview );
2932 map < const QtView *, PickTable * > ::iterator first
2938 return table->getPickTable();
2953 map < const QtView *, PickTable * > :: iterator first
2969 const vector < const ViewBase * > & selViews =
selectedViews();
2970 if ( selViews.empty () )
return;
2976 vector < const ViewBase * >::const_iterator it = selViews.begin();
2977 for ( ; it != selViews.end(); ++it ) {
2981 if (!qtview)
continue;
2985 QRect temp = qtview->boundingRect();
3000 const vector < const ViewBase * > & selViews =
selectedViews();
3001 if ( selViews.size() != 1 )
return;
3004 dynamic_cast <
const QtGroupView * > ( selViews[0] );
3005 if (!groupView)
return;
3011 vector < ViewBase * >::const_iterator first = views.begin();
3012 for ( ; first != views.end(); ++first ) {
3013 QtView * qtview = dynamic_cast <
QtView * > ( *first );
3025 #ifdef ITERATOR_MEMBER_DEFECT 3028 vector < const ViewBase * > ::const_iterator first = views.begin();
3029 while ( first != views.end() ) {
3030 const QtView * view = dynamic_cast <
const QtView * > ( *first++ );
3040 #if QT_VERSION < 0x040000 3042 QObject * parent = ag -> parent ();
3050 if (((*it)->menuText())==filename){
3058 #if QT_VERSION < 0x040000 3066 ag -> addAction ( action );
3068 action -> setToggleAction (
true );
3081 #if QT_VERSION < 0x040000 3090 list<QAction *>::iterator it;
3098 fn = (*it)->menuText();
3114 moveDockWindow(toolBar);
3115 moveDockWindow(Toolbar_2);
3116 moveDockWindow(Toolbar);
3117 moveDockWindow(Toolbar_4);
3119 lineUpDockWindows();
void exportTextTuple(const std::string &suffix)
Saves the DataSource as a text NTuple.
setFilters(const QString &filters)
void initRecentFiles(QActionGroup *ag)
Initializes the recently opened files menu items.
void removeDisplay(PlotterBase *plotter)
Removes the display from the canvas.
void saveToPasteboard(const std::vector< const ViewBase * > &)
Saves the document represented by the list of ViewBase objects to the pasteboard. ...
void showFitsError() const
Raises a dialog box indicating that FITS support is not available.
static DisplayController * instance()
Returns the pointer to the singleton instance.
static DataSourceController * instance()
Returns the pointer to the singleton instance.
virtual void fillPickedPoint(double x, double y, std::vector< double > &picked) const
Fills the picked point vector.
Status
Return codes of opening file.
Class representing a rectangle.
virtual PlotterBase * getParentPlotter() const
Returns the parent plotter.
A derived class of QCustomEvent with which the CanvasView notifiies clients of changes in selections ...
A Plotter class that plots one-dimensional TupleCut values.
std::vector< double > m_current_range
Set to the current range of the selected plotter.
Cut1DPlotter class interface.
PlotterBase * selectedPlotter() const
Returns the selected PlotterBase object.
The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas. ...
virtual void print()
Prints the canvas.
void removeSelected()
Removes the selected objects from the canvas.
virtual double getAspectRatio() const
Get the aspect ratio.
PlotterBase * getPlotter() const
Returns the plotter used by this view.
QCanvasItem * getRightItem()
Get the QCanvasItem clicked by right mouse button.
A base class that is the interface between GUI and the XML serialization and deserialization.
void addView(QtView *view, bool select)
Adds a QtView object to the CanvasView.
void setAddedSelected(bool yes)
Sets to flag to make plot in its selected state when added to the canvas.
void removeTextObservers(const std::vector< const ViewBase * > &views)
Removes TextRep Observer objects, if any, from its target.
hippodraw::CreateNTuple class interface
const std::vector< const ViewBase *> & selectedViews() const
Returns temporary list of selected QtView objects on the canvas.
const std::list< ViewBase *> & getFromPasteboard(ViewFactory *factory, const std::vector< const ViewBase * > &views)
Creates and returns a list of objects that was copied to the pasteboard.
static void createImageFilters()
Creates the image filters string.
hippodraw::EpsView class interface
double old_pos
For cut mode 2, position of first click.
std::vector< const ViewBase *> m_sel_views
Temporary list of selected QtView objects on the canvas.
static RootController * instance()
Returns the singleton instance of the RootController.
arg(long a, int fieldWidth=0, int base=10) const
void saveAreaAsPixmap(const QRect &area, const std::string &filename)
Saves the area area as pixmap to file filename.
void saveSelectedAsFits(const std::string &filename)
Saves the selected objects as FITS image file filename.
ViewBase * createFuncView(const ViewFactory *factory, PlotterBase *plotter, const std::string &type)
Creates a textual view of function of type type.
void saveSelectedImages()
Saves the selected QCanvasItem objects to a image file.
std::list< QAction * > m_recent_list
List of menu items of recently opened files.
void saveSettings() const
Saves the settings for use in future session.
bool m_ignore_margin
a flag set to true if the printer margins should be ignored when adding a plot to the canvas...
void restoreFromSelectCopy()
Restores the selected views from the selection copy.
void copySelectedToClipboard()
Adds selected items to system clipboard.
void setFonts(const QFont &font)
Sets the fonts for the views.
std::pair< double, double > moveToPlotterAt(const PlotterBase *plotter, QtView *view, double x, double y)
Moves the view to the specified position with respect to the currently view for plotter.
void copyFromPasteboard()
Copies from the pasteboard.
void moveToPlotter(const PlotterBase *plotter, QtView *view)
Moves the view to a nice position with respect to the plotter's QCanvasItem.
hippodraw::CanvasWindow class interface.
virtual bool hasZoomY() const
Returns true if the plotter has zoom feature on the Y axis, otherwise returns false.
bool existingFileWarning(const std::string &filename)
Raises dialog to query over writing existing file.
std::vector< QCanvasItem *> m_items
The list of view items on the canvas.
void setup()
Raises the settings dialog.
void createNTuple()
Raise the create NTuple dialog.
int m_upage_h
The usable Page height in Postscript points.
A concrete window class that contains the canvas and responds to menu item and tool bar events from t...
static void toLower(std::string &upper)
Converts the string to lower case.
void invalidImageFormatError(const std::string &filename)
Raises dialog box for error in image format.
void fillMouseData(const std::vector< double > &picked)
Fill m_mouseData with the data from fillPickedPoint.
std::vector< double > m_mouseData
3-vector of mouse event data
virtual void update(const Observable *)
Responds to Observable update message.
void clearSelectedList()
De-selects all items, making the selection list empty.
void pasteViews(const std::list< ViewBase * > &views)
Adds the views to the canvas.
CanvasSelectionEvent class interface.
insertSearchPath(System s, const QString &path)
This class manages the CanvasView settings dialog.
static const std::string & version()
Returns the version number of HippoDraw.
A Plotter class that plots one-dimensional TupleCut values.
void savePlotAsFits(const PlotterBase *plotter, const std::string &filename) const
Saves the plotter as an FITS image file.
void setDrawRect(float x, float y, float w, float h)
Sets the drawing rectangle in the paint device space.
void clear()
Removes all items from canvas and destroy them.
virtual const std::vector< unsigned int > & getShape()
void addSelectedItem(QCanvasItem *item)
Add an item to the selected list.
void addFromPasteboard()
Adds from pasteboard.
readEntry(const QString &key, const QString &def=QString::null, bool *ok=0) const
virtual void defaultToolbar()
Set the toolbar to default position.
A transform that transforms coordinates from one 2D coordinate system to another. ...
NTuple * getPickTable()
Gets the pick table of selected plotter.
Inspector * getInspector()
Gets the inspector object.
static QString s_registry
The QSettings Windows registry key.
void addPlotDisplay(PlotterBase *plotter, bool select)
Creates a QtView object for the display and inserts it onto the canvas in the next available free pla...
hippodraw::PlotterEvent class interface
static Type types[]
An array to allow conversion of integer to enumeration.
void deleteSelected(bool paste)
Removes the selected items from canvas and copies them to the pasteboard.
std::vector< const ViewBase *> m_views
Temporary list of QtView objects on the canvas.
Status saveToFile(const std::vector< const ViewBase * > &views, const std::string &filename)
Saves the document represented by list of ViewBase objects to file with name filename.
void ungroupView()
Ungroup the GroupView object to separated Views.
double high() const
Returns the maximum of the range object.
QtView * getViewFor(const PlotterBase *plotter) const
Returns the QtView object that is the Observer of the plotter.
QPoint m_zoom_start
The starting point of a mouse drag.for zoom.
A singleton class that is the interface between GUI and the displays.
void reTile()
Re-tiles the canvas.
static WindowController * instance()
Returns the application instance.
virtual void contentsMouseMoveEvent(QMouseEvent *)
Overrides the QScrollView event handler.
number(long n, int base=10)
postEvent(QObject *receiver, QEvent *event)
setButtonText(int button, const QString &text)
void placeItems(const std::vector< QCanvasItem * > &items)
Places each item in items on the canvas.
static std::string s_image_filters
A QFileDialog filters string for supported image types.
QtViewFactory class interface.
virtual void controlMousePressEvent()
Overrides inherited method to receive mouse pressed events.
QCanvasItem * selectedItem() const
Returns the selected QCanvasItem.
void hideSelected()
Removes the selected objects from the canvas without destroying in.
hippodraw::NTupleController class interface
int m_num_width
Number of default sized plots horizontally.
void fillSelectedWithObservers(std::vector< const ViewBase * > &)
Fills the input vector with selected items and their observers.
void saveToSelectionCopy(const std::vector< const ViewBase * > &views)
Saves the document represented by the list of ViewBase objects to the selection copy.
void saveSelectedAsEps(const std::string &filename)
Saves the selected objects as EPS image file filename.
void setCutMode(int mode)
hippodraw::RootController class interface.
void setCollidingSelected(const QCanvasItem *target)
Sets all QCanvasItems that collide with target to selected state.
void groupView()
Create a GroupView object containing selected views.
hippodraw::CanvasView class interface
void paste(QCanvasItem *item)
Adds the item to the canvas.
void initFrom(const std::list< ViewBase * > &views)
DataSourceController class interface.
void setFitterDefault(const std::string &name)
Sets the default fitter in the FitterFactory.
std::map< const QtView *, PickTable *> m_table_map
A map from a view to the PickTable.
void saveAs(const std::string &filename) const
Saves all the QtView canvas item to a XML file.
std::vector< double > & getCurrentRange()
Returns the current range of the selected plotter.
ScatterPlot class interface.
int toViewX(double datX) const
Converts the data space coordinate X to the view space coordinate X.
void setVisibleNonViews(bool visible)
Sets visible state of QCanvasItem objects that are not also QtView objects to visible.
std::vector< QCanvasItem *> & getSelectedItems()
Return the vector of selected items.
void addRecentFile(const QString &filename, QActionGroup *ag)
Add recently opened files.
static bool sortViews(QCanvasItem *first, QCanvasItem *second)
bool isSingleItemSelected() const
Returns true if just one item is selected, else returns false.
Accept new setting and retile.
QFileDialog * createImageDialog()
Creates the QFileDialog with supported filters string for supported image types.
int m_apage_w
The actual Page width in Postscript points.
bool m_clicked
For cut mode 2, clicked or not.
void setSelectedItem(QCanvasItem *)
Set the selected QCanvasItem.
intp size(numeric::array arr)
void setPositions()
Set the positions in percentage of every views.
A derived class of InspectorBase class which is generated by the Qt designer.
static QString s_app_key
The QSettings application key for searching for setting.
setOverrideCursor(const QCursor &cursor, bool replace=FALSE)
int writeNTupleToFile(DataSource *source, const std::string &filename)
Writes the DataSource source to a file given by filename.
void setCrossY(double val)
Set the crossY value.
virtual Range getCutRange()
Gets the object of current XyPlotter is a TupleCut object, get the range of it.
hippodraw::BinaryTransform class interface
wait(unsigned long time=ULONG_MAX)
endsWith(const QString &s, bool cs=TRUE) const
const std::vector< ViewBase *> & getViews()
Get all views in this group.
const std::vector< const ViewBase *> & views() const
Returns temporary list of all QtView objects on the canvas.
void addTextDisplay(PlotterBase *plotter, const std::string &s, const std::string &text=std::string())
Add a display of text Adds a display of text to that will be associated with plotter.
hippodraw::FunctionController class interface
void mouseMoveMultiItem(QMouseEvent *e)
Move more than one items in the Canvas.
static QtView * wrapPlotter(PlotterBase *plotter)
Wraps the plotter with a new QtView object.
virtual void getViews()
De-serializes the ViewBase objects.
virtual void contentsMousePressEvent(QMouseEvent *)
CanvasView(QCanvas *, QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
void setSelectedFlags()
Set the selected flags.
void setCrossX(double val)
Set the crossX value.
double low() const
Returns the minimum of the range object.
void writeImageToFile(unsigned int x, unsigned int y, const std::vector< double > &data, const std::string &filename)
Write a image to a FITS image.
int m_upage_w
The usable Page width in Postscript points.
static bool isValidImageFormat(const std::string &suffix)
Returns true if suffix string is one for valid image format.
bool fillPickedPoint(QMouseEvent *e, std::vector< double > &picked)
Fill the picked vector with the event data.
static FunctionController * instance()
Returns the pointer to the singleton instance.
void addFuncDisplay(PlotterBase *plotter, const std::string &s)
Add a text display which displays functions parameters.
The base class for the PlotterBase hierarchy.
The abstract base class for a factory that creates objects closely related to the graphics subsystem ...
A DataSource class implemented with std::vector<double> to store the column data. ...
A singleton class for keeping track the window components of HippoDraw.
A derived class of QCustomEvent to handle updates from PlotterBase.
writeEntry(const QString &key, bool value)
const std::vector< std::string > & getNTupleNames() const
Returns a vector of the current DataSource names.
hippodraw::WindowController class interface
virtual void contentsMouseReleaseEvent(QMouseEvent *)
Overrides inherited method to receive mouse released events.
void setPlotMatrix(unsigned int columns, unsigned int rows)
Sets the number of columns and rows of plots displayed on each page.
virtual TransformBase * getFitsTransform() const
Returns the fits transform object.
void removeView(ViewBase *inView)
Remove a view in the group.
void hide(QCanvasItem *item)
Removes the item from the canvas but not destroys it.
bool m_printer_bounds
A flag to indicate if rectangle display usable printer boundary should be displayed or not...
void copySelectedToPasteboard()
Copies selected items to pasteboard.
void clear()
Removes all the QCanvasItem objects from the canvas.
PyArray_TYPES type(numeric::array arr)
void initDockWindows(QMainWindow *mw)
Initializes the positions of dock windows.
DisplayController class interface declaration.
void setIntervalEnabled(bool yes=true)
Sets the display interval feature of all views to enabled if yes is true, otherwise sets the feature ...
virtual void setRange(Axes::Type axis, const Range &range, bool scaled=false, bool adjust_width=true)
Sets the range on the specified axis.
static FitsController * instance()
Returns the singleton instance of the FitsController.
void setChanged(bool yes=true)
Sets the canvas as being changed.
const std::vector< double > & mouseEventData()
Retrieve a vector of (x, y, z) points from the next mouse event.
int m_edge
For cut mode 1, edge or corner selected.
void initSettings()
Initialize the settings save from previous session.
void savePlotAsEps(const PlotterBase *plotter, const std::string &filename) const
Saves the plotter as an EPS image file.
Expresses a range of values.
readNumEntry(const QString &key, int def=0, bool *ok=0) const
hippodraw::CanvasSettings class interface
virtual Status openUpdatedNTuples()
Open the missing tuples updated by GUI.
void showInspector()
Show the Inspector window.
int m_apage_h
The actual Page height in Postscript points.
The class of views for Encapsulated Postscript generation.
virtual const Range & getRange(Axes::Type axis, bool scaled) const
Returns the range on the specified axis.
void reTilePage()
Re-tiles the current page.
This class manages the Create NTuple dialog.
bool m_add_selected
Set to true if displays should be selected when added.
void contentsMouseReleaseEvent(QMouseEvent *)
Handles details of mouse release, right button.
hippodraw::Inspector class interface.
The abstract base class for views.
Inspector * m_inspector
The Inspector object.
virtual void setShowCrossHairs(bool flag)
Sets display status of cross-hairs.
hippodraw::PlotterBase class interface.
void viewShowPickTable()
Show the pick table.
bool getZoomMode() const
Returns the bool indicating whether zoom mode is enabled or not.
NTuple * getPickTable() const
Gets the pick table as a NTuple.
void helpAbout()
Brings up dialog version numbers and contributors.
static NTupleController * instance()
Returns the pointer to the singleton instance.
void enableNewPlotBox(bool yes=true)
Enables the new plot box.
A derived class of PickTableBase class which is generated by the Qt designer.
void savePlotAsImage(const PlotterBase *plotter, const std::string &filename)
Saves the plotter as image file filename.
A singleton class is the interface between an application and the list of FunctionRep objects contain...
void updatePickTable(QtView *qtview, std::vector< double > &picked)
static const std::string s_app_name
The application name.
virtual void calcDefaultSize(QtView *view, double aspect_ratio=0.0)
Sets the default size and position for the view.
getSaveFileName(const QString &startWith=QString::null, const QString &filter=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, QString *selectedFilter=0, bool resolveSymlinks=TRUE)
critical(QWidget *parent, const QString &caption, const QString &text, int button0, int button1, int button2=0)
virtual const Range & getRange(Axes::Type axis, bool scaled) const
Returns the range on the specified axis.
void saveSelectedAsPixmap(const std::string &filename)
Save the selected objects as Pixmap image file filename.
This class implements additional QCanvasView functionality.
void showPrinterMargins(bool on)
Sets showing the printer margins on or off.
hippodraw::QtGroupView class interface
warning(QWidget *parent, const QString &caption, const QString &text, int button0, int button1, int button2=0)
hippodraw::FitsController class interface.
int m_cut_mode
Cut mode: 1: normal; 2: click; 3: drag.
void removeFromItemList(QCanvasItem *item)
Removes the item from list of items on the canvas.
QRect getSelectedBounds() const
Returns a QRect that enclosed the selected QCanvasItem objects.
void setPlotZoom(const std::vector< double > &start_picked, const std::vector< double > &picked)
Status openFile(const std::string &filename)
Attempts to open and parse the specified HippoDraw document.
hippodraw::Cut2DPlotter class interface
void setInspector(Inspector *inspector)
Sets the Inspector object.
int toViewY(double datY) const
Converts the data space coordinate Y to the view space coordinate Y.
getOpenFileName(const QString &startWith=QString::null, const QString &filter=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, QString *selectedFilter=0, bool resolveSymlinks=TRUE)
static ViewFactory * instance()
virtual void contentsMousePressEvent(QMouseEvent *)
void setUnselectedVisible(bool yes)
Sets the unselected items to visible or not.
void initFitterDefault()
Sets the default fitter.
void add(QCanvasItem *item)
Adds the item to the canvas.
A singleton class that is the interface between GUI and the DataSource objects.
readBoolEntry(const QString &key, bool def=FALSE, bool *ok=0) const
void initFromFile(const std::string &filename)
Initializes canvas from data in file filename.
QWaitCondition mouseEvent
QCanvas * m_canvas
The canvas object.
void ensureVisible(const QCanvasItem *item)
Scrolls the canvas, if needed, so the QCanvasItem item is visible.
QCanvasRectangle * m_drag_rect
Rectangle showing the area which is to be magnified.
const std::string & applicationName() const
Returns the name of the application.
void fillPlotterList(std::vector< PlotterBase * > &plotter_list)
Clears and fills plotter_list with all the PlotterBase objects on the canvas.
void sizeAndPlace(QtView *view)
Calculates the default size and position on the canvas.
static XmlController * s_xml_controller
The XML controller.
QFileDialog * m_image_dialog
The QFileDialog for saving images.
void autosaveSettings(QMainWindow *mw)
Save the recently opened file list.
void initFitterMenu(QActionGroup *group)
Initializes the fitter setting menu items.
hippodraw::PickTable class interface
double maximumZ() const
Returns the largest Z value of all the items on the canvas.
virtual bool hasAxis(Axes::Type axis) const
Returns true if the plotter has an axis of specified type.
void notifyObservers()
Notifies observers of a change in CanvasView.
std::vector< QCanvasItem *> m_selected_list
The list of currently selected QCanvasItem objects.
std::pair< double, double > addTextDisplayAt(PlotterBase *plotter, const std::string &type, const std::string &text, double xrel, double yrel)
Adds a text display at the relative position (xrel, yrel) in the selected item's coordinates.
inverseWorldMatrix() const
void contentsMouseMoveEvent(QMouseEvent *, double aspect)
Moves or re-sizes the selected QCanvasItem object.
Location m_whereClicked
Location where the mouse cursor clicked the object.
void swapOrientation()
Swaps the canvas' orientation from portrait to landscape or visa verse.
static QPrinter * s_printer
The single QPrinter instance.
void placeGraph(QCanvasRectangle *)
Moves the QCanvasRectangle object to place on the canvas where it will not collide with existing QCan...
PlotterBase * getRightClickedPlotter()
void addView(ViewBase *inView)
Add a view to the group.
const std::list< ViewBase *> & getFromSelectionCopy(ViewFactory *factory, const std::vector< const ViewBase * > &views)
Creates and returns objects that were copied to the selection copy.
void setCurrentRange()
Saves the current range of the selected plotter.
static QtXMLController * instance()
Returns the pointer to the singleton instance.
int m_num_height
Number of default sized plots vertically.
The class of derived from GroupViewBase, QtViewImp and QCanvasRectangle for drawing a grouped view on...
void initFitterSettings(QActionGroup *group)
Initializes the fitter settings menu items.
std::vector< PlotterBase *> getSelectedPlotters() const
Returns a list of selected plotters.
virtual const std::vector< double > & getZValues()
Returns all Z values.
virtual void print()
Prints the view to the printer.
ViewBase * createTextView(const ViewFactory *factory, hippodraw::DataRep *rep, const std::string &name, const std::string &text=std::string())
Creates an object which is a derived class of ViewBase.