ThinkGeo.com    |     Documentation    |     Premium Support

Styles

I'm starting to explore styles.   I have layers where I want all objects on the layer to be represented by a single set of styles... a areastyle to fill the polygons (if the data is polygonal) and an alternative style to display dots if the data is points.   And I want two labels on each object, one above and one below the centroid.


I understand how to do this for individual breaks in a class break style, or individual members of a value style.   But what object do I create that just has a single customstyles collection that gets applied to all objects?   I have not found an example where you place multiple labels on a map. 


In many of your examples, you create two feature layers... one for the geometries, and one for the labels.   Is that really required?  Is that how you ensure that labels for one geometry don't get overwritten by a neighboring geometry that is drawn later?



Ted, 
  
   This is kind of a tricky question as it has a few parts. 
  
 1.On the multiple labels what you need to do is use the CustomStyles collection and add two TextStyles to it.  On for the first label and one for the second.  I have a feeling I am missing your point so if so let me know a little more detail.  I can be thick sometimes. 
  
 2.We suggest that you separate the layers that draw geometries and labels.  While this is not required we suggest it so that if you have multiple geometry layers the labels for them always draw on top.  In the case where you must or want draw text and geometries on the same layer then what we need to do is to enhance the TextStyle to allow it to draw on a different DrawingLevel.  Let me explain this.   Inside of a style we ultimately make a call to the GeoCanvas to do the actual drawing.  In the GeoCanvas method calls to draw you specify a DrawingLevel, it is 1-4.  These drawing levels represent four different bitmaps that you can draw to in a stack.  It is used to get certain effects for roads.  For example if you have a road that is drawn by a thick black line then a thinner white line we need this kind of thing.  If we first drew record one and drew the black thick line then draw the white line on top of it using the same level then went to record two etc the effect would not look good.  Instead what we do is draw the black thick line on drawing level one and then the white line on drawing level 2.  At the end of all the records we combine all of them together and get the nice effect we want.  
  
  The problem you are seeing is because if you use a text style and area style on the same layer the two styles are more than likely using drawing level one.  If instead we make the text style use drawing level 4 then the geometries would always draw below them no matter what record number.  I hope you understand, it is a hard thing to explain.  The problem is that the TextStyle defaults to drawing level one.  What we would need to do is change this to level 4 to be safe and also maybe expose this as a property that people could easily set.  This problem comes up over and over and we should make this change.  Let me see if I can get you a stop gap measure if you really need this.  Let me know. 
  
 David 


I too am hitting this and would appreciate being able to set the drawing level for a style.  Any idea when the next version (beta or final) is coming?  I know there are multi-threading issues, just looking for an update.



David, 



We plan to release the next Beta middle this month. 



ThinkGeo Support