|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ImageProperties
This interface collects the properties of visual tag image that are common to all symbologies. It also provides an extension mechanism to manage varying properties of different symbologies. These properties are used in visual tag image generation.
The quiet zone required around the visual tag image to make it readable from the surrounding data is included into the height and width specified for the visual tag image. This means that the API implementation must make sure that the generated image with the quiet zone fits into the given image dimensions.
The API implementation must create a symbology
specific class for each symbology that it supports. This symbology specific class
must implement this interface. These new classes
collect all properties specific to a particular symbology. The symbology specific
classes must define key names for the new properties
as integer constants. The naming convention for the extended keys is that the name
must start with the symbology name, like for example
CODE-39_X_DIMENSION
. The API implementation must
provide default values for all the properties and specify what is the object
the property is represented in. The methods in this interface can be used to
change those default values and to get the values of the symbology specific
properties.
As this specification does not specify any extended properties for the different
symbologies these properties are implementation dependent. This means that
the application developer should always use the
default values retrieved with
SymbologyManager.getImageProperties(symbology)
method. Changing the default values is possible, but it makes the application
dependant on the specific API implementation.
Following list describes the tasks the symbology-specific property class must handle:
String
,
integer, double, etc.)Below is an example of the properties class for Code 39 symbology. It provides four new properties for Code 39 symbology.
public class Code39Properties implements ImageProperties { private String symbology; private double resolution; private double width; private double height; private int sizeUnit; private int logicalSizeUnit; public final static int CODE-39_X_DIMENSION = 51; // double public final static int CODE-39_WIDE_TO_NARROW = 52; // double public final static int CODE-39_INTERCHARACTER_GAP = 53; // double public final static int CODE-39_CHECK_CHARACTER = 54; // boolean public Code39Properties() { this.symbology = "code-39"; this.resolution = 72.0; this.width = 100.0; this.height = 20.0; this.sizeUnit = ImageProperties.PHYSICAL_SIZE_UNIT_PIXEL; this.logicalUnitSize = 1; // set Code 39 related properties setProperty(CODE-39_X_DIMENSION, new Double(20.0)); setProperty(CODE-39_WIDE_TO_NARROW, new Double(2.2)); setProperty(CODE-39_INTERCHARACTER_GAP, new Double(3)); setProperty(CODE-39_CHECK_CHARACTER, new Boolean(true)); } // Implements the methods from the ImageProperties ... }
Field Summary | |
---|---|
static int |
PHYSICAL_SIZE_UNIT_INCH
Constant for inches as physical size unit. |
static int |
PHYSICAL_SIZE_UNIT_MILLIMETER
Constant for millimeters as physical size unit. |
static int |
PHYSICAL_SIZE_UNIT_PIXEL
Constant for pixels as physical size unit. |
Method Summary | |
---|---|
int |
getLogicalUnitSize()
Returns the size of a single unit used in the symbology in pixels. |
double |
getPhysicalHeigth()
Returns the maximum height of the visual tag image. |
int |
getPhysicalSizeUnit()
Returns the unit for the physical dimensions. |
double |
getPhysicalWidth()
Returns the maximum width of the visual tag image. |
java.lang.Object |
getProperty(int key)
Returns the value of the requested property as an object . |
int[] |
getPropertyKeys()
Returns the list of the property keys. |
double |
getResolution()
Returns the resolution of the visual tag image. |
java.lang.String |
getSymbology()
Returns the symbology of the visual tag image. |
void |
setLogicalUnitSize(int size)
Sets the size of the single unit used in the symbology in pixels. |
void |
setPhysicalHeight(double height)
Sets the maximum height for the visual tag image. |
void |
setPhysicalSizeUnit(int sizeUnit)
Sets the unit for the physical dimensions. |
void |
setPhysicalWidth(double width)
Sets the maximum width for the visual tag image. |
void |
setProperty(int key,
java.lang.Object value)
Sets the property for specified key. |
void |
setResolution(double resolution)
Sets the resolution for the visual tag image. |
void |
setSymbology(java.lang.String symbology)
Sets the symbology for the visual tag image. |
Field Detail |
---|
static final int PHYSICAL_SIZE_UNIT_INCH
Constant for inches as physical size unit.
static final int PHYSICAL_SIZE_UNIT_MILLIMETER
Constant for millimeters as physical size unit.
static final int PHYSICAL_SIZE_UNIT_PIXEL
Constant for pixels as physical size unit.
Method Detail |
---|
int getLogicalUnitSize()
Returns the size of a single unit used in the symbology in pixels. This unit can be, for example, the width of a module in data-matrix or the width of a narrow bar in code-39 symbology. The default value of this property is 1 pixel.
double getPhysicalHeigth()
Returns the maximum height of the visual tag image. The height is
represented in the unit specified by the
ImagePropertyes.getPhysicalSizeUnit()
method.
int getPhysicalSizeUnit()
Returns the unit for the physical dimensions. This parameter is represented as integer, where only valid values are the constants defined in this class.
double getPhysicalWidth()
Returns the maximum width of the visual tag image. The width is represented
in the unit specified by the
ImagePropertyes.getPhysicalSizeUnit()
method.
java.lang.Object getProperty(int key)
Returns the value of the requested property as an object
.
Returned value is either the default value set by the implementation
or the value modified by the application.
key
- the identifier of the property
null
if the key
is not
definedint[] getPropertyKeys()
Returns the list of the property keys. Since each property
must have a default value, this method returns
the keys for all extended properties. The actual property value can be
retrieved with method
ImageProperties.getProperty(int key)
.
double getResolution()
Returns the resolution of the visual tag image. The resolution means the number of dots (in printing) or pixels (on screen) per physical unit. With this the dots or pixels can be converted to physical size and vice versa.
java.lang.String getSymbology()
Returns the symbology of the visual tag image.
void setLogicalUnitSize(int size)
Sets the size of the single unit used in the symbology in pixels. This unit can be, for example, the width of a module in data-matrix or the width of a narrow bar in code-39 symbology. Value must be greater than zero.
size
- the size of the logical unit in pixels
java.lang.IllegalArgumentException
- if size
is less
or equal to zerovoid setPhysicalHeight(double height)
Sets the maximum height for the visual tag image. This is the maximum height of the visual tag image that the application is able to handle.
height
- the maximum height
java.lang.IllegalArgumentException
- if height
is
less or equal to zerovoid setPhysicalSizeUnit(int sizeUnit)
Sets the unit for the physical dimensions. This parameter is represented as integer, where only valid values are the constants defined in this class.
sizeUnit
- unit of the physical size
java.lang.IllegalArgumentException
- if sizeUnit
is not
one of the constants defined in this classvoid setPhysicalWidth(double width)
Sets the maximum width for the visual tag image. This is the maximum width of the visual tag image that the application is able to handle.
width
- the maximum width
java.lang.IllegalArgumentException
- if width
is
less or equal to zerovoid setProperty(int key, java.lang.Object value)
Sets the property for specified key.
key
- the key identifier of the propertyvalue
- the value of the property
java.lang.IllegalArgumentException
- if key is not one of the constants
defined in the class implementing this interface or the
value
cannot be converted into the type
of the property
java.lang.NullPointerException
- if value is null
void setResolution(double resolution)
Sets the resolution for the visual tag image.
resolution
- the image resolution
java.lang.IllegalArgumentException
- if resolution
is
less or equal to zerovoid setSymbology(java.lang.String symbology)
Sets the symbology for the visual tag image.
symbology
- the name of the symbology
java.lang.NullPointerException
- if symbology
is
null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |