本文整理汇总了C++中Query::expression方法的典型用法代码示例。如果您正苦于以下问题:C++ Query::expression方法的具体用法?C++ Query::expression怎么用?C++ Query::expression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::expression方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Query
Query::combineWith( const Query& rhs ) const
{
Query merged;
// merge the expressions:
bool lhsEmptyExpr = !_expression.isSet() || _expression->empty();
bool rhsEmptyExpr = !rhs.expression().isSet() || rhs.expression()->empty();
if ( !lhsEmptyExpr && !rhsEmptyExpr )
{
std::stringstream buf;
buf << "( " << *_expression << " ) AND ( " << *rhs.expression() << " )";
std::string str;
str = buf.str();
merged.expression() = str;
}
else if ( lhsEmptyExpr && !rhsEmptyExpr )
{
merged.expression() = *rhs.expression();
}
else if ( !lhsEmptyExpr && rhsEmptyExpr )
{
merged.expression() = *_expression;
}
// tilekey overrides bounds:
if ( _tileKey.isSet() )
{
merged.tileKey() = *_tileKey;
}
else if ( rhs._tileKey.isSet() )
{
merged.tileKey() = *rhs._tileKey;
}
// merge the bounds:
if ( bounds().isSet() && rhs.bounds().isSet() )
{
merged.bounds() = bounds()->intersectionWith( *rhs.bounds() );
}
else if ( bounds().isSet() )
{
merged.bounds() = *bounds();
}
else if ( rhs.bounds().isSet() )
{
merged.bounds() = *rhs.bounds();
}
return merged;
}
示例2: main
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc,argv);
if (argc < 2)
{
return usage("");
}
//The first level
unsigned int firstLevel = 0;
while (arguments.read("--first-level", firstLevel));
//The max level
unsigned int maxLevel = 6;
while (arguments.read("--max-level", maxLevel));
unsigned int maxFeatures = 300;
while (arguments.read("--max-features", maxFeatures));
//The destination directory
std::string destination = "out";
while (arguments.read("--out", destination));
//The name of the layer
std::string layer = "layer";
while (arguments.read("--layer", layer));
//The description of the layer
std::string description = "";
while (arguments.read("--description", description));
std::string queryExpression = "";
while (arguments.read("--expression", queryExpression));
std::string queryOrderBy = "";
while (arguments.read("--order-by", queryOrderBy));
CropFilter::Method cropMethod = CropFilter::METHOD_CENTROID;
if (arguments.read("--crop"))
{
cropMethod = CropFilter::METHOD_CROPPING;
}
std::string destSRS;
while(arguments.read("--dest-srs", destSRS));
// Custom bounding box
Bounds bounds;
double xmin=DBL_MAX, ymin=DBL_MAX, xmax=DBL_MIN, ymax=DBL_MIN;
while (arguments.read("--bounds", xmin, ymin, xmax, ymax ))
{
bounds.xMin() = xmin;
bounds.yMin() = ymin;
bounds.xMax() = xmax;
bounds.yMax() = ymax;
}
std::string filename;
//Get the first argument that is not an option
for(int pos=1;pos<arguments.argc();++pos)
{
if (!arguments.isOption(pos))
{
filename = arguments[ pos ];
break;
}
}
if (filename.empty())
{
return usage( "Please provide a filename" );
}
//Open the feature source
OGRFeatureOptions featureOpt;
featureOpt.url() = filename;
osg::ref_ptr< FeatureSource > features = FeatureSourceFactory::create( featureOpt );
if (!features.valid())
{
OE_NOTICE << "Failed to open " << filename << std::endl;
return 1;
}
features->initialize();
const FeatureProfile* profile = features->getFeatureProfile();
if (!profile)
{
OE_NOTICE << "Failed to create a valid profile for " << filename << std::endl;
return 1;
}
std::string method = cropMethod == CropFilter::METHOD_CENTROID ? "Centroid" : "Cropping";
OE_NOTICE << "Processing " << filename << std::endl
<< " FirstLevel=" << firstLevel << std::endl
<< " MaxLevel=" << maxLevel << std::endl
<< " MaxFeatures=" << maxFeatures << std::endl
//.........这里部分代码省略.........