<html>
<head>
   <meta http-equiv=Content-Type content="text/html; charset=ks_c_5601-1987">
   <style type="text/css">div, span, p { padding: 0px; margin:0cm; margin-bottom:3.5pt; text-align:justify; text-justify:inter-ideograph; text-autospace:none; word-break:break-hangul; font-size: 10pt; }; p.fcknormal, li.fcknormal, div.fcknormal { padding: 0px; margin:0cm; margin-bottom:3.5pt; text-align:justify; text-justify:inter-ideograph; text-autospace:none; word-break:break-hangul; font-size: 10pt };</style>
</head>

<body link="blue" vlink="purple">
<p> Dear,</p>
<p> </p>
<p> I make a console application with VS2010 linking "gdal_i.lib".</p>
<p> The steps are :</p>
<p><strong> 1. Create New Dataset and Band in main.cpp</strong></p>
<div>class XXDataset : public GDALPamDataset</div>
<div>{</div>
<div>public:</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>XXDataset() {};</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>~XXDataset() {};</div>
<div> </div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>static GDALDataset* Open(GDALOpenInfo*);</div>
<div>};</div>
<div> </div>
<div>class XXRasterBand : public GDALPamRasterBand</div>
<div>{</div>
<div>public:</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>XXRasterBand( GDALDataset*, int, GDALDataType );</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>~XXRasterBand() {};</div>
<div>};</div>
<div> </div>
<div>
<div> </div>
<div>GDALDataset* XXDataset::Open(GDALOpenInfo* pOpenInfo)</div>
<div>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>XXDataset* poDS = new XXDataset();</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>poDS- >nRasterXSize = 100;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>poDS- >nRasterYSize = 200;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>poDS- >eAccess = GA_Update;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>poDS- >nBands = 3;</div>
<div> </div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>int iBand = 0;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>for(iBand = 1; iBand < = 3; iBand++ )</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">              </span>XXRasterBand* band = new XXRasterBand( poDS, iBand, GDT_Byte);</div>
<div><span class="Apple-tab-span" style="white-space:pre">              </span>poDS- >SetBand( iBand, band );</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>}</div>
<div> </div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>return poDS;</div>
<div>}</div>
<div> </div>
<div>XXRasterBand::XXRasterBand( GDALDataset *poDS, int nBand, GDALDataType eType)</div>
<div>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>this- >poDS = poDS;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>this- >nBand = nBand;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>this- >eDataType = eType;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>nRasterXSize = 100;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>nRasterYSize = 200;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>nBlockXSize = nRasterXSize;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>nBlockYSize = nRasterYSize;</div>
<div>}</div>
<div> </div>
<div><strong>2. Add the code in main function</strong></div>
<div>void main()</div>
<div>{</div>
<div> </div>
<div> </div>
<div>        GDALDataset* pDSTemp = XXDataset::Open(NULL);</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>if (pDSTemp) GDALClose(pDSTemp);</div>
<div>}</div>
</div>
<div> </div>
<div> </div>
<div>I compile and try to debug this app.</div>
<div>But in "poDS->SetBand" line of "XXDataset::Open", the app is broken when the first band is ready to set.</div>
<div>In XXDataset::Open, all value of parameters is right.</div>
<div>But When stepping into the "SetBand" function, the values may be corrupted.</div>
<div>"papobands" of GDALDataset is not null and it make an error.</div>
<div> </div>
<div>Please let me know the reason or some tips.</div>
<div> </div>
<div>Thanks.</div>
<div> </div>
<p> </p>
</body>
</html>

<img src="http://mail.pixoneer.co.kr/mail/mail_confirm.php?host=pixoneer.co.kr&id=salim&sid=13838149940388501009&rcptto=gdal-dev%40lists.osgeo.org." width="1" height="1">