Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
4e0f7dd4
Commit
4e0f7dd4
authored
May 29, 2019
by
Piotr Gawron
Browse files
old reaction.getCenterLine method removed
parent
2da95dd8
Pipeline
#10421
failed with stage
in 8 minutes and 45 seconds
Changes
14
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java
View file @
4e0f7dd4
package
lcsb.mapviewer.converter.model.sbgnml
;
import
java.awt.geom.Line2D
;
import
java.awt.geom.Point2D
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -11,7 +10,8 @@ import java.util.stream.Collectors;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.*
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.sbgn.ArcClazz
;
import
org.sbgn.GlyphClazz
;
import
org.sbgn.Language
;
...
...
@@ -30,6 +30,7 @@ import lcsb.mapviewer.common.comparator.DoubleComparator;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.converter.graphics.bioEntity.reaction.ReactionConverter
;
import
lcsb.mapviewer.model.graphics.ArrowType
;
import
lcsb.mapviewer.model.graphics.PolylineData
;
import
lcsb.mapviewer.model.map.compartment.Compartment
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.modifier.Catalysis
;
...
...
@@ -580,9 +581,9 @@ public class SbgnmlXmlExporter {
processGlyph
.
setClazz
(
getGlyphClazzFromReaction
(
reaction
).
getClazz
());
Bbox
bbox
=
new
Bbox
();
Line2D
line
=
reaction
.
get
Center
Line
();
Point2D
startPoint
=
line
.
get
P1
();
Point2D
endPoint
=
line
.
get
P2
();
PolylineData
line
=
reaction
.
getLine
();
Point2D
startPoint
=
line
.
get
BeginPoint
();
Point2D
endPoint
=
line
.
get
EndPoint
();
double
pointX
=
(
startPoint
.
getX
()
+
endPoint
.
getX
())
/
2
;
double
pointY
=
(
startPoint
.
getY
()
+
endPoint
.
getY
())
/
2
;
...
...
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java
View file @
4e0f7dd4
...
...
@@ -562,7 +562,7 @@ public class SbgnmlXmlParser {
productPointList
.
add
(
2
,
newPoint
);
}
}
int
reactantPointEnds
=
(
productPointList
.
size
()
-
1
)
/
2
;
int
reactantPointEnds
=
(
productPointList
.
size
()
-
1
)
/
2
;
int
productPointStarts
=
reactantPointEnds
+
1
;
Reactant
reactant
=
new
Reactant
(
model
.
getElementByElementId
(
source
.
getId
()));
...
...
@@ -949,7 +949,7 @@ public class SbgnmlXmlParser {
ModifierTypeUtils
utils
=
new
ModifierTypeUtils
();
Point2D
result
;
Line2D
centerLine
=
reaction
.
get
CenterLine
(
);
Line2D
centerLine
=
reaction
.
get
Line
().
getLines
().
get
(
reaction
.
getLine
().
getLines
().
size
()
/
2
);
double
dx
=
centerLine
.
getX2
()
-
centerLine
.
getX1
();
double
dy
=
centerLine
.
getY2
()
-
centerLine
.
getY1
();
double
centerLineAngle
=
Math
.
atan2
(
dy
,
dx
);
...
...
@@ -1315,7 +1315,7 @@ public class SbgnmlXmlParser {
}
else
{
reaction
.
getProducts
().
get
(
0
).
getLine
().
trimBegin
(
ReactionCellDesignerConverter
.
RECT_SIZE
/
2
-
1
);
}
PolylineData
centerLine
=
new
PolylineData
(
pt
.
copyPoint
(
centerPointStart
),
pt
.
copyPoint
(
centerPointEnd
));
reaction
.
setLine
(
centerLine
);
...
...
converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/compartment/CompartmentConverter.java
View file @
4e0f7dd4
...
...
@@ -6,11 +6,11 @@ import java.awt.Graphics2D;
import
java.awt.geom.Rectangle2D
;
import
java.util.List
;
import
org.apache.logging.log4j.*
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
lcsb.mapviewer.commands.ColorExtractor
;
import
lcsb.mapviewer.common.Configuration
;
import
lcsb.mapviewer.common.geometry.EllipseTransformation
;
import
lcsb.mapviewer.common.geometry.LineTransformation
;
import
lcsb.mapviewer.converter.graphics.ConverterParams
;
import
lcsb.mapviewer.converter.graphics.DrawingException
;
...
...
converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/element/species/SpeciesConverter.java
View file @
4e0f7dd4
...
...
@@ -12,11 +12,11 @@ import java.awt.geom.Point2D;
import
java.awt.geom.Rectangle2D
;
import
java.util.List
;
import
org.apache.logging.log4j.*
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
lcsb.mapviewer.commands.ColorExtractor
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.common.geometry.EllipseTransformation
;
import
lcsb.mapviewer.common.geometry.LineTransformation
;
import
lcsb.mapviewer.converter.graphics.ConverterParams
;
import
lcsb.mapviewer.converter.graphics.DrawingException
;
...
...
converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/reaction/ReactionConverter.java
View file @
4e0f7dd4
This diff is collapsed.
Click to expand it.
converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/GraphicsTestFunctions.java
View file @
4e0f7dd4
...
...
@@ -53,6 +53,7 @@ public abstract class GraphicsTestFunctions {
reaction
.
addModifier
(
modifier
);
reaction
.
addProduct
(
product
);
reaction
.
addReactant
(
reactant
);
reaction
.
setLine
(
new
PolylineData
(
center
,
center
));
reaction
.
setZ
(
elementCounter
);
return
reaction
;
}
...
...
converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/bioEntity/reaction/ReactionConverterTest.java
View file @
4e0f7dd4
...
...
@@ -41,6 +41,7 @@ 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.SplitOperator
;
import
lcsb.mapviewer.model.map.reaction.type.ReactionRect
;
import
lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction
;
import
lcsb.mapviewer.model.map.species.GenericProtein
;
...
...
@@ -208,6 +209,7 @@ public class ReactionConverterTest extends GraphicsTestFunctions {
result
.
addModifier
(
modifier
);
result
.
addProduct
(
product
);
result
.
addReactant
(
reactant
);
result
.
setLine
(
new
PolylineData
(
new
Point2D
.
Double
(
105
,
90
),
new
Point2D
.
Double
(
95
,
90
)));
return
result
;
}
...
...
@@ -249,6 +251,8 @@ public class ReactionConverterTest extends GraphicsTestFunctions {
productOperator
.
addOutput
(
product2
);
productOperator
.
setLine
(
new
PolylineData
(
new
Point2D
.
Double
(
130
,
90
),
new
Point2D
.
Double
(
110
,
90
)));
result
.
setLine
(
new
PolylineData
(
new
Point2D
.
Double
(
105
,
90
),
new
Point2D
.
Double
(
95
,
90
)));
result
.
addModifier
(
modifier1
);
result
.
addModifier
(
modifier2
);
result
.
addNode
(
modifierOperator
);
...
...
@@ -409,6 +413,8 @@ public class ReactionConverterTest extends GraphicsTestFunctions {
Point2D
reactantEnd
=
new
Point2D
.
Double
(
90
,
90
);
Point2D
productEnd
=
new
Point2D
.
Double
(
110
,
90
);
result
.
setLine
(
new
PolylineData
(
new
Point2D
.
Double
(
105
,
90
),
new
Point2D
.
Double
(
95
,
90
)));
Reactant
reactant
=
new
Reactant
(
new
GenericProtein
(
"s2"
));
reactant
.
setLine
(
...
...
@@ -446,4 +452,67 @@ public class ReactionConverterTest extends GraphicsTestFunctions {
}
}
@Test
public
void
testDrawRectangleDataSimple
()
throws
Exception
{
try
{
Graphics2D
graphics
=
createGraphicsMock
();
ReactionConverter
rc
=
new
ReactionConverter
(
colorExtractor
);
PolylineData
line
=
new
PolylineData
(
new
Point2D
.
Double
(
10
,
20
),
new
Point2D
.
Double
(
10
+
ReactionConverter
.
RECT_SIZE
,
20
));
rc
.
drawRectangleData
(
line
,
ReactionRect
.
RECT_EMPTY
,
graphics
);
Mockito
.
verify
(
graphics
,
times
(
1
)).
fill
(
any
(
Shape
.
class
));
Mockito
.
verify
(
graphics
,
times
(
1
)).
draw
(
any
(
Shape
.
class
));
}
catch
(
Exception
e
)
{
throw
e
;
}
}
@Test
public
void
testDrawRectangleDataWithLineAround
()
throws
Exception
{
try
{
Graphics2D
graphics
=
createGraphicsMock
();
ReactionConverter
rc
=
new
ReactionConverter
(
colorExtractor
);
PolylineData
line
=
new
PolylineData
(
new
Point2D
.
Double
(
10
,
20
),
new
Point2D
.
Double
(
10
+
ReactionConverter
.
RECT_SIZE
+
100
,
20
));
rc
.
drawRectangleData
(
line
,
ReactionRect
.
RECT_EMPTY
,
graphics
);
Mockito
.
verify
(
graphics
,
times
(
1
)).
fill
(
any
(
Shape
.
class
));
Mockito
.
verify
(
graphics
,
times
(
3
)).
draw
(
any
(
Shape
.
class
));
}
catch
(
Exception
e
)
{
throw
e
;
}
}
@Test
public
void
testDrawRectangleDataWithPolyLineAround
()
throws
Exception
{
try
{
Graphics2D
graphics
=
createGraphicsMock
();
ReactionConverter
rc
=
new
ReactionConverter
(
colorExtractor
);
PolylineData
line
=
new
PolylineData
();
line
.
addPoint
(
new
Point2D
.
Double
(
10
,
20
));
line
.
addPoint
(
new
Point2D
.
Double
(
100
,
20
));
line
.
addPoint
(
new
Point2D
.
Double
(
100
,
200
));
line
.
addPoint
(
new
Point2D
.
Double
(
200
,
200
));
line
.
addPoint
(
new
Point2D
.
Double
(
200
,
300
));
line
.
addPoint
(
new
Point2D
.
Double
(
300
,
300
));
line
.
addPoint
(
new
Point2D
.
Double
(
300
,
400
));
rc
.
drawRectangleData
(
line
,
ReactionRect
.
RECT_EMPTY
,
graphics
);
Mockito
.
verify
(
graphics
,
times
(
1
)).
fill
(
any
(
Shape
.
class
));
Mockito
.
verify
(
graphics
,
times
(
5
)).
draw
(
any
(
Shape
.
class
));
}
catch
(
Exception
e
)
{
throw
e
;
}
}
}
model/src/main/java/lcsb/mapviewer/model/graphics/PolylineData.java
View file @
4e0f7dd4
...
...
@@ -220,9 +220,9 @@ public class PolylineData implements Serializable, Drawable {
* Return a line that correspond to the part of line.
*
* @param from
* index of the point where line should start
* index of the point where line should start
(included)
* @param to
* index of the point where line should end
* index of the point where line should end
(excluded)
* @return line that correspond to the part of line
*/
public
PolylineData
getSubline
(
int
from
,
int
to
)
{
...
...
model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java
View file @
4e0f7dd4
...
...
@@ -477,16 +477,6 @@ public class Reaction implements BioEntity {
return
result
;
}
/**
* Returns central line of the reaction. Central line is the line that separates
* inputs from outputs.
*
* @return central line of the reaction
*/
public
Line2D
getCenterLine
()
{
return
this
.
line
.
getLines
().
get
(
0
);
}
/**
* Removes modifier.
*
...
...
@@ -518,18 +508,6 @@ public class Reaction implements BioEntity {
return
null
;
}
/**
* Returns central point of the reaction - point on central line (see:
* {@link #getCenterLine()}). This point determines one of the points where
* modifiers are attached.
*
* @return central point of the reaction
*/
public
Point2D
getCenterPoint
()
{
Line2D
line2D
=
getCenterLine
();
return
new
Point2D
.
Double
((
line2D
.
getX1
()
+
line2D
.
getX2
())
/
2
,
(
line2D
.
getY1
()
+
line2D
.
getY2
())
/
2
);
}
/**
* Check if one of the nodes reference to the element.
*
...
...
model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionTest.java
View file @
4e0f7dd4
...
...
@@ -7,14 +7,14 @@ import static org.junit.Assert.assertNull;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
java.awt.geom.Line2D
;
import
java.awt.geom.Point2D
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
org.apache.commons.lang3.SerializationUtils
;
import
org.apache.logging.log4j.*
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
...
...
@@ -33,8 +33,6 @@ import lcsb.mapviewer.model.map.model.Model;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.model.map.model.ModelFullIndexed
;
import
lcsb.mapviewer.model.map.modifier.Catalysis
;
import
lcsb.mapviewer.model.map.reaction.type.DissociationReaction
;
import
lcsb.mapviewer.model.map.reaction.type.HeterodimerAssociationReaction
;
import
lcsb.mapviewer.model.map.species.GenericProtein
;
import
lcsb.mapviewer.model.map.species.Species
;
...
...
@@ -245,119 +243,6 @@ public class ReactionTest extends ModelTestFunctions {
}
}
@Test
public
void
testGetCenterLine
()
{
try
{
Reaction
reaction1
=
new
Reaction
();
Reactant
reactant
=
new
Reactant
();
PolylineData
line1
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
0.0
),
new
Point2D
.
Double
(
0.0
,
1.0
));
reactant
.
setLine
(
line1
);
reaction1
.
addReactant
(
reactant
);
Product
product
=
new
Product
();
PolylineData
line2
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
2.0
),
new
Point2D
.
Double
(
4.0
,
0.0
));
product
.
setLine
(
line2
);
reaction1
.
addProduct
(
product
);
Line2D
line
=
reaction1
.
getCenterLine
();
assertEquals
(
4.0
,
line
.
getP1
().
distance
(
line
.
getP2
()),
Configuration
.
EPSILON
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testGetCenterPoint
()
{
try
{
Reaction
reaction1
=
new
Reaction
();
Reactant
reactant
=
new
Reactant
();
PolylineData
line1
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
0.0
),
new
Point2D
.
Double
(
0.0
,
1.0
));
reactant
.
setLine
(
line1
);
reaction1
.
addReactant
(
reactant
);
Product
product
=
new
Product
();
PolylineData
line2
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
2.0
),
new
Point2D
.
Double
(
4.0
,
0.0
));
product
.
setLine
(
line2
);
reaction1
.
addProduct
(
product
);
assertEquals
(
0.0
,
reaction1
.
getCenterPoint
().
distance
(
new
Point2D
.
Double
(
2.0
,
0.0
)),
Configuration
.
EPSILON
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testGetCenterLine2
()
{
try
{
Reaction
reaction1
=
new
HeterodimerAssociationReaction
();
Reactant
reactant
=
new
Reactant
();
PolylineData
line1
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
0.0
),
new
Point2D
.
Double
(
0.0
,
1.0
));
reactant
.
setLine
(
line1
);
reaction1
.
addReactant
(
reactant
);
Reactant
reactant2
=
new
Reactant
();
PolylineData
line3
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
0.0
),
new
Point2D
.
Double
(
0.0
,
1.0
));
reactant2
.
setLine
(
line3
);
reaction1
.
addReactant
(
reactant2
);
AndOperator
operator
=
new
AndOperator
();
operator
.
addInput
(
reactant
);
operator
.
addInput
(
reactant2
);
PolylineData
line4
=
new
PolylineData
(
new
Point2D
.
Double
(
10.0
,
0.0
),
new
Point2D
.
Double
(
11.0
,
11.0
));
operator
.
setLine
(
line4
);
reaction1
.
addNode
(
operator
);
Product
product
=
new
Product
();
PolylineData
line2
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
2.0
),
new
Point2D
.
Double
(
4.0
,
0.0
));
product
.
setLine
(
line2
);
reaction1
.
addProduct
(
product
);
Line2D
line
=
reaction1
.
getCenterLine
();
assertEquals
(
6.0
,
line
.
getP1
().
distance
(
line
.
getP2
()),
Configuration
.
EPSILON
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testGetCenterLine3
()
{
try
{
Reaction
reaction1
=
new
DissociationReaction
();
Reactant
reactant
=
new
Reactant
();
PolylineData
line1
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
0.0
),
new
Point2D
.
Double
(
0.0
,
1.0
));
reactant
.
setLine
(
line1
);
reaction1
.
addReactant
(
reactant
);
Product
product
=
new
Product
();
PolylineData
line2
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
2.0
),
new
Point2D
.
Double
(
4.0
,
0.0
));
product
.
setLine
(
line2
);
reaction1
.
addProduct
(
product
);
Product
product2
=
new
Product
();
PolylineData
line3
=
new
PolylineData
(
new
Point2D
.
Double
(
0.0
,
0.0
),
new
Point2D
.
Double
(
0.0
,
1.0
));
product2
.
setLine
(
line3
);
reaction1
.
addProduct
(
product2
);
SplitOperator
operator
=
new
SplitOperator
();
operator
.
addOutput
(
product
);
operator
.
addOutput
(
product2
);
PolylineData
line4
=
new
PolylineData
(
new
Point2D
.
Double
(
10.0
,
0.0
),
new
Point2D
.
Double
(
11.0
,
0.0
));
operator
.
setLine
(
line4
);
reaction1
.
addNode
(
operator
);
Line2D
line
=
reaction1
.
getCenterLine
();
assertEquals
(
10.0
,
line
.
getP1
().
distance
(
line
.
getP2
()),
Configuration
.
EPSILON
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testSerialization
()
{
try
{
...
...
pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelContructor.java
View file @
4e0f7dd4
...
...
@@ -805,6 +805,8 @@ public class ModelContructor {
output
.
getLine
().
trimBegin
(
ReactionCellDesignerConverter
.
RECT_SIZE
/
2
-
1
);
line
.
addPoint
(
pt
.
copyPoint
(
output
.
getLine
().
getBeginPoint
()));
}
line
.
setType
(
input
.
getLine
().
getType
());
line
.
setColor
(
input
.
getLine
().
getColor
());
reaction
.
setLine
(
line
);
}
...
...
pathvisio/src/test/java/lcsb/mapviewer/wikipathway/GPMLToModelTest.java
View file @
4e0f7dd4
...
...
@@ -5,10 +5,13 @@ import static org.junit.Assert.assertFalse;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.awt.geom.Line2D
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.junit.Test
;
import
lcsb.mapviewer.common.geometry.PointTransformation
;
import
lcsb.mapviewer.converter.model.celldesigner.geometry.ReactionCellDesignerConverter
;
import
lcsb.mapviewer.model.map.compartment.Compartment
;
import
lcsb.mapviewer.model.map.model.Model
;
...
...
@@ -27,6 +30,8 @@ public class GPMLToModelTest extends WikipathwaysTestFunctions {
private
ModelComparator
mc
=
new
ModelComparator
(
1.0
);
private
PointTransformation
pt
=
new
PointTransformation
();
@Test
public
void
DopamineTest
()
throws
Exception
{
try
{
...
...
@@ -437,7 +442,9 @@ public class GPMLToModelTest extends WikipathwaysTestFunctions {
Reaction
reaction
=
model1
.
getReactions
().
iterator
().
next
();
double
distance
=
reaction
.
getCenterPoint
().
distance
(
reaction
.
getModifiers
().
get
(
0
).
getLine
().
getEndPoint
());
Line2D
centerLine
=
reaction
.
getLine
().
getLines
().
get
(
reaction
.
getLine
().
getLines
().
size
()
/
2
);
double
distance
=
pt
.
getPointOnLine
(
centerLine
.
getP1
(),
centerLine
.
getP2
(),
0.5
)
.
distance
(
reaction
.
getModifiers
().
get
(
0
).
getLine
().
getEndPoint
());
assertTrue
(
"Modifier is too far from center point: "
+
distance
,
distance
<
ReactionCellDesignerConverter
.
RECT_SIZE
);
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/comments/CommentRestImpl.java
View file @
4e0f7dd4
package
lcsb.mapviewer.api.projects.comments
;
import
java.awt.geom.Line2D
;
import
java.awt.geom.Point2D
;
import
java.util.ArrayList
;
import
java.util.LinkedHashSet
;
...
...
@@ -17,6 +18,7 @@ import lcsb.mapviewer.api.BaseRestImpl;
import
lcsb.mapviewer.api.ElementIdentifierType
;
import
lcsb.mapviewer.api.ObjectNotFoundException
;
import
lcsb.mapviewer.api.QueryException
;
import
lcsb.mapviewer.common.geometry.PointTransformation
;
import
lcsb.mapviewer.model.Project
;
import
lcsb.mapviewer.model.map.Comment
;
import
lcsb.mapviewer.model.map.model.Model
;
...
...
@@ -43,6 +45,8 @@ public class CommentRestImpl extends BaseRestImpl {
private
ReactionDao
reactionDao
;
private
ElementDao
elementDao
;
private
PointTransformation
pt
=
new
PointTransformation
();
@Autowired
public
CommentRestImpl
(
ICommentService
commentService
,
ReactionDao
reactionDao
,
ElementDao
elementDao
)
{
...
...
@@ -212,7 +216,8 @@ public class CommentRestImpl extends BaseRestImpl {
if
(
comment
.
getTableName
().
getName
().
contains
(
"Reaction"
))
{
Reaction
reaction
=
reactionDao
.
getById
(
comment
.
getTableId
());
if
(
reaction
!=
null
)
{
coordinates
=
reaction
.
getCenterPoint
();
Line2D
centerLine
=
reaction
.
getLine
().
getLines
().
get
(
reaction
.
getLine
().
getLines
().
size
()
/
2
);
coordinates
=
pt
.
getPointOnLine
(
centerLine
.
getP1
(),
centerLine
.
getP2
(),
0.5
);
}
else
{
logger
.
warn
(
"Invalid reaction dbID: "
+
comment
.
getTableId
());
}
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/models/bioEntities/reactions/ReactionsRestImpl.java
View file @
4e0f7dd4
...
...
@@ -19,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
import
lcsb.mapviewer.api.BaseRestImpl
;
import
lcsb.mapviewer.api.QueryException
;
import
lcsb.mapviewer.common.exception.InvalidXmlSchemaException
;
import
lcsb.mapviewer.common.geometry.PointTransformation
;
import
lcsb.mapviewer.model.map.BioEntity
;
import
lcsb.mapviewer.model.map.kinetics.SbmlFunction
;
import
lcsb.mapviewer.model.map.kinetics.SbmlKinetics
;
...
...
@@ -39,6 +40,8 @@ import lcsb.mapviewer.services.UserAccessException;
@Service
public
class
ReactionsRestImpl
extends
BaseRestImpl
{
private
PointTransformation
pt
=
new
PointTransformation
();
/**
* Default class logger.
*/
...
...
@@ -110,7 +113,8 @@ public class ReactionsRestImpl extends BaseRestImpl {
}
else
if
(
column
.
equals
(
"name"
))
{
value
=
reaction
.
getName
();
}
else
if
(
column
.
equals
(
"centerpoint"
))
{
value
=
reaction
.
getCenterPoint
();
Line2D
centerLine
=
reaction
.
getLine
().
getLines
().
get
(
reaction
.
getLine
().
getLines
().
size
()
/
2
);
value
=
pt
.
getPointOnLine
(
centerLine
.
getP1
(),
centerLine
.
getP2
(),
0.5
);
}
else
if
(
column
.
equals
(
"products"
))
{
List
<
Map
<
String
,
Object
>>
ids
=
new
ArrayList
<>();
for
(
Product
product
:
reaction
.
getProducts
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment