本文整理汇总了Java中org.pathvisio.core.model.ObjectType类的典型用法代码示例。如果您正苦于以下问题:Java ObjectType类的具体用法?Java ObjectType怎么用?Java ObjectType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectType类属于org.pathvisio.core.model包,在下文中一共展示了ObjectType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
vPathway.resetHighlight();
for(PathwayElement pe : vPathway.getPathwayModel().getDataObjects()) {
if(pe.getObjectType() == ObjectType.LINE) {
Line vl = (Line)vPathway.getPathwayElementView(pe);
String grs = pe.getStartGraphRef();
String gre = pe.getEndGraphRef();
if(grs == null || "".equals(grs)) {
vl.getStart().highlight();
}
if(gre == null || "".equals(gre)) {
vl.getEnd().highlight();
}
}
}
}
示例2: getVPosition
import org.pathvisio.core.model.ObjectType; //导入依赖的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;
}
示例3: generateNewIds
import org.pathvisio.core.model.ObjectType; //导入依赖的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);
}
}
}
示例4: addElements
import org.pathvisio.core.model.ObjectType; //导入依赖的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.setGraphId(p.getUniqueGraphId());
addElement(e, p);
//brace
// gdata.setOrientation(OrientationType.RIGHT);
return new PathwayElement[] { e };
}
示例5: getTopLeftCorner
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
/**
* Returns the top left corner of the bounding box around the elements
* @param elements = list of PathwayElement objects
* @return
*/
private Point2D.Double getTopLeftCorner(List<PathwayElement> elements) {
Rectangle2D vr = null;
for (PathwayElement o : elements)
{
if (o.getObjectType() == ObjectType.INFOBOX) continue;
if (o.getObjectType() == ObjectType.BIOPAX) continue;
else {
if (vr == null) vr = o.getMBounds();
else vr.add(o.getMBounds());
}
}
return new Point2D.Double(vr.getX(), vr.getY());
}
示例6: getBackpageHTML
import org.pathvisio.core.model.ObjectType; //导入依赖的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();
}
示例7: usesOldEnsembl
import org.pathvisio.core.model.ObjectType; //导入依赖的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;
}
示例8: convertEnsembl
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
/**
* Ensembl considers each species database as separate,
* and thus they should have separate system codes as well.
* This method will convert generic Ensembl datanodes
* to species specific datanodes if possible.
*/
private void convertEnsembl(Pathway pwy)
{
Organism org = Organism.fromLatinName(pwy.getMappInfo().getOrganism());
if (!ensSpecies.containsKey(org))
return; // 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)
{
elt.setDataSource (ensSpecies.get (org));
}
}
}
示例9: getAnnotationHTML
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
/**
* generates html for a given PathwayElement. Combines the base header with
* fragments from all BackpageHooks into one html String.
*/
public String getAnnotationHTML(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>It is currently not possible to annotate this type of pathway element." +
"<BR>Only DataNodes and Interactions can be annotated.</p>";
} else if (e.getDataSource() == null || e.getXref().getId().equals("")) {
return "<p>This pathway element has not yet been annotated.</p>";
}
StringBuilder builder = new StringBuilder(backpagePanelHeader);
for (DataHook h : hooks) {
builder.append(h.getHtml(e));
}
builder.append("</body></html>");
return builder.toString();
}
示例10: convertGpml
import org.pathvisio.core.model.ObjectType; //导入依赖的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);
}
}
}
示例11: test
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
@Test
public void test() throws ConverterException, IOException {
client.login(props.getProperty("username"), props.getProperty("password"));
String id = "WP4";
WSPathway p = client.getPathway(id);
Pathway pathway = new Pathway();
pathway.readFromXml(IOUtils.toInputStream(p.getGpml(), "UTF-8"), true);
PathwayElement pel = PathwayElement.createPathwayElement(ObjectType.DATANODE);
pel.setGraphId(pathway.getUniqueGraphId());
pel.setDataNodeType(DataNodeType.GENEPRODUCT);
pel.setMCenterX(65);
pel.setMCenterY(65);
pel.setMHeight(20);
pel.setMWidth(80);
pel.setTextLabel("Test");
pel.setElementID("12334");
pathway.add(pel);
String newRevision = client.updatePathway(p.getId(), pathway, "add data node test", Integer.parseInt(p.getRevision()));
assertTrue(Integer.parseInt(newRevision) > Integer.parseInt(p.getRevision()));
}
示例12: scanPathway
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
protected Result scanPathway(File pathwayFile) throws BotException {
try {
ConnectorBotResult report = new ConnectorBotResult(
getCache().getPathwayInfo(pathwayFile));
Pathway pathway = new Pathway();
pathway.readFromXml(pathwayFile, true);
String orgName = pathway.getMappInfo().getOrganism();
Organism org = Organism.fromLatinName(orgName);
if(org == null) org = Organism.fromShortName(orgName);
for(PathwayElement pwe : pathway.getDataObjects()) {
if(pwe.getObjectType() == ObjectType.LINE) {
boolean valid =
pwe.getMStart().isLinked() &&
pwe.getMEnd().isLinked();
report.addLine(pwe, valid);
}
}
return report;
} catch(Exception e) {
throw new BotException(e);
}
}
示例13: BiopaxElement
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
/**
* Constructor for this class. Builds a map of all biopax
* elements and their references
*/
public BiopaxElement()
{
super(ObjectType.BIOPAX);
biopax = new HashMap<String, BiopaxNode>();
ordinal = new HashMap<Class<? extends BiopaxNode>, Map<String, Integer>>();
refresh();
}
示例14: selectObjectsByObjectType
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
public void selectObjectsByObjectType(ObjectType ot) {
clearSelection();
selection.startSelecting();
for(PathwayElement pe : getPathwayModel().getDataObjects()) {
if(pe.getObjectType() == ot) {
selection.addToSelection(getPathwayElementView(pe));
}
}
selection.stopSelecting();
}
示例15: addElement
import org.pathvisio.core.model.ObjectType; //导入依赖的package包/类
Set<PathwayElement> addElement(PathwayElement pwe, Set<PathwayElement> set) {
Set<PathwayElement> added = new HashSet<PathwayElement>();
if(pwe != null) {
//If it's a group, add all subelements
if(pwe.getObjectType() == ObjectType.GROUP) {
for(PathwayElement ge : pwe.getParent().getGroupElements(pwe.getGroupId())) {
added.addAll(addElement(ge, set));
}
}
set.add(pwe);
added.add(pwe);
}
return added;
}