当前位置: 首页>>代码示例>>C++>>正文


C++ OGRPoint类代码示例

本文整理汇总了C++中OGRPoint的典型用法代码示例。如果您正苦于以下问题:C++ OGRPoint类的具体用法?C++ OGRPoint怎么用?C++ OGRPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OGRPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getPointIterator

double OGRCompoundCurve::get_Area() const
{
    if( IsEmpty() || !get_IsClosed() )
        return 0;

    // Optimization for convex rings.
    if( IsConvex() )
    {
        // Compute area of shape without the circular segments.
        OGRPointIterator* poIter = getPointIterator();
        OGRLineString oLS;
        oLS.setNumPoints( getNumPoints() );
        OGRPoint p;
        for( int i = 0; poIter->getNextPoint(&p); i++ )
        {
            oLS.setPoint( i, p.getX(), p.getY() );
        }
        double dfArea = oLS.get_Area();
        delete poIter;

        // Add the area of the spherical segments.
        dfArea += get_AreaOfCurveSegments();

        return dfArea;
    }

    OGRLineString* poLS = CurveToLine();
    double dfArea = poLS->get_Area();
    delete poLS;

    return dfArea;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:32,代码来源:ogrcompoundcurve.cpp

示例2: OGRPoint

OGRPoint *getARCCenter(OGRPoint *ptStart, OGRPoint *ptArc, OGRPoint *ptEnd) {
  // FIXME precision
  double bx = ptStart->getX(); double by = ptStart->getY();
  double cx = ptArc->getX(); double cy = ptArc->getY();
  double dx = ptEnd->getX(); double dy = ptEnd->getY();
  double temp, bc, cd, det, x, y;

  temp = cx*cx+cy*cy;
  bc = (bx*bx + by*by - temp)/2.0;
  cd = (temp - dx*dx - dy*dy)/2.0;
  det = (bx-cx)*(cy-dy)-(cx-dx)*(by-cy);

  OGRPoint *center = new OGRPoint();

  if (fabs(det) < 1.0e-6) { // could not determin the determinante: too small
    return center;
  }
  det = 1/det;
  x = (bc*(cy-dy)-cd*(by-cy))*det;
  y = ((bx-cx)*cd-(cx-dx)*bc)*det;

  center->setX(x);
  center->setY(y);

  return center;
}
开发者ID:imincik,项目名称:pkg-gdal,代码行数:26,代码来源:ilihelper.cpp

示例3: CreateFeature

OGRErr TigerPoint::CreateFeature( OGRFeature *poFeature,
                                  int pointIndex)

{
    char        szRecord[OGR_TIGER_RECBUF_LEN];
    OGRPoint    *poPoint = poFeature->GetGeometryRef()->toPoint();

    if( !SetWriteModule( m_pszFileCode, psRTInfo->nRecordLength+2, poFeature ) )
        return OGRERR_FAILURE;

    memset( szRecord, ' ', psRTInfo->nRecordLength );

    WriteFields( psRTInfo, poFeature, szRecord );

    if( poPoint != nullptr
        && (poPoint->getGeometryType() == wkbPoint
            || poPoint->getGeometryType() == wkbPoint25D) ) {
        WritePoint( szRecord, pointIndex, poPoint->getX(), poPoint->getY() );
    } else {
        if (bRequireGeom) {
            return OGRERR_FAILURE;
        }
    }

    WriteRecord( szRecord, psRTInfo->nRecordLength, m_pszFileCode );

    return OGRERR_NONE;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:28,代码来源:tigerpoint.cpp

示例4: filter

featureset_ptr ogr_datasource::features_at_point(coord2d const& pt) const
{
    if (!is_bound_) bind();
   
    if (dataset_ && layer_.is_valid())
    {
        OGRLayer* layer = layer_.layer();

        if (indexed_)
        {
            filter_at_point filter(pt);
            
            return featureset_ptr(new ogr_index_featureset<filter_at_point> (*dataset_,
                                                                             *layer,
                                                                             filter,
                                                                             index_name_,
                                                                             desc_.get_encoding(),
                                                                             multiple_geometries_));
        }
        else
        {
            OGRPoint point;
            point.setX (pt.x);
            point.setY (pt.y);

            return featureset_ptr(new ogr_featureset (*dataset_,
                                                      *layer,
                                                      point,
                                                      desc_.get_encoding(),
                                                      multiple_geometries_));
        }
    }

    return featureset_ptr();
}
开发者ID:ParveenArora,项目名称:mapnik,代码行数:35,代码来源:ogr_datasource.cpp

示例5: multiPointToDrawable

    osg::Geometry* multiPointToDrawable(OGRMultiPoint* mpoint) const
    {
        osg::Geometry* geom = new osg::Geometry;

        osg::Geometry* pointGeom = new osg::Geometry();
        osg::Vec3Array* vertices = new osg::Vec3Array();

        vertices->reserve(mpoint->getNumGeometries());
        for (int i = 0; i < mpoint->getNumGeometries(); i++ )
        {
            OGRGeometry* ogrGeom = mpoint->getGeometryRef(i);
            OGRwkbGeometryType ogrGeomType = ogrGeom->getGeometryType();

            if (wkbPoint != ogrGeomType && wkbPoint25D != ogrGeomType)
                continue; // skip

            OGRPoint* points = static_cast<OGRPoint*>(ogrGeom);

            vertices->push_back(osg::Vec3(points->getX(), points->getY(), points->getZ()));
        }

        pointGeom->setVertexArray(vertices);
        pointGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, vertices->size()));

        if (pointGeom->getVertexArray())
        {
            OSG_INFO << "osgOgrFeature::multiPointToDrawable " << geom->getVertexArray()->getNumElements() << " vertexes"<< std::endl;
        }

        return pointGeom;
    }
