当前位置: 首页>>代码示例>>Java>>正文


Java PathwayElement.getMAnchors方法代码示例

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


在下文中一共展示了PathwayElement.getMAnchors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: replaceIdsAndRefs

import org.pathvisio.core.model.PathwayElement; //导入方法依赖的package包/类
/**
 * Updates all id's and references of a single PathwayElement, using
 * the provided idMap.
 *
 * This will
 * - replace groupId of elements
 * - replace graphId of elements, anchors and points
 * - replace graphRefs if it's in the map, otherwise set to null
 * - replace groupRegs if it's in the map, otherwise set to null
 */
private void replaceIdsAndRefs(PathwayElement p, Map<String, String> idmap)
{
	// set new unique id
	if (p.getGraphId() != null)
	{
		p.setGraphId(idmap.get(p.getGraphId()));
	}
	for(MPoint mp : p.getMPoints()) {
		mp.setGraphId(idmap.get(mp.getGraphId()));
	}
	for(MAnchor ma : p.getMAnchors()) {
		ma.setGraphId(idmap.get(ma.getGraphId()));
	}
	// set new group id
	String gid = p.getGroupId();
	if (gid != null)
	{
		p.setGroupId(idmap.get(gid));
	}
	// update graphref
	String y = p.getStartGraphRef();
	if (y != null)
	{
		if (idmap.containsKey(y))
		{
			p.setStartGraphRef(idmap.get(y));
		} else
		{
			p.setStartGraphRef(null);
		}
	}
	y = p.getEndGraphRef();
	if (y != null)
	{
		if (idmap.containsKey(y))
		{
			p.setEndGraphRef(idmap.get(y));
		} else
		{
			p.setEndGraphRef(null);
		}
	}
	y = p.getGraphRef();
	if (y != null)
	{
		if (idmap.containsKey(y))
		{
			p.setGraphRef(idmap.get(y));
		} 
		// If the ref points to an item outside the selection, keep using original!
	}		
	// update groupref
	String groupRef = p.getGroupRef();
	if (groupRef != null)
	{
		if (idmap.containsKey(groupRef))
		{
			p.setGroupRef(idmap.get(groupRef));
		} else
		{
			p.setGroupRef(null);
		}
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:75,代码来源:VPathway.java

示例3: Relation

import org.pathvisio.core.model.PathwayElement; //导入方法依赖的package包/类
/**
 * Parse a relation.
 * @param relationLine The line that defines the relation.
 */
public Relation(PathwayElement relationLine) {
	if(relationLine.getObjectType() != ObjectType.LINE) {
		throw new IllegalArgumentException("Object type should be line!");
	}
	Pathway pathway = relationLine.getParent();
	if(pathway == null) {
		throw new IllegalArgumentException("Object has no parent pathway");
	}
	//Add obvious left and right
	addLeft(pathway.getElementById(
			relationLine.getMStart().getGraphRef()
	));
	addRight(pathway.getElementById(
			relationLine.getMEnd().getGraphRef()
	));
	//Find all connecting lines (via anchors)
	for(MAnchor ma : relationLine.getMAnchors()) {
		for(GraphRefContainer grc : ma.getReferences()) {
			if(grc instanceof MPoint) {
				MPoint mp = (MPoint)grc;
				PathwayElement line = mp.getParent();
				if(line.getMStart() == mp) {
					//Start linked to anchor, make it a 'right'
					if(line.getMEnd().isLinked()) {
						addRight(pathway.getElementById(line.getMEnd().getGraphRef()));
					}
				} else {
					//End linked to anchor
					if(line.getEndLineType() == LineType.LINE) {
						//Add as 'left'
						addLeft(pathway.getElementById(line.getMStart().getGraphRef()));
					} else {
						//Add as 'mediator'
						addMediator(line, pathway.getElementById(line.getMStart().getGraphRef()));
					}
				}
			} else {
				Logger.log.warn("unsupported GraphRefContainer: " + grc);
			}
		}
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:47,代码来源:Relation.java


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