blob: a7f9c78a04730eba99a8f75557ff378468ceaaf1 [file] [log] [blame]
package org.eclipse.stem.ui.grapheditor;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.stem.core.graph.Node;
import org.eclipse.stem.definitions.labels.AreaLabel;
import org.eclipse.stem.definitions.labels.PopulationLabel;
public class NodeData
{
EList<org.eclipse.stem.core.graph.NodeLabel> nodeLabels;
String nodeSpatial;
URI nodeURI;
String nodeIdentifier;
String nodeTitle;
Node node;
double origX;
double origY;
NodeData(Node n, double origX, double origY )
{
//TODO
/*this.nodeLabels = new ArrayList<org.eclipse.stem.core.graph.NodeLabel>();
for (org.eclipse.stem.core.graph.NodeLabel nodeLabel : nodeLabelList)
for (int i=0; i< nla.length; i++)
{
org.eclipse.stem.core.graph.NodeLabel nl =
(org.eclipse.stem.core.graph.NodeLabel) EcoreUtil.copy(nla2[i]);
(this.nodeLabels).add(nl);
}*/
this.nodeLabels = n.getLabels();
this.nodeTitle = n.getDublinCore().getTitle();
this.nodeSpatial = n.getDublinCore().getSpatial();
this.nodeURI = n.getURI();
this.nodeIdentifier = n.getDublinCore().getIdentifier();
this.origX = origX;
this.origY = origY;
this.node = n;
}
List<Integer> getNodeLabelTypes()
{
List<Integer> labelTypes = new ArrayList<Integer>();
//new int[this.nodeLabels.size()]; JFW
for (int i=0; i<this.nodeLabels.size(); i++)
{
if (this.nodeLabels.get(i) instanceof AreaLabel)
labelTypes.add(i,GraphDefs.AREA_LABEL);
else if (this.nodeLabels.get(i) instanceof PopulationLabel)
labelTypes.add(i,GraphDefs.POPULATION_LABEL);
else labelTypes.add(i,GraphDefs.UNDEFINED);
}
return labelTypes;
}
Node getNode()
{
return this.node;
}
String getSpacial()
{
return this.nodeSpatial;
}
String getNodeIdentifier()
{
return this.nodeIdentifier;
}
String getNodeTitle()
{
return this.nodeTitle;
}
EList<org.eclipse.stem.core.graph.NodeLabel> getNodeLabels()
{
return this.nodeLabels;
}
URI getNodeURI()
{
return this.nodeURI;
}
double getOrigX()
{
return this.origX;
}
double getOrigY()
{
return this.origY;
}
void setNodeTitle(String nodeTitle)
{
this.nodeTitle = nodeTitle;
}
void setNodeURI(String nodeURI)
{
this.nodeURI = URI.createURI(nodeURI);
}
void setNodeLabels(EList<org.eclipse.stem.core.graph.NodeLabel> nodeLabels)
{
this.nodeLabels=nodeLabels;
}
void setNode(Node n)
{
this.node=n;
}
}