place() public method

public place ( ) : void
return void
      public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, IDictionary<EncodeHintType, object> hints)
      {
         if (String.IsNullOrEmpty(contents))
         {
            throw new ArgumentException("Found empty contents", contents);
         }

         if (format != BarcodeFormat.DATA_MATRIX)
         {
            throw new ArgumentException("Can only encode DATA_MATRIX, but got " + format);
         }

         if (width < 0 || height < 0)
         {
            throw new ArgumentException("Requested dimensions are too small: " + width + 'x' + height);
         }

         // Try to get force shape & min / max size
         var shape = SymbolShapeHint.FORCE_NONE;
         var defaultEncodation = Encodation.ASCII;
         Dimension minSize = null;
         Dimension maxSize = null;
         if (hints != null)
         {
            if (hints.ContainsKey(EncodeHintType.DATA_MATRIX_SHAPE))
            {
               var requestedShape = hints[EncodeHintType.DATA_MATRIX_SHAPE];
               if (requestedShape is SymbolShapeHint)
               {
                  shape = (SymbolShapeHint)requestedShape;
               }
               else
               {
                  SymbolShapeHint requestedShapeEnum;
                  if (Enum.TryParse(requestedShape.ToString(), out requestedShapeEnum))
                     shape = requestedShapeEnum;
               }
            }
            var requestedMinSize = hints.ContainsKey(EncodeHintType.MIN_SIZE) ? hints[EncodeHintType.MIN_SIZE] as Dimension : null;
            if (requestedMinSize != null)
            {
               minSize = requestedMinSize;
            }
            var requestedMaxSize = hints.ContainsKey(EncodeHintType.MAX_SIZE) ? hints[EncodeHintType.MAX_SIZE] as Dimension : null;
            if (requestedMaxSize != null)
            {
               maxSize = requestedMaxSize;
            }
            if (hints.ContainsKey(EncodeHintType.DATA_MATRIX_DEFAULT_ENCODATION))
            {
               var requestedDefaultEncodation = hints[EncodeHintType.DATA_MATRIX_DEFAULT_ENCODATION];
               if (requestedDefaultEncodation != null)
               {
                  defaultEncodation = Convert.ToInt32(requestedDefaultEncodation.ToString());
               }
            }
         }


         //1. step: Data encodation
         String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize, defaultEncodation);

         SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.Length, shape, minSize, maxSize, true);

         //2. step: ECC generation
         String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);

         //3. step: Module placement in Matrix
         var placement =
             new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
         placement.place();

         //4. step: low-level encoding
         return encodeLowLevel(placement, symbolInfo);
      }