private static Dictionary <string, string> GetAnnotationColumns(BasAnnotation annotation) { Dictionary <string, string> annotationDict = new Dictionary <string, string>(); annotationDict.Add("TextString", annotation.TextString); annotationDict.Add("TextAngle", annotation.FontStyle.TextAngle.ToString()); annotationDict.Add("TextFont", annotation.FontStyle.TextFont.ToString()); annotationDict.Add("TextSize", annotation.FontStyle.TextSize.ToString()); return(annotationDict); }
private static void ReadAnnocation(BasFeatureEntity featureEntity, Collection <RecordAnnotation> annotations) { foreach (var item in annotations) { BasAnnotation basAnnotition = new BasAnnotation(); basAnnotition.TextString = item.Text; basAnnotition.Position = new PointShape(ConvertHelper.LatLonToVertex(item.TextLocationLonlat)); AnnotationFontStyle fontStyle = new AnnotationFontStyle(); fontStyle.TextAngle = ConvertHelper.TextAngleToAngle(item.TextAngle); fontStyle.TextSize = float.Parse(item.TextSize); fontStyle.TextFont = int.Parse(item.TextFont); basAnnotition.FontStyle = fontStyle; featureEntity.Annotations.Add(basAnnotition); } }
protected override Collection <Feature> GetFeaturesByIdsCore(IEnumerable <string> ids, IEnumerable <string> returningColumnNames) { Collection <Feature> featuresToDraw = new Collection <Feature>(); annotationFeatures.Clear(); foreach (string id in ids) { long offset; if (id.IndexOf('_') < 0 && long.TryParse(id, out offset)) { // TODO: Add column logic //Swallow the exception to avoid pink tiles. //If a shape is not valid, the we don't add it to the results. try { BasFeatureEntity basFeature; if (!cachedBasFeatureEntities.ContainsKey(id)) { basFeature = basReader.GetFeatureEntityByOffset(offset); PushToCache(basFeature); } else { basFeature = cachedBasFeatureEntities[id]; } Dictionary <string, string> dict = new Dictionary <string, string>(); foreach (var col in basFeature.Columns) { if (returningColumnNames.Contains(col.Key)) { dict.Add(col.Key, col.Value); } } Feature feature = new Feature(basFeature.Shape.GetWellKnownBinary(), id, dict); feature.Id = id; featuresToDraw.Add(feature); foreach (var annotation in basFeature.Annotations) { Dictionary <string, string> annotationDict = GetAnnotationColumns(annotation); Feature annotationFeature = new Feature(annotation.Position, annotationDict); annotationFeatures.Add(annotationFeature); } } catch (Exception) { } } else { string[] annotationIds = id.Split('_'); if (annotationIds.Length == 2) { long parentOffset = long.Parse(annotationIds[0]); BasFeatureEntity basFeature; if (!cachedBasFeatureEntities.ContainsKey(annotationIds[0])) { basFeature = basReader.GetFeatureEntityByOffset(parentOffset); } else { basFeature = cachedBasFeatureEntities[id]; } int currentAnnotationIndex = int.Parse(annotationIds[1]); if (currentAnnotationIndex < basFeature.Annotations.Count) { BasAnnotation currentAnnotation = basFeature.Annotations[currentAnnotationIndex]; Dictionary <string, string> annotationDict = GetAnnotationColumns(currentAnnotation); Feature annotationFeature = new Feature(currentAnnotation.Position, annotationDict); annotationFeature.Id = id; annotationFeatures.Add(annotationFeature); } } } } foreach (var item in annotationFeatures) { featuresToDraw.Add(item); } return(featuresToDraw); }