1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-05-28 14:10:48 +00:00
This commit is contained in:
Arnaud Roques 2022-09-20 22:35:41 +02:00
parent 06afc26207
commit 9bdc69ecee
94 changed files with 365 additions and 397 deletions

View File

@ -477,7 +477,7 @@ root {
HyperLinkColor blue HyperLinkColor blue
FontColor white FontColor white
LineColor #e7e7e7 LineColor #e7e7e7
BackGroundColor #070707 BackGroundColor #303030
} }
document { document {
@ -537,6 +537,11 @@ sequenceDiagram {
LineColor white LineColor white
BackGroundColor #1 BackGroundColor #1
} }
participant,actor,boundary,control,entity,queue,database,collections {
BackgroundColor: #2;
HorizontalAlignment center
}
} }
@ -570,7 +575,7 @@ swimlane {
} }
note { note {
BackGroundColor #3 BackGroundColor #714137
} }
@ -632,6 +637,9 @@ timingDiagram {
ganttDiagram { ganttDiagram {
task {
BackGroundColor #555
}
timeline { timeline {
LineColor #3f3f3f LineColor #3f3f3f
} }
@ -653,9 +661,12 @@ yamlDiagram,jsonDiagram {
BackGroundColor #ccff02 BackGroundColor #ccff02
} }
} }
}
nwdiagDiagram { nwdiagDiagram {
network {
BackGroundColor #555
}
group { group {
BackGroundColor #2 BackGroundColor #2
} }

View File

@ -56,6 +56,7 @@ import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.stats.StatsUtilsIncrement; import net.sourceforge.plantuml.stats.StatsUtilsIncrement;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.version.License; import net.sourceforge.plantuml.version.License;
import net.sourceforge.plantuml.version.Version; import net.sourceforge.plantuml.version.Version;
@ -193,7 +194,13 @@ public abstract class AbstractPSystem implements Diagram {
} }
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return imageBuilder(fileFormatOption); final ColorMapper init = fileFormatOption.getColorMapper();
final ColorMapper newColorMappter = muteColorMapper(init);
return imageBuilder(fileFormatOption.withColorMapper(newColorMappter));
}
protected ColorMapper muteColorMapper(ColorMapper init) {
return init;
} }
// TODO "index" isnt really being used // TODO "index" isnt really being used
@ -203,7 +210,7 @@ public abstract class AbstractPSystem implements Diagram {
public ClockwiseTopRightBottomLeft getDefaultMargins() { public ClockwiseTopRightBottomLeft getDefaultMargins() {
return ClockwiseTopRightBottomLeft.same(0); return ClockwiseTopRightBottomLeft.same(0);
} }
@Override @Override
public Display getTitleDisplay() { public Display getTitleDisplay() {
return null; return null;

View File

@ -175,8 +175,10 @@ public class BlockUml {
if (system == null) { if (system == null) {
if (preprocessorError) if (preprocessorError)
system = new PSystemErrorPreprocessor(data, debug); system = new PSystemErrorPreprocessor(data, debug);
else else {
system = new PSystemBuilder().createPSystem(skinParam, data, rawSource); system = new PSystemBuilder().createPSystem(data, rawSource,
skinParam == null ? Collections.<String, String>emptyMap() : skinParam.values());
}
} }
return system; return system;
} }

View File

@ -85,8 +85,8 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
this(config, charset, defines, reader, null, null); this(config, charset, defines, reader, null, null);
} }
public BlockUmlBuilder(List<String> config, Charset charset, Defines defines, Reader readerInit, SFile newCurrentDir, public BlockUmlBuilder(List<String> config, Charset charset, Defines defines, Reader readerInit,
String desc) throws IOException { SFile newCurrentDir, String desc) throws IOException {
this.defines = defines; this.defines = defines;
this.charset = requireNonNull(charset); this.charset = requireNonNull(charset);

View File

@ -57,7 +57,7 @@ public interface ISkinSimple extends SpriteContainer {
public LineBreakStrategy wrapWidth(); public LineBreakStrategy wrapWidth();
public void copyAllFrom(ISkinSimple other); public void copyAllFrom(Map<String, String> other);
public double minClassWidth(); public double minClassWidth();

View File

@ -46,7 +46,7 @@ public interface ISourceFileReader {
public boolean hasError(); public boolean hasError();
public void setFileFormatOption(FileFormatOption fileFormatOption); public ISourceFileReader setFileFormatOption(FileFormatOption fileFormatOption);
public void setCheckMetadata(boolean checkMetadata); public void setCheckMetadata(boolean checkMetadata);

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.acearth.PSystemXearthFactory; import net.sourceforge.plantuml.acearth.PSystemXearthFactory;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory; import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory;
@ -105,7 +106,7 @@ public class PSystemBuilder {
public static final long startTime = System.currentTimeMillis(); public static final long startTime = System.currentTimeMillis();
final public Diagram createPSystem(ISkinSimple skinParam, List<StringLocated> source, List<StringLocated> rawSource) { final public Diagram createPSystem(List<StringLocated> source, List<StringLocated> rawSource, Map<String, String> skinParam) {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();

View File

@ -76,26 +76,27 @@ public class Pipe {
public void managePipe(ErrorStatus error) throws IOException { public void managePipe(ErrorStatus error) throws IOException {
final boolean noStdErr = option.isPipeNoStdErr(); final boolean noStdErr = option.isPipeNoStdErr();
for(String source = readFirstDiagram(); source != null; source = readSubsequentDiagram()) { for (String source = readFirstDiagram(); source != null; source = readSubsequentDiagram()) {
final Defines defines = option.getDefaultDefines(); final Defines defines = option.getDefaultDefines();
final SFile newCurrentDir = option.getFileDir() == null ? null : new SFile(option.getFileDir()); final SFile newCurrentDir = option.getFileDir() == null ? null : new SFile(option.getFileDir());
final SourceStringReader sourceStringReader = new SourceStringReader(defines, source, UTF_8, final SourceStringReader sourceStringReader = new SourceStringReader(defines, source, UTF_8,
option.getConfig(), newCurrentDir); option.getConfig(), newCurrentDir);
if (option.isComputeurl()) { if (option.isComputeurl())
computeUrlForDiagram(sourceStringReader); computeUrlForDiagram(sourceStringReader);
} else if (option.isSyntax()) { else if (option.isSyntax())
syntaxCheckDiagram(sourceStringReader, error); syntaxCheckDiagram(sourceStringReader, error);
} else if (option.isPipeMap()) { else if (option.isPipeMap())
createPipeMapForDiagram(sourceStringReader, error); createPipeMapForDiagram(sourceStringReader, error);
} else { else
generateDiagram(sourceStringReader, error, noStdErr); generateDiagram(sourceStringReader, error, noStdErr);
}
ps.flush(); ps.flush();
} }
} }
private void generateDiagram(SourceStringReader sourceStringReader, ErrorStatus error, boolean noStdErr) throws IOException { private void generateDiagram(SourceStringReader sourceStringReader, ErrorStatus error, boolean noStdErr)
throws IOException {
final OutputStream os = noStdErr ? new ByteArrayOutputStream() : ps; final OutputStream os = noStdErr ? new ByteArrayOutputStream() : ps;
final DiagramDescription result = sourceStringReader.outputImage(os, option.getImageIndex(), final DiagramDescription result = sourceStringReader.outputImage(os, option.getImageIndex(),
option.getFileFormatOption()); option.getFileFormatOption());
@ -111,28 +112,27 @@ public class Pipe {
ps.write(baos.toByteArray()); ps.write(baos.toByteArray());
} }
} }
if (option.getPipeDelimitor() != null) { if (option.getPipeDelimitor() != null)
ps.println(option.getPipeDelimitor()); ps.println(option.getPipeDelimitor());
}
} }
private void createPipeMapForDiagram(SourceStringReader sourceStringReader, ErrorStatus error) throws IOException { private void createPipeMapForDiagram(SourceStringReader sourceStringReader, ErrorStatus error) throws IOException {
final String result = sourceStringReader.getCMapData(option.getImageIndex(), final String result = sourceStringReader.getCMapData(option.getImageIndex(), option.getFileFormatOption());
option.getFileFormatOption());
// https://forum.plantuml.net/10049/2019-pipemap-diagrams-containing-links-give-zero-exit-code // https://forum.plantuml.net/10049/2019-pipemap-diagrams-containing-links-give-zero-exit-code
// We don't check errors // We don't check errors
error.goOk(); error.goOk();
if (result == null) { if (result == null)
ps.println(); ps.println();
} else { else
ps.println(result); ps.println(result);
}
} }
private void computeUrlForDiagram(SourceStringReader sourceStringReader) throws IOException { private void computeUrlForDiagram(SourceStringReader sourceStringReader) throws IOException {
for (BlockUml s : sourceStringReader.getBlocks()) { for (BlockUml s : sourceStringReader.getBlocks())
ps.println(s.getEncodedUrl()); ps.println(s.getEncodedUrl());
}
} }
private void syntaxCheckDiagram(SourceStringReader sourceStringReader, ErrorStatus error) { private void syntaxCheckDiagram(SourceStringReader sourceStringReader, ErrorStatus error) {
@ -153,11 +153,11 @@ public class Pipe {
private void printInfo(final PrintStream output, final SourceStringReader sourceStringReader) { private void printInfo(final PrintStream output, final SourceStringReader sourceStringReader) {
final List<BlockUml> blocks = sourceStringReader.getBlocks(); final List<BlockUml> blocks = sourceStringReader.getBlocks();
if (blocks.size() == 0) { if (blocks.size() == 0)
stdrpt.printInfo(output, null); stdrpt.printInfo(output, null);
} else { else
stdrpt.printInfo(output, blocks.get(0).getDiagram()); stdrpt.printInfo(output, blocks.get(0).getDiagram());
}
} }
String readFirstDiagram() throws IOException { String readFirstDiagram() throws IOException {
@ -174,14 +174,13 @@ public class Pipe {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
String line; String line;
while(state != State.COMPLETE && (line = br.readLine()) != null) { while (state != State.COMPLETE && (line = br.readLine()) != null) {
if(line.startsWith("@@@format ")) { if (line.startsWith("@@@format ")) {
manageFormat(line); manageFormat(line);
} else { } else {
if (state == State.NO_CONTENT && line.trim().length() > 0) { if (state == State.NO_CONTENT && line.trim().length() > 0)
state = State.START_MARK_NOT_FOUND; state = State.START_MARK_NOT_FOUND;
}
if (state == State.START_MARK_NOT_FOUND && line.startsWith("@start")) { if (state == State.START_MARK_NOT_FOUND && line.startsWith("@start")) {
sb.setLength(0); // discard any previous input sb.setLength(0); // discard any previous input
@ -191,38 +190,35 @@ public class Pipe {
state = State.COMPLETE; state = State.COMPLETE;
} }
if (state != State.NO_CONTENT) { if (state != State.NO_CONTENT)
sb.append(line).append("\n"); sb.append(line).append("\n");
}
} }
} }
switch(state) { switch (state) {
case NO_CONTENT: case NO_CONTENT:
return null; return null;
case START_MARK_NOT_FOUND: case START_MARK_NOT_FOUND:
return (unmarkedAllowed) ? "@startuml\n" + sb.toString() + "@enduml\n" : null; return (unmarkedAllowed) ? "@startuml\n" + sb.toString() + "@enduml\n" : null;
case START_MARK_FOUND: case START_MARK_FOUND:
return sb.toString() + expectedEnd; return sb.toString() + expectedEnd;
case COMPLETE: case COMPLETE:
return sb.toString(); return sb.toString();
default: default:
throw new IllegalStateException("Unexpected value: " + state); throw new IllegalStateException("Unexpected value: " + state);
} }
} }
void manageFormat(String s) { void manageFormat(String s) {
if (s.contains("png")) { if (s.contains("png"))
option.setFileFormatOption(new FileFormatOption(FileFormat.PNG)); option.setFileFormatOption(new FileFormatOption(FileFormat.PNG));
} else if (s.contains("svg")) { else if (s.contains("svg"))
option.setFileFormatOption(new FileFormatOption(FileFormat.SVG)); option.setFileFormatOption(new FileFormatOption(FileFormat.SVG));
}
} }
enum State { enum State {
NO_CONTENT, NO_CONTENT, START_MARK_NOT_FOUND, START_MARK_FOUND, COMPLETE
START_MARK_NOT_FOUND,
START_MARK_FOUND,
COMPLETE
} }
} }

View File

@ -79,8 +79,6 @@ import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svg.LengthAdjust; import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.ColorOrder;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColors; import net.sourceforge.plantuml.ugraphic.color.HColors;
@ -145,8 +143,8 @@ public class SkinParam implements ISkinParam {
private final UmlDiagramType type; private final UmlDiagramType type;
private boolean useVizJs; private boolean useVizJs;
public void copyAllFrom(ISkinSimple other) { public void copyAllFrom(Map<String, String> other) {
this.params.putAll(other.values()); this.params.putAll(other);
} }
public Map<String, String> values() { public Map<String, String> values() {
@ -660,31 +658,6 @@ public class SkinParam implements ISkinParam {
return split[i]; return split[i];
} }
public ColorMapper getColorMapper() {
if ("dark".equalsIgnoreCase(getValue("mode")))
return ColorMapper.FORCE_DARK;
final String monochrome = getValue("monochrome");
if ("true".equals(monochrome))
return ColorMapper.MONOCHROME;
if ("reverse".equals(monochrome))
return ColorMapper.MONOCHROME_REVERSE;
final String value = getValue("reversecolor");
if (value == null)
return ColorMapper.IDENTITY;
if ("dark".equalsIgnoreCase(value))
return ColorMapper.LIGTHNESS_INVERSE;
final ColorOrder order = ColorOrder.fromString(value);
if (order == null)
return ColorMapper.IDENTITY;
return ColorMapper.reverse(order);
}
public boolean shadowing(Stereotype stereotype) { public boolean shadowing(Stereotype stereotype) {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);

View File

@ -55,7 +55,6 @@ import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svg.LengthAdjust; import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
@ -124,11 +123,6 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getHorizontalAlignment(param, arrowDirection, isReverseDefine, overrideDefault); return skinParam.getHorizontalAlignment(param, arrowDirection, isReverseDefine, overrideDefault);
} }
@Override
public ColorMapper getColorMapper() {
return skinParam.getColorMapper();
}
@Override @Override
public boolean shadowing(Stereotype stereotype) { public boolean shadowing(Stereotype stereotype) {
return skinParam.shadowing(stereotype); return skinParam.shadowing(stereotype);
@ -385,7 +379,7 @@ public class SkinParamDelegator implements ISkinParam {
} }
@Override @Override
public void copyAllFrom(ISkinSimple other) { public void copyAllFrom(Map<String, String> other) {
skinParam.copyAllFrom(other); skinParam.copyAllFrom(other);
} }

View File

@ -48,6 +48,8 @@ import net.sourceforge.plantuml.security.SFile;
@HaxeIgnored @HaxeIgnored
public class SourceFileReader extends SourceFileReaderAbstract implements ISourceFileReader { public class SourceFileReader extends SourceFileReaderAbstract implements ISourceFileReader {
private File outputDirectory;
public SourceFileReader(File file) throws IOException { public SourceFileReader(File file) throws IOException {
this(file, file.getAbsoluteFile().getParentFile()); this(file, file.getAbsoluteFile().getParentFile());
} }
@ -72,14 +74,14 @@ public class SourceFileReader extends SourceFileReaderAbstract implements ISourc
FileFormatOption fileFormatOption) throws IOException { FileFormatOption fileFormatOption) throws IOException {
super(file, fileFormatOption, defines, config, charset); super(file, fileFormatOption, defines, config, charset);
FileSystem.getInstance().setCurrentDir(SFile.fromFile(file.getAbsoluteFile().getParentFile())); FileSystem.getInstance().setCurrentDir(SFile.fromFile(file.getAbsoluteFile().getParentFile()));
if (outputDirectory == null) { if (outputDirectory == null)
outputDirectory = file.getAbsoluteFile().getParentFile(); outputDirectory = file.getAbsoluteFile().getParentFile();
} else if (outputDirectory.isAbsolute() == false) { else if (outputDirectory.isAbsolute() == false)
outputDirectory = FileSystem.getInstance().getFile(outputDirectory.getPath()).conv(); outputDirectory = FileSystem.getInstance().getFile(outputDirectory.getPath()).conv();
}
if (outputDirectory.exists() == false) { if (outputDirectory.exists() == false)
outputDirectory.mkdirs(); outputDirectory.mkdirs();
}
this.outputDirectory = outputDirectory; this.outputDirectory = outputDirectory;
} }
@ -141,18 +143,17 @@ public class SourceFileReader extends SourceFileReaderAbstract implements ISourc
if (dir == null) { if (dir == null) {
Log.info(newName + " is not taken as a directory"); Log.info(newName + " is not taken as a directory");
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, newName), suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, newName),
fileFormatOption.getFileFormat(), 0); getFileFormatOption().getFileFormat(), 0);
} else { } else {
Log.info("We are going to create files in directory " + dir); Log.info("We are going to create files in directory " + dir);
suggested = SuggestedFile.fromOutputFile(new File(dir, file.getName()), suggested = SuggestedFile.fromOutputFile(new File(dir, getFileName()),
fileFormatOption.getFileFormat(), 0); getFileFormatOption().getFileFormat(), 0);
} }
Log.info("We are going to put data in " + suggested); Log.info("We are going to put data in " + suggested);
} }
if (suggested == null) { if (suggested == null)
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, file.getName()), suggested = getSuggestedFile(outputDirectory, getFileName());
fileFormatOption.getFileFormat(), cpt++);
}
suggested.getParentFile().mkdirs(); suggested.getParentFile().mkdirs();
return suggested; return suggested;
} }

View File

@ -65,28 +65,37 @@ import net.sourceforge.plantuml.security.SecurityUtils;
public abstract class SourceFileReaderAbstract implements ISourceFileReader { public abstract class SourceFileReaderAbstract implements ISourceFileReader {
protected File file; final private File file;
protected File outputDirectory;
protected File outputFile;
protected final BlockUmlBuilder builder; private FileFormatOption fileFormatOption;
protected /* final */ FileFormatOption fileFormatOption;
private boolean checkMetadata; private boolean checkMetadata;
private boolean noerror; private boolean noerror;
final private Charset charset;
private final BlockUmlBuilder builder;
private int cpt;
protected final SuggestedFile getSuggestedFile(File outputDirectory, String newName) {
final File outFile = new File(outputDirectory, newName);
return SuggestedFile.fromOutputFile(outFile, getFileFormatOption().getFileFormat(), cpt++);
}
public SourceFileReaderAbstract(File file, FileFormatOption fileFormatOption, Defines defines, List<String> config, public SourceFileReaderAbstract(File file, FileFormatOption fileFormatOption, Defines defines, List<String> config,
String charsetName) throws IOException { String charsetName) throws IOException {
if (!file.exists()) { if (file.exists() == false)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
final Charset charset = charsetOrDefault(charsetName);
this.file = file; this.file = file;
this.charset = charsetOrDefault(charsetName);
this.fileFormatOption = fileFormatOption; this.fileFormatOption = fileFormatOption;
this.builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), SFile.fromFile(file.getAbsoluteFile().getParentFile()), this.builder = new BlockUmlBuilder(config, charset, defines, getReader(charset),
FileWithSuffix.getFileName(file)); SFile.fromFile(file.getAbsoluteFile().getParentFile()), FileWithSuffix.getFileName(file));
}
protected final FileFormatOption getFileFormatOption() {
return fileFormatOption;
} }
public void setCheckMetadata(boolean checkMetadata) { public void setCheckMetadata(boolean checkMetadata) {
@ -94,11 +103,9 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
} }
public boolean hasError() { public boolean hasError() {
for (final BlockUml b : builder.getBlockUmls()) { for (final BlockUml b : builder.getBlockUmls())
if (b.getDiagram() instanceof PSystemError) { if (b.getDiagram() instanceof PSystemError)
return true; return true;
}
}
return false; return false;
} }
@ -110,13 +117,14 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
return new InputStreamReader(new BufferedInputStream(new FileInputStream(file)), charset); return new InputStreamReader(new BufferedInputStream(new FileInputStream(file)), charset);
} }
public final Set<FileWithSuffix> getIncludedFiles() { public final Set<FileWithSuffix> getIncludedFiles() throws IOException {
return builder.getIncludedFiles(); return builder.getIncludedFiles();
} }
@Deprecated @Override
public final void setFileFormatOption(FileFormatOption fileFormatOption) { public final ISourceFileReader setFileFormatOption(FileFormatOption fileFormatOption) {
this.fileFormatOption = fileFormatOption; this.fileFormatOption = fileFormatOption;
return this;
} }
protected boolean endsWithSlashOrAntislash(String newName) { protected boolean endsWithSlashOrAntislash(String newName) {
@ -145,8 +153,6 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
} }
} }
protected int cpt;
final public List<GeneratedImage> getGeneratedImages() throws IOException { final public List<GeneratedImage> getGeneratedImages() throws IOException {
Log.info("Reading file: " + file); Log.info("Reading file: " + file);
@ -161,28 +167,26 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
system = blockUml.getDiagram(); system = blockUml.getDiagram();
} catch (Throwable t) { } catch (Throwable t) {
Logme.error(t); Logme.error(t);
if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() || noerror) { if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() || noerror)
continue; continue;
}
return getCrashedImage(blockUml, t, suggested.getFile(0)); return getCrashedImage(blockUml, t, suggested.getFile(0));
} }
if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() && system instanceof PSystemError) { if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() && system instanceof PSystemError)
continue; continue;
}
OptionFlags.getInstance().logData(SFile.fromFile(file), system); OptionFlags.getInstance().logData(SFile.fromFile(file), system);
final List<FileImageData> exportDiagrams; final List<FileImageData> exportDiagrams;
if (noerror && system instanceof PSystemError) { if (noerror && system instanceof PSystemError) {
exportDiagrams = new ArrayList<FileImageData>(); exportDiagrams = new ArrayList<FileImageData>();
exportDiagrams.add( exportDiagrams
new FileImageData(null, new ImageDataSimple(new XDimension2D(0, 0), FileImageData.ERROR))); .add(new FileImageData(null, new ImageDataSimple(new XDimension2D(0, 0), FileImageData.ERROR)));
} else } else
exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption, checkMetadata); exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption, checkMetadata);
if (exportDiagrams.size() > 1) { if (exportDiagrams.size() > 1)
cpt += exportDiagrams.size() - 1; cpt += exportDiagrams.size() - 1;
}
for (FileImageData fdata : exportDiagrams) { for (FileImageData fdata : exportDiagrams) {
final String desc = "[" + file.getName() + "] " + system.getDescription(); final String desc = "[" + file.getName() + "] " + system.getDescription();
@ -206,4 +210,8 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
} }
final protected String getFileName() {
return file.getName();
}
} }

