コード例 #1
0
ファイル: PdfMap.cs プロジェクト: ClaireBrill/GPV
    public LegendProperties(Configuration.PrintTemplateContentRow row)
    {
      OriginX = Convert.ToSingle(row.OriginX) * PointsPerInch;
      OriginY = Convert.ToSingle(row.OriginY) * PointsPerInch;
      Width = Convert.ToSingle(row.Width) * PointsPerInch;
      Height = Convert.ToSingle(row.Height) * PointsPerInch;

      string fontFamily = row.IsFontFamilyNull() ? "Helvetica" : row.FontFamily;
      FontSize = row.IsFontSizeNull() ? 12 : Convert.ToSingle(row.FontSize);

      if (!row.IsFontBoldNull() && row.FontBold == 1)
      {
        fontFamily += "-Bold";
      }

      BaseFont = BaseFont.CreateFont(fontFamily, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

      SwatchHeight = FontSize;
      SwatchWidth = FontSize * 1.4f;
      LayerSpacing = FontSize * 0.5f;
      ClassSpacing = FontSize * 0.15f;
      ColumnSpacing = FontSize * 1.4f;

      ColumnWidth = !row.IsLegendColumnWidthNull() ? Convert.ToSingle(row.LegendColumnWidth) * PointsPerInch :
          FontSize * 12 + SwatchWidth;

      NumColumns = Convert.ToInt32(Math.Floor((Width + ColumnSpacing) / (ColumnWidth + ColumnSpacing)));
    }