Bug 693 - [MITAB] Problem with transparent brushes in MIF files
: [MITAB] Problem with transparent brushes in MIF files
Status: RESOLVED FIXED
: MITAB
MIF support
: unspecified
: PC Linux
: P2 normal
: ---
Assigned To:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2004-10-11 15:39 by
Modified: 2004-10-11 16:22 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2004-10-11 15:39:39
-------- Original Message --------
Subject: [Gdal-dev] Feature Style problem
Date: Mon, 11 Oct 2004 18:54:01 +0400
From: ksa <ksa-nil5@yandex.ru>
To: <gdal-dev@remotesensing.org>

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
------- Comment #1 From 2004-10-11 16:22:25 -------
Tested and applied the patch above in MITAB (will be in next release, 1.3.1 or
1.4.0, whatever it is).

Also backported the fix to GDAL/OGR's CVS.