View File

@ -43,34 +43,23 @@ import net.sourceforge.plantuml.preproc.Defines;
public class SourceFileReaderCopyCat extends SourceFileReaderAbstract implements ISourceFileReader { public class SourceFileReaderCopyCat extends SourceFileReaderAbstract implements ISourceFileReader {
private final File outputDirectory;
public SourceFileReaderCopyCat(Defines defines, final File file, File outputDirectory, List<String> config, public SourceFileReaderCopyCat(Defines defines, final File file, File outputDirectory, List<String> config,
String charset, FileFormatOption fileFormatOption) throws IOException { String charset, FileFormatOption fileFormatOption) throws IOException {
super(file, fileFormatOption, defines, config, charset); super(file, fileFormatOption, defines, config, charset);
final String path = file.getParentFile().getPath(); final String path = file.getParentFile().getPath();
// System.err.println("SourceFileReaderCopyCat::path=" + path);
// System.err.println("SourceFileReaderCopyCat::outputDirectory=" +
// outputDirectory);
this.outputDirectory = new File(outputDirectory, path).getAbsoluteFile(); this.outputDirectory = new File(outputDirectory, path).getAbsoluteFile();
if (outputDirectory.exists() == false) { if (outputDirectory.exists() == false)
outputDirectory.mkdirs(); outputDirectory.mkdirs();
}
// System.err.println("SourceFileReaderCopyCat=" +
// this.outputDirectory.getPath() + " "
// + this.outputDirectory.getAbsolutePath());
} }
@Override @Override
protected SuggestedFile getSuggestedFile(BlockUml blockUml) { protected SuggestedFile getSuggestedFile(BlockUml blockUml) {
final String newName = blockUml.getFileOrDirname(); String newName = blockUml.getFileOrDirname();
SuggestedFile suggested = null; if (newName == null)
if (newName == null) { newName = getFileName();
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, file.getName()), final SuggestedFile suggested = getSuggestedFile(outputDirectory, newName);
fileFormatOption.getFileFormat(), cpt++);
} else {
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, newName),
fileFormatOption.getFileFormat(), cpt++);
}
// System.err.println("SourceFileReaderCopyCat::suggested=" + suggested);
suggested.getParentFile().mkdirs(); suggested.getParentFile().mkdirs();
return suggested; return suggested;
} }

View File

@ -44,6 +44,8 @@ import net.sourceforge.plantuml.security.SFile;
public class SourceFileReaderHardFile extends SourceFileReaderAbstract implements ISourceFileReader { public class SourceFileReaderHardFile extends SourceFileReaderAbstract implements ISourceFileReader {
private final File outputFile;
public SourceFileReaderHardFile(Defines defines, final File file, File outputFile, List<String> config, public SourceFileReaderHardFile(Defines defines, final File file, File outputFile, List<String> config,
String charset, FileFormatOption fileFormatOption) throws IOException { String charset, FileFormatOption fileFormatOption) throws IOException {
super(file, fileFormatOption, defines, config, charset); super(file, fileFormatOption, defines, config, charset);
@ -53,7 +55,7 @@ public class SourceFileReaderHardFile extends SourceFileReaderAbstract implement
@Override @Override
protected SuggestedFile getSuggestedFile(BlockUml blockUml) { protected SuggestedFile getSuggestedFile(BlockUml blockUml) {
final SuggestedFile suggested = SuggestedFile.fromOutputFile(outputFile, fileFormatOption.getFileFormat()); final SuggestedFile suggested = SuggestedFile.fromOutputFile(outputFile, getFileFormatOption().getFileFormat());
return suggested; return suggested;
} }

View File

@ -151,7 +151,6 @@ public class SourceStringReader {
public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
fileFormatOption = fileFormatOption;
if (blocks.size() == 0) { if (blocks.size() == 0) {
noStartumlFound(os, fileFormatOption); noStartumlFound(os, fileFormatOption);
return null; return null;
@ -176,10 +175,9 @@ public class SourceStringReader {
} }
public DiagramDescription generateDiagramDescription(int numImage, FileFormatOption fileFormatOption) { public DiagramDescription generateDiagramDescription(int numImage, FileFormatOption fileFormatOption) {
fileFormatOption = fileFormatOption; if (blocks.size() == 0)
if (blocks.size() == 0) {
return null; return null;
}
for (BlockUml b : blocks) { for (BlockUml b : blocks) {
final Diagram system = b.getDiagram(); final Diagram system = b.getDiagram();
final int nbInSystem = system.getNbImages(); final int nbInSystem = system.getNbImages();
@ -211,18 +209,17 @@ public class SourceStringReader {
} }
public String getCMapData(int numImage, FileFormatOption fileFormatOption) throws IOException { public String getCMapData(int numImage, FileFormatOption fileFormatOption) throws IOException {
fileFormatOption = fileFormatOption; if (blocks.size() == 0)
if (blocks.size() == 0) {
return null; return null;
}
for (BlockUml b : blocks) { for (BlockUml b : blocks) {
final Diagram system = b.getDiagram(); final Diagram system = b.getDiagram();
final int nbInSystem = system.getNbImages(); final int nbInSystem = system.getNbImages();
if (numImage < nbInSystem) { if (numImage < nbInSystem) {
final ImageData imageData = system.exportDiagram(new NullOutputStream(), numImage, fileFormatOption); final ImageData imageData = system.exportDiagram(new NullOutputStream(), numImage, fileFormatOption);
if (imageData.containsCMapData()) { if (imageData.containsCMapData())
return imageData.getCMapData("plantuml"); return imageData.getCMapData("plantuml");
}
return null; return null;
} }
numImage -= nbInSystem; numImage -= nbInSystem;
@ -232,7 +229,6 @@ public class SourceStringReader {
} }
public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException { public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
fileFormatOption = fileFormatOption;
final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"), final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"),
fileFormatOption.isUseRedForError()); fileFormatOption.isUseRedForError());

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public interface SpriteContainer extends SvgCharSizeHack { public interface SpriteContainer extends SvgCharSizeHack {
@ -44,6 +43,4 @@ public interface SpriteContainer extends SvgCharSizeHack {
public Guillemet guillemet(); public Guillemet guillemet();
public ColorMapper getColorMapper();
} }

View File

@ -40,7 +40,6 @@ import java.util.Map;
import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage; import net.sourceforge.plantuml.sprite.SpriteImage;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple { public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
@ -81,11 +80,7 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
return LineBreakStrategy.NONE; return LineBreakStrategy.NONE;
} }
public ColorMapper getColorMapper() { public void copyAllFrom(Map<String, String> other) {
return ColorMapper.IDENTITY;
}
public void copyAllFrom(ISkinSimple other) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Map;
import net.sourceforge.plantuml.anim.Animation; import net.sourceforge.plantuml.anim.Animation;
import net.sourceforge.plantuml.anim.AnimationDecoder; import net.sourceforge.plantuml.anim.AnimationDecoder;
@ -59,6 +60,8 @@ import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleLoader; import net.sourceforge.plantuml.style.StyleLoader;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.ColorOrder;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColors; import net.sourceforge.plantuml.ugraphic.color.HColors;
@ -86,7 +89,7 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return pragma; return pragma;
} }
public TitledDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public TitledDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source); super(source);
this.type = type; this.type = type;
this.skinParam = SkinParam.create(type); this.skinParam = SkinParam.create(type);
@ -278,4 +281,29 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return backgroundColor; return backgroundColor;
} }
@Override
protected ColorMapper muteColorMapper(ColorMapper init) {
if ("dark".equalsIgnoreCase(getSkinParam().getValue("mode")))
return ColorMapper.FORCE_DARK;
final String monochrome = getSkinParam().getValue("monochrome");
if ("true".equals(monochrome))
return ColorMapper.MONOCHROME;
if ("reverse".equals(monochrome))
return ColorMapper.MONOCHROME_REVERSE;
final String value = getSkinParam().getValue("reversecolor");
if (value == null)
return init;
if ("dark".equalsIgnoreCase(value))
return ColorMapper.LIGTHNESS_INVERSE;
final ColorOrder order = ColorOrder.fromString(value);
if (order == null)
return init;
return ColorMapper.reverse(order);
}
} }

View File

@ -49,6 +49,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.awt.geom.XDimension2D; import net.sourceforge.plantuml.awt.geom.XDimension2D;
@ -91,7 +92,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
// super(style, source, type); // super(style, source, type);
// } // }
public UmlDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public UmlDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig); super(source, type, orig);
} }

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.activitydiagram;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -61,7 +61,7 @@ public class ActivityDiagram extends CucaDiagram {
private IEntity lastEntityBrancheConsulted; private IEntity lastEntityBrancheConsulted;
private ConditionalContext currentContext; private ConditionalContext currentContext;
public ActivityDiagram(UmlSource source, ISkinSimple skinParam) { public ActivityDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam); super(source, UmlDiagramType.ACTIVITY, skinParam);
setNamespaceSeparator(null); setNamespaceSeparator(null);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.activitydiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram.command.CommandElse; import net.sourceforge.plantuml.activitydiagram.command.CommandElse;
import net.sourceforge.plantuml.activitydiagram.command.CommandEndPartition; import net.sourceforge.plantuml.activitydiagram.command.CommandEndPartition;
import net.sourceforge.plantuml.activitydiagram.command.CommandEndif; import net.sourceforge.plantuml.activitydiagram.command.CommandEndif;
@ -59,7 +59,7 @@ import net.sourceforge.plantuml.core.UmlSource;
public class ActivityDiagramFactory extends PSystemCommandFactory { public class ActivityDiagramFactory extends PSystemCommandFactory {
@Override @Override
public ActivityDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public ActivityDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ActivityDiagram(source, skinParam); return new ActivityDiagram(source, skinParam);
} }

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
@ -74,7 +74,7 @@ public class ActivityDiagram3 extends UmlDiagram {
private final Swimlanes swinlanes = new Swimlanes(getSkinParam(), getPragma()); private final Swimlanes swinlanes = new Swimlanes(getSkinParam(), getPragma());
public ActivityDiagram3(UmlSource source, ISkinSimple skinParam) { public ActivityDiagram3(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam); super(source, UmlDiagramType.ACTIVITY, skinParam);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivity3; import net.sourceforge.plantuml.activitydiagram3.command.CommandActivity3;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLegacy1; import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLegacy1;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLong3; import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLong3;
@ -160,7 +160,7 @@ public class ActivityDiagramFactory3 extends PSystemCommandFactory {
} }
@Override @Override
public ActivityDiagram3 createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public ActivityDiagram3 createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ActivityDiagram3(source, skinParam); return new ActivityDiagram3(source, skinParam);
} }

View File

@ -54,9 +54,7 @@ import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColors; import net.sourceforge.plantuml.ugraphic.color.HColors;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;

View File

@ -35,14 +35,15 @@
*/ */
package net.sourceforge.plantuml.api; package net.sourceforge.plantuml.api;
import net.sourceforge.plantuml.ISkinSimple; import java.util.Map;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
public interface PSystemFactory { public interface PSystemFactory {
Diagram createSystem(UmlSource source, ISkinSimple skinParam); Diagram createSystem(UmlSource source, Map<String, String> skinParam);
DiagramType getDiagramType(); DiagramType getDiagramType();

View File

@ -38,6 +38,8 @@ package net.sourceforge.plantuml.api;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.BlockUml; import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader; import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.board;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -68,7 +68,7 @@ public class BoardDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public BoardDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public BoardDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new BoardDiagram(source); return new BoardDiagram(source);
} }

View File

@ -37,9 +37,9 @@ package net.sourceforge.plantuml.bpm;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -65,7 +65,7 @@ public class BpmDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public AbstractPSystem createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new BpmDiagram(source); return new BpmDiagram(source);
} }

View File

@ -39,8 +39,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -48,7 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public abstract class AbstractEntityDiagram extends CucaDiagram { public abstract class AbstractEntityDiagram extends CucaDiagram {
public AbstractEntityDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public AbstractEntityDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig); super(source, type, orig);
} }

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.classdiagram;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -61,7 +61,7 @@ import net.sourceforge.plantuml.svek.image.EntityImageClass;
public class ClassDiagram extends AbstractClassOrObjectDiagram { public class ClassDiagram extends AbstractClassOrObjectDiagram {
public ClassDiagram(UmlSource source, ISkinSimple skinParam) { public ClassDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.CLASS, skinParam); super(source, UmlDiagramType.CLASS, skinParam);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.classdiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod; import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod;
import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing; import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing;
@ -86,7 +86,7 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap;
public class ClassDiagramFactory extends PSystemCommandFactory { public class ClassDiagramFactory extends PSystemCommandFactory {
@Override @Override
public ClassDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public ClassDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ClassDiagram(source, skinParam); return new ClassDiagram(source, skinParam);
} }

View File

@ -35,10 +35,11 @@
*/ */
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.annotation.HaxeIgnored; import net.sourceforge.plantuml.annotation.HaxeIgnored;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
@ -68,7 +69,7 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
} }
@Override @Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { final public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
source = source.removeInitialSkinparam(); source = source.removeInitialSkinparam();
final IteratorCounter2 it = source.iterator2(); final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next(); final StringLocated startLine = it.next();

View File

@ -36,11 +36,11 @@
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.annotation.HaxeIgnored; import net.sourceforge.plantuml.annotation.HaxeIgnored;
@ -58,7 +58,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
protected abstract List<Command> createCommands(); protected abstract List<Command> createCommands();
public abstract AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam); public abstract AbstractPSystem createEmptyDiagram(UmlSource source, Map<String, String> skinParam);
@HaxeIgnored @HaxeIgnored
protected PSystemCommandFactory() { protected PSystemCommandFactory() {
@ -70,7 +70,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
} }
@Override @Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { final public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final IteratorCounter2 it = source.iterator2(); final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next(); final StringLocated startLine = it.next();
if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false)

View File

@ -35,10 +35,11 @@
*/ */
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
@ -57,7 +58,7 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
} }
@Override @Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { final public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
if (source.getTotalLineCount() != 3) if (source.getTotalLineCount() != 3)
return null; return null;

View File

@ -35,9 +35,9 @@
*/ */
package net.sourceforge.plantuml.compositediagram; package net.sourceforge.plantuml.compositediagram;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.graphic.USymbol;
public class CompositeDiagram extends AbstractEntityDiagram { public class CompositeDiagram extends AbstractEntityDiagram {
public CompositeDiagram(UmlSource source, ISkinSimple skinParam) { public CompositeDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.COMPOSITE, skinParam); super(source, UmlDiagramType.COMPOSITE, skinParam);
} }

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.compositediagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
@ -69,7 +70,7 @@ public class CompositeDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public CompositeDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public CompositeDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new CompositeDiagram(source, skinParam); return new CompositeDiagram(source, skinParam);
} }
} }

View File

