* @param dataObjectInfo a data object info
*
* @return a new include object
*/
public IncludeObject createInclude(String includeName, AFPDataObjectInfo dataObjectInfo) {
IncludeObject includeObj = factory.createInclude(includeName);
if (dataObjectInfo instanceof AFPImageObjectInfo) {
// IOCA image object
includeObj.setObjectType(IncludeObject.TYPE_IMAGE);
} else if (dataObjectInfo instanceof AFPGraphicsObjectInfo) {
// graphics object
includeObj.setObjectType(IncludeObject.TYPE_GRAPHIC);
} else {
// object container
includeObj.setObjectType(IncludeObject.TYPE_OTHER);
// set mandatory object classification (type other)
Registry.ObjectType objectType = dataObjectInfo.getObjectType();
if (objectType != null) {
// set object classification
final boolean dataInContainer = true;
final boolean containerHasOEG = false; // environment parameters set in include
final boolean dataInOCD = true;
includeObj.setObjectClassification(
// object scope not defined
ObjectClassificationTriplet.CLASS_TIME_VARIANT_PRESENTATION_OBJECT,
objectType, dataInContainer, containerHasOEG, dataInOCD);
} else {
throw new IllegalStateException(
"Failed to set Object Classification Triplet on Object Container.");
}
}
AFPObjectAreaInfo objectAreaInfo = dataObjectInfo.getObjectAreaInfo();
int xOffset = objectAreaInfo.getX();
int yOffset = objectAreaInfo.getY();
includeObj.setObjectAreaOffset(xOffset, yOffset);
int width = objectAreaInfo.getWidth();
int height = objectAreaInfo.getHeight();
includeObj.setObjectAreaSize(width, height);
int rotation = objectAreaInfo.getRotation();
includeObj.setObjectAreaOrientation(rotation);
int widthRes = objectAreaInfo.getWidthRes();
int heightRes = objectAreaInfo.getHeightRes();
includeObj.setMeasurementUnits(widthRes, heightRes);
includeObj.setMappingOption(MappingOptionTriplet.SCALE_TO_FIT);
return includeObj;
}