ThinkGeo.com    |     Documentation    |     Premium Support

Why can't I using CustomStyles?

I use the version MapSuiteDesktopEvalSetup3.0.426 RC2, I cann't use the "CustomStyles" Property of PostgreSqlFeatureLayer.

When I use the "CustomStyles" ,there is a exception.But I use the the version MapSuiteDesktopEvaluationEdition3.0(BETA) and

MapSuiteDesktopEvalSetupV3.0.415 RC2,it works well.

the follwing is my code,it works well in both version Map Suite Desktop Evaluation Edition 3.0 Setup.msi and MapSuiteDesktopEvalSetupV3.0.415RC2 .zip,

but it works badly in version MapSuiteDesktopEvalSetup3.0.426 RC2 with the same code.


string overLayerName = layerName + "Overlay"; PostgreSqlFeatureLayer postgreLayer = new PostgreSqlFeatureLayer(connectionString, tableName, featureIdColumn); postgreLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.MajorRoad3; postgreLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05; ValueStyle valueStyle2 = new ValueStyle(); valueStyle2.ColumnName = "rd_class"; valueStyle2.ValueItems.Add(new ValueItem("1", LineStyles.MajorRoad1)); valueStyle2.ValueItems.Add(new ValueItem("2", LineStyles.MajorRoad2)); valueStyle2.ValueItems.Add(new ValueItem("3", LineStyles.MajorRoad3)); valueStyle2.ValueItems.Add(new ValueItem("5", LineStyles.LocalRoad1)); valueStyle2.ValueItems.Add(new ValueItem("6", LineStyles.LocalRoad2)); valueStyle2.ValueItems.Add(new ValueItem("9", LineStyles.LocalRoad3)); postgreLayer.ZoomLevelSet.ZoomLevel06.CustomStyles.Add(valueStyle2);

postgreLayer.ZoomLevelSet.ZoomLevel06.CustomStyles.Add(TextStyles.LocalRoad2("name_a"));

postgreLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay postgreOverlay = new LayerOverlay(); postgreOverlay.Layers.Add(layerName, postgreLayer); this.m_wpfMap.Overlays.Add(overLayerName, postgreOverlay); this.m_wpfMap.Refresh();


I'm excepting your reply !

thank you very much!

 




Senlin,


 


I noticed your code was missing the set of current extent of the MapControl, which it probably will cause some problem when the default extent is not suitable.


 


I can not recreate the exception by using your code with extent set. We know the exception will throw reasonably when meets following two conditions:



        
  • Set both default style and custom style. 

  •     
  • The zoom level has intersection from default and custom style.


 


But you set default style from zoom level 01 to 05, set custom style from zoom level 06 to 20, there is no intersection of them, so I think it should be work.


 


From version 3.0.415 to version 3.0.426, we introduced the Schema support which caused a potential problem. So please have a try to set the following code: 


postgreSqlFeatureLayer.SchemaName = “public”;


 


Also if you still have problem, could you paste out the exception stack trace, which would be very helpful?


 


Any more questions just feel free to let me know.


 


Thanks.


 


Yale


 



 



Yale, 
 thanks very much for your reply. 
 it works well when I have a try to set the following code:  
  
 postgreSqlFeatureLayer.SchemaName = “public”; 
  
  
  
  


Yale, 
 thanks very much for your reply. 
 it works well when I have a try to set the following code:  
  
 postgreSqlFeatureLayer.SchemaName = “public”; 
  
  
  
  


Senlin, 
  
 Thanks for letting us know your status. It is a potential issue in 4.0.426 and we have fixed it already. 
  
 Thanks 
  
 Yale