@ -53,11 +53,9 @@ public class AtomMath extends AbstractAtom implements Atom {
private final ScientificEquationSafe math; private final ScientificEquationSafe math;
private final HColor foreground; private final HColor foreground;
private final HColor background; private final HColor background;
private final ColorMapper colorMapper;
public AtomMath(ScientificEquationSafe math, HColor foreground, HColor background, ColorMapper colorMapper) { public AtomMath(ScientificEquationSafe math, HColor foreground, HColor background) {
this.math = math; this.math = math;
this.colorMapper = colorMapper;
this.foreground = foreground; this.foreground = foreground;
this.background = background; this.background = background;
} }
@ -81,14 +79,15 @@ public class AtomMath extends AbstractAtom implements Atom {
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final ColorMapper colorMapper = ug.getColorMapper();
final boolean isSvg = ug.matchesProperty("SVG"); final boolean isSvg = ug.matchesProperty("SVG");
final Color back; final Color back;
if (background == null) { if (background == null)
back = null; back = null;
} else { else
back = getColor(background, Color.WHITE); back = getColor(colorMapper, background, Color.WHITE);
}
final Color fore = getColor(foreground, Color.BLACK); final Color fore = getColor(colorMapper, foreground, Color.BLACK);
// final double dpiFactor = ug.dpiFactor(); // final double dpiFactor = ug.dpiFactor();
if (isSvg) { if (isSvg) {
final UImageSvg svg = math.getSvg(1, fore, back); final UImageSvg svg = math.getSvg(1, fore, back);
@ -99,7 +98,7 @@ public class AtomMath extends AbstractAtom implements Atom {
} }
} }
private Color getColor(HColor color, Color defaultValue) { private Color getColor(ColorMapper colorMapper, HColor color, Color defaultValue) {
if (color instanceof HColorSimple) if (color instanceof HColorSimple)
return color.toColor(colorMapper); return color.toColor(colorMapper);

View File

@ -41,7 +41,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
public class AtomSprite extends AbstractAtom implements Atom { public class AtomSprite extends AbstractAtom implements Atom {
@ -50,11 +49,8 @@ public class AtomSprite extends AbstractAtom implements Atom {
private final double scale; private final double scale;
private final Url url; private final Url url;
private final HColor color; private final HColor color;
private final ColorMapper colorMapper;
public AtomSprite(HColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url, public AtomSprite(HColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url) {
ColorMapper colorMapper) {
this.colorMapper = colorMapper;
this.scale = scale; this.scale = scale;
this.sprite = sprite; this.sprite = sprite;
this.url = url; this.url = url;
@ -62,7 +58,7 @@ public class AtomSprite extends AbstractAtom implements Atom {
} }
public XDimension2D calculateDimension(StringBounder stringBounder) { public XDimension2D calculateDimension(StringBounder stringBounder) {
return sprite.asTextBlock(color, scale, colorMapper).calculateDimension(stringBounder); return sprite.asTextBlock(color, scale).calculateDimension(stringBounder);
} }
public double getStartingAltitude(StringBounder stringBounder) { public double getStartingAltitude(StringBounder stringBounder) {
@ -70,13 +66,13 @@ public class AtomSprite extends AbstractAtom implements Atom {
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
if (url != null) { if (url != null)
ug.startUrl(url); ug.startUrl(url);
}
sprite.asTextBlock(color, scale, colorMapper).drawU(ug); sprite.asTextBlock(color, scale).drawU(ug);
if (url != null) { if (url != null)
ug.closeUrl(); ug.closeUrl();
}
} }
} }

View File

@ -119,8 +119,7 @@ public class AtomTextUtils {
final Sprite sprite = skinSimple.getSprite(valSprite); final Sprite sprite = skinSimple.getSprite(valSprite);
if (sprite != null) { if (sprite != null) {
final double scale = Parser.getScale(m.group(4), 1); final double scale = Parser.getScale(m.group(4), 1);
result.add( result.add(new AtomSprite(null, scale, fontConfiguration, sprite, url));
new AtomSprite(null, scale, fontConfiguration, sprite, url, skinSimple.getColorMapper()));
} }
} else if (valImg != null) { } else if (valImg != null) {
final double scale = Parser.getScale(m.group(6), 1); final double scale = Parser.getScale(m.group(6), 1);

View File

@ -255,7 +255,7 @@ public class StripeSimple implements Stripe {
public void addSprite(String src, double scale, HColor color) { public void addSprite(String src, double scale, HColor color) {
final Sprite sprite = skinParam.getSprite(src); final Sprite sprite = skinParam.getSprite(src);
if (sprite != null) if (sprite != null)
atoms.add(new AtomSprite(color, scale, fontConfiguration, sprite, null, skinParam.getColorMapper())); atoms.add(new AtomSprite(color, scale, fontConfiguration, sprite, null));
} }
public void addOpenIcon(String src, double scale, HColor color) { public void addOpenIcon(String src, double scale, HColor color) {
@ -285,8 +285,7 @@ public class StripeSimple implements Stripe {
} }
public void addMath(ScientificEquationSafe math) { public void addMath(ScientificEquationSafe math) {
atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor(), atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor()));
skinParam.getColorMapper()));
} }
private void modifyStripe(String line) { private void modifyStripe(String line) {

View File

@ -42,6 +42,7 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -49,7 +50,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
@ -70,7 +70,6 @@ import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek; import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker; import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker;
import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker; import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker;
@ -121,7 +120,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return ident; return ident;
} }
public CucaDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public CucaDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig); super(source, type, orig);
this.stacks2.add(Ident.empty()); this.stacks2.add(Ident.empty());
} }
@ -788,10 +787,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return Collections.unmodifiableSet(hides); return Collections.unmodifiableSet(hides);
} }
public ColorMapper getColorMapper() {
return getSkinParam().getColorMapper();
}
final public boolean isStandalone(IEntity ent) { final public boolean isStandalone(IEntity ent) {
for (final Link link : getLinks()) for (final Link link : getLinks())
if (link.getEntity1() == ent || link.getEntity2() == ent) if (link.getEntity1() == ent || link.getEntity2() == ent)

View File

@ -110,7 +110,7 @@ public class Stereotype implements CharSequence {
if (tmp == null) if (tmp == null)
return null; return null;
return tmp.asTextBlock(getHtmlColor(), decoration.spriteScale, container.getColorMapper()); return tmp.asTextBlock(getHtmlColor(), decoration.spriteScale);
} }
public boolean isWithOOSymbol() { public boolean isWithOOSymbol() {

View File

@ -55,7 +55,6 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
import net.sourceforge.plantuml.svek.DotMode; import net.sourceforge.plantuml.svek.DotMode;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
final public class DotData implements PortionShower { final public class DotData implements PortionShower {
@ -72,7 +71,6 @@ final public class DotData implements PortionShower {
final private String namespaceSeparator; final private String namespaceSeparator;
final private Pragma pragma; final private Pragma pragma;
private final ColorMapper colorMapper;
private final EntityFactory entityFactory; private final EntityFactory entityFactory;
public EntityFactory getEntityFactory() { public EntityFactory getEntityFactory() {
@ -80,7 +78,7 @@ final public class DotData implements PortionShower {
} }
public DotData(IGroup topParent, List<Link> links, Collection<ILeaf> leafs, UmlDiagramType umlDiagramType, public DotData(IGroup topParent, List<Link> links, Collection<ILeaf> leafs, UmlDiagramType umlDiagramType,
ISkinParam skinParam, GroupHierarchy groupHierarchy, PortionShower portionShower, ColorMapper colorMapper, ISkinParam skinParam, GroupHierarchy groupHierarchy, PortionShower portionShower,
EntityFactory entityFactory, boolean isHideEmptyDescriptionForState, DotMode dotMode, EntityFactory entityFactory, boolean isHideEmptyDescriptionForState, DotMode dotMode,
String namespaceSeparator, Pragma pragma) { String namespaceSeparator, Pragma pragma) {
this.namespaceSeparator = namespaceSeparator; this.namespaceSeparator = namespaceSeparator;
@ -88,7 +86,6 @@ final public class DotData implements PortionShower {
this.topParent = Objects.requireNonNull(topParent); this.topParent = Objects.requireNonNull(topParent);
this.dotMode = dotMode; this.dotMode = dotMode;
this.isHideEmptyDescriptionForState = isHideEmptyDescriptionForState; this.isHideEmptyDescriptionForState = isHideEmptyDescriptionForState;
this.colorMapper = colorMapper;
this.links = links; this.links = links;
this.leafs = leafs; this.leafs = leafs;
this.umlDiagramType = umlDiagramType; this.umlDiagramType = umlDiagramType;
@ -100,13 +97,13 @@ final public class DotData implements PortionShower {
} }
public DotData(IGroup topParent, List<Link> links, Collection<ILeaf> leafs, UmlDiagramType umlDiagramType, public DotData(IGroup topParent, List<Link> links, Collection<ILeaf> leafs, UmlDiagramType umlDiagramType,
ISkinParam skinParam, GroupHierarchy groupHierarchy, ColorMapper colorMapper, EntityFactory entityFactory, ISkinParam skinParam, GroupHierarchy groupHierarchy, EntityFactory entityFactory,
boolean isHideEmptyDescriptionForState, DotMode dotMode, String namespaceSeparator, Pragma pragma) { boolean isHideEmptyDescriptionForState, DotMode dotMode, String namespaceSeparator, Pragma pragma) {
this(topParent, links, leafs, umlDiagramType, skinParam, groupHierarchy, new PortionShower() { this(topParent, links, leafs, umlDiagramType, skinParam, groupHierarchy, new PortionShower() {
public boolean showPortion(EntityPortion portion, IEntity entity) { public boolean showPortion(EntityPortion portion, IEntity entity) {
return true; return true;
} }
}, colorMapper, entityFactory, isHideEmptyDescriptionForState, dotMode, namespaceSeparator, pragma); }, entityFactory, isHideEmptyDescriptionForState, dotMode, namespaceSeparator, pragma);
} }
public UmlDiagramType getUmlDiagramType() { public UmlDiagramType getUmlDiagramType() {
@ -141,10 +138,6 @@ final public class DotData implements PortionShower {
return portionShower.showPortion(portion, entity); return portionShower.showPortion(portion, entity);
} }
public final ColorMapper getColorMapper() {
return colorMapper;
}
public IGroup getRootGroup() { public IGroup getRootGroup() {
return entityFactory.getRootGroup(); return entityFactory.getRootGroup();
} }

View File

@ -84,9 +84,7 @@ import net.sourceforge.plantuml.graphic.USymbols;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.Kal; import net.sourceforge.plantuml.svek.Kal;
import net.sourceforge.plantuml.svek.Margins; import net.sourceforge.plantuml.svek.Margins;

View File

@ -35,9 +35,9 @@
*/ */
package net.sourceforge.plantuml.descdiagram; package net.sourceforge.plantuml.descdiagram;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
@ -51,7 +51,7 @@ import net.sourceforge.plantuml.graphic.USymbols;
public class DescriptionDiagram extends AbstractEntityDiagram { public class DescriptionDiagram extends AbstractEntityDiagram {
public DescriptionDiagram(UmlSource source, ISkinSimple skinParam) { public DescriptionDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.DESCRIPTION, skinParam); super(source, UmlDiagramType.DESCRIPTION, skinParam);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.descdiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator; import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore; import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
@ -69,7 +69,7 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap;
public class DescriptionDiagramFactory extends PSystemCommandFactory { public class DescriptionDiagramFactory extends PSystemCommandFactory {
@Override @Override
public DescriptionDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public DescriptionDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new DescriptionDiagram(source, skinParam); return new DescriptionDiagram(source, skinParam);
} }

View File

@ -64,7 +64,7 @@ public class CommandNewpage extends SingleLineCommand2<UmlDiagram> {
protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
final int dpi = diagram.getSkinParam().getDpi(); final int dpi = diagram.getSkinParam().getDpi();
final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSource(), final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSource(),
diagram.getSkinParam()); diagram.getSkinParam().values());
if (dpi != 96) if (dpi != 96)
emptyDiagram.setParam("dpi", "" + dpi); emptyDiagram.setParam("dpi", "" + dpi);

View File

@ -35,7 +35,8 @@
*/ */
package net.sourceforge.plantuml.eggs; package net.sourceforge.plantuml.eggs;
import net.sourceforge.plantuml.ISkinSimple; import java.util.Map;
import net.sourceforge.plantuml.api.PSystemFactory; import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -45,7 +46,7 @@ import net.sourceforge.plantuml.graphic.GraphicPosition;
public class PSystemWelcomeFactory implements PSystemFactory { public class PSystemWelcomeFactory implements PSystemFactory {
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
if (source.getTotalLineCount() == 2) if (source.getTotalLineCount() == 2)
return new PSystemWelcome(source, GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT); return new PSystemWelcome(source, GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT);

View File

@ -62,10 +62,11 @@ public class SpriteSvgNanoParser implements Sprite {
this.img = new UImage(new PixelImage(Objects.requireNonNull(img), AffineTransformType.TYPE_BILINEAR)); this.img = new UImage(new PixelImage(Objects.requireNonNull(img), AffineTransformType.TYPE_BILINEAR));
} }
public TextBlock asTextBlock(final HColor color, final double scale, final ColorMapper colorMapper) { public TextBlock asTextBlock(final HColor color, final double scale) {
return new AbstractTextBlock() { return new AbstractTextBlock() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final ColorMapper colorMapper = ug.getColorMapper();
if (colorMapper == ColorMapper.MONOCHROME) { if (colorMapper == ColorMapper.MONOCHROME) {
ug.draw(img.monochrome().scale(scale)); ug.draw(img.monochrome().scale(scale));
} else if (color == null) } else if (color == null)

View File

@ -337,7 +337,7 @@ public class SvgNanoParser implements Sprite {
} }
@Override @Override
public TextBlock asTextBlock(final HColor color, final double scale, final ColorMapper colorMapper) { public TextBlock asTextBlock(final HColor color, final double scale) {
final UImageSvg data = new UImageSvg(svgStart, scale); final UImageSvg data = new UImageSvg(svgStart, scale);
final double width = data.getWidth(); final double width = data.getWidth();

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.flowdiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -51,7 +51,7 @@ public class FlowDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public FlowDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public FlowDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new FlowDiagram(source); return new FlowDiagram(source);
} }

View File

@ -67,9 +67,9 @@ public class FtpConnexion {
} }
public synchronized void addIncoming(String fileName, String data) { public synchronized void addIncoming(String fileName, String data) {
if (fileName.startsWith("/")) { if (fileName.startsWith("/"))
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
incoming.put(fileName, data); incoming.put(fileName, data);
} }
@ -86,81 +86,74 @@ public class FtpConnexion {
} }
public synchronized boolean willExist(String fileName) { public synchronized boolean willExist(String fileName) {
if (incoming.containsKey(fileName)) { if (incoming.containsKey(fileName))
return true; return true;
}
if (outgoing.containsKey(fileName)) { if (outgoing.containsKey(fileName))
return true; return true;
}
if (futureOutgoing.contains(fileName)) { if (futureOutgoing.contains(fileName))
return true; return true;
}
return false; return false;
} }
public synchronized boolean doesExist(String fileName) { public synchronized boolean doesExist(String fileName) {
if (incoming.containsKey(fileName)) { if (incoming.containsKey(fileName))
return true; return true;
}
if (outgoing.containsKey(fileName)) { if (outgoing.containsKey(fileName))
return true; return true;
}
return false; return false;
} }
public synchronized byte[] getData(String fileName) throws InterruptedException { public synchronized byte[] getData(String fileName) throws InterruptedException {
if (fileName.startsWith("/")) { if (fileName.startsWith("/"))
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
final String data = incoming.get(fileName); final String data = incoming.get(fileName);
if (data != null) { if (data != null)
return data.getBytes(); return data.getBytes();
}
// do {
// if (willExist(fileName) == false) {
// return null;
// }
final byte data2[] = outgoing.get(fileName); final byte data2[] = outgoing.get(fileName);
if (data2 == null) { if (data2 == null)
return new byte[1]; return new byte[1];
}
// if (data2 != null) {
return data2; return data2;
// }
// Thread.sleep(200L);
// } while (true);
} }
public synchronized int getSize(String fileName) { public synchronized int getSize(String fileName) {
if (fileName.startsWith("/")) { if (fileName.startsWith("/"))
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
final String data = incoming.get(fileName); final String data = incoming.get(fileName);
if (data != null) { if (data != null)
return data.length(); return data.length();
}
final byte data2[] = outgoing.get(fileName); final byte data2[] = outgoing.get(fileName);
if (data2 != null) { if (data2 != null)
return data2.length; return data2.length;
}
return 0; return 0;
} }
public void processImage(String fileName) throws IOException { public void processImage(String fileName) throws IOException {
if (fileName.startsWith("/")) { if (fileName.startsWith("/"))
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
final String pngFileName = getFutureFileName(fileName); final String pngFileName = getFutureFileName(fileName);
boolean done = false; boolean done = false;
try { try {
final SourceStringReader sourceStringReader = new SourceStringReader(incoming.get(fileName)); final SourceStringReader sourceStringReader = new SourceStringReader(incoming.get(fileName));
final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final FileFormat format = getFileFormat(); final FileFormat format = getFileFormat();
final DiagramDescription desc = sourceStringReader.generateDiagramDescription(new FileFormatOption(format)); final FileFormatOption fileFormatOption = new FileFormatOption(format);
final DiagramDescription desc = sourceStringReader.generateDiagramDescription(fileFormatOption);
final List<BlockUml> blocks = sourceStringReader.getBlocks(); final List<BlockUml> blocks = sourceStringReader.getBlocks();
if (blocks.size() > 0) { if (blocks.size() > 0)
blocks.get(0).getDiagram().exportDiagram(baos, 0, new FileFormatOption(format)); blocks.get(0).getDiagram().exportDiagram(baos, 0, fileFormatOption);
}
final String errorFileName = pngFileName.substring(0, pngFileName.length() - 4) + ".err"; final String errorFileName = pngFileName.substring(0, pngFileName.length() - 4) + ".err";
synchronized (this) { synchronized (this) {
outgoing.remove(pngFileName); outgoing.remove(pngFileName);
@ -178,9 +171,9 @@ public class FtpConnexion {
} }
} }
} finally { } finally {
if (done == false) { if (done == false)
outgoing.put(pngFileName, new byte[0]); outgoing.put(pngFileName, new byte[0]);
}
} }
} }

View File

@ -36,8 +36,8 @@
package net.sourceforge.plantuml.gitlog; package net.sourceforge.plantuml.gitlog;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
@ -51,7 +51,7 @@ public class GitDiagramFactory extends PSystemAbstractFactory {
} }
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final GitTextArea textArea = new GitTextArea(); final GitTextArea textArea = new GitTextArea();
final Iterator<StringLocated> it = source.iterator2(); final Iterator<StringLocated> it = source.iterator2();

View File

@ -74,7 +74,7 @@ class SingleLine extends AbstractTextBlock implements Line {
final Sprite sprite = spriteContainer.getSprite(((SpriteCommand) cmd).getSprite()); final Sprite sprite = spriteContainer.getSprite(((SpriteCommand) cmd).getSprite());
if (sprite != null) if (sprite != null)
result.blocs result.blocs
.add(sprite.asTextBlock(fontConfiguration.getColor(), 1, spriteContainer.getColorMapper())); .add(sprite.asTextBlock(fontConfiguration.getColor(), 1));
} else if (cmd instanceof FontChange) { } else if (cmd instanceof FontChange) {
fontConfiguration = ((FontChange) cmd).apply(fontConfiguration); fontConfiguration = ((FontChange) cmd).apply(fontConfiguration);

View File

@ -38,8 +38,8 @@ package net.sourceforge.plantuml.hcl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
@ -57,7 +57,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory {
} }
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final List<String> highlighted = new ArrayList<>(); final List<String> highlighted = new ArrayList<>();
JsonValue data = null; JsonValue data = null;
StyleExtractor styleExtractor = null; StyleExtractor styleExtractor = null;

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.help;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.core.UmlSource;
public class HelpFactory extends PSystemCommandFactory { public class HelpFactory extends PSystemCommandFactory {
@Override @Override
public Help createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public Help createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new Help(source); return new Help(source);
} }

View File

@ -38,9 +38,9 @@ package net.sourceforge.plantuml.jsondiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
@ -57,7 +57,7 @@ public class JsonDiagramFactory extends PSystemAbstractFactory {
} }
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final List<String> highlighted = new ArrayList<>(); final List<String> highlighted = new ArrayList<>();
StyleExtractor styleExtractor = null; StyleExtractor styleExtractor = null;
JsonValue json; JsonValue json;

View File

@ -41,6 +41,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.BlockUml; import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader; import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.api.mda.option2.MDADiagram; import net.sourceforge.plantuml.api.mda.option2.MDADiagram;
import net.sourceforge.plantuml.api.mda.option2.MDAPackage; import net.sourceforge.plantuml.api.mda.option2.MDAPackage;

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.mindmap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.CommandRankDir;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
@ -69,7 +69,7 @@ public class MindMapDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public MindMapDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public MindMapDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new MindMapDiagram(source); return new MindMapDiagram(source);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.nwdiag;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
@ -53,7 +53,7 @@ public class NwDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public NwDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public NwDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new NwDiagram(source); return new NwDiagram(source);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.objectdiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -59,7 +59,7 @@ import net.sourceforge.plantuml.cucadiagram.NoteLinkStrategy;
public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram { public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram {
public AbstractClassOrObjectDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public AbstractClassOrObjectDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig); super(source, type, orig);
} }

View File

@ -223,9 +223,9 @@ public class PicoWebServer implements Runnable {
final String source = transcoder.decode(compressed); final String source = transcoder.decode(compressed);
final SourceStringReader ssr = new SourceStringReader(source); final SourceStringReader ssr = new SourceStringReader(source);
final FileFormatOption fileFormatOption = new FileFormatOption(format);
final List<BlockUml> blocks = ssr.getBlocks(); final List<BlockUml> blocks = ssr.getBlocks();
if (blocks.size() > 0) { if (blocks.size() > 0) {
final FileFormatOption fileFormatOption = new FileFormatOption(format);
final Diagram system = blocks.get(0).getDiagram(); final Diagram system = blocks.get(0).getDiagram();
final ByteArrayOutputStream os = new ByteArrayOutputStream(); final ByteArrayOutputStream os = new ByteArrayOutputStream();
final ImageData imageData = system.exportDiagram(os, 0, fileFormatOption); final ImageData imageData = system.exportDiagram(os, 0, fileFormatOption);

View File

@ -39,8 +39,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandNope; import net.sourceforge.plantuml.command.CommandNope;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
@ -165,7 +165,7 @@ public class GanttDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public GanttDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public GanttDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new GanttDiagram(source); return new GanttDiagram(source);
} }

View File

@ -47,7 +47,6 @@ import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.element.Element;
import net.sourceforge.plantuml.salt.element.WrappedElement; import net.sourceforge.plantuml.salt.element.WrappedElement;
import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public class Dictionary implements SpriteContainer, ISkinSimple { public class Dictionary implements SpriteContainer, ISkinSimple {
@ -106,11 +105,7 @@ public class Dictionary implements SpriteContainer, ISkinSimple {
return LineBreakStrategy.NONE; return LineBreakStrategy.NONE;
} }
public ColorMapper getColorMapper() { public void copyAllFrom(Map<String, String> other) {
return ColorMapper.IDENTITY;
}
public void copyAllFrom(ISkinSimple other) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.salt;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -66,7 +66,7 @@ public class PSystemSaltFactory2 extends PSystemCommandFactory {
} }
@Override @Override
public PSystemSalt createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public PSystemSalt createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
final PSystemSalt result = new PSystemSalt(source); final PSystemSalt result = new PSystemSalt(source);
if (getDiagramType() == DiagramType.SALT) { if (getDiagramType() == DiagramType.SALT) {
result.setIamSalt(true); result.setIamSalt(true);

View File

@ -51,7 +51,6 @@ import java.util.Stack;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
@ -94,7 +93,7 @@ public class SequenceDiagram extends UmlDiagram {
private final Rose skin2 = new Rose(); private final Rose skin2 = new Rose();
public SequenceDiagram(UmlSource source, ISkinSimple skinParam) { public SequenceDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.SEQUENCE, skinParam); super(source, UmlDiagramType.SEQUENCE, skinParam);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.sequencediagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -84,7 +84,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandUrl;
public class SequenceDiagramFactory extends PSystemCommandFactory { public class SequenceDiagramFactory extends PSystemCommandFactory {
@Override @Override
public SequenceDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public SequenceDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new SequenceDiagram(source, skinParam); return new SequenceDiagram(source, skinParam);
} }

View File

@ -37,9 +37,9 @@ package net.sourceforge.plantuml.sprite;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Map;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.awt.geom.XDimension2D; import net.sourceforge.plantuml.awt.geom.XDimension2D;
@ -61,7 +61,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColors;
public class ListSpriteDiagram extends UmlDiagram { public class ListSpriteDiagram extends UmlDiagram {
public ListSpriteDiagram(UmlSource source, ISkinSimple skinParam) { public ListSpriteDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.HELP, skinParam); super(source, UmlDiagramType.HELP, skinParam);
} }
@ -92,7 +92,7 @@ public class ListSpriteDiagram extends UmlDiagram {
final Sprite sprite = getSkinParam().getSprite(n); final Sprite sprite = getSkinParam().getSprite(n);
TextBlock blockName = Display.create(n).create(FontConfiguration.blackBlueTrue(UFont.sansSerif(14)), TextBlock blockName = Display.create(n).create(FontConfiguration.blackBlueTrue(UFont.sansSerif(14)),
HorizontalAlignment.LEFT, getSkinParam()); HorizontalAlignment.LEFT, getSkinParam());
TextBlock tb = sprite.asTextBlock(HColors.BLACK, 1.0, getSkinParam().getColorMapper()); TextBlock tb = sprite.asTextBlock(HColors.BLACK, 1.0);
tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER); tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(x, y))); tb.drawU(ug.apply(new UTranslate(x, y)));
final XDimension2D dim = tb.calculateDimension(ug.getStringBounder()); final XDimension2D dim = tb.calculateDimension(ug.getStringBounder());

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.sprite;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -57,7 +57,7 @@ public class ListSpriteDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public ListSpriteDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public ListSpriteDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ListSpriteDiagram(source, skinParam); return new ListSpriteDiagram(source, skinParam);
} }

View File

@ -36,11 +36,10 @@
package net.sourceforge.plantuml.sprite; package net.sourceforge.plantuml.sprite;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
public interface Sprite { public interface Sprite {
public TextBlock asTextBlock(final HColor color, double scale, ColorMapper colorMapper); public TextBlock asTextBlock(final HColor color, double scale);
} }

View File

@ -123,7 +123,7 @@ public class SpriteColor implements Sprite {
return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
} }
public TextBlock asTextBlock(final HColor color, final double scale, ColorMapper colorMapper) { public TextBlock asTextBlock(final HColor color, final double scale) {
return new AbstractTextBlock() { return new AbstractTextBlock() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {

View File

@ -61,10 +61,11 @@ public class SpriteImage implements Sprite {
this.img = new UImage(new PixelImage(Objects.requireNonNull(img), AffineTransformType.TYPE_BILINEAR)); this.img = new UImage(new PixelImage(Objects.requireNonNull(img), AffineTransformType.TYPE_BILINEAR));
} }
public TextBlock asTextBlock(final HColor color, final double scale, final ColorMapper colorMapper) { public TextBlock asTextBlock(final HColor color, final double scale) {
return new AbstractTextBlock() { return new AbstractTextBlock() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final ColorMapper colorMapper = ug.getColorMapper();
if (colorMapper == ColorMapper.MONOCHROME) if (colorMapper == ColorMapper.MONOCHROME)
ug.draw(img.monochrome().scale(scale)); ug.draw(img.monochrome().scale(scale));
else if (color == null) else if (color == null)

View File

@ -211,7 +211,7 @@ public class SpriteMonochrome implements Sprite {
return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
} }
public TextBlock asTextBlock(final HColor color, final double scale, ColorMapper colorMapper) { public TextBlock asTextBlock(final HColor color, final double scale) {
return new AbstractTextBlock() { return new AbstractTextBlock() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {

View File

@ -41,7 +41,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UImageSvg; import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
public class SpriteSvg implements Sprite { public class SpriteSvg implements Sprite {
@ -52,7 +51,7 @@ public class SpriteSvg implements Sprite {
this.svg = svg; this.svg = svg;
} }
public TextBlock asTextBlock(final HColor color, final double scale, ColorMapper colorMapper) { public TextBlock asTextBlock(final HColor color, final double scale) {
final UImageSvg img = new UImageSvg(svg, scale); final UImageSvg img = new UImageSvg(svg, scale);
return new AbstractTextBlock() { return new AbstractTextBlock() {

View File

@ -38,9 +38,9 @@ package net.sourceforge.plantuml.sprite;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.WithSprite; import net.sourceforge.plantuml.WithSprite;
@ -73,7 +73,7 @@ public class StdlibDiagram extends UmlDiagram {
private static final int WIDTH = 1800; private static final int WIDTH = 1800;
private String name; private String name;
public StdlibDiagram(UmlSource source, ISkinSimple skinParam) { public StdlibDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.HELP, skinParam); super(source, UmlDiagramType.HELP, skinParam);
} }
@ -142,7 +142,7 @@ public class StdlibDiagram extends UmlDiagram {
final Sprite sprite = getSkinParam().getSprite(n); final Sprite sprite = getSkinParam().getSprite(n);
TextBlock blockName = Display.create(n).create(FontConfiguration.blackBlueTrue(UFont.sansSerif(14)), TextBlock blockName = Display.create(n).create(FontConfiguration.blackBlueTrue(UFont.sansSerif(14)),
HorizontalAlignment.LEFT, getSkinParam()); HorizontalAlignment.LEFT, getSkinParam());
TextBlock tb = sprite.asTextBlock(getBlack(), 1.0, getSkinParam().getColorMapper()); TextBlock tb = sprite.asTextBlock(getBlack(), 1.0);
tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER); tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(x, y))); tb.drawU(ug.apply(new UTranslate(x, y)));
final XDimension2D dim = tb.calculateDimension(ug.getStringBounder()); final XDimension2D dim = tb.calculateDimension(ug.getStringBounder());

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.sprite;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -54,7 +54,7 @@ public class StdlibDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public StdlibDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public StdlibDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new StdlibDiagram(source, skinParam); return new StdlibDiagram(source, skinParam);
} }

View File

@ -35,9 +35,9 @@
*/ */
package net.sourceforge.plantuml.statediagram; package net.sourceforge.plantuml.statediagram;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -58,7 +58,7 @@ public class StateDiagram extends AbstractEntityDiagram {
private static final String CONCURRENT_PREFIX = "CONC"; private static final String CONCURRENT_PREFIX = "CONC";
public StateDiagram(UmlSource source, ISkinSimple skinParam) { public StateDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.STATE, skinParam); super(source, UmlDiagramType.STATE, skinParam);
// setNamespaceSeparator(null); // setNamespaceSeparator(null);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.statediagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator; import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore; import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
@ -66,7 +66,7 @@ import net.sourceforge.plantuml.statediagram.command.CommandLinkStateReverse;
public class StateDiagramFactory extends PSystemCommandFactory { public class StateDiagramFactory extends PSystemCommandFactory {
@Override @Override
public StateDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public StateDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new StateDiagram(source, skinParam); return new StateDiagram(source, skinParam);
} }

View File

@ -55,7 +55,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.USymbols;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;

View File

@ -75,7 +75,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
private GeneralImageBuilder createDotDataImageBuilder(DotMode dotMode, StringBounder stringBounder) { private GeneralImageBuilder createDotDataImageBuilder(DotMode dotMode, StringBounder stringBounder) {
final DotData dotData = new DotData(diagram.getEntityFactory().getRootGroup(), getOrderedLinks(), final DotData dotData = new DotData(diagram.getEntityFactory().getRootGroup(), getOrderedLinks(),
diagram.getLeafsvalues(), diagram.getUmlDiagramType(), diagram.getSkinParam(), diagram, diagram, diagram.getLeafsvalues(), diagram.getUmlDiagramType(), diagram.getSkinParam(), diagram, diagram,
diagram.getColorMapper(), diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(), dotMode, diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(), dotMode,
diagram.getNamespaceSeparator(), diagram.getPragma()); diagram.getNamespaceSeparator(), diagram.getPragma());
final boolean intricated = diagram.mergeIntricated(); final boolean intricated = diagram.mergeIntricated();
return new GeneralImageBuilder(intricated, dotData, diagram.getEntityFactory(), diagram.getSource(), return new GeneralImageBuilder(intricated, dotData, diagram.getEntityFactory(), diagram.getSource(),

View File

@ -63,7 +63,6 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersions;
import net.sourceforge.plantuml.cucadiagram.dot.ProcessState; import net.sourceforge.plantuml.cucadiagram.dot.ProcessState;
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.posimo.Moveable; import net.sourceforge.plantuml.posimo.Moveable;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.vizjs.GraphvizJs; import net.sourceforge.plantuml.vizjs.GraphvizJs;

View File

@ -127,8 +127,8 @@ public final class GroupPngMakerActivity {
final ISkinParam skinParam = diagram.getSkinParam(); final ISkinParam skinParam = diagram.getSkinParam();
final DotData dotData = new DotData(group, links, group.getLeafsDirect(), diagram.getUmlDiagramType(), final DotData dotData = new DotData(group, links, group.getLeafsDirect(), diagram.getUmlDiagramType(),
skinParam, new InnerGroupHierarchy(), diagram.getColorMapper(), diagram.getEntityFactory(), false, skinParam, new InnerGroupHierarchy(), diagram.getEntityFactory(), false, DotMode.NORMAL,
DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma()); diagram.getNamespaceSeparator(), diagram.getPragma());
final GeneralImageBuilder svek2 = new GeneralImageBuilder(false, dotData, diagram.getEntityFactory(), final GeneralImageBuilder svek2 = new GeneralImageBuilder(false, dotData, diagram.getEntityFactory(),
diagram.getSource(), diagram.getPragma(), stringBounder, SName.activityDiagram); diagram.getSource(), diagram.getPragma(), stringBounder, SName.activityDiagram);

View File

@ -123,7 +123,8 @@ public final class GroupPngMakerState {
final ISkinParam skinParam = diagram.getSkinParam(); final ISkinParam skinParam = diagram.getSkinParam();
final Style style = EntityImageStateCommon.getStyleState(group, skinParam); final Style style = EntityImageStateCommon.getStyleState(group, skinParam);
// final Style styleHeader = EntityImageStateCommon.getStyleStateHeader(group, skinParam); // final Style styleHeader = EntityImageStateCommon.getStyleStateHeader(group,
// skinParam);
final Style styleTitle = EntityImageStateCommon.getStyleStateTitle(group, skinParam); final Style styleTitle = EntityImageStateCommon.getStyleStateTitle(group, skinParam);
final Style styleBody = EntityImageStateCommon.getStyleStateBody(group, skinParam); final Style styleBody = EntityImageStateCommon.getStyleStateBody(group, skinParam);
@ -139,7 +140,7 @@ public final class GroupPngMakerState {
final List<Link> links = getPureInnerLinks(); final List<Link> links = getPureInnerLinks();
final DotData dotData = new DotData(group, links, group.getLeafsDirect(), diagram.getUmlDiagramType(), final DotData dotData = new DotData(group, links, group.getLeafsDirect(), diagram.getUmlDiagramType(),
skinParam, new InnerGroupHierarchy(), diagram.getColorMapper(), diagram.getEntityFactory(), skinParam, new InnerGroupHierarchy(), diagram.getEntityFactory(),
diagram.isHideEmptyDescriptionForState(), DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.isHideEmptyDescriptionForState(), DotMode.NORMAL, diagram.getNamespaceSeparator(),
diagram.getPragma()); diagram.getPragma());

View File

@ -59,7 +59,6 @@ import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ClusterDecoration; import net.sourceforge.plantuml.svek.ClusterDecoration;

View File

@ -53,7 +53,6 @@ import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
public abstract class EntityImageStateCommon extends AbstractEntityImage { public abstract class EntityImageStateCommon extends AbstractEntityImage {

View File

@ -41,6 +41,8 @@ import java.util.List;
import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.BlockUml; import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.LineLocationImpl; import net.sourceforge.plantuml.LineLocationImpl;
import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.OptionFlags;
@ -78,7 +80,7 @@ public class SyntaxChecker {
return result; return result;
} }
final SourceStringReader sourceStringReader = new SourceStringReader(Defines.createEmpty(), source, final SourceStringReader sourceStringReader = new SourceStringReader(Defines.createEmpty(), source,
Collections.<String> emptyList()); Collections.<String>emptyList());
final List<BlockUml> blocks = sourceStringReader.getBlocks(); final List<BlockUml> blocks = sourceStringReader.getBlocks();
if (blocks.size() == 0) { if (blocks.size() == 0) {
@ -97,9 +99,9 @@ public class SyntaxChecker {
final PSystemError sys = (PSystemError) system; final PSystemError sys = (PSystemError) system;
result.setLineLocation(sys.getLineLocation()); result.setLineLocation(sys.getLineLocation());
result.setSystemError(sys); result.setSystemError(sys);
for (ErrorUml er : sys.getErrorsUml()) { for (ErrorUml er : sys.getErrorsUml())
result.addErrorText(er.getError()); result.addErrorText(er.getError());
}
} else { } else {
result.setDescription(system.getDescription().getDescription()); result.setDescription(system.getDescription().getDescription());
} }
@ -109,7 +111,7 @@ public class SyntaxChecker {
public static SyntaxResult checkSyntaxFair(String source) { public static SyntaxResult checkSyntaxFair(String source) {
final SyntaxResult result = new SyntaxResult(); final SyntaxResult result = new SyntaxResult();
final SourceStringReader sourceStringReader = new SourceStringReader(Defines.createEmpty(), source, final SourceStringReader sourceStringReader = new SourceStringReader(Defines.createEmpty(), source,
Collections.<String> emptyList()); Collections.<String>emptyList());
final List<BlockUml> blocks = sourceStringReader.getBlocks(); final List<BlockUml> blocks = sourceStringReader.getBlocks();
if (blocks.size() == 0) { if (blocks.size() == 0) {

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.timingdiagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
@ -69,7 +69,7 @@ import net.sourceforge.plantuml.timingdiagram.command.CommandUseDateFormat;
public class TimingDiagramFactory extends PSystemCommandFactory { public class TimingDiagramFactory extends PSystemCommandFactory {
@Override @Override
public TimingDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public TimingDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new TimingDiagram(source); return new TimingDiagram(source);
} }

View File

@ -109,7 +109,7 @@ public class ImageBuilder {
private Animation animation; private Animation animation;
private boolean annotations; private boolean annotations;
private HColor backcolor = getDefaultHBackColor(); private HColor backcolor = getDefaultHBackColor();
private ColorMapper colorMapper; // private ColorMapper colorMapper;
private XDimension2D dimension; private XDimension2D dimension;
private final FileFormatOption fileFormatOption; private final FileFormatOption fileFormatOption;
private UDrawable udrawable; private UDrawable udrawable;
@ -138,9 +138,6 @@ public class ImageBuilder {
private ImageBuilder(FileFormatOption fileFormatOption) { private ImageBuilder(FileFormatOption fileFormatOption) {
this.fileFormatOption = fileFormatOption; this.fileFormatOption = fileFormatOption;
this.stringBounder = fileFormatOption.getDefaultStringBounder(SvgCharSizeHack.NO_HACK); this.stringBounder = fileFormatOption.getDefaultStringBounder(SvgCharSizeHack.NO_HACK);
this.colorMapper = fileFormatOption.getColorMapper();
if (this.colorMapper == null)
throw new IllegalArgumentException();
} }
public ImageBuilder annotations(boolean annotations) { public ImageBuilder annotations(boolean annotations) {
@ -220,7 +217,6 @@ public class ImageBuilder {
animation = diagram.getAnimation(); animation = diagram.getAnimation();
annotations = true; annotations = true;
backcolor = diagram.calculateBackColor(); backcolor = diagram.calculateBackColor();
colorMapper = skinParam.getColorMapper();
margin = calculateMargin(diagram); margin = calculateMargin(diagram);
metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null; metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null;
seed = diagram.seed(); seed = diagram.seed();
@ -243,7 +239,7 @@ public class ImageBuilder {
case ANIMATED_GIF: case ANIMATED_GIF:
return writeImageAnimatedGif(os); return writeImageAnimatedGif(os);
default: default:
return writeImageInternal(fileFormatOption, os, animation); return writeImageInternal(os, animation);
} }
} }
@ -254,8 +250,7 @@ public class ImageBuilder {
} }
} }
private ImageData writeImageInternal(FileFormatOption fileFormatOption, OutputStream os, Animation animationArg) private ImageData writeImageInternal(OutputStream os, Animation animationArg) throws IOException {
throws IOException {
XDimension2D dim = getFinalDimension(); XDimension2D dim = getFinalDimension();
double dx = 0; double dx = 0;
double dy = 0; double dy = 0;
@ -272,7 +267,7 @@ public class ImageBuilder {
if (scaleFactor <= 0) if (scaleFactor <= 0)
throw new IllegalStateException("Bad scaleFactor"); throw new IllegalStateException("Bad scaleFactor");
UGraphic ug = createUGraphic(fileFormatOption, dim, animationArg, dx, dy, scaleFactor, UGraphic ug = createUGraphic(dim, animationArg, dx, dy, scaleFactor,
titledDiagram == null ? new Pragma() : titledDiagram.getPragma()); titledDiagram == null ? new Pragma() : titledDiagram.getPragma());
maybeDrawBorder(ug, dim); maybeDrawBorder(ug, dim);
if (randomPixel) if (randomPixel)
@ -396,16 +391,17 @@ public class ImageBuilder {
private Image getAviImage(AffineTransformation affineTransform) throws IOException { private Image getAviImage(AffineTransformation affineTransform) throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayOutputStream baos = new ByteArrayOutputStream();
writeImageInternal(new FileFormatOption(FileFormat.PNG), baos, Animation.singleton(affineTransform)); writeImageInternal(baos, Animation.singleton(affineTransform));
baos.close(); baos.close();
return SImageIO.read(baos.toByteArray()); return SImageIO.read(baos.toByteArray());
} }
private UGraphic createUGraphic(FileFormatOption option, final XDimension2D dim, Animation animationArg, double dx, private UGraphic createUGraphic(final XDimension2D dim, Animation animationArg, double dx, double dy,
double dy, double scaleFactor, Pragma pragma) { double scaleFactor, Pragma pragma) {
switch (option.getFileFormat()) { final ColorMapper colorMapper = fileFormatOption.getColorMapper();
switch (fileFormatOption.getFileFormat()) {
case PNG: case PNG:
return createUGraphicPNG(scaleFactor, dim, animationArg, dx, dy, option.getWatermark()); return createUGraphicPNG(scaleFactor, dim, animationArg, dx, dy, fileFormatOption.getWatermark());
case SVG: case SVG:
final boolean interactive = "true".equalsIgnoreCase(pragma.getValue("svginteractive")); final boolean interactive = "true".equalsIgnoreCase(pragma.getValue("svginteractive"));
return createUGraphicSVG(scaleFactor, dim, interactive); return createUGraphicSVG(scaleFactor, dim, interactive);
@ -430,7 +426,7 @@ public class ImageBuilder {
return new UGraphicDebug(scaleFactor, dim, getSvgLinkTarget(), getHoverPathColorRGB(), seed, return new UGraphicDebug(scaleFactor, dim, getSvgLinkTarget(), getHoverPathColorRGB(), seed,
getPreserveAspectRatio()); getPreserveAspectRatio());
default: default:
throw new UnsupportedOperationException(option.getFileFormat().toString()); throw new UnsupportedOperationException(fileFormatOption.getFileFormat().toString());
} }
} }
@ -440,8 +436,9 @@ public class ImageBuilder {
final String preserveAspectRatio = getPreserveAspectRatio(); final String preserveAspectRatio = getPreserveAspectRatio();
final boolean svgDimensionStyle = skinParam == null || skinParam.svgDimensionStyle(); final boolean svgDimensionStyle = skinParam == null || skinParam.svgDimensionStyle();
final String svgLinkTarget = getSvgLinkTarget(); final String svgLinkTarget = getSvgLinkTarget();
final UGraphicSvg ug = new UGraphicSvg(backcolor, svgDimensionStyle, dim, colorMapper, false, scaleFactor, final UGraphicSvg ug = new UGraphicSvg(backcolor, svgDimensionStyle, dim, fileFormatOption.getColorMapper(),
svgLinkTarget, hoverPathColorRGB, seed, preserveAspectRatio, stringBounder, lengthAdjust, interactive); false, scaleFactor, svgLinkTarget, hoverPathColorRGB, seed, preserveAspectRatio, stringBounder,
lengthAdjust, interactive);
return ug; return ug;
} }
@ -451,7 +448,7 @@ public class ImageBuilder {
Color pngBackColor = new Color(0, 0, 0, 0); Color pngBackColor = new Color(0, 0, 0, 0);
if (this.backcolor instanceof HColorSimple) if (this.backcolor instanceof HColorSimple)
pngBackColor = this.backcolor.toColor(colorMapper); pngBackColor = this.backcolor.toColor(fileFormatOption.getColorMapper());
if (OptionFlags.getInstance().isReplaceWhiteBackgroundByTransparent() && Color.WHITE.equals(pngBackColor)) if (OptionFlags.getInstance().isReplaceWhiteBackgroundByTransparent() && Color.WHITE.equals(pngBackColor))
pngBackColor = new Color(0, 0, 0, 0); pngBackColor = new Color(0, 0, 0, 0);
@ -460,8 +457,8 @@ public class ImageBuilder {
(int) (dim.getHeight() * scaleFactor), pngBackColor, stringBounder); (int) (dim.getHeight() * scaleFactor), pngBackColor, stringBounder);
final Graphics2D graphics2D = builder.getGraphics2D(); final Graphics2D graphics2D = builder.getGraphics2D();
final UGraphicG2d ug = new UGraphicG2d(backcolor, colorMapper, stringBounder, graphics2D, scaleFactor, final UGraphicG2d ug = new UGraphicG2d(backcolor, fileFormatOption.getColorMapper(), stringBounder, graphics2D,
affineTransforms == null ? null : affineTransforms.getFirst(), dx, dy); scaleFactor, affineTransforms == null ? null : affineTransforms.getFirst(), dx, dy);
ug.setBufferedImage(builder.getBufferedImage()); ug.setBufferedImage(builder.getBufferedImage());
final BufferedImage im = ug.getBufferedImage(); final BufferedImage im = ug.getBufferedImage();
if (this.backcolor instanceof HColorGradient) if (this.backcolor instanceof HColorGradient)
@ -481,7 +478,7 @@ public class ImageBuilder {
} else if (skinParam != null) { } else if (skinParam != null) {
final HColor color = skinParam.hoverPathColor(); final HColor color = skinParam.hoverPathColor();
if (color != null) if (color != null)
return color.toRGB(colorMapper); return color.toRGB(fileFormatOption.getColorMapper());
} }
return null; return null;

View File

@ -34,8 +34,6 @@
*/ */
package net.sourceforge.plantuml.ugraphic.color; package net.sourceforge.plantuml.ugraphic.color;
import java.awt.Color;
class HColorScheme extends HColor { class HColorScheme extends HColor {
private final HColor colorForLight; private final HColor colorForLight;

View File

@ -81,7 +81,7 @@ public class Version {
} }
public static int beta() { public static int beta() {
final int beta = 8; final int beta = 9;
return beta; return beta;
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.wbs;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -63,7 +63,7 @@ public class WBSDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public WBSDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public WBSDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new WBSDiagram(source); return new WBSDiagram(source);
} }

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.wire;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -68,7 +68,7 @@ public class WireDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public WireDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public WireDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new WireDiagram(source); return new WireDiagram(source);
} }

View File

@ -38,8 +38,8 @@ package net.sourceforge.plantuml.yaml;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
@ -61,7 +61,7 @@ public class YamlDiagramFactory extends PSystemAbstractFactory {
} }
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final List<String> highlighted = new ArrayList<>(); final List<String> highlighted = new ArrayList<>();
JsonValue yaml = null; JsonValue yaml = null;
StyleExtractor styleExtractor = null; StyleExtractor styleExtractor = null;

View File

@ -53,7 +53,7 @@ class SkinParamTest {
assertThat(skinParam.colorArrowSeparationSpace()).isZero(); assertThat(skinParam.colorArrowSeparationSpace()).isZero();
assertThat(skinParam.getColorMapper()).isEqualTo(ColorMapper.IDENTITY); // assertThat(skinParam.getColorMapper()).isEqualTo(ColorMapper.IDENTITY);
assertThat(skinParam.componentStyle()).isEqualTo(ComponentStyle.UML2); assertThat(skinParam.componentStyle()).isEqualTo(ComponentStyle.UML2);