本文整理汇总了C++中PointViewPtr::hasDim方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewPtr::hasDim方法的具体用法?C++ PointViewPtr::hasDim怎么用?C++ PointViewPtr::hasDim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointViewPtr
的用法示例。
在下文中一共展示了PointViewPtr::hasDim方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
void SbetWriter::write(const PointViewPtr view)
{
Dimension::IdList dims = fileDimensions();
for (PointId idx = 0; idx < view->size(); ++idx)
{
for (auto di = dims.begin(); di != dims.end(); ++di)
{
// If a dimension doesn't exist, write 0.
Dimension::Id dim = *di;
*m_stream << (view->hasDim(dim) ?
view->getFieldAs<double>(dim, idx) : 0.0);
}
}
}
示例2: write
void GeoWaveWriter::write(const PointViewPtr view)
{
using namespace Dimension;
std::ostringstream os;
BasicAccumuloOperations accumuloOperations;
try
{
accumuloOperations = java_new<BasicAccumuloOperations>(
java_new<String>(m_zookeeperUrl),
java_new<String>(m_instanceName),
java_new<String>(m_username),
java_new<String>(m_password),
java_new<String>(m_tableNamespace));
}
catch (AccumuloException& e)
{
log()->get(LogLevel::Error) << "There was a problem establishing a connector. " << e;
return;
}
catch (AccumuloSecurityException& e)
{
log()->get(LogLevel::Error) << "The credentials passed are invalid. " << e;
return;
}
AccumuloDataStore accumuloDataStore = java_new<AccumuloDataStore>(
accumuloOperations);
Index index = IndexType_JaceIndexType::createSpatialVectorIndex();
AccumuloIndexWriter accumuloIndexWriter = java_new<AccumuloIndexWriter>(
index,
accumuloOperations,
accumuloDataStore);
// treat all types as double
os << "location:Point:srid=4326";
for (auto di = m_dims.begin(); di != m_dims.end(); ++di)
os << "," << view->dimName(*di) << ":Double";
SimpleFeatureType TYPE = DataUtilities::createType(
java_new<String>(m_featureTypeName),
java_new<String>(os.str()));
String location = java_new<String>("location");
WritableDataAdapter dataAdapter;
if (m_useFeatCollDataAdapter)
dataAdapter = java_new<FeatureCollectionDataAdapter>(
TYPE,
m_pointsPerEntry);
else
dataAdapter = java_new<FeatureDataAdapter>(TYPE);
GeometryFactory geometryFactory = JTSFactoryFinder::getGeometryFactory();
SimpleFeatureBuilder builder = java_new<SimpleFeatureBuilder>(TYPE);
DefaultFeatureCollection featureCollection = java_new<DefaultFeatureCollection>(
UUID::randomUUID().toString(),
TYPE);
for (PointId idx = 0; idx < view->size(); ++idx)
{
JDouble X = view->getFieldAs<double>(Id::X, idx);
JDouble Y = view->getFieldAs<double>(Id::Y, idx);
Point point = geometryFactory.createPoint(
java_new<Coordinate>(
X,
Y));
builder.set(location, point);
for (auto di = m_dims.begin(); di != m_dims.end(); ++di)
if (view->hasDim(*di))
builder.set(java_new<String>(view->dimName(*di)), java_new<Double>(view->getFieldAs<double>(*di, idx)));
SimpleFeature feature = builder.buildFeature(UUID::randomUUID().toString());
if (m_useFeatCollDataAdapter)
featureCollection.add(feature);
else
accumuloIndexWriter.write(
dataAdapter,
feature);
}
if (m_useFeatCollDataAdapter)
accumuloIndexWriter.write(
dataAdapter,
featureCollection);
accumuloIndexWriter.close();
}