• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PathwayElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pathvisio.core.model.PathwayElement的典型用法代码示例。如果您正苦于以下问题:Java PathwayElement类的具体用法?Java PathwayElement怎么用?Java PathwayElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PathwayElement类属于org.pathvisio.core.model包,在下文中一共展示了PathwayElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:27,代码来源:PanelOutputter.java


示例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;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:19,代码来源:PanelOutputter.java


示例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;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:17,代码来源:Compat.java


示例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);
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:23,代码来源:SearchNode.java


示例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);
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:26,代码来源:BasicSim.java


示例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;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:22,代码来源:Citation.java


示例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");
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:22,代码来源:VPathway.java


示例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;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:18,代码来源:VPathway.java


示例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);
		}
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:29,代码来源:VPathway.java


示例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;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:26,代码来源:Group.java


示例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();
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:22,代码来源:BackpageTextProvider.java


示例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 };
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:27,代码来源:DefaultTemplates.java


示例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);
		}
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:23,代码来源:PathwayTableModel.java


示例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("");
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:18,代码来源:LabelDialog.java


示例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();
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:22,代码来源:Utils.java


示例16: PathwayElementDialog

import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
protected PathwayElementDialog(SwingEngine swingEngine, PathwayElement e, boolean readonly, Frame frame, String title, Component locationComp) {
	super(frame, title, locationComp, true);
	this.readonly = readonly;
	this.swingEngine = swingEngine;
	setDialogComponent(createDialogPane());
	panels = new HashMap<String, PathwayElementPanel>();
	createTabs();
	setInput(e);
	setSize(450, 300);
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:11,代码来源:PathwayElementDialog.java


示例17: makeNewElt

import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
public PathwayElement makeNewElt()
{
	if (isDeletion) throw new IllegalArgumentException();
	PathwayElement result = oldElt.copy();
	for (Change ch : changes)
	{
		StaticProperty pt = StaticProperty.getByTag(ch.attr);
		switch (pt.type())
		{
		case STRING:
			result.setStaticProperty(pt, ch.newValue);
			break;
		case DOUBLE:
			result.setStaticProperty(pt, Double.parseDouble (ch.newValue));
			break;
		case SHAPETYPE:
			// setProperty expects to get ShapeType for this Shape.
			result.setStaticProperty(pt, ShapeRegistry.fromName(ch.newValue));
			break;
		case DATASOURCE:
			result.setStaticProperty(pt, DataSource.getByFullName(ch.newValue));
			break;
		case DB_ID:
			result.setStaticProperty(pt, ch.newValue);
			break;
		case GENETYPE:
			result.setStaticProperty(pt, ch.newValue);
			break;
		default:
			Logger.log.error (ch.attr + " of type " + pt.getType() + " not supported");
			assert (false);
		}
	}
	return result;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:36,代码来源:Patch.java


示例18: findCorrespondence

import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
/**
   This is very similar to PwyDoc.SearchCorrespondence, only
   it doesn't compare two pathways: it compares elements mentioned in the dgpml with pathways.
 */
private SearchNode findCorrespondence(SearchNode currentNode, PwyDoc oldDoc, PathwayElement newElt, SimilarityFunction simFun, CostFunction costFun)
{
	int maxScore = 0;
	PathwayElement maxOldElt = null;
	for (PathwayElement oldElt : oldDoc.getElts())
	{
		// if it's the first node, or if the newElt is not yet in the searchpath
		if (currentNode == null || !currentNode.ancestryHasElt (newElt))
		{
			int score = simFun.getSimScore (oldElt, newElt);
			if (score > maxScore)
			{
				maxOldElt = oldElt;
				maxScore = score;
			}
		}
	}

	if (maxOldElt != null && maxScore > 70)
	{
		// add pairing to search tree.
		SearchNode newNode = new SearchNode (currentNode, newElt, maxOldElt, 0);
		currentNode = newNode;
	}
	return currentNode;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:31,代码来源:Patch.java


示例19: getType

import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
public String getType(PathwayElement e) {
	ObjectType obj = e.getObjectType();
	if(obj.equals(ObjectType.LINE)) {
		return "Interaction";
	} else {
		return e.getDataNodeType();
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:9,代码来源:BackpageTextProvider.java


示例20: delete

import org.pathvisio.core.model.PathwayElement; //导入依赖的package包/类
public void delete(PathwayElement oldElt)
{
	Element e = (new Element("Delete"));
	try
	{
		Element f = GpmlFormat.createJdomElement(oldElt);
		e.addContent (f);
	}
	catch (ConverterException ex) { Logger.log.error ("Converter exception", ex); }
	doc.getRootElement().addContent(e);
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:12,代码来源:DgpmlOutputter.java



注:本文中的org.pathvisio.core.model.PathwayElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java KeyPairProvider类代码示例发布时间:2022-05-23
下一篇:
Java Observers类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap