ASF Bugzilla – Attachment 19947 Details for
Bug 41995
[PATCH] Barcode Support for AFP Renderer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Fix to change setters from int to double
BarcodeSymbologies.java (text/plain), 4.68 KB, created by
Pete Townsend
on 2007-04-13 05:02:50 UTC
(
hide
)
Description:
Fix to change setters from int to double
Filename:
MIME Type:
Creator:
Pete Townsend
Created:
2007-04-13 05:02:50 UTC
Size:
4.68 KB
patch
obsolete
>/* > * Licensed to the Apache Software Foundation (ASF) under one or more > * contributor license agreements. See the NOTICE file distributed with > * this work for additional information regarding copyright ownership. > * The ASF licenses this file to You under the Apache License, Version 2.0 > * (the "License"); you may not use this file except in compliance with > * the License. You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. > */ > >/* $Id: $ */ > >package org.apache.fop.render.afp.bcoca; > >import org.apache.fop.util.UnitConv; > >public abstract class BarcodeSymbologies { > > /** > * AFP factor for a 1440 resolution (default used for barcodes) > */ > private static final int DPI_CONVERSION_FACTOR = 50; > > /** > * the height in afp units > */ > private int height = 0; > > /** > * the width in afp units > */ > private int width = 0; > > /** > * the xoffset in afp units > */ > private int xOffset = 0; > > /** > * the yoffset in afp units > */ > private int yOffset = 0; > > /** > * the module width in thousandths of an inch > */ > private int moduleWidth = 0; > > /** > * Flag to surpress the output of the barcode symbol > */ > private boolean symbolSupressed = false; > > /** > * @return the module width in thousandths of an inch > */ > public int getModuleWidth() { > return moduleWidth; > } > > /** > * Setter for the module width > * @param moduleWidth > */ > public void setModuleWidth(double units, String uom) { > > if ("mm".equals(uom)) { > moduleWidth = (int)Math.round((units / 25.4f) * 1000); > } else if ("in".equals(uom)) { > moduleWidth = (int)Math.round(units * 1000); > } else { > throw new UnsupportedOperationException("Cannot convert the unit of measurement " + uom + " to thousandths of an inch."); > } > > } > > /** > * @return the height in afp units > */ > public int getHeight() { > return height; > } > > /** > * Setter for the height > * @param units > * @param uom > */ > public void setHeight(double units, String uom) { > height = units2afp(units, uom); > } > > public int getWidth() { > return width; > } > > /** > * Setter for the width > * @param units > * @param uom > */ > public void setWidth(double units, String uom) { > width = units2afp(units, uom); > } > > /** > * @return the xOffset > */ > public int getXOffset() { > return xOffset; > } > > /** > * Setter for the xOffset > * @param units > * @param uom > */ > public void setXOffset(double units, String uom) { > xOffset = units2afp(units, uom); > } > > /** > * @return the yOffset > */ > public int getYOffset() { > return yOffset; > } > > /** > * Setter for the yOffset > * @param units > * @param uom > */ > public void setYOffset(double units, String uom) { > yOffset = units2afp(units, uom); > } > > /** > * Converts FOP measurement units to afp measurement units > * @param units the measurement > * @param uom the unit of measurement > */ > protected int units2afp(double units, String uom) { > > double mpt = 0; > if ("mm".equals(uom)) { > mpt = UnitConv.mm2mpt(units); > } else if ("in".equals(uom)) { > mpt = UnitConv.in2mpt(units); > } else { > throw new UnsupportedOperationException("Cannot convert the unit of measurement " + uom + " to afo units."); > } > > return (int)Math.round(mpt / DPI_CONVERSION_FACTOR); > > } > > /** > * @return the bcoca code to represent the barcode type > */ > public abstract byte getBarCodeType(); > > /** > * @return the encoding to use for the barcode > */ > public abstract String getDataEncoding(); > > /** > * @return the bcoca special function flags > */ > public abstract byte[] getSpecialFunctions(); > > /** > * @return the bcoca modifier flags > */ > public abstract byte getBarCodeModifier(); > > /** > * The mpts to units factor identified the afp units resolution. > * @return the conversion factor for mpts to afp units. > */ > public int getMpts2unitsFactor() { > return DPI_CONVERSION_FACTOR; > } > > /** > * @return true if the barcode symbol should be supressed > */ > public boolean isSymbolSupressed() { > return symbolSupressed; > } > > /** > * Setter for the symbolSupressed attribute > * @param symbolSupressed > */ > public void setSymbolSupressed(boolean symbolSupressed) { > this.symbolSupressed = symbolSupressed; > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 41995
:
19849
|
19850
|
19929
|
19930
| 19947