[Gdal-dev] Feature Style problem

ksa ksa-nil5 at yandex.ru
Mon Oct 11 10:54:01 EDT 2004


Hi, Frank.

I'm using OGR 1.2.3 for working with MapInfo files.

I have found that OGRFeature::GetStyleString() returns not accurate
information.
And that is why.
I have MIF file with follow information

-- start of MIF file
Version 300
Charset "WindowsCyrillic"
Delimiter ","
CoordSys Earth Projection 1, 0
Columns 1
  asd Char(10)
Data

Region  1
  5
0.152334 -0.130221
0.82064 0.547912
1.282556 0.159705
0.84521 -0.601966
0.152334 -0.130221
    Pen (1,2,0)
    Brush (60,16711680)
    Center 0.717445 -0.027027
--end of MIF file

how you can see, Brush is transparent (has no background color).
But OGRFeature::GetStyleString() returns follow style string:
"BRUSH(fc:#ff0000,bc:#ffffff,id:"mapinfo-brush-60.ogr-brush-0");PEN(...)".
So, that say current feature has white background color. But that not
represent the facts!.

I have found in MITAB module (file mitab_feature.cpp) in
ITABFeatureBrush::GetBrushStyleString() follow lines:

<...>
       pszStyle
=CPLSPrintf("BRUSH(fc:#%6.6x,bc:#%6.6x,id:\"mapinfo-brush-%d.ogr-brush-%d\")
",
                            m_sBrushDef.rgbFGColor,
                            m_sBrushDef.rgbBGColor,
                            m_sBrushDef.nFillPattern,nOGRStyle);
<...>

in other words, brush ALWAYS has background color!
I have found, that ITABFeatureBrush has method GetBrushTransparent(). So, I
suggest remake that method as follow:

<...>
    if(GetBrushTransparent())
       pszStyle
=CPLSPrintf("BRUSH(fc:#%6.6x,id:\"mapinfo-brush-%d.ogr-brush-%d\")",
                            m_sBrushDef.rgbFGColor,
                            m_sBrushDef.nFillPattern,nOGRStyle);
    else
       pszStyle
=CPLSPrintf("BRUSH(fc:#%6.6x,bc:#%6.6x,id:\"mapinfo-brush-%d.ogr-brush-%d\")
",
                            m_sBrushDef.rgbFGColor,
                            m_sBrushDef.rgbBGColor,
                            m_sBrushDef.nFillPattern,nOGRStyle);
<...>

Sergey A. Karin




More information about the Gdal-dev mailing list