Index: /trunk/tools/geometry_tools.py
===================================================================
--- /trunk/tools/geometry_tools.py	(revision 2568)
+++ /trunk/tools/geometry_tools.py	(revision 2569)
@@ -47,6 +47,8 @@
 ## Shapes/objects
 # buoy1: Function to draw a buoy as superposition of prism and section of ball
+# band_lighthouse: Function to plot a lighthouse with spiral bands
 # circ_sec: Function union of point A and B by a section of a circle
 # ellipse_polar: Function to determine an ellipse from its center and polar coordinates
+# green_buoy1: Function to draw a green mark buoy using buoy1
 # p_angle_triangle: Function to draw a triangle by an initial point and two 
 #   consecutive angles and the first length of face. The third angle and 2 and 3rd 
@@ -61,6 +63,8 @@
 # p_spiral: Function to provide a polygon of an Archimedean spiral
 # p_triangle: Function to provide the polygon of a triangle from its 3 vertices
-# band_lighthouse: Function to plot a lighthouse with spiral bands
-# green_buoy1: Function to draw a green mark buoy using buoy1
+# prefchannelport[A/B]_buoy1: Function to draw a preferred channel port system 
+#   [A/B] buoy using buoy1
+# prefchannelstarboard[A/B]_buoy1: Function to draw a preferred channel starboard 
+#   system [A/B] buoy using buoy1
 # red_buoy1: Function to draw a red mark buoy using buoy1
 # safewater_buoy1: Function to draw a safe water mark buoy using buoy1
@@ -2186,5 +2190,5 @@
     buoy = ma.masked_equal(buoy, gen.fillValueF)
 
-    buoysecs = ['buoy', 'sign', 'quarter1', 'quarter2', 'quarter3', 'quarter4']
+    buoysecs = ['buoy', 'sign']
     buoydic = {'buoy': [buoy[0:N2,:],'-','r',1.5],                                   \
       'sign': [buoy[N2+1:N2+N3+1,:],'-','r',1.5]}
@@ -2223,7 +2227,183 @@
     buoy = ma.masked_equal(buoy, gen.fillValueF)
 
-    buoysecs = ['buoy', 'sign', 'quarter1', 'quarter2', 'quarter3', 'quarter4']
+    buoysecs = ['buoy', 'sign']
     buoydic = {'buoy': [buoy[0:N2,:],'-','g',1.5],                                   \
       'sign': [buoy[N2+1:N2+N3+1,:],'-','g',1.5]}
