本文整理汇总了C#中GeoPoint.isValid方法的典型用法代码示例。如果您正苦于以下问题:C# GeoPoint.isValid方法的具体用法?C# GeoPoint.isValid怎么用?C# GeoPoint.isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoPoint
的用法示例。
在下文中一共展示了GeoPoint.isValid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: intersects
/**
* Returns true if a point falls within the extent.
* @param input
* Point to test against extent rectangle.
*/
public bool intersects(GeoPoint input)
{
if (isValid() && input.isValid() && !isEmpty())
{
if (isInfinite())
return true;
GeoPoint point = sw.getSRS().transform(input);
return
point.isValid() &&
(point.X >= sw.X || Math.Abs(point.X - sw.X) < EPSILON) &&
(point.X <= ne.X || Math.Abs(point.X - ne.X) < EPSILON) &&
(point.Y >= sw.Y || Math.Abs(point.Y - sw.Y) < EPSILON) &&
(point.Y <= ne.Y || Math.Abs(point.Y - ne.Y) < EPSILON);
//point.x() >= sw.x() && point.x() <= ne.x() &&
//point.y() >= sw.y() && point.y() <= ne.y();
}
return false;
}
示例2: contains
/**
* Returns true if a point falls within this extent.
* @param input
* Point to test against this extent.
*/
public bool contains(GeoPoint input)
{
if (isInfinite() && input.isValid())
return true;
if (!isValid() || !input.isValid())
return false;
GeoPoint p = getSRS().transform(input);
if (!p.isValid())
return false;
return
(sw.X <= p.X || Math.Abs(sw.X - p.X) < EPSILON) &&
(p.X <= ne.X || Math.Abs(p.X - ne.X) < EPSILON) &&
(sw.Y <= p.Y || Math.Abs(sw.Y - p.Y) < EPSILON) &&
(p.Y <= ne.Y || Math.Abs(p.Y - ne.Y) < EPSILON);
//return sw.x() <= p.x() && p.x() <= ne.x() && sw.y() <= p.y() && p.y() <= ne.y();
}
示例3: expandToInclude
/**
* Modified this extent to include a point.
* @param point
* Point to include.
*/
public void expandToInclude(GeoPoint input)
{
if (!isValid() || !input.isValid())
{
//TODO osgGIS::notify( osg::WARN ) << "GeoExtent::expandToInclude: Illegal: either the extent of the input point is invalid" << std::endl;
return;
}
if (!isInfinite())
{
if (isEmpty())
{
ne = sw = input;
}
else
{
GeoPoint new_point = getSRS().transform(input);
if (new_point.isValid())
{
double xmin = sw.X;
double ymin = sw.Y;
double xmax = ne.X;
double ymax = ne.Y;
if (new_point.X < xmin)
xmin = new_point.X;
if (new_point.X > xmax)
xmax = new_point.X;
if (new_point.Y < ymin)
ymin = new_point.Y;
if (new_point.Y > ymax)
ymax = new_point.Y;
sw.set((float)xmin, (float)ymin, (float)sw.Z);
ne.set((float)xmax, (float)ymax, (float)ne.Z);
}
else
{
//TODO osgGIS::notify( osg::WARN )
// << "GeoExtent::expandToInclude: "
// << "Unable to reproject coordinates" << std::endl;
}
}
}
recalc();
}
示例4: getCursor
/**
* Gets a cursor that will iterate over all the features whose shapes
* intersect the specified point.
*
* @return
* A cursor for iterating over search results
*/
public FeatureCursor getCursor(GeoPoint point)
{
if (point.isValid())
{
assertSpatialIndex();
return index.getCursor(new GeoExtent(point, point), true);
}
else
{
return new FeatureCursor(); // empty
}
}