Register  |  Login   Search
ThinkGeo - GPS Tracking and Mapping Solutions  |  Home  |  Cygnus Track  |  Blog
 
LivePerson Chat

Discussion Forums

The online community for users of Map Suite GIS components

Subject: Icon renderers (another question)
Prev Next
You are not authorized to post a reply.
Author Messages
7/01/2008 10:35 AM  

Heya

Another question related to IconRenderers... Is there any way to access the border and background properties of the label that is rendered as opposed to using images?

Icons can have text overlayed on top of them that is slightly longer than the image used then it doesn't look that great. I would like to keep the icons that i'm using quite simple at this point and just have a rectangle block behind the text of the icons.

 

Take a look at the attachment for what i'm trying to get to. The icon on the left is 24px wide, while the icon on the right is 28px wide (note the longer name).

 






7/02/2008 10:54 AM  
looks like smileys don't do so well in the subject line : P
7/04/2008 4:25 AM  
I think you also can use IconValueRender in this scenario. At first you create two icons, one is shorter and the other is longer. If the text field's value is "R27" or something like it, just use the first icon; if it is "R102", use the other one. Map Suite also support an interface named "ILabel", maybe you can have a try. But I think you need to do more research about it if you want to use that.
7/08/2008 3:09 AM  
That sounds like a plan. I'm going to give that a shot and i'll post my results here. Thanks Sun.
7/08/2008 6:02 AM  

So I tried the IconValueRenderer... but it seems that a limitation is that you need to match to an exact piece of text before it will work. I managed to do this by matching to a field called "Type" with the value "Main".

The code I used:

IconValueRenderer.IconValue IconValue1 = new IconValueRenderer.IconValue("Main", mMainIcon, TextSymbols);
            IconValue1.TextFieldValueStringLengthMin = 1;
            IconValue1.TextFieldValueStringLengthMax = 3;

            IconValueRenderer.IconValue IconValue2 = new IconValueRenderer.IconValue("Main", mHighwayIcon, TextSymbols);
            IconValue2.TextFieldValueStringLengthMin = 3;
            IconValue2.TextFieldValueStringLengthMax = 4;

            IconValueCollection.Add(IconValue1);
            IconValueCollection.Add(IconValue2);

            IconValueRenderer IconValueRenderer = new IconValueRenderer("Type", "RD_NUMBER", IconValueCollection);

The problem with this is that I really only want to match on length, and not any specific value in the field. I want my application to be compatible with Shape File dbf files that I do not know the exact column structure of.

I tried not including the Value field but nothing renders at all:

IconValueRenderer.IconValue IconValue1 = new IconValueRenderer.IconValue();
            IconValue1.Icon = mMainIcon;
            IconValue1.TextSymbols = TextSymbols;
            IconValue1.TextFieldValueStringLengthMin = 1;
            IconValue1.TextFieldValueStringLengthMax = 3;

            IconValueRenderer.IconValue IconValue2 = new IconValueRenderer.IconValue();
            IconValue2.Icon = mHighwayIcon;
            IconValue2.TextSymbols = TextSymbols;
            IconValue2.TextFieldValueStringLengthMin = 3;
            IconValue2.TextFieldValueStringLengthMax = 4;

            IconValueCollection.Add(IconValue1);
            IconValueCollection.Add(IconValue2);

            IconValueRenderer IconValueRenderer = new IconValueRenderer();
            IconValueRenderer.IconValues  = IconValueCollection;
            IconValueRenderer.FieldName = "RD_Name";

 

 

Is there another way to use the IconValueRenderer where I do not need to match on an exact value?

7/16/2008 8:19 AM  
Does anyone have any ideas on this one?
You are not authorized to post a reply.
Forums > Map Suite 2.x GIS Components > Map Suite Desktop > Icon renderers (another question)



ActiveForums 3.7