ThinkGeo.com    |     Documentation    |     Premium Support

Line labels are reversed

Hi,


I'm experiencing reversed labels with recents builds; how can I avoid that?



Thank you


Patrick.



Patrick,


Thanks for your post.


I have tested the normal TextStyle by default settings, no label is reversed. So I think you might use some sepcial settings to cause this problem, or you use your custom text style. If it is like that, could you provide the settings or simple code?  


Thanks


James



Sure, here is my code: 
  
 TextStyle ts = TextStyles.CreateSimpleTextStyle(LabelColumn.Value, "Arial", 11,  
         DrawingFontStyles.Regular, GeoColor.SimpleColors.Black, GeoColor.StandardColors.White, 2, -10, 0); 
  
 ts.PointPlacement = PointPlacement.UpperCenter; 
 ts.YOffsetInPixel = 7; 
 ts.AllowLineCarriage = true; 
 ts.SplineType = SplineType.StandardSplining; 
  
 ts.BestPlacement = true; 
 ts.OverlappingRule = LabelOverlappingRule.NoOverlapping; 
 ts.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels; 
  
 Layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(ts); 
 Layer.ZoomLevelSet.ApplyUntilZoomLevel = Layer.ZoomLevelSet.ZoomLevel20;

James: additional note: the line is going from right to left, so somewhere the text is going in the direction of the line … but I do not want it

Patrick, 
  
 I tested by using your code and I found the problem is caused by "ts.SplineType = SplineType.StandardSplining; ". The result of StandardSplining might not very good but it solve another problem that can make long label easy to read.  
  
 If you set SplineType to none can fix this problem, but I think you have the reason to set StandardSplining, so I will do more research and try to figure out how to make it good looking. 
  
 I will try to override the GetLabelingCandidateCore method of TextStyle, if I make it I will let you know. 
  
 Thanks 
 James

splinetype.none simply does not draw the label for me (w7, 64bits, FR, 3.1.299.125) 
 but you’re right, I need spline display for follow the line curve.

Patrick, 
  
 I have fixed this problem, you can try 3.1.299.127 which will be automatic generated the next day. 
  
 Thanks 
 James

Hi is the problem solved yet? What does one have to do? We have the similar problem, if the line is not horizontal then the label are revered, irrelevant of the start point and end point! The following is my text style 
 TextStyle textStyle = TextStyles.CreateSimpleTextStyle( 
                 columnName, "Arial", textSize, fontStyles, textColor, 0, 0); 
             textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 3); 
             textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; 
             textStyle.SplineType = SplineType.ForceSplining; 
             textStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels; 
             //// elevationStyle.YOffsetInPixel = 5; 
             textStyle.TextLineSegmentRatio = 9999999; 
             textStyle.FittingLineInScreen = true; 
             textStyle.SuppressPartialLabels = true; 
             textStyle.BestPlacement = true; 
  
             return textStyle; 
 Regards 
 Murshed

Hi Murshed, 
  
 Sorry we haven’t reproduced your issue with your code and our data, please let us know your detail dll version(If possible please use the latest version) and any screen capture or simple sample contains your test data should be helpful. 
  
 Regards, 
  
 Don

Hi Don thank you very much for your reply!! I am using mapsuite wpf 7.*.*.* However I fixed it myself with some try and error!! Here is the info of the old problem 
WKT: LINESTRING(-193232.32414293 2729712.32586722,799835.063224535 4300030.70687686)



The Style(to show reversed text) is in my previous post(which is in many places in thinkgeo site)

And for me what worked is the following style: 
I am posing the my solution just in case someone has the same problem!! (if you pay attention I changed the spline type value.)
TextStyle textStyle = TextStyles.CreateSimpleTextStyle(
                columnName, “Arial”, textSize, fontStyles, textColor, 0, 0);
            textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 3);
            textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping;
            textStyle.SplineType = SplineType.StandardSplining;
            textStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels;            
            textStyle.TextLineSegmentRatio = double.MaxValue; // Not so important
            textStyle.FittingLineInScreen = true;
            textStyle.SuppressPartialLabels = true;
            textStyle.BestPlacement = true;




After applying new style. Text is fixed however I donot want the text to appear that many time!! any idea?

Regards,

Murshed





Hi Murshed, 
  
 Thanks for your share, but I did a quickly sample, and haven’t reproduced your problem, so I think maybe that’s not caused only by text style setting, maybe some other thing also works for it. 
  
 My test library is the latest 8.0.251.0. 
  
 please see my test code as below: 
  
  
private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            string wkt = “LINESTRING(-193232.32414293 2729712.32586722,799835.063224535 4300030.70687686)”;
            LineShape line = new LineShape(wkt);
            Feature feature = new Feature(line);
            feature.ColumnValues.Add(“label”, “Line My line reversed”);

            Map1.MapUnit = GeographyUnit.Meter;

            TextStyle textStyle = TextStyles.CreateSimpleTextStyle(
            “label”, “Arial”, 15, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, 0);
            textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 3);
            textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping;
            textStyle.SplineType = SplineType.StandardSplining;
            textStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels;
            textStyle.TextLineSegmentRatio = double.MaxValue; // Not so important
            textStyle.FittingLineInScreen = true;
            textStyle.SuppressPartialLabels = true;
            textStyle.BestPlacement = true;


            InMemoryFeatureLayer layer = new InMemoryFeatureLayer();
            layer.Open();
            layer.Columns.Add(new FeatureSourceColumn(“label”));

            layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Black, 1, true);
            layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = textStyle;
            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


            layer.InternalFeatures.Add(feature);

            LayerOverlay overlay = new LayerOverlay();
            overlay.Layers.Add(layer);

            Map1.Overlays.Add(overlay);


            Map1.CurrentExtent = layer.GetBoundingBox();

            Map1.Refresh();
        }
 
  
 Regards, 
  
 Don