package ASSET.Models.Vessels;

import ASSET.Participants.CoreParticipant;
import MWC.GenericData.WorldArea;
import MWC.GenericData.WorldDistance;
import MWC.GenericData.WorldLocation;

/**
 * Created by IntelliJ IDEA
 */
public class SonarBuoyField extends CoreParticipant {
  //////////////////////////////////////////////////
  // member variables
  //////////////////////////////////////////////////


  //////////////////////////////////////////////////
  // constructor
  //////////////////////////////////////////////////

  /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/** the area covered by this buoy field
	 * 
	 */
	private WorldArea _myCoverage;

	/** normal constructor
	 * @param coverage 
   *
   */
  public SonarBuoyField(final int id, WorldArea coverage) {
    // create the participant bits
    super(id, null, null, null);
    
    // store the coverage
    _myCoverage = coverage;

  }


  //////////////////////////////////////////////////
  // member methods
  //////////////////////////////////////////////////

  
  
  
  /** return what this participant is currently doing
   *
   */
  public String getActivity() {
    return "Active";
  }


  /** the range calculation goes from our area, not just a single point
   * 
   */
	public WorldDistance rangeFrom(WorldLocation point)
	{
		double dist = 0;
		
		// is this point inside us?
		if(getCoverage().contains(point))
		{
			// done - return zero distance
		}
		else
		{
			// right, measure the distance from the sides
			dist = getCoverage().rangeFromEdge(point);
		}
		
		return new WorldDistance(dist, WorldDistance.DEGS);
	}


	public WorldArea getCoverage()
	{
		return _myCoverage;
	}

}

@@ -269,15 +269,15 @@
 pant
- %7B%0A  
+%0A%7B%0A%09
 //
+ 
 ////
@@ -313,34 +313,33 @@
 ///////////////%0A
-  
+%09
 // member variab
@@ -342,20 +342,20 @@
 riables%0A
-  
+%09
 //
+ 
 ////////
@@ -396,21 +396,20 @@
 //////%0A%0A
-%0A  
+%09
 //
+ 
 ////////
@@ -449,18 +449,17 @@
 ///////%0A
-  
+%09
 // const
@@ -465,20 +465,20 @@
 tructor%0A
-  
+%09
 //
+ 
 ////////
@@ -519,18 +519,17 @@
 //////%0A%0A
-  
+%09
 /**%0A%09 * 
@@ -588,14 +588,17 @@
 1L;%0A
-%09
 %0A%09/**
+%0A%09 *
  the
@@ -677,16 +677,20 @@
 e;%0A%0A%09/**
+%0A%09 *
  normal 
@@ -701,16 +701,21 @@
 tructor%0A
+%09 * %0A
 %09 * @par
@@ -729,23 +729,20 @@
 rage
- %0A   *%0A  
+%0A%09 * %0A%09
  */%0A
-  
+%09
 publ
@@ -792,23 +792,22 @@
 overage)
- %7B%0A    
+%0A%09%7B%0A%09%09
 // creat
@@ -829,20 +829,18 @@
 nt bits%0A
-    
+%09%09
 super(id
@@ -864,17 +864,11 @@
 l);%0A
-    %0A    
+%0A%09%09
 // s
@@ -885,20 +885,18 @@
 overage%0A
-    
+%09%09
 _myCover
@@ -916,18 +916,16 @@
 e;%0A%0A
-  %7D%0A%0A%0A  
+%09%7D%0A%0A%09
 //
+ 
 ////
@@ -969,18 +969,17 @@
 ///////%0A
-  
+%09
 // membe
@@ -992,12 +992,12 @@
 ods%0A
-  
+%09
 //
+ 
 ////
@@ -1046,21 +1046,15 @@
 //%0A%0A
-  %0A  %0A  %0A  /*
+%09/**%0A%09 
 * re
@@ -1103,21 +1103,19 @@
 ing%0A
-   *%0A  
+%09 * %0A%09
  */%0A
-  
+%09
 publ
@@ -1141,15 +1141,14 @@
 ty()
- %7B%0A    
+%0A%09%7B%0A%09%09
 retu
@@ -1164,18 +1164,19 @@
 e%22;%0A
-  %7D%0A%0A%0A  /*
+%09%7D%0A%0A%09/**%0A%09 
 * th
@@ -1243,16 +1243,14 @@
 int%0A
-  
+%09
  * %0A
-  
+%09
  */%0A
@@ -1328,135 +1328,13 @@
  0;%0A
-%09%09
 %0A%09%09//
- is this point inside us?%0A%09%09if(getCoverage().contains(point))%0A%09%09%7B%0A%09%09%09// done - return zero distance%0A%09%09%7D%0A%09%09else%0A%09%09%7B%0A%09%09%09//
  rig
@@ -1373,17 +1373,16 @@
 e sides%0A
-%09
 %09%09dist =
@@ -1422,14 +1422,8 @@
 t);%0A
-%09%09%7D%0A%09%09
 %0A%09%09r
@@ -1477,17 +1477,16 @@
 S);%0A%09%7D%0A%0A
-%0A
 %09public 

move the 'contained' test to the WorldArea object