本文整理汇总了C++中QPolygonF::value方法的典型用法代码示例。如果您正苦于以下问题:C++ QPolygonF::value方法的具体用法?C++ QPolygonF::value怎么用?C++ QPolygonF::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPolygonF
的用法示例。
在下文中一共展示了QPolygonF::value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _makeRegionPolygon
casa::ImageRegion* ImageRegionGenerator::_makeRegionPolygon( casa::ImageInterface<casa::Float> * image,
Carta::Lib::Regions::Polygon* polygon ){
casa::ImageRegion* imageRegion = nullptr;
if ( image && polygon ){
QPolygonF poly = polygon->qpolyf();
int cornerPointCount = poly.count();
casa::Vector<casa::Double> x( cornerPointCount );
casa::Vector<casa::Double> y( cornerPointCount );
const casa::CoordinateSystem &cs = image->coordinates( );
bool successful = true;
for ( int i = 0; i < cornerPointCount; ++i ) {
QPointF polyPt = poly.value( i );
casa::Vector<casa::Double> worldPt = _toWorld( cs, polyPt.x(), polyPt.y(), &successful );
if ( successful ){
x[i] = worldPt[0];
y[i] = worldPt[1];
}
else {
qDebug() << "i="<<i<<" could not convert x="<<polyPt.x()<<" y="<<polyPt.y()<<" to world.";
break;
}
}
if ( successful ){
casa::Vector<casa::Int> dispAxes(2);
const casa::CoordinateSystem &cs = image->coordinates( );
int directionIndex = cs.findCoordinate( casa::Coordinate::DIRECTION );
if ( directionIndex >= 0 ){
casa::Vector<casa::Int> dirPixelAxis = cs.pixelAxes(directionIndex);
dispAxes(0) = dirPixelAxis[0];
dispAxes(1) = dirPixelAxis[1];
const casa::String units( RAD_UNITS.toStdString().c_str() );
try {
casa::Quantum<casa::Vector<casa::Double> > qx( x, units );
casa::Quantum<casa::Vector<casa::Double> > qy( y, units );
casa::WCPolygon poly(qx, qy, casa::IPosition(dispAxes), cs);
imageRegion = new casa::ImageRegion(poly);
}
catch( casa::AipsError& error ) {
qDebug() << "Error making image region: "<<error.getMesg().c_str();
}
}
}
}
return imageRegion;
}