20 #include <tbb/atomic.h>
22 namespace MAKVRinTerra
24 template <
typename FS,
typename S =
typename FS::Sink>
27 ,
public boost::enable_shared_from_this<DtIndexingFeatureSet<FS,S> >
30 typedef boost::shared_ptr<DtIndexingFeatureSet>
Ptr;
31 typedef boost::shared_ptr<const DtIndexingFeatureSet>
CPtr;
32 typedef boost::weak_ptr<DtIndexingFeatureSet>
WPtr;
46 typedef boost::shared_ptr<Config>
Ptr;
83 return Make(boost::shared_ptr<Config>(cfg), bounds);
101 return FS::Wrap(this->shared_from_this());
106 return myConfig->inputSink->label() +
" index level "
107 + boost::lexical_cast<std::string>(
myLevel);
132 const boost::optional<DtFeatureGeometry>& geometry,
137 return myFeatures->filter(query, boost::none_t(), load);
141 return myFeatures->filter(query, geometry, load);
143 bool covers[4] = {
false,
false,
false,
false };
144 bool intersections[4] = {
false,
false,
false,
false };
145 size_t lastIntersection = 0;
147 unsigned numIntersects = 0;
152 for (
unsigned i=0; !done && i != 4; ++i)
154 std::auto_ptr<DtFeatureGeometry::RelationshipMatrix> matrix
157 if (!matrix->intersects())
160 switch (geometry->type())
165 intersections[i] =
true;
167 lastIntersection = i;
171 intersections[i] =
true;
173 lastIntersection = i;
176 if (matrix->coveredBy())
183 if (matrix->touches())
186 intersections[i] =
true;
188 lastIntersection = i;
191 if (matrix->covers())
195 if (matrix->coveredBy())
204 switch (numIntersects)
209 !covers[lastIntersection] ? geometry : boost::none_t(),
215 for (
size_t i=0; i != 4; ++i)
217 if (!intersections[i])
222 !covers[i] ? geometry : boost::none_t(),
226 return list.release();
259 const boost::shared_ptr<Config>& cfg,
285 DtTHROW_NEW(
DtException,
"Tile index out of bounds");
291 Ptr This(this->shared_from_this());
309 Ptr This(this->shared_from_this());
323 DtWarn <<
"Error activating subtile" << std::endl;
361 :
myBounds(pbounds.makeSubBounds(i,2,2))
369 Caller caller(parent, *
this);
370 mySink->addLoadedCallback(caller);
398 size_t c =
mySink->numberOfFeatures();
403 if (pc <= parent.myConfig->minFeaturesToIndexTile)
408 if (pc/(
double)c >= parent.
myConfig->featuresIndexRatio)
423 :
set(
set), subtile(subtile)