Feature iterator within another - is it possible?

Hi, everybody,

I want to use two feature iterators (XfmFeatureIteratorP) at the same time.

I'd like to know if it is possible to use one iterator within another?

In my example program ends at the line:

xfmFeatureIterator_getNext(iterator, &feature);

in locate1() procedure. I suppose it's caused by running the second iterator in locate2() or by the second XfmLocateOp.

Am I right?

Regards,

Mariusz

 

Example (I have removed all necessary code to make the example clearer):

void locate1(XfmLocateOpP locateOp) {

  XfmFeatureIteratorP        iterator1 = NULL;

  XfmFeatureP                        feature;

  int status;

 

  status = xfmLocateOp_getLocatedFeatures (locateOp, &iterator);

  status = xfmFeatureIterator_getFirst (iterator, &feature);

  while(feature != NULL) {

    procedure1(feature);

    xfmFeature_free (&feature);

    xfmFeatureIterator_getNext(iterator, &feature);

  }

  xfmFeatureIterator_free (&iterator);

}

 

void procedure1(XfmFeatureP feature)

{

  XfmLocateOpP   locateOp = NULL;

  int status;

  status = xfmLocateOp_create (&locateOp);
  if (SUCCESS != status)  {
      return status;
  }

  xfmCmdMgr_startLocateOperation (locateOp, locate2, NULL, NULL, NULL, NULL);

}

 

void locate2(XfmLocateOpP locateOp) {

  XfmFeatureIteratorP        iterator1 = NULL;

  XfmFeatureP                        feature;

  int status;

 

  status = xfmLocateOp_getLocatedFeatures (locateOp, &iterator);

  status = xfmFeatureIterator_getFirst (iterator, &feature);

  while(feature != NULL) {

    // do something

    xfmFeature_free (&feature);

    xfmFeatureIterator_getNext(iterator, &feature);

  }

  xfmFeatureIterator_free (&iterator);

}

 

  • Mariusz,

    You are correct. At this time locate operations cannot be nested and are expected to be performed sequentially when using the xfmCmdMgr_startLocateOperation function. Depending on your specific application requirements, there may be alternative means by which you could perform this type of nested locate operations. Please contact me directly to discuss possible alternative techniques.

    Regards,

    Jeff Bielefeld [Bentley]