use of com.ramussoft.pb.print.PIDEF0painter in project ramus by Vitaliy-Yakovchuk.
the class AbstractTemplate method createPainter.
private void createPainter(final Rectangle rectangle) {
painter = new PIDEF0painter(base, rectangle.getSize(), dataPlugin);
rect = rectangle;
refresh = false;
}
use of com.ramussoft.pb.print.PIDEF0painter in project ramus by Vitaliy-Yakovchuk.
the class HTMLHelper method getDiagramPicture.
public byte[] getDiagramPicture(final String id) {
final Row r = dataPlugin.findRowByGlobalId(GlobalId.convert(id));
if (r instanceof Function) {
final Function f = (Function) r;
final PIDEF0painter painter = new PIDEF0painter(f, new Dimension(IMAGE_WIDTH, IMAGE_HEIGHT), dataPlugin);
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
try {
painter.writeToStream(stream, PIDEF0painter.PNG_FORMAT);
} catch (final IOException e) {
e.printStackTrace();
}
return stream.toByteArray();
}
return new byte[] {};
}
use of com.ramussoft.pb.print.PIDEF0painter in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method outFunctionModel.
private void outFunctionModel(final int format) throws IOException {
Row row = loadRowById();
if (row == null || !(row instanceof Function))
return;
row = replaceIDEF0Row(row);
final Function f = (Function) row;
int imageWidth = IMAGE_WIDTH;
String s = (String) params.get("w");
if (s != null) {
try {
imageWidth = new Integer(s).intValue();
if (imageWidth > 2000)
imageWidth = 2000;
} catch (final Exception e) {
}
}
int imageHeight = IMAGE_HEIGHT;
s = (String) params.get("h");
if (s != null) {
try {
imageHeight = new Integer(s).intValue();
if (imageHeight > 1600)
imageHeight = 1600;
} catch (final Exception e) {
}
}
final PIDEF0painter painter = new PIDEF0painter(f, new Dimension(imageWidth, imageHeight), dataPlugin);
painter.writeToStream(stream, format);
}
use of com.ramussoft.pb.print.PIDEF0painter in project ramus by Vitaliy-Yakovchuk.
the class ExportToImagesDialog method exportToFile.
protected void exportToFile(File dir, Function f, String prefix) throws FileNotFoundException, IOException {
String size = null;
switch(imageSizeComboBox.getSelectedIndex()) {
case 0:
size = "800x535";
break;
case 1:
size = "905x700";
break;
case 2:
size = "1024x768";
break;
case 3:
size = "1152x864";
break;
case 4:
size = "1300x1000";
break;
case 5:
size = "1601x1200";
break;
}
StringTokenizer st = new StringTokenizer(size, "x");
int width = Integer.valueOf(st.nextToken());
int height = Integer.valueOf(st.nextToken());
PIDEF0painter painter = new PIDEF0painter(f, new Dimension(width, height), dataPlugin);
File file = new File(dir, prefix + MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) f) + imageTypeComboBox.getSelectedItem().toString());
FileOutputStream stream = new FileOutputStream(file);
painter.writeToStream(stream, imageTypeComboBox.getSelectedIndex());
stream.close();
}
Aggregations