private List <RasterData <StringRepresentation, string> > GetStringValues(SerializableReferenceLayer serializableReferenceLayer) { var values = serializableReferenceLayer.StringValues; if (values == null || !values.Any()) { return(null); } var rowCount = serializableReferenceLayer.ReferenceLayer.RowCount; var columnCount = serializableReferenceLayer.ReferenceLayer.ColumnCount; var data = new List <RasterData <StringRepresentation, string> >(); foreach (var value in values) { var list = new string[columnCount, rowCount]; for (int i = 0; i < columnCount; i++) { for (int j = 0; j < rowCount; j++) { list[i, j] = value.values[i * rowCount + j]; } } data.Add(new RasterData <StringRepresentation, string> { Values = list, Representation = value.Representation as StringRepresentation }); } return(data); }
public ReferenceLayer ConvertToReferenceLayer(SerializableReferenceLayer serializableReferenceLayer) { var convertToReferenceLayer = serializableReferenceLayer.ReferenceLayer; convertToReferenceLayer.StringRasterValues = GetStringValues(serializableReferenceLayer); convertToReferenceLayer.EnumeratedRasterValues = GetEnumeratedValues(serializableReferenceLayer); convertToReferenceLayer.NumericRasterValues = GetNumericValues(serializableReferenceLayer); return(convertToReferenceLayer); }