本文整理汇总了C++中PointPtr类的典型用法代码示例。如果您正苦于以下问题:C++ PointPtr类的具体用法?C++ PointPtr怎么用?C++ PointPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PointPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void object::test<36>()
{
PointPtr point = poly_->getCentroid();
ensure( point != nullptr );
ensure( !point->isEmpty() );
ensure_equals( point->getGeometryTypeId(), geos::geom::GEOS_POINT );
// FREE MEMORY
factory_->destroyGeometry(point);
}
示例2: for
void PointList::BoxCoordinites (kkint32& minRow,
kkint32& minCol,
kkint32& maxRow,
kkint32& maxCol
)
{
minRow = minCol = 999999;
maxRow = maxCol = -1;
for (iterator x = begin (); x != end (); x++)
{
PointPtr p = *x;
if (p->Row () < minRow)
minRow = p->Row ();
if (p->Row () > maxRow)
maxRow = p->Row ();
if (p->Col () < minCol)
minCol = p->Col ();
if (p->Col () > maxCol)
maxCol = p->Col ();
}
}
示例3: createTimespanPlacemark
/**
* @brief KmlExport::createTimespanPlacemark Creates a timespan placemark, which allows the
* trajectory to be played forward in time. The placemark also contains pertinent data about
* the vehicle's state at that timespan
* @param timestampPoint
* @param lastPlacemarkTime
* @param newPlacemarkTime
* @return Returns the placemark containing the timespan
*/
PlacemarkPtr KmlExport::createTimespanPlacemark(const LLAVCoordinates ×tampPoint, quint32 lastPlacemarkTime, quint32 newPlacemarkTime)
{
// Create coordinates
CoordinatesPtr coordinates = factory->CreateCoordinates();
coordinates->add_latlngalt(timestampPoint.latitude, timestampPoint.longitude, timestampPoint.altitude);
// Create point, using previous coordinates
PointPtr point = factory->CreatePoint();
point->set_extrude(true); // Extrude to ground
point->set_altitudemode(kmldom::ALTITUDEMODE_ABSOLUTE);
point->set_coordinates(coordinates);
// Create the timespan
TimeSpanPtr timeSpan = factory->CreateTimeSpan();
QDateTime startTime = QDateTime::currentDateTimeUtc().addMSecs(lastPlacemarkTime); // FIXME: Make it a function of the realtime preferably gotten from the GPS
QDateTime endTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime);
timeSpan->set_begin(startTime.toString(dateTimeFormat).toStdString());
timeSpan->set_end(endTime.toString(dateTimeFormat).toStdString());
// Create an icon style. This arrow icon will be rotated and colored to represent velocity
AttitudeActual::DataFields attitudeActualData = attitudeActual->getData();
AirspeedActual::DataFields airspeedActualData = airspeedActual->getData();
IconStylePtr iconStyle = factory->CreateIconStyle();
iconStyle->set_color(mapVelocity2Color(airspeedActualData.CalibratedAirspeed));
iconStyle->set_heading(attitudeActualData.Yaw + 180); //Adding 180 degrees because the arrow art points down, i.e. south.
// Create a line style. This defines the style for the "legs" connecting the points to the ground.
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_color(mapVelocity2Color(timestampPoint.groundspeed));
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_linestyle(lineStyle);
style->set_iconstyle(iconStyle);
// Generate the placemark with all above attributes
PlacemarkPtr placemark = factory->CreatePlacemark();
placemark->set_geometry(point);
placemark->set_timeprimitive(timeSpan);
placemark->set_name(QString("%1").arg(timeStamp / 1000.0).toStdString());
placemark->set_visibility(true);
// Set the placemark to use the custom rotated arrow style
placemark->set_styleurl("#directiveArrowStyle");
placemark->set_styleselector(style);
// Add a nice description to the placemark
placemark->set_description(informationString.toStdString());
return placemark;
}
示例4: ogr2extrude_rec
void ogr2extrude_rec (
int nExtrude,
GeometryPtr poKmlGeometry )
{
PointPtr poKmlPoint;
LineStringPtr poKmlLineString;
PolygonPtr poKmlPolygon;
MultiGeometryPtr poKmlMultiGeometry;
size_t nGeom;
size_t i;
switch ( poKmlGeometry->Type ( ) ) {
case kmldom::Type_Point:
poKmlPoint = AsPoint ( poKmlGeometry );
poKmlPoint->set_extrude ( nExtrude );
break;
case kmldom::Type_LineString:
poKmlLineString = AsLineString ( poKmlGeometry );
poKmlLineString->set_extrude ( nExtrude );
break;
case kmldom::Type_LinearRing:
break;
case kmldom::Type_Polygon:
poKmlPolygon = AsPolygon ( poKmlGeometry );
poKmlPolygon->set_extrude ( nExtrude );
break;
case kmldom::Type_MultiGeometry:
poKmlMultiGeometry = AsMultiGeometry ( poKmlGeometry );
nGeom = poKmlMultiGeometry->get_geometry_array_size ( );
for ( i = 0; i < nGeom; i++ ) {
ogr2extrude_rec ( nExtrude,
poKmlMultiGeometry->
get_geometry_array_at ( i ) );
}
break;
default:
break;
}
}
示例5:
Measurement& Measurement::operator=(const Measurement &rhs)
{
id=rhs.id;
centroid=rhs.centroid;
PointPtr p;
for(uint i=0;i<rhs.points.size();i++)
{
p.reset(new Point);
*p=*(rhs.points[i]);
points.push_back(p);
}
return *this;
}
示例6: if
KKStr PointList::ToDelStr (char del) const
{
if (QueueSize () < 1)
return "[]";
KKStr result (QueueSize () * 10);
int count = 0;
PointList::const_iterator idx;
for (idx = begin (); idx != end (); ++idx, ++count)
{
PointPtr p = *idx;
if (count > 0)
result << del;
result << p->Row () << del << p->Col ();
}
return result;
} /* ToDelStr */
示例7: PickPosition
bool CurveCreateTool::MouseDown( const MouseButtonInput& e )
{
if ( m_Instance.ReferencesObject() && m_Scene->IsEditable() )
{
Math::Vector3 position;
PickPosition( e.GetPosition().x, e.GetPosition().y, position );
PointPtr point = new Core::Point( m_Scene, new Content::Point( position ) );
point->SetParent( m_Instance );
point->SetTransient( true );
m_Scene->AddObject( point );
m_Instance->Dirty();
m_Scene->Execute( true );
}
return __super::MouseDown( e );
}
示例8: add
void Cluster::add(const PointPtr &p)
{
if (points != NULL)
assert(p->getDims() == points->p->getDims()); //make sure dimensions match
if (find(p) != NULL) { //make sure p is not already in cluster
return;
}
size++;
LNodePtr node = new LNode; // Dynamically allocate new node
LNodePtr ptr = points;
node->p = p;
if (points == NULL) { //case: empty cluster
points = node;
node->next = nullptr;
return;
}
if (*node->p < *points->p) { //case: new point is smallest point
node->next = points;
points = node;
return;
}
LNodePtr last = nullptr;
while ( *p > *ptr->p) { //put in lexographic order
last = ptr;
if (ptr->next == NULL) {//if end of list
node->next = nullptr;
last->next = node;
return;
}
ptr = ptr->next;
}
while (*p == *ptr->p && p > ptr->p) { //if points are equal sort by memory address
last = ptr; //for reasons of comparison
if (ptr->next == NULL) {
node->next = nullptr;
last->next = node;
return;
}
ptr = ptr->next;
}
node->next = ptr;
if (last != nullptr)
last->next = node;
else
points = node;
}
示例9: pointCentr
void object::test<38>()
{
// First centroid
PointPtr point = poly_->getCentroid();
ensure( point != nullptr );
ensure( !point->isEmpty() );
ensure_equals( point->getGeometryTypeId(), geos::geom::GEOS_POINT );
CoordinateCPtr pointCoord = point->getCoordinate();
ensure( pointCoord != nullptr );
geos::geom::Coordinate pointCentr(*pointCoord);
// FREE MEMORY
factory_->destroyGeometry(point);
// Second centroid
geos::geom::Coordinate coordCentr;
bool isCentroid = poly_->getCentroid(coordCentr);
ensure( isCentroid );
// Comparison of two centroids
ensure_equals( "Check Polygon::getCentroid() functions.", coordCentr, pointCentr );
}
示例10: CreateInstance
void CurveCreateTool::CreateInstance( const Math::Vector3& position )
{
if (m_Instance.ReferencesObject())
{
// remove temp reference
m_Scene->RemoveObject( m_Instance );
}
m_Instance = new Core::Curve( m_Scene, new Content::Curve() );
m_Instance->SetSelected( true );
m_Instance->SetTransient( true );
m_Instance->SetCurveType( s_CurveType );
m_Scene->AddObject( m_Instance );
PointPtr point = new Core::Point( m_Scene, new Content::Point( position ) );
point->SetParent( m_Instance );
point->SetTransient( true );
m_Scene->AddObject( point );
m_Instance->Evaluate( GraphDirections::Downstream );
}
示例11: coord
void object::test<11>()
{
geos::geom::Coordinate coord(x_, y_, z_);
geos::geom::CoordinateArraySequence sequence;
sequence.add(coord);
PointPtr pt = factory_.createPoint(sequence);
ensure( "createPoint() returned null pointer.", pt != 0 );
ensure( "createPoint() returned empty point.", !pt->isEmpty() );
ensure( pt->isSimple() );
ensure( pt->isValid() );
ensure( pt->getCoordinate() != 0 );
CoordinateCPtr pcoord = pt->getCoordinate();
ensure( pcoord != 0 );
ensure_equals( pcoord->x, x_ );
ensure_equals( pcoord->y, y_ );
ensure_equals( pcoord->z, z_ );
GeometryPtr geo = 0;
geo = pt->getEnvelope();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = pt->getCentroid();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = pt->getBoundary();
ensure( geo != 0 );
ensure( geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = pt->convexHull();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
ensure_equals( pt->getGeometryTypeId(), geos::geom::GEOS_POINT );
ensure_equals( pt->getDimension(), geos::geom::Dimension::P );
ensure_equals( pt->getBoundaryDimension(), geos::geom::Dimension::False );
ensure_equals( pt->getNumPoints(), 1u );
ensure_equals( pt->getLength(), 0.0 );
ensure_equals( pt->getArea(), 0.0 );
// FREE MEMORY
factory_.destroyGeometry(pt);
}
示例12:
void object::test<8>()
{
PointPtr pt = factory_.createPoint();
ensure( "createPoint() returned null pointer.", pt != 0 );
ensure( "createPoint() returned non-empty point.", pt->isEmpty() );
ensure( pt->isSimple() );
ensure( pt->isValid() );
ensure( pt->getCentroid() == 0 );
ensure( pt->getCoordinate() == 0 );
GeometryPtr geo = 0;
geo = pt->getEnvelope();
ensure( geo != 0 );
ensure( geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = pt->getBoundary();
ensure( geo != 0 );
ensure( geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = pt->convexHull();
ensure( geo != 0 );
ensure( geo->isEmpty() );
factory_.destroyGeometry(geo);
ensure_equals( pt->getGeometryTypeId(), geos::geom::GEOS_POINT );
ensure_equals( pt->getDimension(), geos::geom::Dimension::P );
ensure_equals( pt->getBoundaryDimension(), geos::geom::Dimension::False );
ensure_equals( pt->getNumPoints(), 0u );
ensure_equals( pt->getLength(), 0.0 );
ensure_equals( pt->getArea(), 0.0 );
// FREE MEMORY
factory_.destroyGeometry(pt);
}
示例13: kml2extrude_rec
int kml2extrude_rec (
GeometryPtr poKmlGeometry,
int *pnExtrude )
{
PointPtr poKmlPoint;
LineStringPtr poKmlLineString;
PolygonPtr poKmlPolygon;
MultiGeometryPtr poKmlMultiGeometry;
size_t nGeom;
size_t i;
switch ( poKmlGeometry->Type ( ) ) {
case kmldom::Type_Point:
poKmlPoint = AsPoint ( poKmlGeometry );
if ( poKmlPoint->has_extrude ( ) ) {
*pnExtrude = poKmlPoint->get_extrude ( );
return TRUE;
}
break;
case kmldom::Type_LineString:
poKmlLineString = AsLineString ( poKmlGeometry );
if ( poKmlLineString->has_extrude ( ) ) {
*pnExtrude = poKmlLineString->get_extrude ( );
return TRUE;
}
break;
case kmldom::Type_LinearRing:
break;
case kmldom::Type_Polygon:
poKmlPolygon = AsPolygon ( poKmlGeometry );
if ( poKmlPolygon->has_extrude ( ) ) {
*pnExtrude = poKmlPolygon->get_extrude ( );
return TRUE;
}
break;
case kmldom::Type_MultiGeometry:
poKmlMultiGeometry = AsMultiGeometry ( poKmlGeometry );
nGeom = poKmlMultiGeometry->get_geometry_array_size ( );
for ( i = 0; i < nGeom; i++ ) {
if ( kml2extrude_rec ( poKmlMultiGeometry->
get_geometry_array_at ( i ), pnExtrude ) )
return TRUE;
}
break;
default:
break;
}
return FALSE;
}
示例14: geom2kml
ElementPtr geom2kml (
OGRGeometry * poOgrGeom,
int extra,
KmlFactory * poKmlFactory )
{
int i;
if ( !poOgrGeom ) {
return NULL;
}
/***** ogr geom vars *****/
OGRPoint *poOgrPoint = NULL;
OGRLineString *poOgrLineString;
OGRPolygon *poOgrPolygon;
OGRGeometryCollection *poOgrMultiGeom;
/***** libkml geom vars *****/
CoordinatesPtr coordinates;
PointPtr poKmlPoint;
LineStringPtr poKmlLineString;
LinearRingPtr poKmlLinearRing;
OuterBoundaryIsPtr poKmlOuterRing;
InnerBoundaryIsPtr poKmlInnerRing;
PolygonPtr poKmlPolygon;
MultiGeometryPtr poKmlMultiGeometry;
ElementPtr poKmlGeometry;
ElementPtr poKmlTmpGeometry;
/***** other vars *****/
double x,
y,
z;
int numpoints = 0;
int nGeom;
OGRwkbGeometryType type = poOgrGeom->getGeometryType ( );
switch ( type ) {
case wkbPoint:
poOgrPoint = ( OGRPoint * ) poOgrGeom;
if (poOgrPoint->getCoordinateDimension() == 0)
{
poKmlGeometry = poKmlPoint = poKmlFactory->CreatePoint ( );
}
else
{
x = poOgrPoint->getX ( );
y = poOgrPoint->getY ( );
if ( x > 180 )
x -= 360;
coordinates = poKmlFactory->CreateCoordinates ( );
coordinates->add_latlng ( y, x );
poKmlGeometry = poKmlPoint = poKmlFactory->CreatePoint ( );
poKmlPoint->set_coordinates ( coordinates );
}
break;
case wkbPoint25D:
poOgrPoint = ( OGRPoint * ) poOgrGeom;
x = poOgrPoint->getX ( );
y = poOgrPoint->getY ( );
z = poOgrPoint->getZ ( );
if ( x > 180 )
x -= 360;
coordinates = poKmlFactory->CreateCoordinates ( );
coordinates->add_latlngalt ( y, x, z );
poKmlGeometry = poKmlPoint = poKmlFactory->CreatePoint ( );
poKmlPoint->set_coordinates ( coordinates );
break;
case wkbLineString:
poOgrLineString = ( OGRLineString * ) poOgrGeom;
if( extra >= 0 )
{
((OGRLinearRing*)poOgrGeom)->closeRings();
}
numpoints = poOgrLineString->getNumPoints ( );
if( extra >= 0 )
{
if( numpoints < 4 &&
CPLTestBool(CPLGetConfigOption("LIBKML_STRICT_COMPLIANCE", "TRUE")) )
{
CPLError(CE_Failure, CPLE_NotSupported, "A linearring should have at least 4 points");
return NULL;
//.........这里部分代码省略.........
示例15: if
static OGRGeometry *kml2geom_rec (
GeometryPtr poKmlGeometry,
OGRSpatialReference *poOgrSRS)
{
/***** ogr geom vars *****/
OGRPoint *poOgrPoint;
OGRLineString *poOgrLineString;
OGRLinearRing *poOgrLinearRing;
OGRPolygon *poOgrPolygon;
OGRGeometryCollection *poOgrMultiGeometry;
OGRGeometry *poOgrGeometry = NULL;
OGRGeometry *poOgrTmpGeometry = NULL;
/***** libkml geom vars *****/
CoordinatesPtr poKmlCoordinates;
PointPtr poKmlPoint;
LineStringPtr poKmlLineString;
LinearRingPtr poKmlLinearRing;
OuterBoundaryIsPtr poKmlOuterRing;
InnerBoundaryIsPtr poKmlInnerRing;
PolygonPtr poKmlPolygon;
MultiGeometryPtr poKmlMultiGeometry;
GxTrackPtr poKmlGxTrack;
GxMultiTrackPtr poKmlGxMultiTrack;
GeometryPtr poKmlTmpGeometry;
Vec3 oKmlVec;
size_t nRings,
nCoords,
nGeom,
i;
switch ( poKmlGeometry->Type ( ) ) {
case kmldom::Type_Point:
poKmlPoint = AsPoint ( poKmlGeometry );
if ( poKmlPoint->has_coordinates ( ) ) {
poKmlCoordinates = poKmlPoint->get_coordinates ( );
nCoords = poKmlCoordinates->get_coordinates_array_size ( );
if (nCoords > 0)
{
oKmlVec = poKmlCoordinates->get_coordinates_array_at ( 0 );
if ( oKmlVec.has_altitude ( ) )
poOgrPoint = new OGRPoint ( oKmlVec.get_longitude ( ),
oKmlVec.get_latitude ( ),
oKmlVec.get_altitude ( ) );
else
poOgrPoint = new OGRPoint ( oKmlVec.get_longitude ( ),
oKmlVec.get_latitude ( ) );
poOgrGeometry = poOgrPoint;
}
else
{
poOgrGeometry = new OGRPoint();
}
}
else
{
poOgrGeometry = new OGRPoint();
}
break;
case kmldom::Type_LineString:
poKmlLineString = AsLineString ( poKmlGeometry );
poOgrLineString = new OGRLineString ( );
if ( poKmlLineString->has_coordinates ( ) ) {
poKmlCoordinates = poKmlLineString->get_coordinates ( );
nCoords = poKmlCoordinates->get_coordinates_array_size ( );
for ( i = 0; i < nCoords; i++ ) {
oKmlVec = poKmlCoordinates->get_coordinates_array_at ( i );
if ( oKmlVec.has_altitude ( ) )
poOgrLineString->
addPoint ( oKmlVec.get_longitude ( ),
oKmlVec.get_latitude ( ),
oKmlVec.get_altitude ( ) );
else
poOgrLineString->
addPoint ( oKmlVec.get_longitude ( ),
oKmlVec.get_latitude ( ) );
}
}
poOgrGeometry = poOgrLineString;
break;
case kmldom::Type_LinearRing:
poKmlLinearRing = AsLinearRing ( poKmlGeometry );
poOgrLinearRing = new OGRLinearRing ( );
if ( poKmlLinearRing->has_coordinates ( ) ) {
poKmlCoordinates = poKmlLinearRing->get_coordinates ( );
nCoords = poKmlCoordinates->get_coordinates_array_size ( );
//.........这里部分代码省略.........