I'm just starting out using the styles features of OGR (using the C API) but at 
struggling with a few elements of it.

My code (copied below) fails to get any OGRStyleToolH.  Ie, the "if ( tool )" 
block never gets run, because 'tool' is always NULL at the point indicated by 
the comment.  But the execution does reach that point in the code which 
indicates that the OGRStyleMrgH does in fact include at least one part (tool).

I'd be grateful if somebody could point out what I'm doing wrong.

Thanks,
Nik.


-------------------------------------------
        const char *styleChars = OGR_STBL_GetNextStyle(table) ) )
        NSString *styleName = [NSString 
stringWithUTF8String:OGR_STBL_GetLastStyleName(table)];
        OGRStyleMgrH styleMgr = OGR_SM_Create(NULL);
        OGR_SM_InitStyleString(styleMgr, styleChars);


        for ( int i = 0; i < OGR_SM_GetPartCount(styleMgr, NULL); i++ )
        {
                OGRStyleToolH tool = OGR_SM_GetPart(styleMgr, i, NULL);
                
                if ( tool )  //  'tool' always NULL here
                {
                        switch ( OGR_ST_GetType(tool) )
                        {
                                case OGRSTCPen:
                                        self.pen = tool;
                                        break;
                                        
                                case OGRSTCBrush:
                                        self.brush = tool;
                                        break;
                                        
                                case OGRSTCSymbol:
                                        self.symbol = tool;
                                        break;
                                        
                                case OGRSTCLabel:
                                        self.label = tool;
                                        break;
                                        
                                default:
                                        NSLog(@"Unknown style tool type!");
                                        break;
                        }
                }
        }
-------------------------------------------


_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to