本文整理汇总了C++中OGRGeometry::Distance方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRGeometry::Distance方法的具体用法?C++ OGRGeometry::Distance怎么用?C++ OGRGeometry::Distance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRGeometry
的用法示例。
在下文中一共展示了OGRGeometry::Distance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: featuredetect
//.........这里部分代码省略.........
double yMin = psExtent->MinY;
double xMax = psExtent->MaxX;
double yMax = psExtent->MaxY;
stringstream strm;
strm << xMin;
string exp;
double scaleFactor;
string bound_string = strm.str();
int size = bound_string.size();
size_t found=bound_string.find("+");
if (found!=string::npos) {
exp = bound_string.substr(found+1,size);
}
if(exp.empty()) {
stringstream strExtent;
strExtent << yMin;
bound_string = strExtent.str();
size = bound_string.size();
found = bound_string.find("+");
if(found!=string::npos) {
exp = bound_string.substr(found+1,size);
}
}
if(exp.empty()) {
stringstream strExtent;
strExtent << xMax;
bound_string = strExtent.str();
size = bound_string.size();
found = bound_string.find("+");
if(found!=string::npos) {
exp = bound_string.substr(found+1,size);
}
}
if(exp.empty()) {
stringstream strExtent;
strExtent << yMax;
bound_string = strExtent.str();
size = bound_string.size();
found = bound_string.find("+");
if(found!=string::npos) {
exp = bound_string.substr(found+1,size);
}
}
if(!exp.empty()) {
int exponent = boost::lexical_cast<int>(exp);
exponent-=3;
scaleFactor = pow (10,exponent);
}
else
{
scaleFactor = 1;
}
xMin/=scaleFactor;
xMax/=scaleFactor;
yMin/=scaleFactor;
yMax/=scaleFactor;
double gWidth = xMax - xMin;
double gHeight = yMax - yMin;
double widthFactor = 1;
double pwidth = abs(gWidth-gHeight);
double s = gWidth - gHeight;
if(s<0.16)
gWidth = gHeight + 0.16;
double scaledX=(XPoint*(gWidth* widthFactor*(100-increase_width)/100)/640 + (xMin+(-x_pos_shift+increase_width/2)/100*gWidth* widthFactor))*scaleFactor;
double scaledY=(YPoint*(gHeight*widthFactor*(-1+increase_height/100))/480 + (yMax+(y_pos_shift-increase_height/2)/100*gHeight*widthFactor))*scaleFactor;
OGRPoint *poPoint =new OGRPoint();
poPoint->setX(scaledX);
poPoint->setY(scaledY);
poLayer->ResetReading();
int index=0;bool flagFeature=false;
while( (poFeature = poLayer->GetNextFeature()) != NULL )
{
OGRGeometry *poGeometry;
poGeometry = poFeature->GetGeometryRef();
if(poGeometry->Distance(poPoint)/scaleFactor<=0.01*gWidth*widthFactor)
{
flagFeature=true;
//std::cerr<<index<<" " <<flagFeature<<" "<<poGeometry->Distance(poPoint);
break;
}
index++;
}
if(flagFeature)
DBFDialog *attrtable =new DBFDialog(cfile,sfile,flagFeature,index);
}
}