开发者ID:Kurdakov,项目名称:emscripten_OSG,代码行数:31,代码来源:ReaderWriterOGR.cpp

示例6: CPLError

OGRBoolean OGRPoint::Equals( OGRGeometry * poOther ) const

{
    if( poOther== this )
        return TRUE;

    if( poOther->getGeometryType() != getGeometryType() )
        return FALSE;

    OGRPoint *poOPoint = dynamic_cast<OGRPoint *>(poOther);
    if( poOPoint == NULL )
    {
        CPLError(CE_Fatal, CPLE_AppDefined,
                 "dynamic_cast failed.  Expected OGRPoint.");
        return FALSE;
    }
    if( flags != poOPoint->flags )
        return FALSE;

    if( IsEmpty() )
        return TRUE;

    // Should eventually test the SRS.
    if( poOPoint->getX() != getX()
        || poOPoint->getY() != getY()
        || poOPoint->getZ() != getZ() )
        return FALSE;

    return TRUE;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:30,代码来源:ogrpoint.cpp

示例7: while

OGRFeature *OGROpenAirLabelLayer::GetNextRawFeature()
{
    const char* pszLine;
    double dfLat = 0, dfLon = 0;
    int bHasCoord = FALSE;

    while(TRUE)
    {
        pszLine = CPLReadLine2L(fpOpenAir, 1024, NULL);
        if (pszLine == NULL)
            return NULL;

        if (pszLine[0] == '*' || pszLine[0] == '\0')
            continue;

        if (EQUALN(pszLine, "AC ", 3))
        {
            if (osCLASS.size() != 0)
            {
                osNAME = "";
                osCEILING = "";
                osFLOOR = "";
            }
            osCLASS = pszLine + 3;
        }
        else if (EQUALN(pszLine, "AN ", 3))
            osNAME = pszLine + 3;
        else if (EQUALN(pszLine, "AH ", 3))
            osCEILING = pszLine + 3;
        else if (EQUALN(pszLine, "AL ", 3))
            osFLOOR = pszLine + 3;
        else if (EQUALN(pszLine, "AT ", 3))
        {
            bHasCoord = OGROpenAirGetLatLon(pszLine + 3, dfLat, dfLon);
            break;
        }
    }

    OGRFeature* poFeature = new OGRFeature(poFeatureDefn);
    poFeature->SetField(0, osCLASS.c_str());
    poFeature->SetField(1, osNAME.c_str());
    poFeature->SetField(2, osFLOOR.c_str());
    poFeature->SetField(3, osCEILING.c_str());

    CPLString osStyle;
    osStyle.Printf("LABEL(t:\"%s\")", osNAME.c_str());
    poFeature->SetStyleString(osStyle.c_str());

    if (bHasCoord)
    {
        OGRPoint* poPoint = new OGRPoint(dfLon, dfLat);
        poPoint->assignSpatialReference(poSRS);
        poFeature->SetGeometryDirectly(poPoint);
    }

    poFeature->SetFID(nNextFID++);

    return poFeature;
}
开发者ID:samalone,项目名称:gdal-ios,代码行数:59,代码来源:ogropenairlabellayer.cpp

示例8: HashAirwayIntersectionFeatureFunc

static unsigned long HashAirwayIntersectionFeatureFunc(const void* _feature)
{
    OGRFeature* feature = (OGRFeature*)_feature;
    OGRPoint* point = (OGRPoint*) feature->GetGeometryRef();
    unsigned long hash = CPLHashSetHashStr((unsigned char*)feature->GetFieldAsString(0));
    const double x = point->getX();
    const double y = point->getY();
    return hash ^ OGRXPlaneAirwayHashDouble(x) ^ OGRXPlaneAirwayHashDouble(y);
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:9,代码来源:ogr_xplane_awy_reader.cpp

示例9: ogrfeature

      ogrfeature(const xyh point):
	poFeature(OGRFeature::CreateFeature( poLayer->getLayerDefn() ))
      {
	poFeature->SetField( "Height", point.value);
	OGRPoint pt; // destroy ??
	pt.setX( point.row );
	pt.setY( point.col );
	poFeature->SetGeometry( &pt );
      }
开发者ID:ehelle,项目名称:spotgen,代码行数:9,代码来源:gdal-cpp-wrapper.hpp

示例10: OGRPoint

OGRGeometry *OGRPoint::clone() const

{
    OGRPoint    *poNewPoint = new OGRPoint( x, y, z );

    poNewPoint->assignSpatialReference( getSpatialReference() );

    return poNewPoint;
}
开发者ID:epolyan,项目名称:OpenCPN,代码行数:9,代码来源:ogrpoint.cpp

示例11: checkCentroid

bool GDALSpatialLinking::checkCentroid(OGRGeometry* geo, OGRGeometry * lead_geo)
{
	OGRPoint ct;
	if (int error = geo->Centroid(&ct) != OGRERR_NONE) {
		DM::Logger(DM::Warning) << "error calculationg ct " << error;
		return false;
	}
	return ct.Within(lead_geo);
}
开发者ID:christianurich,项目名称:DynaMind-GDALModules,代码行数:9,代码来源:gdalspatiallinking.cpp

示例12: CPLError

OGRErr GTMWaypointLayer::CreateFeature (OGRFeature *poFeature)
{
    FILE* fp = poDS->getOutputFP();
    if (fp == NULL)
        return CE_Failure;

    OGRGeometry *poGeom = poFeature->GetGeometryRef();
    if ( poGeom == NULL )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "Features without geometry not supported by GTM writer in waypoints layer." );
        return OGRERR_FAILURE;
    }

    if (NULL != poCT)
    {
        poGeom = poGeom->clone();
        poGeom->transform( poCT );
    }


    switch( poGeom->getGeometryType() )
    {
    case wkbPoint:
    case wkbPoint25D:
    {
        OGRPoint* point = (OGRPoint*)poGeom;
        double lat = point->getY();
        double lon = point->getX();
        CheckAndFixCoordinatesValidity(lat, lon);
        poDS->checkBounds((float)lat, (float)lon);
        writeDouble(fp, lat);
        writeDouble(fp, lon);
        float altitude = 0.0;
        if (poGeom->getGeometryType() == wkbPoint25D)
            altitude = (float) point->getZ();

        WriteFeatureAttributes(poFeature, altitude);
        break;
    }

    default:
    {
        CPLError( CE_Failure, CPLE_NotSupported,
                  "Geometry type of `%s' not supported for 'waypoint' element.\n",
                  OGRGeometryTypeToName(poGeom->getGeometryType()) );
        return OGRERR_FAILURE;
    }
    }

    if (NULL != poCT)
        delete poGeom;

    return OGRERR_NONE;

}
开发者ID:RyanHun,项目名称:World-Wind-Java,代码行数:56,代码来源:gtmwaypointlayer.cpp

