use of uk.ac.ed.ph.jqtiplus.node.content.xhtml.object.Object in project openolat by klemens.
the class AssessmentItemFactory method appendHotspotInteraction.
public static HotspotInteraction appendHotspotInteraction(ItemBody itemBody, Identifier responseDeclarationId, Identifier correctResponseId) {
HotspotInteraction hotspotInteraction = new HotspotInteraction(itemBody);
hotspotInteraction.setResponseIdentifier(responseDeclarationId);
hotspotInteraction.setMaxChoices(1);
itemBody.getBlocks().add(hotspotInteraction);
Object graphicObject = new Object(hotspotInteraction);
graphicObject.setType("image/png");
graphicObject.setWidth("400");
graphicObject.setHeight("320");
hotspotInteraction.setObject(graphicObject);
HotspotChoice choice = new HotspotChoice(hotspotInteraction);
choice.setIdentifier(correctResponseId);
choice.setFixed(Boolean.FALSE);
choice.setShape(Shape.CIRCLE);
List<Integer> coords = new ArrayList<>();
coords.add(new Integer(55));
coords.add(new Integer(77));
coords.add(new Integer(8));
choice.setCoords(coords);
hotspotInteraction.getHotspotChoices().add(choice);
return hotspotInteraction;
}
use of uk.ac.ed.ph.jqtiplus.node.content.xhtml.object.Object in project OpenOLAT by OpenOLAT.
the class HotspotAssessmentItemBuilder method setBackground.
public void setBackground(String data, String mimeType, int height, int width) {
Object graphichObject = hotspotInteraction.getObject();
if (graphichObject == null) {
graphichObject = new Object(hotspotInteraction);
hotspotInteraction.setObject(graphichObject);
}
graphichObject.setData(data);
graphichObject.setType(mimeType);
if (height > 0) {
graphichObject.setHeight(Integer.toString(height));
} else {
graphichObject.setHeight(null);
}
if (width > 0) {
graphichObject.setWidth(Integer.toString(width));
} else {
graphichObject.setWidth(null);
}
}
use of uk.ac.ed.ph.jqtiplus.node.content.xhtml.object.Object in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendHotspotInteraction.
public static HotspotInteraction appendHotspotInteraction(ItemBody itemBody, Identifier responseDeclarationId, Identifier correctResponseId) {
HotspotInteraction hotspotInteraction = new HotspotInteraction(itemBody);
hotspotInteraction.setResponseIdentifier(responseDeclarationId);
hotspotInteraction.setMaxChoices(1);
itemBody.getBlocks().add(hotspotInteraction);
Object graphicObject = new Object(hotspotInteraction);
graphicObject.setType("image/png");
graphicObject.setWidth("400");
graphicObject.setHeight("320");
hotspotInteraction.setObject(graphicObject);
HotspotChoice choice = new HotspotChoice(hotspotInteraction);
choice.setIdentifier(correctResponseId);
choice.setFixed(Boolean.FALSE);
choice.setShape(Shape.CIRCLE);
List<Integer> coords = new ArrayList<>();
coords.add(new Integer(55));
coords.add(new Integer(77));
coords.add(new Integer(8));
choice.setCoords(coords);
hotspotInteraction.getHotspotChoices().add(choice);
return hotspotInteraction;
}
use of uk.ac.ed.ph.jqtiplus.node.content.xhtml.object.Object in project openolat by klemens.
the class ImportExportHelper method getMaterials.
protected static void getMaterials(AssessmentItem item, File itemFile, AssessmentItemsAndResources materials) {
File directory = itemFile.getParentFile();
QueryUtils.search(Img.class, item).forEach((img) -> {
if (img.getSrc() != null) {
String imgPath = img.getSrc().toString();
File imgFile = new File(directory, imgPath);
if (imgFile.exists()) {
materials.addMaterial(new ItemMaterial(imgFile, imgPath));
}
}
});
QueryUtils.search(A.class, item).forEach((a) -> {
URI href = a.getHref();
if (href != null && href.getHost() == null && href.getPath() != null) {
String hrefPath = href.getPath();
File aFile = new File(directory, hrefPath);
if (aFile.exists()) {
materials.addMaterial(new ItemMaterial(aFile, hrefPath));
}
}
});
QueryUtils.search(Object.class, item).forEach((object) -> {
if (StringHelper.containsNonWhitespace(object.getData())) {
String path = object.getData();
File objectFile = new File(directory, path);
if (objectFile.exists()) {
materials.addMaterial(new ItemMaterial(objectFile, path));
}
}
});
}
use of uk.ac.ed.ph.jqtiplus.node.content.xhtml.object.Object in project openolat by klemens.
the class DrawingAssessmentItemBuilder method setBackground.
public void setBackground(String data, String mimeType, int height, int width) {
Object graphichObject = drawingInteraction.getObject();
if (graphichObject == null) {
graphichObject = new Object(drawingInteraction);
drawingInteraction.setObject(graphichObject);
}
graphichObject.setData(data);
graphichObject.setType(mimeType);
if (height > 0) {
graphichObject.setHeight(Integer.toString(height));
} else {
graphichObject.setHeight(null);
}
if (width > 0) {
graphichObject.setWidth(Integer.toString(width));
} else {
graphichObject.setWidth(null);
}
}
Aggregations