Example #1
0
		public Vertex Opposite(Vertex k)
		{
			if (k.Equals(origin))
				return destination;
			else if (k.Equals(destination))
				return origin;
			else
				return null;
		}
	// Methods dealing with directed edges //

	//Methods dealing with positioning 
	//We don't bother to create a subclass for this behavior as our graph is only used for one purpose in this application
	public void InsertRadiusVertices(Vertex v, int radius)
	{
		AbsoluteLocation sourceLocation = v.getLocation().getAbsoluteLocation(); 
		AbsoluteLocation targetLocation;
		double dist;
		foreach (Vertex w in vertices.Values)
		{
			if (v.Equals(w))
				continue;
			
			targetLocation = w.getLocation().getAbsoluteLocation(); 
			dist = com.smartcampus.baselogic.DistanceMeasurements.CalculateMoveddistanceInMeters(
					sourceLocation.getLatitude(), sourceLocation.getLongitude(),
					targetLocation.getLatitude(), targetLocation.getLongitude());
			
			if (dist <= radius)
				v.addRadiusVertex((Vertex)w);
		}
	}