Commit e4b3358f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1442-export-to-image' into 'devel_15.1.x'

neutral color is used in color extractor

See merge request !1264
parents 397db307 0cd0989f
Pipeline #36169 passed with stage
in 17 minutes and 40 seconds
......@@ -19,7 +19,7 @@ import lcsb.mapviewer.model.map.species.*;
public class ColorModelCommandTest extends CommandTestFunctions {
Logger logger = LogManager.getLogger(ColorModelCommandTest.class);
ColorExtractor colorExtractor = new ColorExtractor(Color.RED, Color.GREEN, Color.BLUE);
ColorExtractor colorExtractor = new ColorExtractor(Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
@Before
public void setUp() throws Exception {
......
......@@ -373,7 +373,7 @@ public class LayoutService implements ILayoutService {
Collection<ColorSchema> schemas = createColorSchemaCollection(layoutId);
// colors here are not important
ColorModelCommand command = new ColorModelCommand(model, schemas,
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK));
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK, Color.WHITE));
List<Pair<Element, ColorSchema>> result = new ArrayList<>();
for (Map.Entry<BioEntity, ColorSchema> entry : command.getModifiedElements().entrySet()) {
if (entry.getKey() instanceof Element) {
......@@ -393,7 +393,7 @@ public class LayoutService implements ILayoutService {
Collection<ColorSchema> schemas = createColorSchemaCollection(layoutId);
// colors here are not important
ColorModelCommand command = new ColorModelCommand(model, schemas,
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK));
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK, Color.WHITE));
List<Pair<Reaction, ColorSchema>> result = new ArrayList<>();
for (Map.Entry<BioEntity, ColorSchema> entry : command.getModifiedElements().entrySet()) {
if (entry.getKey() instanceof Reaction) {
......@@ -413,7 +413,7 @@ public class LayoutService implements ILayoutService {
Collection<ColorSchema> schemas = createColorSchemaCollection(layoutId);
// colors here are not important
ColorModelCommand command = new ColorModelCommand(model, schemas,
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK));
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK, Color.WHITE));
return command.getModifiedElements();
} catch (InvalidColorSchemaException | IOException e) {
throw new InvalidStateException(e);
......@@ -426,7 +426,7 @@ public class LayoutService implements ILayoutService {
Collection<ColorSchema> schemas = createColorSchemaCollection(layoutId);
// colors here are not important
ColorModelCommand command = new ColorModelCommand(model, schemas,
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK));
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK, Color.WHITE));
for (Map.Entry<BioEntity, ColorSchema> entry : command.getModifiedElements().entrySet()) {
if (entry.getKey() instanceof Element) {
......@@ -448,7 +448,7 @@ public class LayoutService implements ILayoutService {
Collection<ColorSchema> schemas = createColorSchemaCollection(layoutId);
// colors here are not important
ColorModelCommand command = new ColorModelCommand(model, schemas,
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK));
new ColorExtractor(Color.BLACK, Color.BLACK, Color.BLACK, Color.WHITE));
for (Map.Entry<BioEntity, ColorSchema> entry : command.getModifiedElements().entrySet()) {
if (entry.getKey() instanceof Reaction) {
......
......@@ -137,12 +137,14 @@ public class UserService implements IUserService {
Color colorMin = null;
Color colorMax = null;
Color colorSimple = null;
Color colorNeutral = null;
if (loggedUser != null) {
User dbUser = getUserByLogin(loggedUser.getLogin());
if (dbUser != null) {
colorMin = dbUser.getMinColor();
colorMax = dbUser.getMaxColor();
colorSimple = dbUser.getSimpleColor();
colorNeutral = dbUser.getNeutralColor();
}
}
ColorParser parser = new ColorParser();
......@@ -156,7 +158,10 @@ public class UserService implements IUserService {
if (colorSimple == null) {
colorSimple = parser.parse(configurationService.getConfigurationValue(ConfigurationElementType.SIMPLE_COLOR_VAL));
}
return new ColorExtractor(colorMin, colorMax, colorSimple);
if (colorNeutral== null) {
colorNeutral = parser.parse(configurationService.getConfigurationValue(ConfigurationElementType.NEUTRAL_COLOR_VAL));
}
return new ColorExtractor(colorMin, colorMax, colorSimple, colorNeutral);
}
@Override
......
......@@ -50,7 +50,7 @@ public class LayoutServiceTest extends ServiceTestFunctions {
@Autowired
ILayoutService layoutService;
ColorExtractor colorExtractor = new ColorExtractor(Color.RED, Color.GREEN, Color.BLUE);
private ColorExtractor colorExtractor = new ColorExtractor(Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
private User user, user2;
......
......@@ -191,7 +191,7 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
@Test
public void testColoring3() throws Exception {
ColorExtractor colorExtractor = new ColorExtractor(Color.RED, Color.GREEN, Color.BLUE);
ColorExtractor colorExtractor = new ColorExtractor(Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
Model model = getModelForFile("testFiles/coloring/protein_to_color.xml", false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment