2013-12-10 19:36:50 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
2019-01-16 18:34:41 +00:00
|
|
|
* (C) Copyright 2009-2020, Arnaud Roques
|
2013-12-10 19:36:50 +00:00
|
|
|
*
|
2016-03-06 16:47:34 +00:00
|
|
|
* Project Info: http://plantuml.com
|
2013-12-10 19:36:50 +00:00
|
|
|
*
|
2017-03-15 19:13:31 +00:00
|
|
|
* If you like this project or if you find it useful, you can support us at:
|
|
|
|
*
|
|
|
|
* http://plantuml.com/patreon (only 1$ per month!)
|
|
|
|
* http://plantuml.com/paypal
|
|
|
|
*
|
2013-12-10 19:36:50 +00:00
|
|
|
* This file is part of PlantUML.
|
|
|
|
*
|
|
|
|
* PlantUML is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PlantUML distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
|
|
* License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Original Author: Arnaud Roques
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package net.sourceforge.plantuml.donors;
|
|
|
|
|
2016-12-01 20:29:25 +00:00
|
|
|
import java.awt.geom.Dimension2D;
|
2013-12-10 19:36:50 +00:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.ArrayList;
|
2016-12-01 20:29:25 +00:00
|
|
|
import java.util.Arrays;
|
2013-12-10 19:36:50 +00:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.StringTokenizer;
|
|
|
|
|
2017-06-05 11:27:21 +00:00
|
|
|
import net.sourceforge.plantuml.BackSlash;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.FileFormatOption;
|
2021-03-23 09:40:50 +00:00
|
|
|
import net.sourceforge.plantuml.PlainDiagram;
|
2018-05-01 17:26:04 +00:00
|
|
|
import net.sourceforge.plantuml.code.AsciiEncoder;
|
2017-12-11 21:02:10 +00:00
|
|
|
import net.sourceforge.plantuml.code.CompressionBrotli;
|
2020-05-07 14:12:08 +00:00
|
|
|
import net.sourceforge.plantuml.code.NoPlantumlCompressionException;
|
2018-05-06 19:59:19 +00:00
|
|
|
import net.sourceforge.plantuml.code.StringCompressorNone;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.code.Transcoder;
|
|
|
|
import net.sourceforge.plantuml.code.TranscoderImpl;
|
|
|
|
import net.sourceforge.plantuml.core.DiagramDescription;
|
|
|
|
import net.sourceforge.plantuml.graphic.GraphicStrings;
|
2016-12-01 20:29:25 +00:00
|
|
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
|
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
|
|
|
import net.sourceforge.plantuml.graphic.UDrawable;
|
2016-11-18 21:12:09 +00:00
|
|
|
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
2020-06-07 10:03:18 +00:00
|
|
|
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
2016-12-01 20:29:25 +00:00
|
|
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.UImage;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.version.PSystemVersion;
|
|
|
|
|
2021-03-23 09:40:50 +00:00
|
|
|
public class PSystemDonors extends PlainDiagram {
|
2019-02-09 21:56:24 +00:00
|
|
|
|
|
|
|
private static final int COLS = 6;
|
|
|
|
private static final int FREE_LINES = 6;
|
2019-05-24 19:59:31 +00:00
|
|
|
|
2021-05-09 21:14:40 +00:00
|
|
|
public static final String DONORS = "6wOD0AmFjCllA6nYeh4EstErPvQF9MScYM1vdb2SMCJfBY3-0FTEZ_kDz1VHbTtxfXbHwxL9EOEeFWXw"
|
|
|
|
+ "mBlRGljG-byVX3bBNWHtfWGNa0AYEBf4VgGRsKwVL1bIWcUfwEzlcRYztJekL2Q9lX7AWU9-EMJWRVfi"
|
|
|
|
+ "dft6eD4BL1_-zf1sN_s_gRDrUIY4MRfRWH4O5OrmN5ycSw__erfKE0KxXnfs-Z6Tkg0w7AfLYSssDqMq"
|
|
|
|
+ "akQEMQ6-dOzQJIwAaLAa-6iZ3RyOJ6ZCoUoJv9T-qVYbRiA7rkeQOjm1n3bJEhfkw-ryF8Zb5qby2F84"
|
|
|
|
+ "Nr2im1n8ET8lejcvwK73mu6XVXVLsDB2FKzI894DBUJDFugaq7k8iylWfk5L0GA_Tr21P0ngr8Ip0tS3"
|
|
|
|
+ "Akd15fqQkEfYVs5fMOVbAJsJXgSH2oyBQW4r14aCUa5dz9LRfkvvA1m9UKhYEMqLwi-2Tz0s5_IDBIK1"
|
|
|
|
+ "wslxgLcIF-AKhOSq7RdF-LTd1xnhoChLRyOSaPoWAIzpGPblBL0_0Zqq9so9xrNkBCGXr4VgfW-TQmwr"
|
|
|
|
+ "Yd12BYaLw-Hbjhsc_w4hPx914PuE5laz-UjYKnnieQibDS0RMYKqwtm2IGtrzvSyNZhV1TUKIDmR4Mr4"
|
|
|
|
+ "TWtHVp-tD3CK1-ZWDBEXcoPO1gkqwYYs888zGiS7t2Ga1-5ycbpsf-MNw2q_0V1c4a5ts0WqWT-_k3Ba"
|
|
|
|
+ "o8KqaAbhqrm0R3sjr8k6poCCAdG8kXLLmkbjxleP9erjo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"
|
|
|
|
+ "slTxRh8uK3ZHsE32KdEZXqazMkPJxRXfivuCAf6xL4pq2BERbgZo4rrFgiiXKxTUKBCajAux4tJosnRa" + "qhLppmip9EnB2W00";
|
2015-04-07 18:18:37 +00:00
|
|
|
|
2019-08-26 17:07:21 +00:00
|
|
|
/*
|
|
|
|
* Special thanks to our sponsors and donors:
|
|
|
|
*
|
2019-09-14 18:12:04 +00:00
|
|
|
* - Noam Tamim
|
2019-08-26 17:07:21 +00:00
|
|
|
*/
|
|
|
|
|
2016-12-01 20:29:25 +00:00
|
|
|
@Override
|
2021-03-23 09:40:50 +00:00
|
|
|
protected UDrawable getRootDrawable(FileFormatOption fileFormatOption) throws IOException {
|
2019-02-09 21:56:24 +00:00
|
|
|
final List<TextBlock> cols = getCols(getDonors(), COLS, FREE_LINES);
|
2016-12-01 20:29:25 +00:00
|
|
|
return new UDrawable() {
|
|
|
|
public void drawU(UGraphic ug) {
|
2020-02-18 21:24:31 +00:00
|
|
|
final TextBlockBackcolored header = GraphicStrings
|
|
|
|
.createBlackOnWhite(Arrays.asList("<b>Special thanks to our sponsors and donors !"));
|
2016-12-01 20:29:25 +00:00
|
|
|
header.drawU(ug);
|
|
|
|
final StringBounder stringBounder = ug.getStringBounder();
|
2020-03-18 10:50:02 +00:00
|
|
|
ug = ug.apply(UTranslate.dy(header.calculateDimension(stringBounder).getHeight()));
|
2016-12-01 20:29:25 +00:00
|
|
|
double x = 0;
|
|
|
|
double lastX = 0;
|
|
|
|
double y = 0;
|
|
|
|
for (TextBlock tb : cols) {
|
|
|
|
final Dimension2D dim = tb.calculateDimension(stringBounder);
|
2020-03-18 10:50:02 +00:00
|
|
|
tb.drawU(ug.apply(UTranslate.dx(x)));
|
2016-12-01 20:29:25 +00:00
|
|
|
lastX = x;
|
|
|
|
x += dim.getWidth() + 10;
|
|
|
|
y = Math.max(y, dim.getHeight());
|
|
|
|
}
|
2020-06-07 10:03:18 +00:00
|
|
|
final UImage logo = new UImage(
|
|
|
|
new PixelImage(PSystemVersion.getPlantumlImage(), AffineTransformType.TYPE_BILINEAR));
|
2016-12-01 20:29:25 +00:00
|
|
|
ug.apply(new UTranslate(lastX, y - logo.getHeight())).draw(logo);
|
2015-04-07 18:18:37 +00:00
|
|
|
}
|
2016-12-01 20:29:25 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public static List<TextBlock> getCols(List<String> lines, final int nbCol, final int reserved) throws IOException {
|
2021-05-14 08:42:57 +00:00
|
|
|
final List<TextBlock> result = new ArrayList<>();
|
2016-12-01 20:29:25 +00:00
|
|
|
final int maxLine = (lines.size() + (nbCol - 1) + reserved) / nbCol;
|
|
|
|
for (int i = 0; i < lines.size(); i += maxLine) {
|
|
|
|
final List<String> current = lines.subList(i, Math.min(lines.size(), i + maxLine));
|
|
|
|
result.add(GraphicStrings.createBlackOnWhite(current));
|
2015-04-07 18:18:37 +00:00
|
|
|
}
|
2016-12-01 20:29:25 +00:00
|
|
|
return result;
|
2015-04-07 18:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private List<String> getDonors() throws IOException {
|
2021-05-14 08:42:57 +00:00
|
|
|
final List<String> lines = new ArrayList<>();
|
2020-05-07 14:12:08 +00:00
|
|
|
final Transcoder t = TranscoderImpl.utf8(new AsciiEncoder(), new StringCompressorNone(),
|
2020-02-18 21:24:31 +00:00
|
|
|
new CompressionBrotli());
|
2020-05-07 14:12:08 +00:00
|
|
|
try {
|
|
|
|
final String s = t.decode(DONORS).replace('*', '.');
|
|
|
|
final StringTokenizer st = new StringTokenizer(s, BackSlash.NEWLINE);
|
|
|
|
while (st.hasMoreTokens()) {
|
|
|
|
lines.add(st.nextToken());
|
|
|
|
}
|
|
|
|
} catch (NoPlantumlCompressionException e) {
|
|
|
|
e.printStackTrace();
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
2015-04-07 18:18:37 +00:00
|
|
|
return lines;
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public DiagramDescription getDescription() {
|
2017-03-12 17:22:02 +00:00
|
|
|
return new DiagramDescription("(Donors)");
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static PSystemDonors create() {
|
|
|
|
return new PSystemDonors();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|