+
+    return buoy, buoysecs, buoydic
+
+def prefchannelportA_buoy1(height=5., width=10., bradii=1.75, bfrac=0.8, hsigns=0.3, \
+  N=300):
+    """ Function to draw a preferred channel port system A buoy using buoy1
+      height: height of the prism (5., default) 
+      width: width of the prism (10., default)
+      bradii: radii of the ball (1.75, default)
+      bfrac: fraction of the ball above the prism (0.8, default)
+      hisgns: height of the signs [as reg. triangle] as percentage of the height 
+        (0.3, default)
+      N: total number of points of the buoy (300, default)
+    """
+    fname = 'prefchannelportA_buoy1'
+
+    buoy = np.ones((N,2), dtype=np.float)*gen.fillValueF
+
+    # buoy
+    N2 = int(N/2)
+    buoy1v, buoy1vsecs, buoy1vdic = buoy1(height=5., width=10., bradii=1.75,         \
+      bfrac=0.8, N=N2)
+    buoy[0:N2,:] = buoy1v
+
+    # signs
+    N3 = N - N2 - 1
+    lsign = height*hsigns*2.
+    
+    Height = np.max(buoy1v[:,0])
+    triu = p_angle_triangle(N=N3)
+    sign = triu*lsign
+    buoy[N2+1:N2+2+N3,:] = sign + [Height+0.2*lsign,-lsign/2.]
+
+    # painting it
+    Ncut, third1 = cut_ypolygon(buoy1v, yval=Height/3., keep='bottom')
+    Ncut, third2 = cut_between_ypolygon(buoy1v, yval1=Height/3., yval2=Height*2./3.)
+    Ncut, third3 = cut_ypolygon(buoy1v, yval=Height*2./3., keep='above')
+
+    buoy = ma.masked_equal(buoy, gen.fillValueF)
+
+    buoysecs = ['buoy', 'sign', 'third1', 'third2', 'third3']
+    buoydic = {'buoy': [buoy[0:N2,:],'-','r',1.5],                                   \
+      'sign': [buoy[N2+1:N2+N3+1,:],'-','g',1.5], 'third1': [third1,'-','g',1.5],    \
+      'third2': [third2,'-','r',1.5], 'third3': [third3,'-','g',1.5]}
+
+    return buoy, buoysecs, buoydic
+
+def prefchannelportB_buoy1(height=5., width=10., bradii=1.75, bfrac=0.8, hsigns=0.3, \
+  N=300):
+    """ Function to draw a preferred channel port system B buoy using buoy1
+      height: height of the prism (5., default) 
+      width: width of the prism (10., default)
+      bradii: radii of the ball (1.75, default)
+      bfrac: fraction of the ball above the prism (0.8, default)
+      hisgns: height of the signs [as reg. triangle] as percentage of the height 
+        (0.3, default)
+      N: total number of points of the buoy (300, default)
+    """
+    fname = 'prefchannelportB_buoy1'
+
+    buoy = np.ones((N,2), dtype=np.float)*gen.fillValueF
+
+    # buoy
+    N2 = int(N/2)
+    buoy1v, buoy1vsecs, buoy1vdic = buoy1(height=5., width=10., bradii=1.75,         \
+      bfrac=0.8, N=N2)
+    buoy[0:N2,:] = buoy1v
+
+    # signs
+    N3 = N - N2 - 1
+    lsign = height*hsigns*2.
+    
+    Height = np.max(buoy1v[:,0])
+    triu = p_angle_triangle(N=N3)
+    sign = triu*lsign
+    buoy[N2+1:N2+2+N3,:] = sign + [Height+0.2*lsign,-lsign/2.]
+
+    # painting it
+    Ncut, third1 = cut_ypolygon(buoy1v, yval=Height/3., keep='bottom')
+    Ncut, third2 = cut_between_ypolygon(buoy1v, yval1=Height/3., yval2=Height*2./3.)
+    Ncut, third3 = cut_ypolygon(buoy1v, yval=Height*2./3., keep='above')
+
+    buoy = ma.masked_equal(buoy, gen.fillValueF)
+
+    buoysecs = ['buoy', 'sign', 'third1', 'third2', 'third3']
+    buoydic = {'buoy': [buoy[0:N2,:],'-','r',1.5],                                   \
+      'sign': [buoy[N2+1:N2+N3+1,:],'-','r',1.5], 'third1': [third1,'-','r',1.5],    \
+      'third2': [third2,'-','g',1.5], 'third3': [third3,'-','r',1.5]}
+
+    return buoy, buoysecs, buoydic
+
+def prefchannelstarboardA_buoy1(height=5., width=10., bradii=1.75, bfrac=0.8,        \
+  hsigns=0.3, N=300):
+    """ Function to draw a preferred channel starboard system A buoy using buoy1
+      height: height of the prism (5., default) 
+      width: width of the prism (10., default)
+      bradii: radii of the ball (1.75, default)
+      bfrac: fraction of the ball above the prism (0.8, default)
+      hisgns: height of the signs [as reg. triangle] as percentage of the height 
+        (0.3, default)
+      N: total number of points of the buoy (300, default)
+    """
+    fname = 'prefchannelstarboardA_buoy1'
+
+    buoy = np.ones((N,2), dtype=np.float)*gen.fillValueF
+
+    # buoy
+    N2 = int(N/2)
+    buoy1v, buoy1vsecs, buoy1vdic = buoy1(height=5., width=10., bradii=1.75,         \
+      bfrac=0.8, N=N2)
+    buoy[0:N2,:] = buoy1v
+
+    # signs
+    N3 = N - N2 - 1
+    lsign = height*hsigns*2.
+    
+    Height = np.max(buoy1v[:,0])
+    sign = p_prism(lsign, lsign*2, N=N3)
+    buoy[N2+1:N2+2+N3,:] = sign + [Height+1.2*lsign,0.]
+
+    # painting it
+    # painting it
+    Ncut, third1 = cut_ypolygon(buoy1v, yval=Height/3., keep='bottom')
+    Ncut, third2 = cut_between_ypolygon(buoy1v, yval1=Height/3., yval2=Height*2./3.)
+    Ncut, third3 = cut_ypolygon(buoy1v, yval=Height*2./3., keep='above')
+
+    buoy = ma.masked_equal(buoy, gen.fillValueF)
+
+    buoysecs = ['buoy', 'sign']
+    buoydic = {'buoy': [buoy[0:N2,:],'-','g',1.5],                                   \
+      'sign': [buoy[N2+1:N2+N3+1,:],'-','r',1.5], 'third1': [third1,'-','r',1.5],    \
+      'third2': [third2,'-','g',1.5], 'third3': [third3,'-','r',1.5]}
+
+    return buoy, buoysecs, buoydic
+
+def prefchannelstarboardB_buoy1(height=5., width=10., bradii=1.75, bfrac=0.8,        \
+  hsigns=0.3, N=300):
+    """ Function to draw a preferred channel starboard system B buoy using buoy1
+      height: height of the prism (5., default) 
+      width: width of the prism (10., default)
+      bradii: radii of the ball (1.75, default)
+      bfrac: fraction of the ball above the prism (0.8, default)
+      hisgns: height of the signs [as reg. triangle] as percentage of the height 
+        (0.3, default)
+      N: total number of points of the buoy (300, default)
+    """
+    fname = 'prefchannelstarboardB_buoy1'
+
+    buoy = np.ones((N,2), dtype=np.float)*gen.fillValueF
+
+    # buoy
+    N2 = int(N/2)
+    buoy1v, buoy1vsecs, buoy1vdic = buoy1(height=5., width=10., bradii=1.75,         \
+      bfrac=0.8, N=N2)
+    buoy[0:N2,:] = buoy1v
+
+    # signs
+    N3 = N - N2 - 1
+    lsign = height*hsigns*2.
+    
+    Height = np.max(buoy1v[:,0])
+    sign = p_prism(lsign, lsign*2, N=N3)
+    buoy[N2+1:N2+2+N3,:] = sign + [Height+1.2*lsign,0.]
+
+    # painting it
+    # painting it
+    Ncut, third1 = cut_ypolygon(buoy1v, yval=Height/3., keep='bottom')
+    Ncut, third2 = cut_between_ypolygon(buoy1v, yval1=Height/3., yval2=Height*2./3.)
+    Ncut, third3 = cut_ypolygon(buoy1v, yval=Height*2./3., keep='above')
+
+    buoy = ma.masked_equal(buoy, gen.fillValueF)
+
+    buoysecs = ['buoy', 'sign']
+    buoydic = {'buoy': [buoy[0:N2,:],'-','g',1.5],                                   \
+      'sign': [buoy[N2+1:N2+N3+1,:],'-','g',1.5], 'third1': [third1,'-','g',1.5],    \
+      'third2': [third2,'-','r',1.5], 'third3': [third3,'-','g',1.5]}
 
     return buoy, buoysecs, buoydic
