本文整理汇总了Java中org.pathvisio.core.model.PathwayElement类的典型用法代码示例。如果您正苦于以下问题:Java PathwayElement类的具体用法?Java PathwayElement怎么用?Java PathwayElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathwayElement类属于org.pathvisio.core.model包,在下文中一共展示了PathwayElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
public void delete(PathwayElement oldElt)
{
VPathwayElement velt = findElt (oldElt, vpwy[PWY_OLD]);
//assert (velt != null || oldElt.getObjectType () == ObjectType.INFOBOX);
if (velt == null)
{
Logger.log.warn (Utils.summary(oldElt) + " doesn't have a corresponding view element");
}
else
{
velt.highlight (Color.RED);
Map <String, String> hint = new HashMap<String, String>();
hint.put ("element", "Element removed");
Rectangle2D r = velt.getVBounds();
ModData mod = new ModData (
(int)vpwy[PWY_NEW].mFromV(r.getX() + r.getWidth() / 2),
(int)vpwy[PWY_NEW].mFromV(r.getY() + r.getHeight() / 2),
0,
0,
hint, ModData.ModType.REMOVED);
modifications.add (mod);
modsByElt.put (velt, mod);
}
}
示例2: findElt
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
helper to find a VPathwayElt that corresponds to a certain PathwayElement
*/
private VPathwayElement findElt (PathwayElement target, VPathway vpwy)
{
for (VPathwayElement velt : vpwy.getDrawingObjects())
{
if (velt instanceof Graphics)
{
Graphics g = (Graphics)velt;
if (g.getPathwayElement() == target)
{
return velt;
}
}
}
return null;
}
示例3: usesOldEnsembl
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
private boolean usesOldEnsembl(Pathway pwy)
{
Organism org = Organism.fromLatinName(pwy.getMappInfo().getOrganism());
if (!ensSpecies.containsKey(org))
return false; // this pwy is not one of the species to be converted
for (PathwayElement elt : pwy.getDataObjects())
{
if (elt.getObjectType() == ObjectType.DATANODE &&
elt.getDataSource() == BioDataSource.ENSEMBL)
{
return true;
}
}
return false;
}
示例4: SearchNode
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
Create a new SearchNode.
note: parent may be null for the first SearchNode.
This will mark oldElt and newElt so they can be added only once.
*/
public SearchNode(SearchNode aParent, PathwayElement anOldElt, PathwayElement aNewElt, float aCost)
{
cost = aCost;
parent = aParent;
oldElt = anOldElt;
newElt = aNewElt;
assert (oldElt != null);
assert (newElt != null);
if (parent != null)
{
parentSet = parent.parentSet;
}
assert (!parentSet.contains(oldElt));
assert (!parentSet.contains(newElt));
parentSet.add (oldElt);
parentSet.add (newElt);
}
示例5: getSimScore
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
returns a score between 0 and 100, 100 if both elements are completely similar
*/
public int getSimScore (PathwayElement oldE, PathwayElement newE)
{
Map<String, String> oldC = PwyElt.getContents(oldE);
Map<String, String> newC = PwyElt.getContents(newE);
int oldN = oldC.size();
int newN = newC.size();
if (oldN + newN == 0) return 0; // div by 0 prevention
int score = 0;
for (String key : oldC.keySet())
{
if (newC.containsKey (key) && newC.get(key).equals (oldC.get(key)))
{
score += 2;
}
}
return (100 * score) / (oldN + newN);
}
示例6: getVPosition
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
protected Point2D getVPosition() {
PathwayElement mParent = parent.getPathwayElement();
Point2D vp = null;
//Check for mappinfo object, needs a special treatment,
//since it has no bounds in the model
if(mParent.getObjectType() == ObjectType.MAPPINFO) {
Rectangle2D vb = parent.getVBounds();
double x = rPosition.getX();
double y = rPosition.getY();
if(vb.getWidth() != 0) x *= vb.getWidth() / 2;
if(vb.getHeight() != 0) y *= vb.getHeight() / 2;
x += vb.getCenterX();
y += vb.getCenterY();
vp = new Point2D.Double(x, y);
} else { //For other objects, use the model bounds
Point2D mp = mParent.toAbsoluteCoordinate(rPosition);
vp = new Point2D.Double(vFromM(mp.getX()), vFromM(mp.getY()));
}
return vp;
}
示例7: fromModel
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
* Maps the contents of a pathway to this VPathway
*/
public void fromModel(Pathway aData)
{
Logger.log.trace("Create view structure");
data = aData;
for (PathwayElement o : data.getDataObjects())
{
fromModelElement(o);
}
// data.fireObjectModifiedEvent(new PathwayEvent(null,
// PathwayEvent.MODIFIED_GENERAL));
fireVPathwayEvent(new VPathwayEvent(this, VPathwayEventType.MODEL_LOADED));
data.addListener(this);
undoManager.setPathway(data);
addScheduled();
Logger.log.trace("Done creating view structure");
}
示例8: isAnotherLineLinked
import org.pathvisio.core.model.PathwayElement; //导入依赖的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;
}
示例9: generateNewIds
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
* Generate new id's for a bunch of elements to be pasted, but do not actually set them.
* Instead, store these new ids in a map, so that we can later update
* both the graphIds and graphReferences,
* as well as groupIds and groupReferences.
*
* idMap and newIds should be an empty map / set.
* It will be filled by this method.
*/
private void generateNewIds(List<PathwayElement> elements,
Map<String, String> idmap, Set<String> newids)
{
for (PathwayElement o : elements)
{
String id = o.getGraphId();
String groupId = o.getGroupId();
generatePasteId(id, data.getGraphIds(), idmap, newids);
generatePasteId(groupId, data.getGroupIds(), idmap, newids);
//For a line, also process the point ids
if(o.getObjectType() == ObjectType.LINE || o.getObjectType() == ObjectType.GRAPHLINE) {
for(MPoint mp : o.getMPoints())
generatePasteId(mp.getGraphId(), data.getGraphIds(), idmap, newids);
for(MAnchor ma : o.getMAnchors())
generatePasteId(ma.getGraphId(), data.getGraphIds(), idmap, newids);
}
}
}
示例10: getIdRefPairs
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
* Generates current id-ref pairs from all current groups
*
* @return HashMap<String, String>
*/
protected Map<String, String> getIdRefPairs()
{
// idRefPairs<id, ref>
Map<String, String> idRefPairs = new HashMap<String, String>();
// Populate hash map of id-ref pairs for all groups
for (VPathwayElement vpe : canvas.getDrawingObjects())
{
if (vpe instanceof Graphics && vpe instanceof Group)
{
PathwayElement pe = ((Graphics) vpe).getPathwayElement();
if (pe.getGroupRef() != null)
{
idRefPairs.put(pe.getGroupId(), pe.getGroupRef());
}
}
}
return idRefPairs;
}
示例11: getBackpageHTML
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
* generates html for a given PathwayElement. Combines the base
* header with fragments from all BackpageHooks into one html String.
*/
public String getBackpageHTML(PathwayElement e)
{
if (e == null) {
return "<p>No pathway element is selected.</p>";
} else if (e.getObjectType() != ObjectType.DATANODE && e.getObjectType() != ObjectType.LINE) {
return "<p>Backpage is not available for this type of element.<BR>Only DataNodes or Interactions can have a backpage.</p>";
} else if (e.getDataSource() == null || e.getXref().getId().equals("")) {
return "<p>There is no annotation for this pathway element defined.</p>";
}
StringBuilder builder = new StringBuilder(backpagePanelHeader);
for (BackpageHook h : hooks)
{
builder.append(h.getHtml(e));
}
builder.append ("</body></html>");
return builder.toString();
}
示例12: addElements
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
public PathwayElement[] addElements(Pathway p, double mx, double my) {
PathwayElement e = PathwayElement.createPathwayElement(ObjectType.SHAPE);
e.setShapeType(type);
e.setMCenterX(mx);
e.setMCenterY(my);
e.setMWidth(1);
e.setMHeight(1);
e.setRotation(0);
e.setColor(Color.LIGHT_GRAY);
e.setLineThickness(3.0);
if (ccType.equals(CellularComponentType.CELL)
|| ccType.equals(CellularComponentType.NUCLEUS)
|| ccType.equals(CellularComponentType.ORGANELLE))
{
e.setLineStyle(LineStyle.DOUBLE);
} else if (ccType.equals(CellularComponentType.CYTOSOL) || ccType.equals(CellularComponentType.EXTRACELLULAR)
|| ccType.equals(CellularComponentType.MEMBRANE))
{
e.setLineStyle(LineStyle.DASHED);
e.setLineThickness(1.0);
}
e.setGraphId(p.getUniqueGraphId());
e.setDynamicProperty(CellularComponentType.CELL_COMPONENT_KEY, ccType.toString());
addElement(e, p);
return new PathwayElement[] { e };
}
示例13: updatePropertyCounts
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
* Add/remove properties to/from the table model.
*
* @param e the PathwayElement with the properties of interest
* @param remove true if the PathwayElement's visible properties should be removed from the table model,
* false if it should be added to the table model
*/
public void updatePropertyCounts(PathwayElement e, boolean remove)
{
for(Object o : PropertyDisplayManager.getVisiblePropertyKeys(e))
{
PropertyView tp = propertyValues.get(o);
if(tp == null) {
propertyValues.put(o, tp = new PropertyView(swingEngine.getEngine().getActiveVPathway(), o));
}
if(remove) {
tp.removeElement(e);
} else {
tp.addElement(e);
}
}
}
示例14: refresh
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
protected void refresh() {
super.refresh();
if(getInput() != null) {
PathwayElement input = getInput();
text.setText(input.getTextLabel());
int style = input.isBold() ? Font.BOLD : Font.PLAIN;
style |= input.isItalic() ? Font.ITALIC : Font.PLAIN;
Font f = new Font(
input.getFontName(), style, (int)(input.getMFontSize())
);
fontPreview.setFont(f);
fontPreview.setText(f.getName());
} else {
text.setText("");
fontPreview.setText("");
}
}
示例15: summary
import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
public static String summary(PathwayElement elt)
{
if (elt == null) return "null"; // TODO, why is this necessary?
StringBuilder result = new StringBuilder ("[" + elt.getObjectType().getTag());
summaryHelper(elt, result, StaticProperty.TEXTLABEL, "lbl");
summaryHelper(elt, result, StaticProperty.WIDTH, "w");
summaryHelper(elt, result, StaticProperty.HEIGHT, "h");
summaryHelper(elt, result, StaticProperty.CENTERX, "cx");
summaryHelper(elt, result, StaticProperty.CENTERY, "cy");
summaryHelper(elt, result, StaticProperty.STARTX, "x1");
summaryHelper(elt, result, StaticProperty.STARTY, "y1");
summaryHelper(elt, result, StaticProperty.ENDX, "x2");
summaryHelper(elt, result, StaticProperty.ENDY, "y2");
summaryHelper(elt, result, StaticProperty.GRAPHID, "id");
summaryHelper(elt, result, StaticProperty.STARTGRAPHREF, "startref");
summaryHelper(elt, result, StaticProperty.ENDGRAPHREF, "endref");
summaryHelper(elt, result, StaticProperty.MAPINFONAME, "title");
summaryHelper(elt, result, StaticProperty.AUTHOR, "author");
result.append("]");
return result.toString();
}