IRasterStretch2.StretchStats Return type?

2253
2
11-22-2011 08:56 AM
PatrickYoung1
New Contributor
Hi,

I am trying to figure out what is returned by the StrectchStats call as seen in the following help file:

IRasterStretch2.StretchStats Reference

It returns an IArray, but I can't figure out what to cast the elements of the array as.  In other words, in the snippet of code below, what should "ISomething" be?

IRasterStretch2 irs = irrgbr as IRasterStretch2;
IArray ia = irs.StretchStats;
ISomething value = ia.get_Element(0) as ISomething; // What should "ISomething" be?
0 Kudos
2 Replies
ZhengwenFu
New Contributor
Hi,

I am trying to figure out what is returned by the StrectchStats call as seen in the following help file:

IRasterStretch2.StretchStats Reference

It returns an IArray, but I can't figure out what to cast the elements of the array as.  In other words, in the snippet of code below, what should "ISomething" be?

IRasterStretch2 irs = irrgbr as IRasterStretch2;
IArray ia = irs.StretchStats;
ISomething value = ia.get_Element(0) as ISomething; // What should "ISomething" be?


Hi,I meet the same problem,Do you have got it?
0 Kudos
ZhengwenFu
New Contributor
I am glad to tell those gays who happen to meet the same question,that I  have got it!

                IRasterRGBRenderer2 m_pRasterRGBRenderer = pRasterLayer.Renderer as IRasterRGBRenderer2;
                IRasterStretch2 pRasterStretch2 = m_pRasterRGBRenderer as IRasterStretch2;
                IArray pArray = pRasterStretch2.SpecificationHistogram;
                IArray pArray2 = pRasterStretch2.StretchStats;

                object obj1 = pArray.get_Element(1);
                object obj2 = pArray2.get_Element(1);
                IStatsHistogram pStatsHistogram = obj2 as IStatsHistogram;

That's the answer!
It'a IStatsHistogram.
0 Kudos