本文整理汇总了Java中org.pathvisio.core.model.MLine类的典型用法代码示例。如果您正苦于以下问题:Java MLine类的具体用法?Java MLine怎么用?Java MLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MLine类属于org.pathvisio.core.model包,在下文中一共展示了MLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
List<Graphics> selection = vPathway.getSelectedGraphics();
if(selection.size() == 1) {
Graphics g = selection.get(0);
if(g instanceof Line) {
Line l = (Line)g;
ConnectorShape s = ((MLine)l.getPathwayElement()).getConnectorShape();
if(s instanceof FreeConnectorShape) {
vPathway.getUndoManager().newAction("" + getValue(NAME));
if(add) {
addWaypoint((FreeConnectorShape)s, (MLine)l.getPathwayElement());
} else {
removeWaypoint((MLine)l.getPathwayElement());
}
}
}
}
}
示例2: addWaypoint
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
private void addWaypoint(FreeConnectorShape s, MLine l) {
//TODO: It would be nice to have access to the mouse position here, so
//we can add the waypoint to where the user clicked
//Point2D mp = new Point2D.Double(vPathway.mFromV(p.getX()), vPathway.mFromV(p.getY()));
//WayPoint nwp = new WayPoint(mp);
//double c = s.toLineCoordinate(p);
//We don't have the mouse position, just add the waypoint in the center
//with an offset if needed
List<MPoint> oldPoints = l.getMPoints();
List<MPoint> newPoints = new ArrayList<MPoint>(oldPoints);
int i = oldPoints.size() - 1; //MPoints size always >= 2
MPoint mp = oldPoints.get(i);
MPoint mp2 = oldPoints.get(i - 1);
double mc = s.toLineCoordinate(mp.toPoint2D());
double mc2 = s.toLineCoordinate(mp2.toPoint2D());
double c = mc2 + (mc - mc2) / 2.0; //Add new waypoint on center of last segment
Point2D p = s.fromLineCoordinate(c);
newPoints.add(i, l.new MPoint(p.getX(), p.getY()));
l.setMPoints(newPoints);
}
示例3: isAnotherLineLinked
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
private boolean isAnotherLineLinked(String graphRef, MLine currLine) {
for (PathwayElement element : getPathwayModel().getDataObjects()) {
if (element instanceof MLine) {
if (element.equals(currLine)) {
continue;
}
for (MPoint point:element.getMPoints()) {
if (point.getGraphRef() == null) {
// skip point
} else if (graphRef != null && point.getGraphRef().equals(graphRef)) {
return true;
}
}
}
}
return false;
}
示例4: getInteractionType
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
private static LineType getInteractionType(List<MLine> participatingLines) {
List<LineType> lineTypes = new ArrayList<LineType>();
for(MLine l : participatingLines) {
if(!l.getStartLineType().equals(LineType.LINE)) {
if(!lineTypes.contains(l.getStartLineType())) lineTypes.add(l.getStartLineType());
}
if(!l.getEndLineType().equals(LineType.LINE)) {
if(!lineTypes.contains(l.getEndLineType())) lineTypes.add(l.getEndLineType());
}
}
if(lineTypes.size() > 1) {
return null;
} else if (lineTypes.size() == 1) {
return lineTypes.get(0);
} else {
return LineType.LINE;
}
}
示例5: convertGpml
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
public static void convertGpml(Pathway p, String wpId, String revision, Model pathwayModel) {
Resource pathwayRes = PathwayConverter.parsePathwayInfoGpml(p, wpId, revision, pathwayModel);
DataHandlerGpml data = new DataHandlerGpml(p, pathwayRes);
for(PathwayElement e : p.getDataObjects()) {
if(e.getObjectType().equals(ObjectType.DATANODE)) {
DataNodeConverter.parseDataNodesGpml(e, pathwayModel, data);
} else if(e.getObjectType().equals(ObjectType.STATE)) {
StateConverter.parseStateGpml(e, pathwayModel, data);
} else if(e.getObjectType().equals(ObjectType.LINE)) {
InteractionConverter.parseInteractionGpml((MLine) e, pathwayModel, data);
} else if(e.getObjectType().equals(ObjectType.GRAPHLINE)) {
GraphicalLineConverter.parseInteractionGpml((MLine) e, pathwayModel, data);
} else if(e.getObjectType().equals(ObjectType.LABEL)) {
LabelConverter.parseLabelGpml(e, pathwayModel, data);
} else if(e.getObjectType().equals(ObjectType.SHAPE)) {
ShapeConverter.parseShapeGpml(e, pathwayModel, data);
} else if(e.getObjectType().equals(ObjectType.GROUP)) {
GroupConverter.parseGroupGpml((MGroup) e, pathwayModel, data);
} else if(e.getObjectType().equals(ObjectType.INFOBOX)) {
InfoBoxConverter.parseInfoBoxGpml(e, pathwayModel, data);
}
}
}
示例6: selectionEvent
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
public void selectionEvent(SelectionEvent e) {
boolean enable = false;
if(e.selection.size() == 1) {
VPathwayElement ve = e.selection.iterator().next();
if(ve instanceof Line) {
ConnectorShape s = ((MLine)((Line)ve).getPathwayElement()).getConnectorShape();
enable = s instanceof FreeConnectorShape;
} else {
enable = false;
}
}
setEnabled(enable);
}
示例7: removeWaypoint
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
private void removeWaypoint(MLine l) {
//TODO: Instead of removing the last point, it would be better to adjust the context
//menu to remove a specific point (like with anchors). This could be done by making
//VPoint extend VPathwayElement so we can directly get the selected waypoint here.
List<MPoint> newPoints = new ArrayList<MPoint>(l.getMPoints());
newPoints.remove(newPoints.size() - 2);
l.setMPoints(newPoints);
}
示例8: pathwayModified
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
public void pathwayModified(PathwayEvent e)
{
switch (e.getType())
{
case PathwayEvent.DELETED:
Graphics deleted = getPathwayElementView(e.getAffectedData());
if (deleted != null)
{
if (deleted.getPathwayElement() instanceof MLine) {
removeRefFromConnectingAnchors(deleted.getPathwayElement().getMStart().getGraphRef(), deleted.getPathwayElement().getMEnd().getGraphRef());
}
deleted.markDirty();
removeDrawingObject(deleted, false);
}
break;
case PathwayEvent.ADDED:
lastAdded = fromModelElement(e.getAffectedData());
if (lastAdded != null) {
lastAdded.markDirty();
}
break;
case PathwayEvent.RESIZED:
if (parent != null)
{
parent.resized();
}
break;
}
addScheduled();
cleanUp();
}
示例9: linkPointToObject
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
/**
* @arg p2d point where mouse is at
*/
private void linkPointToObject(Point2D p2d, Handle g)
{
if (dragUndoState == DRAG_UNDO_CHANGE_START)
{
dragUndoState = DRAG_UNDO_CHANGED;
}
hideLinkAnchors();
VPoint p = (VPoint) g.getAdjustable();
Line l = p.getLine();
PathwayElement pe = l.getPathwayElement();
List<LinkProvider> objects = getLinkProvidersAt(p2d);
//Fix for preventing grouped line to link to its own group
//Remove the group from the list of linkproviders
//Also remove the line anchors to prevent linking a line
//to it's own anchors
if(g.getAdjustable() instanceof VPoint) {
if(pe.getGroupRef() != null) {
PathwayElement group = getPathwayModel().getGroupById(pe.getGroupRef());
objects.remove(getPathwayElementView(group));
}
for(VAnchor va : l.getVAnchors()) {
objects.remove(va);
}
}
GraphIdContainer idc = null;
for (LinkProvider lp : objects)
{
if (lp instanceof VAnchor && ((VAnchor)lp).getMAnchor().getShape().isDisallowLinks()) {
break;
}
lp.showLinkAnchors();
LinkAnchor la = lp.getLinkAnchorAt(p2d);
if(la != null) {
//Set graphRef
la.link(p.getMPoint());
idc = la.getGraphIdContainer();
if(currentLinkAnchor != null) {
currentLinkAnchor.unhighlight();
}
la.highlight();
currentLinkAnchor = la;
break;
}
}
if(idc == null && p.getMPoint().isLinked()) {
String graphRef = p.getMPoint().getGraphRef();
p.getMPoint().unlink();
if(currentLinkAnchor != null) {
if (pe instanceof MLine && isAnotherLineLinked(graphRef, (MLine)pe)) {
} else if (currentLinkAnchor.getGraphIdContainer() instanceof MAnchor &&
currentLinkAnchor.getGraphIdContainer().getGraphId().equals(graphRef)) {
currentLinkAnchor.getGraphIdContainer().setGraphId(null);
}
currentLinkAnchor.unhighlight();
}
}
}
示例10: getMLine
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
private MLine getMLine() {
return (MLine)gdata;
}
示例11: createReversibleInteraction
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
private static void createReversibleInteraction(MLine l, DataHandlerWp data, Model model, List<MLine> regLines) {
if(l.getStartGraphRef() != null && l.getEndGraphRef() != null) {
PathwayElement start1 = data.getPathway().getElementById(l.getStartGraphRef());
PathwayElement end1 = data.getPathway().getElementById(l.getEndGraphRef());
Resource resStart1 = data.getDataNodes().get(start1.getXref());
Resource resEnd1 = data.getDataNodes().get(end1.getXref());
if(resStart1 != null && resEnd1 != null) {
String url = Utils.WP_RDF_URL + "/Pathway/" + data.getPwyId() + "_r" + data.getRevision() + "/WP/Interaction/" + l.getGraphId() + "_1";
Resource intRes = model.createResource(url);
intRes.addProperty(RDF.type, Wp.Interaction);
intRes.addProperty(RDF.type, Wp.DirectedInteraction);
Resource lineType = getLineTypeResource(l.getEndLineType());
if(lineType != null) intRes.addProperty(RDF.type, lineType);
intRes.addProperty(DCTerms.isPartOf, data.getPathwayRes());
intRes.addProperty(Wp.isAbout, model.createResource(Utils.WP_RDF_URL + "/Pathway/" + data.getPwyId() + "_r" + data.getRevision() + "/Interaction/" + l.getGraphId()));
intRes.addProperty(Wp.participants, resStart1);
intRes.addProperty(Wp.source, resStart1);
resStart1.addProperty(DCTerms.isPartOf, intRes);
intRes.addProperty(Wp.participants, resEnd1);
intRes.addProperty(Wp.target, resEnd1);
resEnd1.addProperty(DCTerms.isPartOf, intRes);
data.getPathwayElements().put(l, intRes);
String url2 = Utils.WP_RDF_URL + "/Pathway/" + data.getPwyId() + "_r" + data.getRevision() + "/WP/Interaction/" + l.getGraphId() + "_2";
Resource intRes2 = model.createResource(url2);
intRes2.addProperty(RDF.type, Wp.Interaction);
intRes2.addProperty(RDF.type, Wp.DirectedInteraction);
Resource lineType2 = getLineTypeResource(l.getStartLineType());
if(lineType2 != null) intRes2.addProperty(RDF.type, lineType2);
intRes2.addProperty(DCTerms.isPartOf, data.getPathwayRes());
intRes2.addProperty(Wp.isAbout, model.createResource(Utils.WP_RDF_URL + "/Pathway/" + data.getPwyId() + "_r" + data.getRevision() + "/Interaction/" + l.getGraphId()));
intRes2.addProperty(Wp.participants, resStart1);
intRes2.addProperty(Wp.target, resStart1);
resStart1.addProperty(DCTerms.isPartOf, intRes2);
intRes2.addProperty(Wp.participants, resEnd1);
intRes2.addProperty(Wp.source, resEnd1);
resEnd1.addProperty(DCTerms.isPartOf, intRes2);
for(PublicationXref xref : l.getBiopaxReferenceManager().getPublicationXRefs()) {
if(xref.getPubmedId() != null && !xref.getPubmedId().trim().equals("")) {
String pubmedUrl = Utils.IDENTIFIERS_ORG_URL + "/pubmed/" + xref.getPubmedId().trim();
Resource pubmedRes = model.createResource(pubmedUrl);
intRes.addProperty(DCTerms.bibliographicCitation, pubmedRes);
intRes2.addProperty(DCTerms.bibliographicCitation, pubmedRes);
pubmedRes.addProperty(RDF.type, Wp.PublicationReference);
pubmedRes.addProperty(FOAF.page, model.createResource(Utils.PUBMED_URL + xref.getPubmedId().trim()));
pubmedRes.addProperty(DCTerms.isPartOf, data.getPathwayRes());
}
}
for(MLine regLine : regLines) {
if(!isReversible(regLine)) {
String regUrl = Utils.WP_RDF_URL + "/Pathway/" + data.getPwyId() + "_r" + data.getRevision() + "/WP/Interaction/" + regLine.getGraphId();
createRegInt(regLine, data, model, intRes, regUrl + "_1");
createRegInt(regLine, data, model, intRes2, regUrl + "_2");
} else {
System.out.println("regulating line is reversible - not allowed " + regLine.getGraphId());
}
}
}
}
}
示例12: createRegInt
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
private static void createRegInt(MLine l, DataHandlerWp data, Model model, Resource parentInt, String url) {
if(l.getStartGraphRef() != null && l.getEndGraphRef() != null) {
PathwayElement startElem = data.getPathway().getElementById(l.getStartGraphRef());
PathwayElement endElem = data.getPathway().getElementById(l.getEndGraphRef());
Resource regulator = null;
if(startElem == null) {
// start = anchor - hopefully?
if(endElem != null) {
regulator = data.getPathwayElements().get(endElem);
}
} else {
regulator = data.getPathwayElements().get(startElem);
}
if(regulator != null) {
LineType lt = l.getStartLineType();
if(lt.equals(LineType.LINE)) {
lt = l.getEndLineType();
}
String regUrl = url;
Resource regIntRes = model.createResource(regUrl);
data.getPathwayElements().put(l, regIntRes);
regIntRes.addProperty(RDF.type, Wp.Interaction);
regIntRes.addProperty(RDF.type, Wp.DirectedInteraction);
Resource lineType = getLineTypeResource(lt);
if(lineType != null) {
regIntRes.addProperty(RDF.type, lineType);
}
regIntRes.addProperty(DCTerms.isPartOf, data.getPathwayRes());
regIntRes.addProperty(Wp.isAbout, model.createResource(Utils.WP_RDF_URL + "/Pathway/" + data.getPwyId() + "_r" + data.getRevision() + "/Interaction/" + l.getGraphId()));
for(PublicationXref xref : l.getBiopaxReferenceManager().getPublicationXRefs()) {
if(xref.getPubmedId() != null && !xref.getPubmedId().trim().equals("")) {
String pubmedUrl = Utils.IDENTIFIERS_ORG_URL + "/pubmed/" + xref.getPubmedId().trim();
Resource pubmedRes = model.createResource(pubmedUrl);
parentInt.addProperty(DCTerms.bibliographicCitation, pubmedRes);
pubmedRes.addProperty(RDF.type, Wp.PublicationReference);
pubmedRes.addProperty(FOAF.page, model.createResource(Utils.PUBMED_URL + xref.getPubmedId().trim()));
pubmedRes.addProperty(DCTerms.isPartOf, data.getPathwayRes());
}
}
regIntRes.addProperty(Wp.participants, parentInt);
regIntRes.addProperty(Wp.participants, regulator);
regIntRes.addProperty(Wp.source, regulator);
regIntRes.addProperty(Wp.target, parentInt);
regulator.addProperty(DCTerms.isPartOf, regIntRes);
data.getPathwayElements().put(l, regIntRes);
}
}
}
示例13: isReversible
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
private static boolean isReversible(MLine e) {
if(!e.getStartLineType().equals(LineType.LINE) && !e.getEndLineType().equals(LineType.LINE)) {
return true;
}
return false;
}
示例14: parseInteractionGpml
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
/**
* conversion only GPML vocabulary
*/
public static void parseInteractionGpml(MLine e, Model model, DataHandlerGpml data) {
Resource intRes = model.createResource(data.getPathwayRes().getURI() + "/Interaction/" + e.getGraphId());
intRes.addProperty(RDF.type, Gpml.INTERACTION);
data.getPathwayRes().addProperty(Gpml.HAS_INTERACTION, intRes);
intRes.addProperty(DCTerms.isPartOf, data.getPathwayRes());
intRes.addLiteral(Gpml.LINE_THICKNESS, e.getLineThickness());
intRes.addLiteral(Gpml.GRAPH_ID, e.getGraphId());
intRes.addLiteral(Gpml.COLOR, Utils.colorToHex(e.getColor()));
intRes.addLiteral(Gpml.LINE_STYLE, e.getLineStyle() != LineStyle.DASHED ? "Solid" : "Broken");
intRes.addLiteral(Gpml.ZORDER, e.getZOrder());
intRes.addLiteral(Gpml.CONNECTOR_TYPE, e.getConnectorType().getName());
if(e.getXref() != null && e.getXref().getId() != null && e.getXref().getDataSource() != null) {
intRes.addLiteral(Gpml.XREF_ID, e.getXref().getId());
intRes.addLiteral(Gpml.XREF_DATASOURCE, e.getXref().getDataSource().getFullName());
}
if(e.getGroupRef() != null) intRes.addLiteral(Gpml.GROUP_REF, e.getGroupRef());
// TODO: in schema there is an interaction type but that's not in the data model.
for(MAnchor a : e.getMAnchors()) {
if(a.getGraphId() != null) AnchorConverter.parseAnchorGpml(a, model, intRes, data);
}
for(MPoint p : e.getMPoints()) {
if(p.equals(e.getStartPoint())) {
PointConverter.parsePointGpml(p, model, intRes, data, e.getStartLineType().getName());
} else if (p.equals(e.getEndPoint())) {
PointConverter.parsePointGpml(p, model, intRes, data, e.getEndLineType().getName());
} else {
PointConverter.parsePointGpml(p, model, intRes, data, null);
}
}
for(String s : e.getBiopaxRefs()) {
intRes.addLiteral(Gpml.BIOPAX_REF, s);
}
for(Comment c : e.getComments()) {
CommentConverter.parseCommentGpml(c, model, intRes, data);
}
for(PublicationXref xref : e.getBiopaxReferenceManager().getPublicationXRefs()) {
PublicationXrefConverter.parsePublicationXrefGpml(xref, intRes, model, data);
}
data.getPathwayElements().put(e, intRes);
}
示例15: parseInteractionGpml
import org.pathvisio.core.model.MLine; //导入依赖的package包/类
/**
* conversion only GPML vocabulary
*/
public static void parseInteractionGpml(MLine e, Model model, DataHandlerGpml data) {
Resource intRes = model.createResource(data.getPathwayRes().getURI() + "/GraphicalLine/" + e.getGraphId());
intRes.addProperty(RDF.type, Gpml.GRAPHICAL_LINE);
data.getPathwayRes().addProperty(Gpml.HAS_GRAPHICAL_LINE, intRes);
intRes.addProperty(DCTerms.isPartOf, data.getPathwayRes());
intRes.addLiteral(Gpml.LINE_THICKNESS, e.getLineThickness());
intRes.addLiteral(Gpml.GRAPH_ID, e.getGraphId());
intRes.addLiteral(Gpml.COLOR, Utils.colorToHex(e.getColor()));
intRes.addLiteral(Gpml.LINE_STYLE, e.getLineStyle() != LineStyle.DASHED ? "Solid" : "Broken");
intRes.addLiteral(Gpml.ZORDER, e.getZOrder());
intRes.addLiteral(Gpml.CONNECTOR_TYPE, e.getConnectorType().getName());
if(e.getGroupRef() != null) intRes.addLiteral(Gpml.GROUP_REF, e.getGroupRef());
// TODO: in schema there is an interaction type but that's not in the data model.
for(MAnchor a : e.getMAnchors()) {
if(a.getGraphId() != null) AnchorConverter.parseAnchorGpml(a, model, intRes, data);
}
for(MPoint p : e.getMPoints()) {
if(p.equals(e.getStartPoint())) {
PointConverter.parsePointGpml(p, model, intRes, data, e.getStartLineType().getName());
} else if (p.equals(e.getEndPoint())) {
PointConverter.parsePointGpml(p, model, intRes, data, e.getEndLineType().getName());
} else {
PointConverter.parsePointGpml(p, model, intRes, data, null);
}
}
for(String s : e.getBiopaxRefs()) {
intRes.addLiteral(Gpml.BIOPAX_REF, s);
}
for(Comment c : e.getComments()) {
CommentConverter.parseCommentGpml(c, model, intRes, data);
}
for(PublicationXref xref : e.getBiopaxReferenceManager().getPublicationXRefs()) {
PublicationXrefConverter.parsePublicationXrefGpml(xref, intRes, model, data);
}
data.getPathwayElements().put(e, intRes);
}