~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to ogr/ogrfeaturestyle.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: ogrfeaturestyle.cpp 18572 2010-01-17 14:21:31Z rouault $
 
2
 * $Id: ogrfeaturestyle.cpp 23051 2011-09-04 17:59:02Z winkey $
3
3
 *
4
4
 * Project:  OpenGIS Simple Features Reference Implementation
5
5
 * Purpose:  Feature Representation string API
33
33
#include "ogr_featurestyle.h"
34
34
#include "ogr_api.h"
35
35
 
36
 
CPL_CVSID("$Id: ogrfeaturestyle.cpp 18572 2010-01-17 14:21:31Z rouault $");
 
36
CPL_CVSID("$Id: ogrfeaturestyle.cpp 23051 2011-09-04 17:59:02Z winkey $");
37
37
 
38
38
CPL_C_START
39
39
void OGRFeatureStylePuller() {}
48
48
{
49
49
    {OGRSTPenColor,"c",FALSE,OGRSTypeString},
50
50
    {OGRSTPenWidth,"w",TRUE,OGRSTypeDouble},
51
 
    {OGRSTPenPattern,"p",TRUE,OGRSTypeString},
 
51
    {OGRSTPenPattern,"p",FALSE,OGRSTypeString}, // georefed,but multiple times.
52
52
    {OGRSTPenId,"id",FALSE,OGRSTypeString},
53
53
    {OGRSTPenPerOffset,"dp",TRUE,OGRSTypeDouble},
54
54
    {OGRSTPenCap,"cap",FALSE,OGRSTypeString},
376
376
/*      const char *OGRStyleMgr::GetStyleByName(const char *pszStyleName)   */
377
377
/*                                                                          */
378
378
/****************************************************************************/
 
379
 
 
380
/**
 
381
 * \brief find a style in the current style table.
 
382
 *
 
383
 *
 
384
 * @param pszStyleName the name of the style to add.
 
385
 *
 
386
 * @return the style string matching the name or NULL if not found or error.
 
387
 */
379
388
const char *OGRStyleMgr::GetStyleByName(const char *pszStyleName)
380
389
{    
381
390
    if (m_poDataSetStyleTable)
390
399
/*                                   char *pszStyleString)                  */
391
400
/*                                                                          */
392
401
/****************************************************************************/
 
402
 
 
403
/**
 
404
 * \brief Add a style to the current style table.
 
405
 *
 
406
 * This method is the same as the C function OGR_SM_AddStyle().
 
407
 *
 
408
 * @param pszStyleName the name of the style to add.
 
409
 * @param pszStyleString the style string to use, or NULL to use the style 
 
410
 *                       stored in the manager.
 
411
 *
 
412
 * @return TRUE on success, FALSE on errors. 
 
413
 */
 
414
 
393
415
GBool OGRStyleMgr::AddStyle(const char *pszStyleName, 
394
416
                            const char *pszStyleString)
395
417
{
413
435
/************************************************************************/
414
436
 
415
437
/**
416
 
 * Add a style to the current style table.
 
438
 * \brief Add a style to the current style table.
417
439
 *
418
440
 * This function is the same as the C++ method OGRStyleMgr::AddStyle().
419
441
 *
440
462
/*                                                                          */
441
463
/****************************************************************************/
442
464
 
 
465
/**
 
466
 * \brief Get the style string from the style manager.
 
467
 *
 
468
 * @param poFeature feature object from which to read the style or NULL to
 
469
 *                  get the style string stored in the manager.
 
470
 *
 
471
 * @return the style string stored in the feature or the style string stored
 
472
 *          in the style manager if poFeature is NULL
 
473
 *
 
474
 * NOTE: this method will call OGRStyleMgr::InitFromFeature() if poFeature is
 
475
 *       not NULL and replace the style string stored in the style manager
 
476
 */
 
477
 
443
478
const char *OGRStyleMgr::GetStyleString(OGRFeature *poFeature)
444
479
{
445
480
    if (poFeature == NULL)
448
483
      return InitFromFeature(poFeature);
449
484
}
450
485
 
 
486
/****************************************************************************/
 
487
/*            GBool OGRStyleMgr::AddPart(const char *pszPart)               */
 
488
/*            Add a new part in the current style                           */
 
489
/****************************************************************************/
 
490
 
 
491
/**
 
492
 * \brief Add a part (style string) to the current style.
 
493
 *
 
494
 * @param pszPart the style string defining the part to add.
 
495
 *
 
496
 * @return TRUE on success, FALSE on errors. 
 
497
 */
 
498
 
451
499
GBool OGRStyleMgr::AddPart(const char *pszPart)
452
500
{
453
501
    char *pszTmp; 
490
538
GBool OGRStyleMgr::AddPart(OGRStyleTool *poStyleTool)
491
539
{
492
540
    char *pszTmp;
493
 
    if (poStyleTool)
 
541
    if (poStyleTool && poStyleTool->GetStyleString())
494
542
    {
495
543
        if (m_pszStyleString)
496
544
        {
618
666
 *
619
667
 * This method is the same as the C function OGR_SM_GetPart().
620
668
 *
 
669
 * This method instanciates a new object that should be freed with OGR_ST_Destroy().
 
670
 *
621
671
 * @param nPartId the part number (0-based index).
622
672
 * @param pszStyleString (optional) the style string on which to operate.
623
673
 * If NULL then the current style string stored in the style manager is used.
648
698
 
649
699
    pszString = CSLGetField( papszStyleString, nPartId );
650
700
    
651
 
    if ( pszString || strlen(pszString) > 0 )
 
701
    if ( strlen(pszString) > 0 )
652
702
    {
653
703
        poStyleTool = CreateStyleToolFromStyleString(pszString);
654
704
        if ( poStyleTool )
669
719
 *
670
720
 * This function is the same as the C++ method OGRStyleMgr::GetPart().
671
721
 *
 
722
 * This function instanciates a new object that should be freed with OGR_ST_Destroy().
 
723
 *
672
724
 * @param hSM handle to the style manager.
673
725
 * @param nPartId the part number (0-based index).
674
726
 * @param pszStyleString (optional) the style string on which to operate.
1729
1781
    for ( i = 0; i < nElements; i++ )
1730
1782
    {
1731
1783
        char    **papszStylePair =
1732
 
            CSLTokenizeString2( papszToken2[i], ":", CSLT_HONOURSTRINGS
1733
 
                                                     | CSLT_STRIPLEADSPACES
1734
 
                                                     | CSLT_STRIPENDSPACES );
 
1784
            CSLTokenizeString2( papszToken2[i], ":", 
 
1785
                                CSLT_HONOURSTRINGS 
 
1786
                                | CSLT_STRIPLEADSPACES
 
1787
                                | CSLT_STRIPENDSPACES 
 
1788
                                | CSLT_ALLOWEMPTYTOKENS );
 
1789
 
1735
1790
        int     j, nTokens = CSLCount(papszStylePair);
1736
1791
 
1737
1792
        if ( nTokens < 1 || nTokens > 2 )