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

Discussion Forums

The online community for users of Map Suite GIS components

Using SymbolCustomRenderer
Last Post 03-05-2008 04:15 AM by sun. 4 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
MatthewUser is Offline
Level 1
Level 1
Posts:9

--
02-19-2008 01:10 PM

What I need to do is render a layer of shapes where the color of each shape depends on a value in a table other than the shapefile dbf table. I need to do a join between the dbf table and this other table. e.g. suppose the layer being displayed is US Zips, and I have a table 'ZipColor' in SQLServer with columns 'ZIP' and 'color'. I want to be able to use the zip of each shape being rendered to get the color from the ZipColor table.

 

Is it possible to do this with MapSuite? It appears to me that I would have to use the SymbolCustomRenderer object to do this. Is taht right? If so, is there an example available using this class?

 

Thanks for any help you can give me.

MatthewUser is Offline
Level 1
Level 1
Posts:9

--
02-27-2008 03:28 PM

I have explored this further, and am now trying to use the CustomDrawEXEventHandler for a CustomPoint for the layer that I am trying to draw. I have added a CustomField to the layer to contain the data I need to identify the color I want for each point in the layer.

 

The CustomDrawEXEventHandler has a recordNum parameter identifying which point in the layer to draw. I am using the layer.DataQuery method to get the data associated with the point I am trying to draw. Unfortunately, the CustomField I added does not appear to be included in the DataTable that returns from DataQuery.

 

Is that correct? Will the DataQuery method only return the fields in the .dbf file, and not the custom fields as well?

 

Thanks-

 Matt

guoxinUser is Offline
Level 1
Level 1
Posts:15

--
02-27-2008 10:45 PM
Matthew,
I think you can use the classes MapSuite.CustomField and MapSuite.SymbolClassBreakRenderer to implement your requirement.
Please have a look at the sample “CustomData” in Desktop Edition, which has a same function with your project. I think it will be helpful.

Guo
MatthewUser is Offline
Level 1
Level 1
Posts:9

--
02-28-2008 08:23 AM
Guo- That is what I started out to do, but it appears that the SymbolClassBreakRenderer only allows ranges of numeric values; I want to assign a different color for each of a set number of string keys. I've made it work using the CustomDrawEXEventHandler by using the PointSymbol parameter as an index into a data structure holding the information needed to build the point symbol I want to draw, and the recNumber parameter to find the color I want to draw.

I'm still puzzled about the CustomField functionality; if I can't access the data in the custom field with the DataQuery call, how can I get it? Can it only be used by the SymbolClassBreakRenderer?

Matt
sunUser is Offline
Level 3
Level 3
Posts:94

--
03-05-2008 04:15 AM

I think the custom data is stored in a hashtable, and you can get the hashtable by layer.CustomFields[0].CustomData but not the DataQuery method. In your case the key of the hashtable may be the recordID in the dbf file, the corresponding value should be the color you got from SQL Server.

You are not authorized to post a reply.

Active Forums 4.1