本文整理汇总了C++中TP函数的典型用法代码示例。如果您正苦于以下问题:C++ TP函数的具体用法?C++ TP怎么用?C++ TP使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DBbox
void trend::TrendBase::wiret(const PointVector& pdata, WireWidth width)
{
// first check whether to draw only the center line
DBbox wsquare = DBbox(TP(0,0),TP(width,width));
bool center_line_only = !wsquare.visible(topCTM() * scrCTM(), visualLimit());
_clayer->wire(pdata, width, center_line_only, *_rmm);
}
示例2: TP
int tellstdfunc::stdDISTANCE::execute()
{
// get the data from the stack
telldata::ttlist *pl = static_cast<telldata::ttlist*>(OPstack.top());OPstack.pop();
telldata::ttpnt* p1 = NULL;
telldata::ttpnt* p2 = NULL;
for (unsigned i = 0; i < pl->size(); i++) {
p1 = p2;
p2 = static_cast<telldata::ttpnt*>((pl->mlist())[i]);
if (NULL != p1)
{
TP ap1 = TP(p1->x(),p1->y(), DATC->DBscale());
TP ap2 = TP(p2->x(),p2->y(), DATC->DBscale());
DATC->addRuler(ap1,ap2);
/* std::ostringstream info;
info << "Distance {" << p1->x() << " , " << p1->y() <<"} - {"
<< p2->x() << " , " << p2->y() <<"} is ";
tell_log(console::MT_WARNING,info.str());*/
}
}
delete pl;
RefreshGL();
return EXEC_NEXT;
}
示例3: check
laydata::tdtdata* laydata::tdtdesign::addpoly(word la, const pointlist* pl) {
laydata::valid_poly check(*pl);
if (!check.valid()) {
std::ostringstream ost;
ost << "Polygon check fails - " << check.failtype();
tell_log(console::MT_ERROR, ost.str());
return NULL;
}
laydata::tdtdata* newshape;
DBbox old_overlap = _target.edit()->overlap();
tdtlayer *actlay = static_cast<tdtlayer*>(targetlayer(la));
modified = true;
pointlist vpl = check.get_validated();
if (check.box()) {
TP* p1= DEBUG_NEW TP(vpl[0] *_target.rARTM());
TP* p2= DEBUG_NEW TP(vpl[2] *_target.rARTM());
newshape = actlay->addbox(p1,p2);
}
for(pointlist::iterator PL = vpl.begin(); PL != vpl.end(); PL++)
(*PL) *= _target.rARTM();
newshape = actlay->addpoly(vpl);
if (_target.edit()->overlapChanged(old_overlap, this))
do {} while(validate_cells());
return newshape;
}
示例4: GetClientSize
void tui::LayoutCanvas::update_viewport() {
int W, H;
GetClientSize(&W,&H);
lp_BL = TP(0,0) * _LayCTM;
lp_TR = TP(W, H) * _LayCTM;
Properties->setClipRegion(DBbox(lp_BL.x(),lp_TR.y(), lp_TR.x(), lp_BL.y()));
glClearColor(0,0,0,0);
}
示例5: GetClientSize
void tui::LayoutCanvas::update_viewport() {
int W, H;
GetClientSize(&W,&H);
lp_BL = TP(0,0) * _LayCTM;
lp_TR = TP(W, H) * _LayCTM;
// _status_line.update(W, _LayCTM);
DATC->setClipRegion(DBbox(lp_BL.x(),lp_TR.y(), lp_TR.x(), lp_BL.y()));
glClearColor(0,0,0,0);
}
示例6: if
/*!The method uses #_shape1 and #_shape2 structure as an input data and produces
one or more polygons representing the result of the logical OR between the
input polygons. Method returns false if no output shapes are generated, and
true otherwise*/
bool logicop::logic::OR(pcollection& plycol) {
bool result = false;
VPoint* centinel = NULL;
if (0 == _crossp) {
// If there are no crossing points found, this still does not mean
// that the operation will fail. Polygons might be fully overlapping...
// Check that a random point from poly1 is inside poly2 ...
if (_shape1->inside(_poly2)) centinel = _shape2;
// ... if not, check that a random point from poly2 is inside poly1 ...
else if (_shape2->inside(_poly1)) centinel = _shape1;
// ... if not - polygons does not have any common area
else return false;
// If we've got here means that one of the polygons is completely
// overlapped by the other one. So we need to return the outer one
pointlist *shgen = new pointlist();
VPoint* vpnt = centinel;
do {
shgen->push_back(TP(vpnt->cp()->x(), vpnt->cp()->y()));
vpnt = vpnt->next();
}while (centinel != vpnt);
plycol.push_back(shgen);
return true;
}
pcollection lclcol; // local collection of the resulting shapes
// get first external and non crossing point
centinel = getFirstOutside(_poly2, _shape1);
if (NULL == centinel) centinel = getFirstOutside(_poly1, _shape2);
assert(centinel);
VPoint* collector = centinel;
bool direction = true; /*next*/
do {
if (0 == collector->visited()) {
pointlist *shgen = new pointlist();
VPoint* pickup = collector;
direction = (0 == lclcol.size());
do {
pickup = pickup->follower(direction);
shgen->push_back(TP(pickup->cp()->x(), pickup->cp()->y()));
} while (pickup != collector);
direction = true;
lclcol.push_back(shgen);
result = true;
}
collector = collector->next();
} while (collector != centinel);
if (!result) return result;
// Convert all collected shapes to a single normalized polygon
pointlist* respoly = lclcol.front();lclcol.pop_front();
while (0 < lclcol.size()) {
respoly = hole2simple(*respoly, *(lclcol.front()));
lclcol.pop_front();
}
plycol.push_back(respoly);
return result;
}
示例7: PSegment
//-----------------------------------------------------------------------------
// class SSegment (Stretch Segment)
//-----------------------------------------------------------------------------
logicop::SSegment::SSegment(const TP& p1, const TP& p2, int distance) : PSegment(p1,p2)
{
assert(0 != distance);
DBline sample(TP(0,0), TP(distance, 0));
CTM mtrx;
real rotation = laydata::xangle(p1,p2) + 270.0;
mtrx.Rotate(rotation);
mtrx.Translate(p1);
sample = sample * mtrx;
_moved = parallel(sample.p2());
}
示例8: DBbox
int tellstdfunc::stdZOOMWINb::execute() {
telldata::ttwnd *w = static_cast<telldata::ttwnd*>(OPstack.top());OPstack.pop();
real DBscale = DATC->DBscale();
DBbox* box = DEBUG_NEW DBbox(TP(w->p1().x(), w->p1().y(), DBscale),
TP(w->p2().x(), w->p2().y(), DBscale));
wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM);
eventZOOM.SetInt(tui::ZOOM_WINDOW);
eventZOOM.SetClientData(static_cast<void*>(box));
wxPostEvent(TopedCanvasW, eventZOOM);
return EXEC_NEXT;
}
示例9: TEUNDO_DEBUG
void tellstdfunc::stdSELECT::undo() {
TEUNDO_DEBUG("select(box) UNDO");
telldata::ttwnd *w = static_cast<telldata::ttwnd*>(UNDOPstack.front());UNDOPstack.pop_front();
real DBscale = DATC->DBscale();
TP* p1DB = DEBUG_NEW TP(w->p1().x(), w->p1().y(), DBscale);
TP* p2DB = DEBUG_NEW TP(w->p2().x(), w->p2().y(), DBscale);
laydata::tdtdesign* ATDB = DATC->lockDB();
ATDB->unselect_inBox(p1DB, p2DB);
DATC->unlockDB();
delete w;delete p1DB; delete p2DB;
UpdateLV();
}
示例10: parseSingleReply
Month parseSingleReply(QNetworkReply* reply, QString& error)
{
QTextStream page(reply);
QString str = page.readAll();
Month ret;
if(str.indexOf("Ошибка") != -1)
{
error = "Ошибка в запросе";
return ret;
}
int start = str.indexOf("<tbody>");
int end = str.indexOf("</tbody>");
str = str.mid(start, end - start);
auto list = str.split("<tr align=\"center\">", QString::SkipEmptyParts);
for(int i = 1; i < list.size(); i++)
{
QString line = list[i];
auto day = line.split("<td", QString::SkipEmptyParts);
Half first;
Half second;
first.t = TP(day[2]);
second.t = TP(day[7]);
first.p = TP(day[3]);
second.p = TP(day[8]);
first.cl = cloudness(day[4]);
second.cl = cloudness(day[9]);
first.ph = precipitations(day[5]);
second.ph = precipitations(day[10]);
auto windAM = wind(day[6]);
auto windPM = wind(day[11]);
first.wd = windLable(windAM.first);
second.wd = windLable(windPM.first);
first.ws = windAM.second;
second.ws = windPM.second;
ret.append( qMakePair(first, second) );
}
return ret;
}
示例11: getOpValue
int tellstdfunc::stdCELLAREF::execute() {
UNDOcmdQ.push_front(this);
// get the parameters from the operand stack
//cellaref("boza",getpoint(),0,false,1,3,2,30,70);
real stepY = getOpValue();
real stepX = getOpValue();
word row = getWordValue();
word col = getWordValue();
real magn = getOpValue();
bool flip = getBoolValue();
real angle = getOpValue();
telldata::ttpnt *rpnt =
static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
std::string name = getStringValue();
real DBscale = DATC->DBscale();
int4b istepX = (int4b)rint(stepX * DBscale);
int4b istepY = (int4b)rint(stepY * DBscale);
CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn,angle,flip);
laydata::ArrayProperties arrprops(istepX,istepY,col,row);
laydata::tdtdesign* ATDB = DATC->lockDB();
telldata::ttlayout* cl = DEBUG_NEW telldata::ttlayout(
ATDB->addcellaref(name,ori,arrprops),REF_LAY);
DATC->unlockDB();
OPstack.push(cl); UNDOPstack.push_front(cl->selfcopy());
LogFile << LogFile.getFN() << "(\""<< name << "\"," << *rpnt << "," <<
angle << "," << LogFile._2bool(flip) << "," << magn << "," <<
col << "," << row << "," << stepX << "," << stepY << ");";
LogFile.flush();
delete rpnt;
RefreshGL();
return EXEC_NEXT;
}
示例12: view
void CreateSingleWayInteraction::paintEvent(QPaintEvent* anEvent, QPainter& thePainter)
{
if (theRoad && (!theRoad->layer() || theRoad->isDeleted())) { // The road was begon and then undoed. Restarting....
HaveFirst = false;
theRoad = NULL;
Creating = false;
view()->setInteracting(false);
}
if (HaveFirst)
{
QPointF PreviousPoint;
if (theRoad && theRoad->size() && !Prepend)
PreviousPoint = COORD_TO_XY(CAST_NODE(theRoad->get(theRoad->size()-1))->position());
else
PreviousPoint = COORD_TO_XY(FirstPoint);
QBrush SomeBrush(QColor(0xff,0x77,0x11,128));
QPen TP(SomeBrush,qBound(3, int(view()->pixelPerM()*4+2), 10));
::draw(thePainter,TP,Feature::UnknownDirection, PreviousPoint,LastCursor ,4 ,view()->projection());
Coord NewPoint = XY_TO_COORD(LastCursor);
const qreal distance = FirstPoint.distanceFrom(NewPoint);
QString distanceTag;
if (distance < 1.0)
distanceTag = QString("%1 m").arg(int(distance * 1000));
else
distanceTag = QString("%1 km").arg(distance, 0, 'f', 3);
thePainter.drawText(LastCursor + QPointF(10,-10), distanceTag);
}
FeatureSnapInteraction::paintEvent(anEvent,thePainter);
}
示例13: testDummyRandomExceptionPackages
void testDummyRandomExceptionPackages()
{
try
{
libmaus2::parallel::SimpleThreadPool TP(8);
uint64_t const dispid = 0;
libmaus2::parallel::DummyThreadWorkPackageRandomExceptionDispatcher dummydisp;
TP.registerDispatcher(dispid,&dummydisp);
libmaus2::parallel::DummyThreadWorkPackageMeta meta;
libmaus2::parallel::PosixMutex printmutex;
libmaus2::parallel::DummyThreadWorkPackage * pack = meta.freelist.getPackage(); //(0,dispid,&printmutex,&meta);
*pack = libmaus2::parallel::DummyThreadWorkPackage(0 /* priority */, dispid, &printmutex, &meta);
TP.enque(pack);
TP.join();
}
catch(std::exception const & ex)
{
std::cerr << ex.what() << std::endl;
}
}
示例14: Vector_dot
Value* Vector_dot(const Vector* vector1, const Vector* vector2, const Context* ctx) {
unsigned count = vector1->vals->count;
if(count != vector2->vals->count && vector2->vals->count != 1) {
/* Both vectors must have the same number of values */
return ValErr(mathError("Vectors must have the same dimensions for dot product."));
}
/* Store the total value of the dot product */
Value* accum = ValInt(0);
unsigned i;
for(i = 0; i < count; i++) {
Value* val2;
if(vector2->vals->count == 1) {
val2 = vector2->vals->args[0];
}
else {
val2 = vector2->vals->args[i];
}
/* accum += v1[i] * val2 */
TP(tp);
accum = TP_EVAL(tp, ctx, "@@[email protected]@*@@",
accum,
Value_copy(vector1->vals->args[i]),
Value_copy(val2));
}
return accum;
}
示例15: getOpValue
int tellstdfunc::stdROTATESEL::execute()
{
UNDOcmdQ.push_front(this);
UNDOPstack.push_front(OPstack.top());
telldata::ttpnt *p1 = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop();
real angle = getOpValue();
UNDOPstack.push_front(DEBUG_NEW telldata::ttreal(angle));
real DBscale = DATC->DBscale();
// rotate_selected returns 3 select lists : Failed/Deleted/Added
// This is because of the box rotation in which case box has to be converted to polygon
// Failed shapes here should not exist but no explicit check for this
laydata::selectList* fadead[3];
byte i;
for (i = 0; i < 3; fadead[i++] = DEBUG_NEW laydata::selectList());
laydata::tdtdesign* ATDB = DATC->lockDB();
ATDB->rotate_selected(TP(p1->x(), p1->y(), DBscale), angle, fadead);
telldata::ttlist* added = make_ttlaylist(fadead[2]);
ATDB->select_fromList(get_ttlaylist(added));
// save for undo operations ...
UNDOPstack.push_front(make_ttlaylist(fadead[0])); // first failed
UNDOPstack.push_front(make_ttlaylist(fadead[1])); // then deleted
UNDOPstack.push_front(added); // and added
for (i = 0; i < 3; delete fadead[i++]);
DATC->unlockDB();
LogFile << LogFile.getFN() << "("<< angle << "," << *p1 << ");"; LogFile.flush();
//delete p1; undo will delete them
RefreshGL();
return EXEC_NEXT;
}