| 
    QGIS API Documentation
    3.26.3-Buenos Aires (65e4edfdad)
    
   | 
 
 
 
 
Go to the documentation of this file.
   27 #include <QTextStream> 
   42   if ( poly.size() != 1 )
 
   46   if ( polyline.size() == 5 && polyline.at( 0 ) == polyline.at( 4 ) && geom.
isGeosValid() )
 
   47     return QgsRectangle( polyline.at( 0 ).x(), polyline.at( 0 ).y(), polyline.at( 2 ).x(), polyline.at( 2 ).y() );
 
   55   const double xMax = xMin + 
width;
 
   57   const double yMax = yMin + 
height;
 
   70   const double xmin = mXmin - v.
x();
 
   71   const double xmax = mXmax - v.
x();
 
   72   const double ymin = mYmin - v.
y();
 
   73   const double ymax = mYmax - v.
y();
 
   79   const double xmin = mXmin + v.
x();
 
   80   const double xmax = mXmax + v.
x();
 
   81   const double ymin = mYmin + v.
y();
 
   82   const double ymax = mYmax + v.
y();
 
  116     QLatin1String( 
"POLYGON((" ) +
 
  122     QStringLiteral( 
"))" );
 
  136       precision = 
static_cast<int>( std::ceil( -1.0 * std::log10( std::min( 
width(), 
height() ) ) ) ) + 1;
 
  144     rep = QStringLiteral( 
"Empty" );
 
  146     rep = QStringLiteral( 
"%1,%2 : %3,%4" )
 
  163   QTextStream foo( &rep );
 
  165   foo.setRealNumberPrecision( 8 );
 
  166   foo.setRealNumberNotation( QTextStream::FixedNotation );
 
  170       << mXmin << 
' ' << mYmin << 
", " 
  171       << mXmin << 
' ' << mYmax << 
", " 
  172       << mXmax << 
' ' << mYmax << 
", " 
  173       << mXmax << 
' ' << mYmin << 
", " 
  174       << mXmin << 
' ' << mYmin;
 
  182   return QgsBox3d( mXmin, mYmin, zMin, mXmax, mYmax, zMax );
 
  188   auto gridifyValue = []( 
double value, 
double spacing ) -> 
double 
  191       return  std::round( value / spacing ) * spacing;
 
  197            gridifyValue( mXmin, spacing ),
 
  198            gridifyValue( mYmin, spacing ),
 
  199            gridifyValue( mXmax, spacing ),
 
  200            gridifyValue( mYmax, spacing )
 
  212   double xmin, ymin, xmax, ymax;
 
  213   in >> xmin >> ymin >> xmax >> ymax;
 
  
double height() const SIP_HOLDGIL
Returns the height of the rectangle.
 
QVector< QgsPolylineXY > QgsPolygonXY
Polygon: first item of the list is outer ring, inner rings (if any) start from second item.
 
QgsRectangle & operator-=(QgsVector v)
Moves this rectangle in the direction of the reversed vector.
 
#define QgsDebugMsgLevel(str, level)
 
QString asWktPolygon() const
Returns a string representation of the rectangle as a WKT Polygon.
 
QgsPointXY center() const SIP_HOLDGIL
Returns the center point of the rectangle.
 
QVector< QgsPointXY > QgsPolylineXY
Polyline as represented as a vector of two-dimensional points.
 
QgsRectangle scaled(double scaleFactor, const QgsPointXY *center=nullptr) const
Scale the rectangle around its center point.
 
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
 
static QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
 
static QgsRectangle fromCenterAndSize(const QgsPointXY ¢er, double width, double height)
Creates a new rectangle, given the specified center point and width and height.
 
QString asPolygon() const
Returns the rectangle as a polygon.
 
A rectangle specified with double values.
 
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
 
bool isMultipart() const SIP_HOLDGIL
Returns true if WKB of the geometry is of WKBMulti* type.
 
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
 
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
 
QgsPolygonXY asPolygon() const
Returns the contents of the geometry as a polygon.
 
double x() const SIP_HOLDGIL
Returns the vector's x-component.
 
QgsRectangle snappedToGrid(double spacing) const
Returns a copy of this rectangle that is snapped to a grid with the specified spacing between the gri...
 
double y() const SIP_HOLDGIL
Returns the vector's y-component.
 
void setXMinimum(double x) SIP_HOLDGIL
Set the minimum x value.
 
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
 
void setXMaximum(double x) SIP_HOLDGIL
Set the maximum x value.
 
QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
 
A class to represent a 2D point.
 
void setYMaximum(double y) SIP_HOLDGIL
Set the maximum y value.
 
QgsRectangle & operator+=(QgsVector v)
Moves this rectangle in the direction of the vector.
 
QDataStream & operator>>(QDataStream &in, QgsRectangle &rectangle)
Reads a rectangle from stream in into rectangle.
 
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
 
void setYMinimum(double y) SIP_HOLDGIL
Set the minimum y value.
 
A geometry is the spatial representation of a feature.
 
static QgsRectangle fromWkt(const QString &wkt)
Creates a new rectangle from a wkt string.
 
double width() const SIP_HOLDGIL
Returns the width of the rectangle.
 
QDataStream & operator<<(QDataStream &out, const QgsRectangle &rectangle)
Writes the list rectangle to stream out.
 
A class to represent a vector. Currently no Z axis / 2.5D support is implemented.
 
QString asWktCoordinates() const
Returns a string representation of the rectangle in WKT format.
 
QgsBox3d toBox3d(double zMin, double zMax) const
Converts the rectangle to a 3D box, with the specified zMin and zMax z values.
 
A 3-dimensional box composed of x, y, z coordinates.
 
QgsRectangle operator+(QgsVector v) const
Returns a rectangle offset from this one in the direction of the vector.
 
bool isEmpty() const
Returns true if the rectangle is empty.
 
QgsRectangle()=default
Constructor for a null rectangle.
 
QgsRectangle operator-(QgsVector v) const
Returns a rectangle offset from this one in the direction of the reversed vector.
 
bool isGeosValid(Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const
Checks validity of the geometry using GEOS.