Пример #1
0
 public static Annotations FromProtoAnnotations(SkylineDocumentProto.Types.Annotations protoAnnotations)
 {
     if (protoAnnotations == null)
     {
         return(EMPTY);
     }
     return(new Annotations(protoAnnotations.Note, protoAnnotations.Values
                            .Select(value => new KeyValuePair <string, string>(
                                        value.Name,
                                        value.TextValue)),
                            protoAnnotations.Color));
 }
Пример #2
0
 public static Annotations FromProtoAnnotations(StringPool stringPool, SkylineDocumentProto.Types.Annotations protoAnnotations)
 {
     Assume.IsNotNull(stringPool);
     if (protoAnnotations == null)
     {
         return(EMPTY);
     }
     return(new Annotations(protoAnnotations.Note, protoAnnotations.Values
                            .Select(value => new KeyValuePair <string, string>(
                                        stringPool.GetString(value.Name),
                                        stringPool.GetString(value.TextValue))),
                            protoAnnotations.Color));
 }
Пример #3
0
 public SkylineDocumentProto.Types.Annotations ToProtoAnnotations()
 {
     if (IsEmpty)
     {
         return(null);
     }
     SkylineDocumentProto.Types.Annotations protoAnnotations = new SkylineDocumentProto.Types.Annotations
     {
         Note  = Note ?? string.Empty,
         Color = ColorIndex
     };
     if (_annotations != null)
     {
         foreach (var annotation in _annotations)
         {
             protoAnnotations.Values.Add(new SkylineDocumentProto.Types.AnnotationValue()
             {
                 Name      = annotation.Key,
                 TextValue = annotation.Value
             });
         }
     }
     return(protoAnnotations);
 }