本文整理汇总了C++中DBbox::p2方法的典型用法代码示例。如果您正苦于以下问题:C++ DBbox::p2方法的具体用法?C++ DBbox::p2怎么用?C++ DBbox::p2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBbox
的用法示例。
在下文中一共展示了DBbox::p2方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void tui::LayoutCanvas::OnZoom(wxCommandEvent& evt) {
DBbox* box = NULL;
switch (evt.GetInt())
{
case ZOOM_WINDOW : box = static_cast<DBbox*>(evt.GetClientData());break;
case ZOOM_WINDOWM: box = DEBUG_NEW DBbox(presspoint.x(),presspoint.y(),
ScrMARK.x(),ScrMARK.y());break;
case ZOOM_IN : box = DEBUG_NEW DBbox( (3*lp_BL.x() + lp_TR.x())/4, //in
(3*lp_BL.y() + lp_TR.y())/4,
(3*lp_TR.x() + lp_BL.x())/4,
(3*lp_TR.y() + lp_BL.y())/4);
break;
case ZOOM_OUT : box = DEBUG_NEW DBbox( (5*lp_BL.x() - lp_TR.x())/4, //out
(5*lp_BL.y() - lp_TR.y())/4,
(5*lp_TR.x() - lp_BL.x())/4,
(5*lp_TR.y() - lp_BL.y())/4);
break;
case ZOOM_LEFT : box = DEBUG_NEW DBbox( ( lp_TR.x() + lp_BL.x())/2, //left
lp_BL.y() ,
(3*lp_BL.x() - lp_TR.x())/2,
lp_TR.y() );
break;
case ZOOM_RIGHT : box = DEBUG_NEW DBbox( (3*lp_TR.x() - lp_BL.x())/2, // right
lp_BL.y() ,
( lp_TR.x() + lp_BL.x())/2,
lp_TR.y() );
break;
case ZOOM_UP : box = DEBUG_NEW DBbox( lp_BL.x() , // up
(3*lp_BL.y() - lp_TR.y())/2,
lp_TR.x() ,
( lp_TR.y() + lp_BL.y())/2);
break;
case ZOOM_DOWN : box = DEBUG_NEW DBbox( lp_BL.x() , // down
( lp_TR.y() + lp_BL.y())/2,
lp_TR.x() ,
(3*lp_TR.y() - lp_BL.y())/2);
break;
case ZOOM_EMPTY : box = DEBUG_NEW DBbox(-10,-10,90,90);
break;
case ZOOM_REFRESH: invalid_window = true; Refresh(); return;
default: assert(false);
}
int Wcl, Hcl;
GetClientSize(&Wcl,&Hcl);
// To prevent a loss of precision in the following lines - don't use
// integer variables (Wcl & Hcl) directly
double W = Wcl;
double H = Hcl;
double w = abs(box->p1().x() - box->p2().x());
double h = abs(box->p1().y() - box->p2().y());
double sc = ((W/H < w/h) ? w/W : h/H);
double tx = ((box->p1().x() + box->p2().x()) - W*sc) / 2;
double ty = ((box->p1().y() + box->p2().y()) - H*sc) / 2;
_LayCTM.setCTM( sc, 0.0, 0.0, sc, tx, ty);
_LayCTM.FlipX((box->p1().y() + box->p2().y())/2); // flip Y coord towards the center
DATC->setScrCTM(_LayCTM.Reversed());
delete box;
invalid_window = true;
Refresh();
}
示例2: assert
int tellstdfunc::stdGETOVERLAP::execute()
{
telldata::TtLayout* layObject = static_cast<telldata::TtLayout*>(OPstack.top());OPstack.pop();
assert(layObject);
real DBscale = PROPC->DBscale();
DBbox ovlBox = layObject->data()->overlap();
telldata::TtPnt p1DB(ovlBox.p1().x()/DBscale, ovlBox.p1().y()/DBscale );
telldata::TtPnt p2DB(ovlBox.p2().x()/DBscale, ovlBox.p2().y()/DBscale);
OPstack.push(DEBUG_NEW telldata::TtBox( p1DB, p2DB ));
delete layObject;
return EXEC_NEXT;
}
示例3: DBline
void layprop::SupplementaryData::getConsts(const CTM& LayCTM, DBline& long_mark, DBline& short_mark, DBline& text_bp, double& scaledpix)
{
// Side ticks (segments) of the rulers has to be with constant size. The next lines
// are generating a segment with the size 7/3 screen pixels centered in
// the {0,0} point of the canvas (logical coords)
// the coeffitients 1e3/1e-3 are picked ramdomly attempting to reduce the
// error
const double ico = 1e3;
const double dco = 1/ico;
DBline tick_sample = DBline(TP(0,0),TP(0,7,ico)) * LayCTM;
double tick_size = ((double)(tick_sample.p2().y()-tick_sample.p1().y()));
long_mark = DBline(TP(0,-tick_size, dco),TP(0,tick_size, dco));
tick_sample = DBline(TP(0,0),TP(0,3,ico)) * LayCTM;
tick_size = ((double)(tick_sample.p2().y()-tick_sample.p1().y()));
short_mark = DBline(TP(0,-tick_size, dco),TP(0,tick_size, dco));
tick_sample = DBline(TP(0,0),TP(0,20,ico)) * LayCTM;
tick_size = ((double)(tick_sample.p1().y()-tick_sample.p2().y()));
text_bp = DBline(TP(0,0),TP(0,tick_size, dco));
// now prepare to draw the size
DBbox pixelbox = DBbox(TP(),TP(15,15)) * LayCTM;
scaledpix = ((double)(pixelbox.p2().x()-pixelbox.p1().x()));
}
示例4: DBline
void trend::TrendBase::genRulerMarks(const CTM& LayCTM, DBline& long_mark, DBline& short_mark, DBline& text_bp, double& scaledpix)
{
// Side ticks (segments) of the rulers has to be with constant size. The next
// lines are generating a segment with the size 7/3 screen pixels centred in
// the {0,0} point of the canvas (logical coordinates)
// The coefficients 1e3/1e-3 are picked arbitrary in an attempt to reduce the
// error
const double ico = 1e3;
const double dco = 1/ico;
DBline tick_sample = DBline(TP(0,0),TP(0,7,ico)) * LayCTM;
double tick_size = ((double)(tick_sample.p2().y()-tick_sample.p1().y()));
long_mark = DBline(TP(0,-tick_size, dco),TP(0,tick_size, dco));
tick_sample = DBline(TP(0,0),TP(0,3,ico)) * LayCTM;
tick_size = ((double)(tick_sample.p2().y()-tick_sample.p1().y()));
short_mark = DBline(TP(0,-tick_size, dco),TP(0,tick_size, dco));
tick_sample = DBline(TP(0,0),TP(0,20,ico)) * LayCTM;
tick_size = ((double)(tick_sample.p1().y()-tick_sample.p2().y()));
text_bp = DBline(TP(0,0),TP(0,tick_size, dco));
// now prepare to draw the size
DBbox pixelbox = DBbox(TP(),TP(15,15)) * LayCTM;
scaledpix = ((double)(pixelbox.p2().x()-pixelbox.p1().x()));
}
示例5: switch
void tui::LayoutCanvas::OnZoom(wxCommandEvent& evt) {
DBbox* box = NULL;
switch (evt.GetInt()) {
case ZOOM_WINDOW : box = static_cast<DBbox*>(evt.GetClientData());break;
case ZOOM_WINDOWM: box = new DBbox(presspoint.x(),presspoint.y(),
ScrMARK.x(),ScrMARK.y());break;
case ZOOM_IN : box = new DBbox((3*lp_BL.x() + lp_TR.x())/4, //in
(3*lp_BL.y() + lp_TR.y())/4,
(3*lp_TR.x() + lp_BL.x())/4,
(3*lp_TR.y() + lp_BL.y())/4); break;
case ZOOM_OUT : box = new DBbox((5*lp_BL.x() - lp_TR.x())/4, //out
(5*lp_BL.y() - lp_TR.y())/4,
(5*lp_TR.x() - lp_BL.x())/4,
(5*lp_TR.y() - lp_BL.y())/4); break;
case ZOOM_LEFT : box = new DBbox(( lp_TR.x() + lp_BL.x())/2, //left
lp_BL.y() ,
(3*lp_BL.x() - lp_TR.x())/2,
lp_TR.y() ); break;
case ZOOM_RIGHT : box = new DBbox((3*lp_TR.x() - lp_BL.x())/2, // right
lp_BL.y() ,
( lp_TR.x() + lp_BL.x())/2,
lp_TR.y() ); break;
case ZOOM_UP : box = new DBbox( lp_BL.x() , // up
(3*lp_BL.y() - lp_TR.y())/2,
lp_TR.x() ,
( lp_TR.y() + lp_BL.y())/2); break;
case ZOOM_DOWN : box = new DBbox( lp_BL.x() , // down
( lp_TR.y() + lp_BL.y())/2,
lp_TR.x() ,
(3*lp_TR.y() - lp_BL.y())/2); break;
case ZOOM_EMPTY : box = new DBbox(-10,-10,90,90); break;
default: assert(false);
}
int W, H;
GetClientSize(&W,&H);
double w = abs(box->p1().x() - box->p2().x());
double h = abs(box->p1().y() - box->p2().y());
double sc = (W/H < w/h) ? w/W : h/H;
double tx = ((box->p1().x() + box->p2().x()) - W*sc) / 2;
double ty = ((box->p1().y() + box->p2().y()) - H*sc) / 2;
_LayCTM.setCTM( sc, 0.0, 0.0, sc, tx, ty);
_LayCTM.FlipX((box->p1().y() + box->p2().y())/2); // flip Y coord towards the center
Properties->setScrCTM(_LayCTM.Reversed());
invalid_window = true;
delete box;
Refresh();
}
示例6: TP
//tui::CanvasStatus::CanvasStatus(){};
void tui::StatusLine::update(const int4b width, const CTM& _LayCTM)
{
_sb_BL = TP(0,0) * _LayCTM;
_sb_TR = TP(width, 30) * _LayCTM;
DBbox pixelbox = DBbox(TP(),TP(14,14)) * _LayCTM;
_scaledpix = ((double)(pixelbox.p2().x()-pixelbox.p1().x()));
_cY = TP(width-150, 17) * _LayCTM;
_cX = TP(width-300, 17) * _LayCTM;
_dY = TP(width-450, 17) * _LayCTM;
_dX = TP(width-600, 17) * _LayCTM;
_Ycoord = DBbox(TP(width - 130, 28), TP(width - 2, 2)) * _LayCTM;
_Xcoord = DBbox(TP(width - 280, 28), TP(width - 162, 2)) * _LayCTM;
_wcY = TP(width-120, 16) * _LayCTM;
_wcX = TP(width-270, 16) * _LayCTM;
}