本文整理汇总了C++中pt1函数的典型用法代码示例。如果您正苦于以下问题:C++ pt1函数的具体用法?C++ pt1怎么用?C++ pt1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pt1函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_homo_move_assign
static void
test_homo_move_assign ()
{
rw_info (0, __FILE__, __LINE__,
"move assignment operator (homogenous tuples)");
std::tuple<> et1, et2;
et2 = std::move (et1);
_RWSTD_UNUSED (et2);
int i = std::rand ();
std::tuple<int> it1 (i);
std::tuple<int> it2;
it2 = std::move (it1);
test (__LINE__, it2, i);
// move assignment ill-formed for constant element types
std::tuple<std::tuple<int> > nt1 (it2);
std::tuple<std::tuple<int> > nt2;
nt2 = std::move (nt1);
test (__LINE__, nt2, it2);
std::tuple<long, const char*> pt1 (1234567890L, "string");
std::tuple<long, const char*> pt2;
pt2 = std::move (pt1);
test (__LINE__, pt2, 1234567890L, (const char*) "string");
const UserDefined ud (i);
std::tuple<UserDefined> ut1 (ud);
std::tuple<UserDefined> ut2;
UserDefined::reset ();
ut2 = std::move (ut1); ++UserDefined::expect.move_asgn;
test (__LINE__, ut2, ud);
std::tuple<bool, char, int, double, void*, UserDefined>
bt1 (true, 'a', i, 3.14159, (void* const) &i, ud);
std::tuple<bool, char, int, double, void*, UserDefined> bt2;
UserDefined::reset ();
bt2 = std::move (bt1); ++UserDefined::expect.move_asgn;
test (__LINE__, bt2, true, 'a', i, 3.14159, (void* const) &i, ud);
}
开发者ID:Flameeyes,项目名称:stdcxx,代码行数:43,代码来源:20.tuple.cnstr.cpp
示例2: QgsPolygonV2
QgsTriangle::QgsTriangle( const QPointF p1, const QPointF p2, const QPointF p3 )
: QgsPolygonV2()
{
mWkbType = QgsWkbTypes::Triangle;
QgsPointV2 pt1( p1 );
QgsPointV2 pt2( p2 );
QgsPointV2 pt3( p3 );
if ( !validateGeom( pt1, pt2, pt3 ) )
{
return;
}
QVector< double > x;
x << p1.x() << p2.x() << p3.x();
QVector< double > y;
y << p1.y() << p2.y() << p3.y();
QgsLineString *ext = new QgsLineString( x, y );
setExteriorRing( ext );
}
开发者ID:cayetanobv,项目名称:QGIS,代码行数:19,代码来源:qgstriangle.cpp
示例3: pt0
void CGuideRectODL::GetTopPointList( std::vector<gp_Pnt>& arrPoint )
{
m_arrTopPoint.clear();
//如果开始点大于结束点
Gdiplus::REAL fX0 = m_rtArea.GetLeft();
Gdiplus::REAL fY0 = m_rtArea.GetTop();
Gdiplus::REAL fX1 = m_rtArea.GetRight();
Gdiplus::REAL fY1 = m_rtArea.GetBottom();
gp_Pnt pt0(fX0, 0, fY0);
gp_Pnt pt1(fX1, 0, fY0);
gp_Pnt pt2(fX1, 0, fY1);
gp_Pnt pt3(fX0, 0, fY1);
m_arrTopPoint.push_back(pt0);
m_arrTopPoint.push_back(pt1);
m_arrTopPoint.push_back(pt2);
m_arrTopPoint.push_back(pt3);
m_arrTopPoint.push_back(pt0);
arrPoint = m_arrTopPoint;
}
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:20,代码来源:GuideRectODL.cpp
示例4: pt1
bool CCoordTransService::Transform (double *pX, double *pY)
{
if (m_fIsInitialized) {
try {
CCSPoint pt1 (*pX, *pY);
THROW_FAILED_HRESULT(m_CTF -> Transform (&pt1, TRANSDIRECTION_FORWARD));
THROW_FAILED_HRESULT(pt1 -> get_X (pX));
THROW_FAILED_HRESULT(pt1 -> get_Y (pY));
return true;
} catch (_com_error &e) {
ShowError (_COM_ERROR(e), IDS_CSSERRORCAPTION, g_cbTransform);
return false;
}
}
ShowError (TRIAS02_E_CSSNOTINITIALIZED, IDS_CSSERRORCAPTION, g_cbTransform);
return false;
}
开发者ID:hkaiser,项目名称:TRiAS,代码行数:20,代码来源:CTFService.cpp
示例5: Surface
Surface* Building::extrude_envelope() const
{
Surface* envelope = new Surface(SurfaceType::Envelope,0,_length,_width,_height);
OGRLinearRing* ringFt = _footprint->getExteriorRing();
if(ringFt->isClockwise())
adjust_winding_ccw(ringFt);
envelope->addChild(new Surface(SurfaceType::Footprint,_footprint,_length,_width,0.));
//extrude roof
OGRLinearRing* ringRoof = new OGRLinearRing;
for(int i=0; i<ringFt->getNumPoints(); i++)
ringRoof->addPoint(ringFt->getX(i),ringFt->getY(i),_height);
OGRPolygon plyRoof;
plyRoof.addRingDirectly(ringRoof);
envelope->addChild(new Surface(SurfaceType::Roof,&plyRoof,_length,_width,0.));
//extrude walls
for(int i=0; i<ringFt->getNumPoints()-1; i++)
{
OGRLinearRing* ringWall = new OGRLinearRing;
ringWall->addPoint(ringFt->getX(i),ringFt->getY(i),0);
ringWall->addPoint(ringFt->getX(i+1),ringFt->getY(i+1),0);
ringWall->addPoint(ringFt->getX(i+1),ringFt->getY(i+1),_height);
ringWall->addPoint(ringFt->getX(i),ringFt->getY(i),_height);
ringWall->addPoint(ringFt->getX(i),ringFt->getY(i),0);
OGRPolygon plyWall;
plyWall.addRingDirectly(ringWall);
OGRPoint pt1(ringFt->getX(i),ringFt->getY(i),0);
OGRPoint pt2(ringFt->getX(i+1),ringFt->getY(i+1),0);
envelope->addChild(new Wall(&plyWall,pt1.Distance(&pt2),_height,&pt1,&pt2));
}
return envelope;
}
开发者ID:HEShuang,项目名称:BuildUP,代码行数:41,代码来源:Building.cpp
示例6: test_homo_move_ctor
static void
test_homo_move_ctor ()
{
rw_info (0, __FILE__, __LINE__,
"move constructor (homogenous tuples)");
std::tuple<> et (std::tuple<> ()); _RWSTD_UNUSED (et);
const int ci = std::rand ();
std::tuple<int> it1 (ci);
std::tuple<int> it2 (std::move (it1));
test (__LINE__, it2, ci);
std::tuple<const int> ct1 (ci);
std::tuple<const int> ct2 = std::move (ct1);
test (__LINE__, ct2, ci);
std::tuple<std::tuple<int> > nt1 (it1);
std::tuple<std::tuple<int> > nt2 = std::move (nt1);
test (__LINE__, nt2, it1);
std::tuple<long, const char*> pt1 (1234567890L, "string");
std::tuple<long, const char*> pt2 (std::move (pt1));
test (__LINE__, pt2, 1234567890L, (const char*) "string");
const UserDefined ud (ci);
std::tuple<UserDefined> ut1 (ud);
UserDefined::reset ();
std::tuple<UserDefined> ut2 (std::move (ut1));
++UserDefined::expect.move_ctor;
test (__LINE__, ut2, ud);
std::tuple<bool, char, int, double, void*, UserDefined>
bt1 (true, 'a', ci, 3.14159, (void*) &ci, ud);
++UserDefined::expect.copy_ctor;
std::tuple<bool, char, int, double, void*, UserDefined>
bt2 (std::move (bt1));
++UserDefined::expect.move_ctor;
test (__LINE__, bt2, true, 'a', ci, 3.14159, (void*) &ci, ud);
}
开发者ID:Flameeyes,项目名称:stdcxx,代码行数:41,代码来源:20.tuple.cnstr.cpp
示例7: pt1
void displayopencv::DisplayBspline(const mathtools::application::Bspline<2> &bspline, cv::Mat &img, const mathtools::affine::Frame<2>::Ptr frame, const cv::Scalar &color, const unsigned int &nb_pts)
{
double inf = bspline.getInfBound(),
sup = bspline.getSupBound();
Eigen::Vector2d prev = mathtools::affine::Point<2>(bspline(inf)).getCoords(frame);
for(unsigned int i=1;i<nb_pts;i++)
{
double t = inf + (double)i*(sup-inf)/(double)(nb_pts-1);
Eigen::Vector2d curr = mathtools::affine::Point<2>(bspline(t)).getCoords(frame);
cv::Point pt1(prev.x(), prev.y()),
pt2(curr.x(), curr.y());
prev=curr;
cv::line(img,pt1,pt2,color);
}
}
开发者ID:Ibujah,项目名称:skeletonbasedreconstruction,代码行数:21,代码来源:DisplayBsplineOCV.cpp
示例8: mark
void mark(cv::Mat& img, PPoint2d &p, unsigned char l) {
int r = 10;
//draw_circle(img, p, r, l);
// draw_circle(img, p[0], p[1], 10, l);
// draw_line(img, p[0]-r/2, p[1]-r/2, p[0]+r/2, p[1]+r/2, l);
// draw_line(img, p[0]-r/2, p[1]+r/2, p[0]+r/2, p[1]-r/2, l);
double x = p.x();
double y = p.y();
cv::Point2d pt(x,y);
cv::Point2d pt1(x - r / 2, y - r / 2);
cv::Point2d pt2(x + r / 2, y + r / 2);
cv::Point2d pt3(x - r / 2, y + r / 2);
cv::Point2d pt4(x + r / 2, y - r / 2);
cout << p << endl;
if (x >= 0 && y >= 0 && x <= img.rows && y <= img.cols) {
cv::circle(img, pt, 10, l);
cv::line(img, pt1, pt2, l);
cv::line(img, pt3, pt4, l);
}
}
开发者ID:NuitNoir,项目名称:practice,代码行数:21,代码来源:drawLine.hpp
示例9: grp
void FixtureGroup_Test::swap()
{
FixtureGroup grp(m_doc);
grp.setSize(QSize(4, 4));
for (quint32 id = 0; id < 16; id++)
{
Fixture* fxi = new Fixture(m_doc);
fxi->setChannels(1);
m_doc->addFixture(fxi);
grp.assignFixture(fxi->id());
}
QCOMPARE(grp.headList().size(), 16);
QLCPoint pt1(0, 0);
QLCPoint pt2(2, 1);
QVERIFY(grp.headHash().contains(pt1) == true);
QVERIFY(grp.headHash().contains(pt2) == true);
QCOMPARE(grp.headHash()[pt1], GroupHead(0, 0));
QCOMPARE(grp.headHash()[pt2], GroupHead(6, 0));
// Switch places with two fixtures
grp.swap(pt1, pt2);
QVERIFY(grp.headHash().contains(pt1) == true);
QVERIFY(grp.headHash().contains(pt2) == true);
QCOMPARE(grp.headHash()[pt1], GroupHead(6, 0));
QCOMPARE(grp.headHash()[pt2], GroupHead(0, 0));
// Switch places with a fixture and an empty point
pt2 = QLCPoint(500, 500);
grp.swap(pt1, pt2);
QVERIFY(grp.headHash().contains(pt1) == false);
QVERIFY(grp.headHash().contains(pt2) == true);
QCOMPARE(grp.headHash()[pt2], GroupHead(6, 0));
// ...and back again
grp.swap(pt1, pt2);
QVERIFY(grp.headHash().contains(pt1) == true);
QVERIFY(grp.headHash().contains(pt2) == false);
QCOMPARE(grp.headHash()[pt1], GroupHead(6, 0));
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:40,代码来源:fixturegroup_test.cpp
示例10: check_are_mergable
void check_are_mergable()
{
Polycurve_conic_traits_2 traits;
Polycurve_conic_traits_2::Construct_x_monotone_curve_2
construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object();
Polycurve_conic_traits_2::Are_mergeable_2 are_mergeable_2 =
traits.are_mergeable_2_object();
//create a curve
Rat_point_2 ps1(1, 10);
Rat_point_2 pmid1(5, 4);
Rat_point_2 pt1(10, 1);
Conic_curve_2 c1(ps1, pmid1, pt1);
Rat_point_2 ps2(10, 1);
Rat_point_2 pmid2(15, 14);
Rat_point_2 pt2(20, 20);
Conic_curve_2 c2(ps2, pmid2, pt2);
Rat_point_2 ps3(Rational(1,4), 4);
Rat_point_2 pmid3(Rational(3,2), 2);
Rat_point_2 pt3(2, Rational(1,3));
Conic_curve_2 c3(ps3, pmid3, pt3);
//construct x-monotone curve(compatible with polyline class)
Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 =
construct_x_monotone_curve_2(c1);
Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 =
construct_x_monotone_curve_2(c2);
Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc3 =
construct_x_monotone_curve_2(c3);
bool result = are_mergeable_2(polyline_xmc1, polyline_xmc2);
std::cout << "Are_mergable:: Mergable x-monotone polycurves are Computed as: "
<< ((result)? "Mergable" : "Not-Mergable") << std::endl;
result = are_mergeable_2(polyline_xmc1, polyline_xmc3);
std::cout << "Are_mergable:: Non-Mergable x-monotone polycurves are Computed as: "
<< ((result)? "Mergable" : "Not-Mergable") << std::endl;
}
开发者ID:2php,项目名称:cgal,代码行数:40,代码来源:test_conic_polycurve.cpp
示例11: DrawResult
void DrawResult(IplImage* image, windage::Matrix3 homography, CvScalar color = CV_RGB(255, 0, 0), int thickness = 1)
{
windage::Vector3 pt1(0.0, 0.0, 1.0);
windage::Vector3 pt2(TEMPLATE_WIDTH, 0.0, 1.0);
windage::Vector3 pt3(TEMPLATE_WIDTH, TEMPLATE_HEIGHT, 1.0);
windage::Vector3 pt4(0.0, TEMPLATE_HEIGHT, 1.0);
windage::Vector3 outPoint1 = homography * pt1;
windage::Vector3 outPoint2 = homography * pt2;
windage::Vector3 outPoint3 = homography * pt3;
windage::Vector3 outPoint4 = homography * pt4;
outPoint1 /= outPoint1.z;
outPoint2 /= outPoint2.z;
outPoint3 /= outPoint3.z;
outPoint4 /= outPoint4.z;
cvLine(image, cvPoint((int)outPoint1.x, (int)outPoint1.y), cvPoint((int)outPoint2.x, (int)outPoint2.y), color, thickness);
cvLine(image, cvPoint((int)outPoint2.x, (int)outPoint2.y), cvPoint((int)outPoint3.x, (int)outPoint3.y), color, thickness);
cvLine(image, cvPoint((int)outPoint3.x, (int)outPoint3.y), cvPoint((int)outPoint4.x, (int)outPoint4.y), color, thickness);
cvLine(image, cvPoint((int)outPoint4.x, (int)outPoint4.y), cvPoint((int)outPoint1.x, (int)outPoint1.y), color, thickness);
}
开发者ID:Barbakas,项目名称:windage,代码行数:22,代码来源:main.cpp
示例12: wxCHECK
// forward the message to the appropriate item
bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
{
// only owner-drawn control should receive this message
wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), false );
DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)item;
// the item may be -1 for an empty listbox
if ( pStruct->itemID == (UINT)-1 )
return false;
wxListBoxItem *pItem = (wxListBoxItem *)m_aItems[pStruct->itemID];
wxDCTemp dc((WXHDC)pStruct->hDC);
wxPoint pt1(pStruct->rcItem.left, pStruct->rcItem.top);
wxPoint pt2(pStruct->rcItem.right, pStruct->rcItem.bottom);
wxRect rect(pt1, pt2);
return pItem->OnDrawItem(dc, rect,
(wxOwnerDrawn::wxODAction)pStruct->itemAction,
(wxOwnerDrawn::wxODStatus)pStruct->itemState);
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:23,代码来源:listbox.cpp
示例13: check_is_vertical
void check_is_vertical()
{
Polycurve_conic_traits_2 traits;
Polycurve_conic_traits_2::Construct_x_monotone_curve_2
construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object();
Polycurve_conic_traits_2::Is_vertical_2 is_vertical =
traits.is_vertical_2_object();
//create a curve
Rat_point_2 ps1(1, 10);
Rat_point_2 pmid1(5, 4);
Rat_point_2 pt1(10, 1);
Conic_curve_2 c1(ps1, pmid1, pt1);
//make x-monotone curve
Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 =
construct_x_monotone_curve_2(c1);
bool result = is_vertical(polyline_xmc1);
std::cout << "Is_verticle:: Expected first result is not vertivle: Computed: "
<< ((result)? "vertical" : "not vertical") << std::endl;
}
开发者ID:2php,项目名称:cgal,代码行数:22,代码来源:test_conic_polycurve.cpp
示例14: CPPUNIT_ASSERT
void AABoxContainTest::testIsInVolumePt()
{
// Test empty box
gmtl::AABoxf box;
gmtl::Point3f origin;
CPPUNIT_ASSERT(! gmtl::isInVolume(box, origin));
// Test valid box with pt outside
gmtl::AABoxf box2(gmtl::Point3f(-1,-1,-1), gmtl::Point3f(1,1,1));
gmtl::Point3f pt1(2,2,2);
CPPUNIT_ASSERT(! gmtl::isInVolume(box2, pt1));
CPPUNIT_ASSERT(! gmtl::isInVolumeExclusive(box2, pt1));
//Test valid box with pt inside
CPPUNIT_ASSERT(gmtl::isInVolume(box2, origin));
CPPUNIT_ASSERT(gmtl::isInVolumeExclusive(box2, origin));
//Test valid box with pt on surface
gmtl::Point3f pt_on_surf(1,0,0);
CPPUNIT_ASSERT(gmtl::isInVolume(box2, pt_on_surf));
CPPUNIT_ASSERT(!gmtl::isInVolumeExclusive(box2, pt_on_surf));
}
开发者ID:CosmicPirate,项目名称:RayTracingRenderer,代码行数:22,代码来源:AABoxContainTest.cpp
示例15: check_construct_opposite
void check_construct_opposite()
{
Polycurve_conic_traits_2 traits;
Polycurve_conic_traits_2::Construct_x_monotone_curve_2
construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object();
Polycurve_conic_traits_2::Construct_opposite_2 construct_opposite_2 =
traits.construct_opposite_2_object();
//create a curve
Rat_point_2 ps1(1, 10);
Rat_point_2 pmid1(5, 4);
Rat_point_2 pt1(10, 1);
Conic_curve_2 c1(ps1, pmid1, pt1);
//construct x-monotone curve (compatible with polyline class)
Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 =
construct_x_monotone_curve_2(c1);
Polycurve_conic_traits_2::X_monotone_curve_2 polyline_opposite_curve =
construct_opposite_2(polyline_xmc1);
std::cout<< "Construct_opposite_2:: Opposite curve created";
}
开发者ID:2php,项目名称:cgal,代码行数:22,代码来源:test_conic_polycurve.cpp
示例16: TEST
TEST(NumLib, SpatialFunctionInterpolationSurface)
{
// create geometry
GeoLib::Point pt1(0.0, 0.0, 0.0);
GeoLib::Point pt2(10.0, 0.0, 0.0);
GeoLib::Point pt3(10.0, 10.0, 0.0);
GeoLib::Point pt4(0.0, 10.0, 0.0);
std::vector<GeoLib::Point*> pnts = {&pt1, &pt2, &pt3, &pt4};
GeoLib::Polyline ply0(pnts);
ply0.addPoint(0);
ply0.addPoint(1);
ply0.addPoint(2);
ply0.addPoint(3);
ply0.addPoint(0);
std::unique_ptr<GeoLib::Surface> sfc1(GeoLib::Surface::createSurface(ply0));
// define a function
const std::vector<std::size_t> vec_point_ids = {{0, 1, 2, 3}};
const std::vector<double> vec_point_values = {{0., 100., 100., 0.}};
NumLib::LinearInterpolationOnSurface interpolate(*sfc1, vec_point_ids, vec_point_values, std::numeric_limits<double>::max());
// normal
for (unsigned k=0; k<10; k++) {
ASSERT_DOUBLE_EQ(k*10., interpolate(GeoLib::Point(k,0,0)));
ASSERT_DOUBLE_EQ(k*10., interpolate(GeoLib::Point(k,5,0)));
ASSERT_DOUBLE_EQ(k*10., interpolate(GeoLib::Point(k,10,0)));
}
// failure
// x, y
ASSERT_DOUBLE_EQ(std::numeric_limits<double>::max(), interpolate(GeoLib::Point(-1,-1,0)));
ASSERT_DOUBLE_EQ(std::numeric_limits<double>::max(), interpolate(GeoLib::Point(11,-1,0)));
ASSERT_DOUBLE_EQ(std::numeric_limits<double>::max(), interpolate(GeoLib::Point(11,11,0)));
ASSERT_DOUBLE_EQ(std::numeric_limits<double>::max(), interpolate(GeoLib::Point(-1,11,0)));
// z
ASSERT_DOUBLE_EQ(std::numeric_limits<double>::max(), interpolate(GeoLib::Point(0,0,1)));
ASSERT_DOUBLE_EQ(std::numeric_limits<double>::max(), interpolate(GeoLib::Point(0,0,-1)));
}
开发者ID:Yonghuizz,项目名称:ogs,代码行数:38,代码来源:TestSpatialFunction.cpp
示例17: FL_WARN
void BlockingInfoRenderer::render(Camera* cam, Layer* layer, RenderList& instances) {
CellGrid* cg = layer->getCellGrid();
if (!cg) {
FL_WARN(_log, "No cellgrid assigned to layer, cannot draw grid");
return;
}
Rect cv = cam->getViewPort();
RenderList::const_iterator instance_it = instances.begin();
for (;instance_it != instances.end(); ++instance_it) {
Instance* instance = (*instance_it)->instance;
if (!instance->getObject()->isBlocking() || !instance->isBlocking()) {
continue;
}
std::vector<ExactModelCoordinate> vertices;
cg->getVertices(vertices, instance->getLocationRef().getLayerCoordinates());
std::vector<ExactModelCoordinate>::const_iterator it = vertices.begin();
int halfind = vertices.size() / 2;
ScreenPoint firstpt = cam->toScreenCoordinates(cg->toMapCoordinates(*it));
Point pt1(firstpt.x, firstpt.y);
Point pt2;
++it;
for (; it != vertices.end(); it++) {
ScreenPoint pts = cam->toScreenCoordinates(cg->toMapCoordinates(*it));
pt2.x = pts.x; pt2.y = pts.y;
Point cpt1 = pt1;
Point cpt2 = pt2;
m_renderbackend->drawLine(cpt1, cpt2, m_color.r, m_color.g, m_color.b);
pt1 = pt2;
}
m_renderbackend->drawLine(pt2, Point(firstpt.x, firstpt.y), m_color.r, m_color.g, m_color.b);
ScreenPoint spt1 = cam->toScreenCoordinates(cg->toMapCoordinates(vertices[0]));
Point pt3(spt1.x, spt1.y);
ScreenPoint spt2 = cam->toScreenCoordinates(cg->toMapCoordinates(vertices[halfind]));
Point pt4(spt2.x, spt2.y);
m_renderbackend->drawLine(pt3, pt4, m_color.r, m_color.g, m_color.b);
}
}
开发者ID:mgeorgehansen,项目名称:FIFE_Technomage,代码行数:38,代码来源:blockinginforenderer.cpp
示例18: pt1
bool MgCmdDrawRect::touchEnded(const MgMotion* sender)
{
Point2d pt1(m_startPt);
Point2d pt2(snapPoint(sender));
MgBaseRect* shape = (MgBaseRect*)dynshape()->shape();
if (shape->getFlag(kMgSquare)) {
float len = (float)mgMax(fabs(pt2.x - pt1.x), fabs(pt2.y - pt1.y));
Box2d rect(m_startPt, 2.f * len, 0);
pt1 = rect.leftTop();
pt2 = rect.rightBottom();
}
shape->setRect(pt1, pt2);
dynshape()->shape()->update();
float minDist = mgDisplayMmToModel(5, sender);
if (shape->getWidth() > minDist && shape->getHeight() > minDist) {
addRectShape(sender);
}
return _touchEnded(sender);
}
开发者ID:fanliugen,项目名称:touchvg,代码行数:23,代码来源:mgdrawrect.cpp
示例19: plotLinesToPainter
void plotLinesToPainter(QPainter& painter,
const Numpy1DObj& x1, const Numpy1DObj& y1,
const Numpy1DObj& x2, const Numpy1DObj& y2,
const QRectF* clip, bool autoexpand)
{
const int maxsize = min(x1.dim, x2.dim, y1.dim, y2.dim);
// if autoexpand, expand rectangle by line width
QRectF clipcopy;
if ( clip != 0 && autoexpand )
{
const qreal lw = painter.pen().widthF();
qreal x1, y1, x2, y2;
clip->getCoords(&x1, &y1, &x2, &y2);
clipcopy.setCoords(x1, y1, x2, y2);
clipcopy.adjust(-lw, -lw, lw, lw);
}
if( maxsize != 0 )
{
QVector<QLineF> lines;
for(int i = 0; i < maxsize; ++i)
{
QPointF pt1(x1(i), y1(i));
QPointF pt2(x2(i), y2(i));
if( clip != 0 )
{
if( clipLine(clipcopy, pt1, pt2) )
lines << QLineF(pt1, pt2);
}
else
lines << QLineF(pt1, pt2);
}
painter.drawLines(lines);
}
}
开发者ID:amcdawes,项目名称:veusz,代码行数:37,代码来源:qtloops.cpp
示例20: createBlock
void createBlock()
{
AcDbBlockTableRecord* pBTR = new AcDbBlockTableRecord();
pBTR->setName(DYNBLKSAMP_BLOCKNAME);
AcDbSymbolTable* pBT = NULL;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBT, AcDb::kForWrite);
pBT->add(pBTR);
pBT->close();
AcGePoint3d pt1(0.0, 0.0, 0.0);
AcGePoint3d pt2(2.0, 0.0, 0.0);
AcDbLine* pLine = new AcDbLine(pt1, pt2);
pBTR->appendAcDbEntity(pLine);
pLine->close();
pt1 = pt2;
pt2.y = 2.0;
pLine = new AcDbLine(pt1, pt2);
pBTR->appendAcDbEntity(pLine);
pLine->close();
pt1 = pt2;
pt2.x = 0.0;
pLine = new AcDbLine(pt1, pt2);
pBTR->appendAcDbEntity(pLine);
pLine->close();
pt1 = pt2;
pt2.y = 0.0;
pLine = new AcDbLine(pt1, pt2);
pBTR->appendAcDbEntity(pLine);
pLine->close();
pBTR->close();
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:36,代码来源:ProtocolReactors.cpp
注:本文中的pt1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论