예제 #1
0
        // 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);
                }
            }
        }
예제 #2
0
	// 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);
		}
	}