示例13: OGRPoint

OGRGeometry *OGRPoint::clone() const

{
    OGRPoint    *poNewPoint = new OGRPoint( x, y, z );

    poNewPoint->assignSpatialReference( getSpatialReference() );
    poNewPoint->setCoordinateDimension( nCoordDimension );

    return poNewPoint;
}
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:10,代码来源:ogrpoint.cpp

示例14: readRing

	void Shape::readRing(OGRLinearRing* ring, ShapePart& shapePart) {
		shapePart.points.resize(ring->getNumPoints());
		for (int j = 0; j < ring->getNumPoints(); ++j) {
			OGRPoint point;
			ring->getPoint(j, &point);

			shapePart.points[j].x = point.getX();
			shapePart.points[j].y = point.getY();
			updateBounds(&point);
		}
	}
开发者ID:gnishida,项目名称:GDALTest,代码行数:11,代码来源:GShapefile.cpp

示例15: readLineString

	void Shape::readLineString(OGRLineString* lineString, ShapeObject& shapeObject) {
		shapeObject.parts.resize(1);
		shapeObject.parts[0].points.resize(lineString->getNumPoints());

		for (int i = 0; i < lineString->getNumPoints(); ++i) {
			OGRPoint point;
			lineString->getPoint(i, &point);
			shapeObject.parts[0].points[i].x = point.getX();
			shapeObject.parts[0].points[i].y = point.getY();
			updateBounds(&point);
		}
	}
开发者ID:gnishida,项目名称:GDALTest,代码行数:12,代码来源:GShapefile.cpp


注:本文中的OGRPoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。