예제 #1
0
        public Edge addUndirectionalEdge(Edge e)
        {
            Vertex origin      = e.getOrigin();
            Vertex destination = e.getDestination();

            origin.addOutEdge(e);
            destination.addOutEdge(e);
            origin.addInEdge(e);
            destination.addInEdge(e);

            //Add, if missing vertices
            if (!vertices.ContainsKey(origin.getId()))
            {
                vertices.Add(origin.getId(), origin);
            }

            if (!vertices.ContainsKey(destination.getId()))
            {
                vertices.Add(destination.getId(), destination);
            }

            if (!edges.Contains(e))
            {
                edges.Add(e);
            }

            return(e);
        }
예제 #2
0
        public bool addVertex(Vertex v)
        {
            if (vertices.ContainsKey(v.getId()))
            {
                return(false);
            }

            //Add vertex to <vertexId, vertex> structure
            vertices.Add(v.getId(), v);
            //Add vertex to <floorNum, List<Vertex> structure
            if (v.getLocation() != null && v.getLocation().getAbsoluteLocation() != null)
            {
                int floor = (int)v.getLocation().getAbsoluteLocation().getAltitude();
                if (!verticesByFloor.ContainsKey(floor))
                {
                    verticesByFloor.Add(floor, new List <Vertex>());
                }
                verticesByFloor[floor].Add(v);
            }
            return(true);
        }
예제 #3
0
		// Copy constructor
		public Vertex(Vertex aVertex) {
		
			double latitude = aVertex.getLocation().getAbsoluteLocation().getLatitude();
			double longitude = aVertex.getLocation().getAbsoluteLocation().getLongitude();
			double altitude = aVertex.getLocation().getAbsoluteLocation().getAltitude();
		
			AggregateLocation aggLoc = new AggregateLocation(new AbsoluteLocation(latitude, longitude, altitude));
			this.location = aggLoc;
			this.inEdges = aVertex.getInEdges();
			this.outEdges = aVertex.getOutEdges();
			this.id = aVertex.getId();
			this.fingerprints = aVertex.getFingerPrints();
			this.radiusVertices = aVertex.getRadiusVertices();
		}
예제 #4
0
        // Copy constructor
        public Vertex(Vertex aVertex)
        {
            double latitude  = aVertex.getLocation().getAbsoluteLocation().getLatitude();
            double longitude = aVertex.getLocation().getAbsoluteLocation().getLongitude();
            double altitude  = aVertex.getLocation().getAbsoluteLocation().getAltitude();

            AggregateLocation aggLoc = new AggregateLocation(new AbsoluteLocation(latitude, longitude, altitude));

            this.location       = aggLoc;
            this.inEdges        = aVertex.getInEdges();
            this.outEdges       = aVertex.getOutEdges();
            this.id             = aVertex.getId();
            this.fingerprints   = aVertex.getFingerPrints();
            this.radiusVertices = aVertex.getRadiusVertices();
        }
예제 #5
0
        public bool removeVertex(Vertex v)
        {
            foreach (Edge e in v.incidentEdges())
            {
                edges.Remove(e);
            }

            //remove from <vertexId, vertex> structure
            vertices.Remove(v.getId());
            //remove from <floorNum, List<Vertex> structure
            bool hasLocation = v.getLocation() != null && v.getLocation().getAbsoluteLocation() != null;

            if (hasLocation)
            {
                int floor = (int)v.getLocation().getAbsoluteLocation().getAltitude();
                if (verticesByFloor.ContainsKey(floor))
                {
                    verticesByFloor[floor].Remove(v);
                }
            }
            return(true);
        }
예제 #6
0
 public bool ContainsVertex(Vertex v)
 {
     return(vertices.ContainsKey(v.getId()));
 }
예제 #7
0
	public bool removeVertex(Vertex v)
	{
		foreach (Edge e in v.incidentEdges())
			edges.Remove(e);
			
		//remove from <vertexId, vertex> structure
		vertices.Remove(v.getId());
		//remove from <floorNum, List<Vertex> structure
		bool hasLocation = v.getLocation() != null && v.getLocation().getAbsoluteLocation() != null;
		if (hasLocation)
		{
			int floor = (int)v.getLocation().getAbsoluteLocation().getAltitude();
			if (verticesByFloor.ContainsKey(floor))
			{
				verticesByFloor[floor].Remove(v);
			}
		}
		return true;
	}
예제 #8
0
	public bool ContainsVertex(Vertex v)
	{
		return vertices.ContainsKey(v.getId());
	}
예제 #9
0
	public bool addVertex(Vertex v)
	{
		if (vertices.ContainsKey(v.getId()))
			return false;
					
		//Add vertex to <vertexId, vertex> structure
		vertices.Add(v.getId(), v);
		//Add vertex to <floorNum, List<Vertex> structure
		if (v.getLocation() != null && v.getLocation().getAbsoluteLocation() != null)
		{
			int floor = (int)v.getLocation().getAbsoluteLocation().getAltitude();
			if (!verticesByFloor.ContainsKey(floor))
			{
				verticesByFloor.Add(floor, new List<Vertex>());
			}
			verticesByFloor[floor].Add(v);
		}
		return true;
	}