Skip to content
Snippets Groups Projects
Commit 20aaee78 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '130-semantic-zoom' into 'master'

Basic semantic zooming functionality

See merge request !25
parents 09b90670 003c0204
No related branches found
No related tags found
1 merge request!25Basic semantic zooming functionality
Showing
with 473 additions and 160 deletions
...@@ -4,7 +4,6 @@ import java.io.BufferedReader; ...@@ -4,7 +4,6 @@ import java.io.BufferedReader;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.ConnectException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
...@@ -85,8 +84,8 @@ public class WebPageDownloader { ...@@ -85,8 +84,8 @@ public class WebPageDownloader {
urlConn.setRequestMethod("GET"); urlConn.setRequestMethod("GET");
urlConn.addRequestProperty("User-Agent", "minerva-framework"); urlConn.addRequestProperty("User-Agent", "minerva-framework");
try { try {
urlConn.connect(); urlConn.connect();
code = urlConn.getResponseCode(); code = urlConn.getResponseCode();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
code = HttpURLConnection.HTTP_NOT_FOUND; code = HttpURLConnection.HTTP_NOT_FOUND;
} catch (IOException e) { } catch (IOException e) {
......
...@@ -67,6 +67,10 @@ public final class Configuration { ...@@ -67,6 +67,10 @@ public final class Configuration {
* Where the main webpgae is located. * Where the main webpgae is located.
*/ */
public static final String MAIN_PAGE = "/index.xhtml"; public static final String MAIN_PAGE = "/index.xhtml";
/**
* Name of the cookie for authentication token.
*/
public static final String AUTH_TOKEN = "MINERVA_AUTH_TOKEN"; public static final String AUTH_TOKEN = "MINERVA_AUTH_TOKEN";
/** /**
......
...@@ -5,6 +5,8 @@ import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerSpecies ...@@ -5,6 +5,8 @@ import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerSpecies
import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.AnnotatedObject;
import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.Species;
/** /**
* Describes structural information that appears in the cell designer notes. * Describes structural information that appears in the cell designer notes.
...@@ -116,7 +118,12 @@ public enum NoteField { ...@@ -116,7 +118,12 @@ public enum NoteField {
/** /**
* {@link Species#charge}. * {@link Species#charge}.
*/ */
CHARGE("Charge", CellDesignerSpecies.class, null); // CHARGE("Charge", CellDesignerSpecies.class, null), //
/**
* {@link Element#getSemanticZoomLevelVisibility()}.
*/
SEMANTIC_ZOOM_LEVEL_VISIBILITY("SemanticZoomLevelVisibility", AnnotatedObject.class, null); //
/** /**
* Name used in the notes to distinguish fields. * Name used in the notes to distinguish fields.
......
...@@ -562,6 +562,28 @@ public class RestAnnotationParser extends XmlParser { ...@@ -562,6 +562,28 @@ public class RestAnnotationParser extends XmlParser {
} }
} }
/**
* Assigns semanticZoomingLevel to the element from notes string.
*
* @param element
* element to which data should be put to
* @param annotationString
* notes string
*/
private void setSemanticZoomLevelVisibility(AnnotatedObject element, String annotationString) {
String zoomLevelVisibility = getParamByPrefix(annotationString, NoteField.SEMANTIC_ZOOM_LEVEL_VISIBILITY.getCommonName() + ":");
if (zoomLevelVisibility == null) {
return;
}
if (element.getSemanticZoomLevelVisibility() == null) {
element.setSemanticZoomLevelVisibility(zoomLevelVisibility);
} else if (!element.getSemanticZoomLevelVisibility().equals(zoomLevelVisibility)) {
logger.warn(
elementUtils.getElementTag(element) + " New " + NoteField.SEMANTIC_ZOOM_LEVEL_VISIBILITY.getCommonName() + " different than default ["
+ zoomLevelVisibility + "][" + element.getSemanticZoomLevelVisibility() + "]. Ignoring.");
}
}
/** /**
* Assigns notes to the element from notes string. This might look strange. * Assigns notes to the element from notes string. This might look strange.
* The idea is that sometimes we have notes from more then one source. And the * The idea is that sometimes we have notes from more then one source. And the
...@@ -620,6 +642,7 @@ public class RestAnnotationParser extends XmlParser { ...@@ -620,6 +642,7 @@ public class RestAnnotationParser extends XmlParser {
setNotes(object, ann); setNotes(object, ann);
setSymbol(object, ann); setSymbol(object, ann);
setSynonyms(object, ann); setSynonyms(object, ann);
setSemanticZoomLevelVisibility(object, ann);
setAbbreviation(object, ann); setAbbreviation(object, ann);
setFormula(object, ann); setFormula(object, ann);
if (object instanceof Reaction) { if (object instanceof Reaction) {
......
...@@ -417,6 +417,18 @@ public class RestAnnotationParserTest extends CellDesignerTestFunctions { ...@@ -417,6 +417,18 @@ public class RestAnnotationParserTest extends CellDesignerTestFunctions {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override
public void setSemanticZoomLevelVisibility(String zoomLevelVisibility) {
// TODO Auto-generated method stub
}
@Override
public String getSemanticZoomLevelVisibility() {
// TODO Auto-generated method stub
return null;
}
}); });
fail("Exception expected"); fail("Exception expected");
} catch (NotImplementedException e) { } catch (NotImplementedException e) {
......
...@@ -27,7 +27,7 @@ import org.sbgn.bindings.Sbgn; ...@@ -27,7 +27,7 @@ import org.sbgn.bindings.Sbgn;
import lcsb.mapviewer.common.comparator.DoubleComparator; import lcsb.mapviewer.common.comparator.DoubleComparator;
import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.converter.graphics.reaction.ReactionConverter; import lcsb.mapviewer.converter.graphics.bioEntity.reaction.ReactionConverter;
import lcsb.mapviewer.model.graphics.ArrowType; import lcsb.mapviewer.model.graphics.ArrowType;
import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.Model;
......
...@@ -28,7 +28,7 @@ import lcsb.mapviewer.common.comparator.DoubleComparator; ...@@ -28,7 +28,7 @@ import lcsb.mapviewer.common.comparator.DoubleComparator;
import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.InvalidInputDataExecption; import lcsb.mapviewer.converter.InvalidInputDataExecption;
import lcsb.mapviewer.converter.graphics.species.SpeciesConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.SpeciesConverter;
import lcsb.mapviewer.converter.model.celldesigner.types.ModifierType; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierType;
import lcsb.mapviewer.converter.model.celldesigner.types.ModifierTypeUtils; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierTypeUtils;
import lcsb.mapviewer.converter.model.sbgnml.structures.Process; import lcsb.mapviewer.converter.model.sbgnml.structures.Process;
......
...@@ -16,8 +16,8 @@ import org.apache.log4j.Logger; ...@@ -16,8 +16,8 @@ import org.apache.log4j.Logger;
import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.commands.ColorExtractor;
import lcsb.mapviewer.common.MimeType; import lcsb.mapviewer.common.MimeType;
import lcsb.mapviewer.converter.graphics.bioEntity.BioEntityConverterImpl;
import lcsb.mapviewer.converter.graphics.layer.LayerConverter; import lcsb.mapviewer.converter.graphics.layer.LayerConverter;
import lcsb.mapviewer.converter.graphics.reaction.ReactionConverter;
import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.compartment.PathwayCompartment; import lcsb.mapviewer.model.map.compartment.PathwayCompartment;
import lcsb.mapviewer.model.map.layout.ColorSchema; import lcsb.mapviewer.model.map.layout.ColorSchema;
...@@ -172,11 +172,16 @@ public abstract class AbstractImageGenerator { ...@@ -172,11 +172,16 @@ public abstract class AbstractImageGenerator {
* Should the visualization include hierarchical view or not. * Should the visualization include hierarchical view or not.
*/ */
private boolean nested = false; private boolean nested = false;
/**
* Should the visualization include semantic zoom view or not.
*/
private boolean semanticZoom = false;
/** /**
* Should sbgn standard be used. * Should sbgn standard be used.
*/ */
private boolean sbgn = false; private boolean sbgn = false;
/** /**
* List of objects containging information about layouts visualized in the * List of objects containging information about layouts visualized in the
...@@ -208,6 +213,17 @@ public abstract class AbstractImageGenerator { ...@@ -208,6 +213,17 @@ public abstract class AbstractImageGenerator {
return this; return this;
} }
/**
* @param semanticZoom
* semanticZoom to set
* @return object with all parameters
* @see #semanticZoom
*/
public Params semanticZoom(boolean semanticZoom) {
this.semanticZoom = semanticZoom;
return this;
}
/** /**
* @param scale * @param scale
* scale to set * scale to set
...@@ -561,7 +577,8 @@ public abstract class AbstractImageGenerator { ...@@ -561,7 +577,8 @@ public abstract class AbstractImageGenerator {
} }
/** /**
* @param sbgn the sbgn to set * @param sbgn
* the sbgn to set
* @see #sbgn * @see #sbgn
* @return object with all parameters * @return object with all parameters
*/ */
...@@ -659,13 +676,13 @@ public abstract class AbstractImageGenerator { ...@@ -659,13 +676,13 @@ public abstract class AbstractImageGenerator {
// compartment/complexes) // compartment/complexes)
if (element instanceof Species) { if (element instanceof Species) {
if (((Species) element).getComplex() == null) { if (((Species) element).getComplex() == null) {
drawSpecies((Species) element, params.getVisibleLayoutsForElement(element)); drawSpecies((Species) element, params.getVisibleLayoutsForElement(element), params);
} }
} }
} }
// draw all reactions // draw all reactions
for (Reaction reaction : params.getModel().getSortedReactions()) { for (Reaction reaction : params.getModel().getSortedReactions()) {
drawReaction(reaction, params.getVisibleLayoutsForElement(reaction)); drawReaction(reaction, params.getVisibleLayoutsForElement(reaction), params);
} }
// draw all compartments // draw all compartments
for (Compartment compartment : params.getModel().getSortedCompartments()) { for (Compartment compartment : params.getModel().getSortedCompartments()) {
...@@ -738,8 +755,8 @@ public abstract class AbstractImageGenerator { ...@@ -738,8 +755,8 @@ public abstract class AbstractImageGenerator {
} }
// get a converter for this compartment // get a converter for this compartment
ElementConverterImpl converter = new ElementConverterImpl(compartment, colorExtractor); BioEntityConverterImpl converter = new BioEntityConverterImpl(compartment, colorExtractor);
ConverterParams compartmentParams = new ConverterParams().textCentered(fill).level(level); ConverterParams compartmentParams = new ConverterParams().textCentered(fill).level(level).semanticZoomingOn(params.semanticZoom);
if (nested) { if (nested) {
compartmentParams.fill(fill).scale(Math.max(scale, 1)); compartmentParams.fill(fill).scale(Math.max(scale, 1));
...@@ -749,7 +766,7 @@ public abstract class AbstractImageGenerator { ...@@ -749,7 +766,7 @@ public abstract class AbstractImageGenerator {
// standard compartment (not the pathway) // standard compartment (not the pathway)
if (nested || !(compartment instanceof PathwayCompartment)) { if (nested || !(compartment instanceof PathwayCompartment)) {
try { try {
converter.drawElement(compartment, graphics, compartmentParams, visibleLayouts); converter.draw(compartment, graphics, compartmentParams, visibleLayouts);
} catch (Exception e) { } catch (Exception e) {
throw new DrawingException(eu.getElementTag(compartment) + "Problem with drawing element.", e); throw new DrawingException(eu.getElementTag(compartment) + "Problem with drawing element.", e);
} }
...@@ -769,7 +786,7 @@ public abstract class AbstractImageGenerator { ...@@ -769,7 +786,7 @@ public abstract class AbstractImageGenerator {
for (Element element : result) { for (Element element : result) {
// if a child is a standard species // if a child is a standard species
if (element instanceof Species) { if (element instanceof Species) {
drawSpecies((Species) element, params.getVisibleLayoutsForElement(element)); drawSpecies((Species) element, params.getVisibleLayoutsForElement(element), params);
} else if (element instanceof Compartment) { } else if (element instanceof Compartment) {
drawCompartment((Compartment) element, nested, params.getVisibleLayoutsForElement(element), params); drawCompartment((Compartment) element, nested, params.getVisibleLayoutsForElement(element), params);
} else { } else {
...@@ -793,10 +810,12 @@ public abstract class AbstractImageGenerator { ...@@ -793,10 +810,12 @@ public abstract class AbstractImageGenerator {
* object to be drawn * object to be drawn
* @param visibleLayouts * @param visibleLayouts
* list of {@link ColorSchema} used for coloring species in layouts * list of {@link ColorSchema} used for coloring species in layouts
* @param params
* list of all params to create apropriate image
* @throws DrawingException * @throws DrawingException
* thrown when there was a problem with drawing a {@link Species} * thrown when there was a problem with drawing a {@link Species}
*/ */
protected void drawSpecies(final Species species, List<ColorSchema> visibleLayouts) throws DrawingException { protected void drawSpecies(final Species species, List<ColorSchema> visibleLayouts, Params params) throws DrawingException {
// The displaying of species is indicated by values of VisibilityLevel. If // The displaying of species is indicated by values of VisibilityLevel. If
// VisibilityLevel is big enough, then it is // VisibilityLevel is big enough, then it is
...@@ -825,14 +844,16 @@ public abstract class AbstractImageGenerator { ...@@ -825,14 +844,16 @@ public abstract class AbstractImageGenerator {
} }
// at the beginning try to find an appropriate converter // at the beginning try to find an appropriate converter
ElementConverterImpl converter = new ElementConverterImpl(species, sbgnFormat, colorExtractor); BioEntityConverterImpl converter = new BioEntityConverterImpl(species, sbgnFormat, colorExtractor);
double customScale = 1; double customScale = 1;
if (rescale) { if (rescale) {
customScale = scale; customScale = scale;
} }
try { try {
converter converter.draw(
.drawElement(species, graphics, new ConverterParams().scale(customScale).textCentered(rescale).level(level).sbgnFormat(sbgnFormat), visibleLayouts); species, graphics,
new ConverterParams().scale(customScale).textCentered(rescale).level(level).sbgnFormat(sbgnFormat).semanticZoomingOn(params.semanticZoom),
visibleLayouts);
} catch (Exception e) { } catch (Exception e) {
throw new DrawingException(eu.getElementTag(species) + "Problem with drawing element.", e); throw new DrawingException(eu.getElementTag(species) + "Problem with drawing element.", e);
} }
...@@ -847,7 +868,7 @@ public abstract class AbstractImageGenerator { ...@@ -847,7 +868,7 @@ public abstract class AbstractImageGenerator {
// depending on current zoom level, children are drawn or not // depending on current zoom level, children are drawn or not
if (complex.getTransparencyLevel() <= level) { if (complex.getTransparencyLevel() <= level) {
for (Species a : complex.getElements()) { for (Species a : complex.getElements()) {
drawSpecies(a, visibleLayouts); drawSpecies(a, visibleLayouts, params);
} }
} }
} }
...@@ -861,13 +882,15 @@ public abstract class AbstractImageGenerator { ...@@ -861,13 +882,15 @@ public abstract class AbstractImageGenerator {
* object to be drawn * object to be drawn
* @param visibleLayouts * @param visibleLayouts
* list of {@link ColorSchema} used for coloring reaction in layouts * list of {@link ColorSchema} used for coloring reaction in layouts
* @param params
* list of all params to create apropriate image
*/ */
protected void drawReaction(final Reaction reaction, List<ColorSchema> visibleLayouts) { protected void drawReaction(final Reaction reaction, List<ColorSchema> visibleLayouts, Params params) {
if (!cross(reaction.getLines())) { if (!cross(reaction.getLines())) {
return; return;
} }
ReactionConverter converter = new ReactionConverter(colorExtractor); BioEntityConverterImpl converter = new BioEntityConverterImpl(reaction, sbgnFormat, colorExtractor);
converter.drawReaction(reaction, graphics, sbgnFormat, visibleLayouts); converter.draw(reaction, graphics, new ConverterParams().sbgnFormat(sbgnFormat).semanticZoomingOn(params.semanticZoom).level(level), visibleLayouts);
} }
/** /**
......
...@@ -11,28 +11,33 @@ public class ConverterParams { ...@@ -11,28 +11,33 @@ public class ConverterParams {
* Should the object be filled with the solid color. In other words it tells * Should the object be filled with the solid color. In other words it tells
* us if the object is not transparent. * us if the object is not transparent.
*/ */
private boolean fill = false; private boolean fill = false;
/** /**
* At which level the object is visualized. It helps to deterimine font size. * At which level the object is visualized. It helps to deterimine font size.
* However it's possible that this value is not required. * However it's possible that this value is not required.
*/ */
private int level = 0; private int level = 0;
/** /**
* What is the scale. It allows to adjust font size to be readable. * What is the scale. It allows to adjust font size to be readable.
*/ */
private double scale = 1; private double scale = 1;
/** /**
* Should the text describing element be centered or not. * Should the text describing element be centered or not.
*/ */
private boolean textCentered = false; private boolean textCentered = false;
/** /**
* Should the map be displayed in SBGN format. * Should the map be displayed in SBGN format.
*/ */
private boolean sbgnFormat = false; private boolean sbgnFormat = false;
/**
* Is the semantic zooming filtered.
*/
private boolean semanticZoomingOn = false;
/** /**
* @param fill * @param fill
...@@ -56,6 +61,17 @@ public class ConverterParams { ...@@ -56,6 +61,17 @@ public class ConverterParams {
return this; return this;
} }
/**
* @param semanticZoomingOn
* the semanticZoomingOn to set
* @return object with all parameters
* @see #semanticZoomingOn
*/
public ConverterParams semanticZoomingOn(final boolean semanticZoomingOn) {
this.semanticZoomingOn = semanticZoomingOn;
return this;
}
/** /**
* @param textCentered * @param textCentered
* the textCentered to set * the textCentered to set
...@@ -129,6 +145,14 @@ public class ConverterParams { ...@@ -129,6 +145,14 @@ public class ConverterParams {
return sbgnFormat; return sbgnFormat;
} }
/**
* @return the semanticZoomingOn
* @see #semanticZoomingOn
*/
public boolean isSemanticZoomingOn() {
return semanticZoomingOn;
}
@Override @Override
public String toString() { public String toString() {
String result = "[" + this.getClass().getSimpleName() + "] " + // String result = "[" + this.getClass().getSimpleName() + "] " + //
...@@ -136,6 +160,7 @@ public class ConverterParams { ...@@ -136,6 +160,7 @@ public class ConverterParams {
"level:" + level + "," + // "level:" + level + "," + //
"scale:" + scale + "," + // "scale:" + scale + "," + //
"textCentered:" + textCentered + "," + // "textCentered:" + textCentered + "," + //
"semanticZoomingOn:" + semanticZoomingOn + "," + //
"sbgnFormat:" + sbgnFormat; "sbgnFormat:" + sbgnFormat;
return result; return result;
} }
......
package lcsb.mapviewer.converter.graphics;
import java.awt.Graphics2D;
import java.util.List;
import lcsb.mapviewer.model.map.layout.ColorSchema;
import lcsb.mapviewer.model.map.species.Element;
/**
* This interface defines what operations should be possible to convert
* {@link Element} into a graphics on Graphics2D object.
*
* @author Piotr Gawron
*
* @param <T>
* class of alias to convert
*/
public interface ElementConverter<T extends Element> {
/**
* Alpha value (0..255) used for visualizing layout data that are normally
* visualized in javascript.
*/
int LAYOUT_ALPHA = 200;
/**
* This function draw representation of the alias on the graphics object.
*
* @param alias
* alias that should be drawn
* @param graphics
* where we want to draw alias
* @param params
* visuzalization params (like, should the object be filled with
* solid color, etc.), for more information see
* {@link ConverterParams}
*
*/
void drawElement(T alias, Graphics2D graphics, ConverterParams params);
/**
* This function draw representation of the alias on the graphics object.
*
* @param alias
* alias that should be drawn
* @param graphics
* where we want to draw alias
* @param params
* visuzalization params (like, should the object be filled with
* solid color, etc.), for more information see
* {@link ConverterParams}
* @param visualizedLayoutsColorSchemas
* list of {@link ColorSchema} that were used for visualizing this
* alias in different layouts that should be overlayed on the alias
*
*/
void drawElement(T alias, Graphics2D graphics, ConverterParams params, List<ColorSchema> visualizedLayoutsColorSchemas);
/**
* This function will find proper font size to display text within it. Then it
* will print this text.
*
* @param alias
* alias with description to be drawn
* @param graphics
* where the description should be drawn
* @param params
* parameters of visualization (centering, scale)
* @throws DrawingException
* thrown when there is a problem with drawing alias
*/
void drawText(T alias, Graphics2D graphics, ConverterParams params) throws DrawingException;
}
...@@ -57,21 +57,25 @@ public class MapGenerator { ...@@ -57,21 +57,25 @@ public class MapGenerator {
* Do we want to generate images in hierarchical view or normal. * Do we want to generate images in hierarchical view or normal.
* *
*/ */
private boolean nested = false; private boolean nested = false;
/**
* Do we want to generate images with semantic zoom view or not.
*/
private boolean semanticZoom = false;
/** /**
* Should we remove empty elements in nested view. * Should we remove empty elements in nested view.
* *
*/ */
private boolean removeEmpty = false; private boolean removeEmpty = false;
/** /**
* Callback function that update progress information. * Callback function that update progress information.
* *
*/ */
private IProgressUpdater updater = new IProgressUpdater() { private IProgressUpdater updater = new IProgressUpdater() {
@Override @Override
public void setProgress(double progress) { public void setProgress(double progress) {
} }
}; };
/** /**
* Zoom factor on the lowest level. * Zoom factor on the lowest level.
...@@ -135,6 +139,17 @@ public class MapGenerator { ...@@ -135,6 +139,17 @@ public class MapGenerator {
return this; return this;
} }
/**
* @param semanticZoom
* the semanticZoom to set
* @see #nested
* @return full {@link MapGeneratorParams} object
*/
public MapGeneratorParams semanticZoom(boolean semanticZoom) {
this.semanticZoom = semanticZoom;
return this;
}
/** /**
* @return the removeEmpty * @return the removeEmpty
* @see #removeEmpty * @see #removeEmpty
...@@ -326,6 +341,8 @@ public class MapGenerator { ...@@ -326,6 +341,8 @@ public class MapGenerator {
imgParams.height(TILE_SIZE * TILES_CACHE_NUM); imgParams.height(TILE_SIZE * TILES_CACHE_NUM);
imgParams.model(params.model); imgParams.model(params.model);
imgParams.sbgn(params.sbgn); imgParams.sbgn(params.sbgn);
imgParams.level(i);
imgParams.semanticZoom(params.semanticZoom);
if (params.nested) { if (params.nested) {
imgParams.level(i).nested(params.nested); imgParams.level(i).nested(params.nested);
......
package lcsb.mapviewer.converter.graphics.bioEntity;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.common.exception.InvalidStateException;
import lcsb.mapviewer.converter.graphics.ConverterParams;
import lcsb.mapviewer.converter.graphics.DrawingException;
import lcsb.mapviewer.model.map.AnnotatedObject;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.layout.ColorSchema;
import lcsb.mapviewer.model.map.reaction.AbstractNode;
import lcsb.mapviewer.model.map.reaction.NodeOperator;
import lcsb.mapviewer.model.map.reaction.Product;
import lcsb.mapviewer.model.map.reaction.Reactant;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.reaction.ReactionNode;
import lcsb.mapviewer.model.map.species.Complex;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.Species;
/**
* This interface defines what operations should be possible to convert
* {@link AnnotatedObject} into a graphics on Graphics2D object.
*
* @author Piotr Gawron
*
* @param <T>
* class of alias to convert
*/
public abstract class BioEntityConverter<T extends AnnotatedObject> {
/**
* Default class logger.
*/
@SuppressWarnings("unused")
private final Logger logger = Logger.getLogger(BioEntityConverter.class);
/**
* Alpha value (0..255) used for visualizing overlay data that are normally
* visualized in javascript.
*/
public static final int LAYOUT_ALPHA = 200;
/**
* This function draw representation of the alias on the graphics object.
*
* @param bioEntity
* {@link AnnotatedObject} that should be drawn
* @param graphics
* where we want to draw bioEntity
* @param params
* visuzalization params (like, should the object be filled with
* solid color, etc.), for more information see
* {@link ConverterParams}
*
*/
public void draw(T bioEntity, Graphics2D graphics, ConverterParams params) {
draw(bioEntity, graphics, params, new ArrayList<>());
}
/**
* This function draw representation of the alias on the graphics object.
*
* @param bioEntity
* {@link AnnotatedObject} that should be drawn
* @param graphics
* where we want to draw bioEntity
* @param params
* visuzalization params (like, should the object be filled with
* solid color, etc.), for more information see
* {@link ConverterParams}
* @param visualizedOverlaysColorSchemas
* list of {@link ColorSchema} that were used for visualizing this
* bioentity in different data overlays that should be overlayed on
* the alias
*
*/
public abstract void draw(T bioEntity, Graphics2D graphics, ConverterParams params, List<ColorSchema> visualizedOverlaysColorSchemas);
/**
* This function will find proper font size to display text within it. Then it
* will print this text.
*
* @param bioEntity
* bioEntity with description to be drawn
* @param graphics
* where the description should be drawn
* @param params
* parameters of visualization (centering, scale)
* @throws DrawingException
* thrown when there is a problem with drawing bioEntity
*/
public abstract void drawText(T bioEntity, Graphics2D graphics, ConverterParams params) throws DrawingException;
/**
* Checks if {@link AbstractNode} is visible according to visualization given
* in params.
*
* @param node
* visibility of this object will be checked
* @param params
* visualization params
* @return true if object is visible
*/
protected boolean isVisible(AbstractNode node, ConverterParams params) {
if (node instanceof NodeOperator) {
return isVisible((NodeOperator) node, params);
} else if (node instanceof ReactionNode) {
return isVisible(((ReactionNode) node).getElement(), params);
} else {
throw new InvalidArgumentException("Unknown class type: " + node.getClass());
}
}
/**
* Checks if {@link NodeOperator} is visible according to visualization given
* in params.
*
* @param operator
* visibility of this object will be checked
* @param params
* visualization params
* @return true if object is visible
*/
protected boolean isVisible(NodeOperator operator, ConverterParams params) {
boolean result = false;
if (operator.isModifierOperator() || operator.isReactantOperator()) {
for (AbstractNode input : operator.getInputs()) {
result |= isVisible(input, params);
}
} else if (operator.isProductOperator()) {
for (AbstractNode output : operator.getOutputs()) {
result |= isVisible(output, params);
}
} else {
throw new InvalidStateException("Unknown class state: " + operator);
}
return result;
}
/**
* Checks if {@link AnnotatedObject} is visible according to visualization
* given in params.
*
* @param bioEntity
* visibility of this object will be checked
* @param params
* visualization params
* @return true if object is visible
*/
protected boolean isVisible(AnnotatedObject bioEntity, ConverterParams params) {
if (params.isSemanticZoomingOn()) {
boolean result = matchLevel(params.getLevel(), bioEntity.getSemanticZoomLevelVisibility());
if (bioEntity instanceof Element) {
Compartment compartment = ((Element) bioEntity).getCompartment();
if (compartment != null) {
result &= isVisible(compartment, params);
}
if (bioEntity instanceof Species) {
Complex complex = ((Species) bioEntity).getComplex();
if (complex != null) {
result &= isVisible(complex, params);
}
}
} else if (bioEntity instanceof Reaction) {
if (!isAnyProductVisible(((Reaction) bioEntity).getProducts(), params)) {
result = false;
} else if (!isAnyReactantVisible(((Reaction) bioEntity).getReactants(), params)) {
result = false;
}
} else {
throw new InvalidArgumentException("Unknown class type: " + bioEntity.getClass());
}
return result;
}
return true;
}
/**
* Checks if at least one reactant is visible.
*
* @param reactants
* list of reactants
* @param params
* params against which check is run
* @return true if at least one reactant is visible
*/
private boolean isAnyReactantVisible(List<Reactant> reactants, ConverterParams params) {
boolean result = false;
for (Reactant reactant : reactants) {
if (isVisible(reactant, params)) {
result = true;
}
}
return result;
}
/**
* Checks if at least one product is visible.
*
* @param products
* list of products
* @param params
* params against which check is run
* @return true if at least one product is visible
*/
private boolean isAnyProductVisible(List<Product> products, ConverterParams params) {
boolean result = false;
for (Product product : products) {
if (isVisible(product, params)) {
result = true;
}
}
return result;
}
/**
* Checks if level belongs to the range defined in
* semanticZoomLevelVisibility.
*
* @param level
* level to ve checked
* @param semanticZoomLevelVisibility
* range of levels to be checked
* @return true if level is in the range
*/
protected boolean matchLevel(int level, String semanticZoomLevelVisibility) {
if (semanticZoomLevelVisibility == null || semanticZoomLevelVisibility.isEmpty()) {
return true;
}
if (semanticZoomLevelVisibility.contains("{")) {
String strLevels = semanticZoomLevelVisibility.replace("{", "").replace("}", "");
String[] ranges = strLevels.split(",");
for (String string : ranges) {
if (Integer.valueOf(string).equals(level)) {
return true;
}
}
}
if (Integer.valueOf(semanticZoomLevelVisibility) <= level) {
return true;
}
return false;
}
}
package lcsb.mapviewer.converter.graphics; package lcsb.mapviewer.converter.graphics.bioEntity;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.util.List; import java.util.List;
...@@ -8,25 +8,29 @@ import org.apache.log4j.Logger; ...@@ -8,25 +8,29 @@ import org.apache.log4j.Logger;
import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.commands.ColorExtractor;
import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.common.exception.NotImplementedException;
import lcsb.mapviewer.converter.graphics.compartment.BottomSquareCompartmentConverter; import lcsb.mapviewer.converter.graphics.ConverterParams;
import lcsb.mapviewer.converter.graphics.compartment.LeftSquareCompartmentConverter; import lcsb.mapviewer.converter.graphics.DrawingException;
import lcsb.mapviewer.converter.graphics.compartment.OvalCompartmentConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.compartment.BottomSquareCompartmentConverter;
import lcsb.mapviewer.converter.graphics.compartment.PathwayCompartmentConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.compartment.LeftSquareCompartmentConverter;
import lcsb.mapviewer.converter.graphics.compartment.RightSquareCompartmentConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.compartment.OvalCompartmentConverter;
import lcsb.mapviewer.converter.graphics.compartment.SquareCompartmentConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.compartment.PathwayCompartmentConverter;
import lcsb.mapviewer.converter.graphics.compartment.TopSquareCompartmentConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.compartment.RightSquareCompartmentConverter;
import lcsb.mapviewer.converter.graphics.species.AntisenseRnaConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.compartment.SquareCompartmentConverter;
import lcsb.mapviewer.converter.graphics.species.ComplexConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.compartment.TopSquareCompartmentConverter;
import lcsb.mapviewer.converter.graphics.species.DegradedConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.AntisenseRnaConverter;
import lcsb.mapviewer.converter.graphics.species.DrugConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.ComplexConverter;
import lcsb.mapviewer.converter.graphics.species.GeneConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.DegradedConverter;
import lcsb.mapviewer.converter.graphics.species.IonConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.DrugConverter;
import lcsb.mapviewer.converter.graphics.species.PhenotypeConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.GeneConverter;
import lcsb.mapviewer.converter.graphics.species.ProteinConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.IonConverter;
import lcsb.mapviewer.converter.graphics.species.RnaConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.PhenotypeConverter;
import lcsb.mapviewer.converter.graphics.species.SBGNNucleicAcidFeatureConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.ProteinConverter;
import lcsb.mapviewer.converter.graphics.species.SimpleMoleculeConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.RnaConverter;
import lcsb.mapviewer.converter.graphics.species.UnknownConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.SBGNNucleicAcidFeatureConverter;
import lcsb.mapviewer.converter.graphics.bioEntity.element.species.SimpleMoleculeConverter;
import lcsb.mapviewer.converter.graphics.bioEntity.element.species.UnknownConverter;
import lcsb.mapviewer.converter.graphics.bioEntity.reaction.ReactionConverter;
import lcsb.mapviewer.model.map.AnnotatedObject;
import lcsb.mapviewer.model.map.compartment.BottomSquareCompartment; import lcsb.mapviewer.model.map.compartment.BottomSquareCompartment;
import lcsb.mapviewer.model.map.compartment.LeftSquareCompartment; import lcsb.mapviewer.model.map.compartment.LeftSquareCompartment;
import lcsb.mapviewer.model.map.compartment.OvalCompartment; import lcsb.mapviewer.model.map.compartment.OvalCompartment;
...@@ -35,6 +39,7 @@ import lcsb.mapviewer.model.map.compartment.RightSquareCompartment; ...@@ -35,6 +39,7 @@ import lcsb.mapviewer.model.map.compartment.RightSquareCompartment;
import lcsb.mapviewer.model.map.compartment.SquareCompartment; import lcsb.mapviewer.model.map.compartment.SquareCompartment;
import lcsb.mapviewer.model.map.compartment.TopSquareCompartment; import lcsb.mapviewer.model.map.compartment.TopSquareCompartment;
import lcsb.mapviewer.model.map.layout.ColorSchema; import lcsb.mapviewer.model.map.layout.ColorSchema;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.AntisenseRna; import lcsb.mapviewer.model.map.species.AntisenseRna;
import lcsb.mapviewer.model.map.species.Complex; import lcsb.mapviewer.model.map.species.Complex;
import lcsb.mapviewer.model.map.species.Degraded; import lcsb.mapviewer.model.map.species.Degraded;
...@@ -59,13 +64,13 @@ import lcsb.mapviewer.modelutils.map.ElementUtils; ...@@ -59,13 +64,13 @@ import lcsb.mapviewer.modelutils.map.ElementUtils;
* @author Piotr Gawron * @author Piotr Gawron
* *
*/ */
public class ElementConverterImpl implements ElementConverter<Element> { public class BioEntityConverterImpl extends BioEntityConverter<AnnotatedObject> {
/** /**
* Default class logger. * Default class logger.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static Logger logger = Logger.getLogger(ElementConverterImpl.class.getName()); private static Logger logger = Logger.getLogger(BioEntityConverterImpl.class.getName());
/** /**
* Returns a converter for given element. If converter doesn't exist then * Returns a converter for given element. If converter doesn't exist then
...@@ -77,7 +82,7 @@ public class ElementConverterImpl implements ElementConverter<Element> { ...@@ -77,7 +82,7 @@ public class ElementConverterImpl implements ElementConverter<Element> {
* object that helps to convert overlay values into colors * object that helps to convert overlay values into colors
* @return converter that can be applied for the given element * @return converter that can be applied for the given element
*/ */
private ElementConverter<? extends Element> getConverterForElement(Element element, ColorExtractor colorExtractor) { private BioEntityConverter<? extends AnnotatedObject> getConverterForElement(AnnotatedObject element, ColorExtractor colorExtractor) {
if (element == null) { if (element == null) {
throw new InvalidArgumentException("element cannot be null"); throw new InvalidArgumentException("element cannot be null");
} }
...@@ -123,6 +128,8 @@ public class ElementConverterImpl implements ElementConverter<Element> { ...@@ -123,6 +128,8 @@ public class ElementConverterImpl implements ElementConverter<Element> {
return new LeftSquareCompartmentConverter(colorExtractor); return new LeftSquareCompartmentConverter(colorExtractor);
} else if (element instanceof RightSquareCompartment) { } else if (element instanceof RightSquareCompartment) {
return new RightSquareCompartmentConverter(colorExtractor); return new RightSquareCompartmentConverter(colorExtractor);
} else if (element instanceof Reaction) {
return new ReactionConverter(colorExtractor);
} else { } else {
throw new NotImplementedException(new ElementUtils().getElementTag(element) + "Unknown element class"); throw new NotImplementedException(new ElementUtils().getElementTag(element) + "Unknown element class");
} }
...@@ -132,7 +139,7 @@ public class ElementConverterImpl implements ElementConverter<Element> { ...@@ -132,7 +139,7 @@ public class ElementConverterImpl implements ElementConverter<Element> {
* Converter used for conversion of the {@link Element} given in constructor. * Converter used for conversion of the {@link Element} given in constructor.
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private ElementConverter elementConverter = null; private BioEntityConverter elementConverter = null;
/** /**
* Support constructor. Used in case of SBGN format display * Support constructor. Used in case of SBGN format display
...@@ -144,7 +151,7 @@ public class ElementConverterImpl implements ElementConverter<Element> { ...@@ -144,7 +151,7 @@ public class ElementConverterImpl implements ElementConverter<Element> {
* @param sbgnFormat * @param sbgnFormat
* boolean value indicating if SBGN display format should be used * boolean value indicating if SBGN display format should be used
*/ */
public ElementConverterImpl(final Element element, final boolean sbgnFormat, ColorExtractor colorExtractor) { public BioEntityConverterImpl(final AnnotatedObject element, final boolean sbgnFormat, ColorExtractor colorExtractor) {
// If element is a nucleic acid feature to be displayed in SBGN // If element is a nucleic acid feature to be displayed in SBGN
if (sbgnFormat && (element instanceof AntisenseRna || element instanceof Rna || element instanceof Gene)) { if (sbgnFormat && (element instanceof AntisenseRna || element instanceof Rna || element instanceof Gene)) {
...@@ -156,7 +163,7 @@ public class ElementConverterImpl implements ElementConverter<Element> { ...@@ -156,7 +163,7 @@ public class ElementConverterImpl implements ElementConverter<Element> {
// if we don't know which converter to use then throw an exception // if we don't know which converter to use then throw an exception
if (elementConverter == null) { if (elementConverter == null) {
throw new InvalidArgumentException("Unknown converter for class: " + element.getClass() + ". Element id: " + element.getElementId()); throw new InvalidArgumentException(new ElementUtils().getElementTag(element) + "Unknown converter for class: " + element.getClass());
} }
} }
...@@ -168,25 +175,24 @@ public class ElementConverterImpl implements ElementConverter<Element> { ...@@ -168,25 +175,24 @@ public class ElementConverterImpl implements ElementConverter<Element> {
* @param element * @param element
* {@link Element} for which this converter will be used * {@link Element} for which this converter will be used
*/ */
public ElementConverterImpl(final Element element, ColorExtractor colorExtractor) { public BioEntityConverterImpl(final Element element, ColorExtractor colorExtractor) {
this(element, false, colorExtractor); this(element, false, colorExtractor);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void drawElement(final Element element, final Graphics2D graphics, final ConverterParams params) { public void drawText(final AnnotatedObject element, final Graphics2D graphics, final ConverterParams params) throws DrawingException {
elementConverter.drawElement(element, graphics, params); if (isVisible(element, params)) {
elementConverter.drawText(element, graphics, params);
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void drawText(final Element element, final Graphics2D graphics, final ConverterParams params) throws DrawingException { public void draw(AnnotatedObject element, Graphics2D graphics, ConverterParams params, List<ColorSchema> visualizedLayoutsColorSchemas) {
elementConverter.drawText(element, graphics, params); if (isVisible(element, params)) {
elementConverter.draw(element, graphics, params, visualizedLayoutsColorSchemas);
}
} }
@SuppressWarnings("unchecked")
@Override
public void drawElement(Element element, Graphics2D graphics, ConverterParams params, List<ColorSchema> visualizedLayoutsColorSchemas) {
elementConverter.drawElement(element, graphics, params, visualizedLayoutsColorSchemas);
}
} }
package lcsb.mapviewer.converter.graphics.bioEntity.element;
import lcsb.mapviewer.converter.graphics.bioEntity.BioEntityConverter;
import lcsb.mapviewer.model.map.species.Element;
/**
* This interface defines what operations should be possible to convert
* {@link Element} into a graphics on Graphics2D object.
*
* @author Piotr Gawron
*
* @param <T>
* class of alias to convert
*/
public abstract class ElementConverter<T extends Element> extends BioEntityConverter<T> {
}
package lcsb.mapviewer.converter.graphics.compartment; package lcsb.mapviewer.converter.graphics.bioEntity.element.compartment;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics2D; import java.awt.Graphics2D;
...@@ -44,7 +44,7 @@ public class BottomSquareCompartmentConverter extends CompartmentConverter<Botto ...@@ -44,7 +44,7 @@ public class BottomSquareCompartmentConverter extends CompartmentConverter<Botto
} }
@Override @Override
public void drawElement(final BottomSquareCompartment alias, final Graphics2D graphics, final ConverterParams params) { public void draw(final BottomSquareCompartment alias, final Graphics2D graphics, final ConverterParams params) {
// keep the old values of colors and line // keep the old values of colors and line
Color oldColor = graphics.getColor(); Color oldColor = graphics.getColor();
Stroke oldStroke = graphics.getStroke(); Stroke oldStroke = graphics.getStroke();
......
package lcsb.mapviewer.converter.graphics.compartment; package lcsb.mapviewer.converter.graphics.bioEntity.element.compartment;
import java.awt.Color; import java.awt.Color;
import java.awt.Font; import java.awt.Font;
...@@ -14,7 +14,7 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; ...@@ -14,7 +14,7 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.common.geometry.EllipseTransformation; import lcsb.mapviewer.common.geometry.EllipseTransformation;
import lcsb.mapviewer.common.geometry.LineTransformation; import lcsb.mapviewer.common.geometry.LineTransformation;
import lcsb.mapviewer.converter.graphics.ConverterParams; import lcsb.mapviewer.converter.graphics.ConverterParams;
import lcsb.mapviewer.converter.graphics.ElementConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.ElementConverter;
import lcsb.mapviewer.converter.graphics.geometry.FontFinder; import lcsb.mapviewer.converter.graphics.geometry.FontFinder;
import lcsb.mapviewer.converter.graphics.geometry.RectangleTooSmallException; import lcsb.mapviewer.converter.graphics.geometry.RectangleTooSmallException;
import lcsb.mapviewer.converter.graphics.placefinder.PlaceFinder; import lcsb.mapviewer.converter.graphics.placefinder.PlaceFinder;
...@@ -31,7 +31,7 @@ import lcsb.mapviewer.model.map.layout.ColorSchema; ...@@ -31,7 +31,7 @@ import lcsb.mapviewer.model.map.layout.ColorSchema;
* class for which the comparator is created * class for which the comparator is created
* *
*/ */
public abstract class CompartmentConverter<T extends Compartment> implements ElementConverter<T> { public abstract class CompartmentConverter<T extends Compartment> extends ElementConverter<T> {
/** /**
* Default class logger. * Default class logger.
...@@ -175,8 +175,8 @@ public abstract class CompartmentConverter<T extends Compartment> implements Ele ...@@ -175,8 +175,8 @@ public abstract class CompartmentConverter<T extends Compartment> implements Ele
} }
@Override @Override
public void drawElement(T alias, Graphics2D graphics, ConverterParams params, List<ColorSchema> visualizedLayoutsColorSchemas) { public void draw(T alias, Graphics2D graphics, ConverterParams params, List<ColorSchema> visualizedLayoutsColorSchemas) {
drawElement(alias, graphics, params); draw(alias, graphics, params);
Color oldColor = graphics.getColor(); Color oldColor = graphics.getColor();
int count = 0; int count = 0;
......
package lcsb.mapviewer.converter.graphics.compartment; package lcsb.mapviewer.converter.graphics.bioEntity.element.compartment;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics2D; import java.awt.Graphics2D;
...@@ -44,7 +44,7 @@ public class LeftSquareCompartmentConverter extends CompartmentConverter<LeftSqu ...@@ -44,7 +44,7 @@ public class LeftSquareCompartmentConverter extends CompartmentConverter<LeftSqu
} }
@Override @Override
public void drawElement(final LeftSquareCompartment alias, final Graphics2D graphics, final ConverterParams params) { public void draw(final LeftSquareCompartment alias, final Graphics2D graphics, final ConverterParams params) {
// keep the old values of color and line type // keep the old values of color and line type
Color oldColor = graphics.getColor(); Color oldColor = graphics.getColor();
Stroke oldStroke = graphics.getStroke(); Stroke oldStroke = graphics.getStroke();
......
package lcsb.mapviewer.converter.graphics.compartment; package lcsb.mapviewer.converter.graphics.bioEntity.element.compartment;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics2D; import java.awt.Graphics2D;
...@@ -47,7 +47,7 @@ public class OvalCompartmentConverter extends CompartmentConverter<OvalCompartme ...@@ -47,7 +47,7 @@ public class OvalCompartmentConverter extends CompartmentConverter<OvalCompartme
} }
@Override @Override
public void drawElement(final OvalCompartment alias, final Graphics2D graphics, final ConverterParams params) { public void draw(final OvalCompartment alias, final Graphics2D graphics, final ConverterParams params) {
// keep the old values of color and line type // keep the old values of color and line type
Color oldColor = graphics.getColor(); Color oldColor = graphics.getColor();
Stroke oldStroke = graphics.getStroke(); Stroke oldStroke = graphics.getStroke();
......
package lcsb.mapviewer.converter.graphics.compartment; package lcsb.mapviewer.converter.graphics.bioEntity.element.compartment;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics2D; import java.awt.Graphics2D;
...@@ -40,7 +40,7 @@ public class PathwayCompartmentConverter extends CompartmentConverter<PathwayCom ...@@ -40,7 +40,7 @@ public class PathwayCompartmentConverter extends CompartmentConverter<PathwayCom
private Color backgroundColor = Color.LIGHT_GRAY; private Color backgroundColor = Color.LIGHT_GRAY;
@Override @Override
public void drawElement(final PathwayCompartment alias, final Graphics2D graphics, final ConverterParams params) { public void draw(final PathwayCompartment alias, final Graphics2D graphics, final ConverterParams params) {
// keep the old values of colors and line // keep the old values of colors and line
Color oldColor = graphics.getColor(); Color oldColor = graphics.getColor();
Stroke oldStroke = graphics.getStroke(); Stroke oldStroke = graphics.getStroke();
......
package lcsb.mapviewer.converter.graphics.compartment; package lcsb.mapviewer.converter.graphics.bioEntity.element.compartment;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics2D; import java.awt.Graphics2D;
...@@ -44,7 +44,7 @@ public class RightSquareCompartmentConverter extends CompartmentConverter<RightS ...@@ -44,7 +44,7 @@ public class RightSquareCompartmentConverter extends CompartmentConverter<RightS
} }
@Override @Override
public void drawElement(final RightSquareCompartment alias, final Graphics2D graphics, final ConverterParams params) { public void draw(final RightSquareCompartment alias, final Graphics2D graphics, final ConverterParams params) {
// keep the old values of color and line type // keep the old values of color and line type
Color oldColor = graphics.getColor(); Color oldColor = graphics.getColor();
Stroke oldStroke = graphics.getStroke(); Stroke oldStroke = graphics.getStroke();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment