Ejemplo n.º 1
0
 PointVisibilityCalculator(IEnumerable <Polyline> holes, VisibilityGraph visibilityGraph, Point point,
                           VisibilityKind visibilityKind)
 {
     this.holes = holes;
     //this.graphOfHoleBoundaries = holeBoundariesGraph;
     this.visibilityGraph = visibilityGraph;
     q = point;
     qPolylinePoint      = new PolylinePoint(q);
     QVertex             = this.visibilityGraph.AddVertex(qPolylinePoint);
     this.visibilityKind = visibilityKind;
     heapForSorting      = new BinaryHeapWithComparer <Stem>(new StemStartPointComparer(q));
 }
Ejemplo n.º 2
0
 public static VisibilityKind getByName(string name)
 {
     for (int i = 0; i < VALUES_ARRAY.Length; ++i)
     {
         VisibilityKind result = VALUES_ARRAY[i];
         if (result.getName() == name)
         {
             return(result);
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
 public static VisibilityKind get(string literal)
 {
     for (int i = 0; i < VALUES_ARRAY.Length; ++i)
     {
         VisibilityKind result = VALUES_ARRAY[i];
         if (result.ToString() == literal)
         {
             return(result);
         }
     }
     return(null);
 }
 internal static void CalculatePointVisibilityGraph(IEnumerable<Polyline> listOfHoles,
                                                    VisibilityGraph visibilityGraph, Point point,
                                        VisibilityKind visibilityKind, out VisibilityVertex qVertex) {
     //maybe there is nothing to do
     var qv = visibilityGraph.FindVertex(point);
     if (qv != null){
         qVertex = qv;
         return;
     }
         
     var calculator = new PointVisibilityCalculator(listOfHoles, visibilityGraph, point, visibilityKind);
     calculator.FillGraph();
     qVertex = calculator.QVertex;
     Debug.Assert(qVertex != null);
 }
Ejemplo n.º 5
0
 private string AddVisibility(VisibilityKind visib)
 {
     if (visib == VisibilityKind.Private)
     {
         return("-");
     }
     else if (visib == VisibilityKind.Protected)
     {
         return("~");
     }
     else if (visib == VisibilityKind.Public)
     {
         return("+");
     }
     return(null);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// We suppose that the holes are convex and oriented clockwis and are mutually disjoint
        /// </summary>
        /// <param name="listOfHoles"></param>
        /// <param name="visibilityGraph"></param>
        /// <param name="point">The point can belong to the boundary of one of the holes</param>
        /// <param name="visibilityKind">tangent or regural visibility</param>
        /// <param name="qVertex">the graph vertex corresponding to the pivot</param>
        /// <returns></returns>
        internal static VisibilityVertex CalculatePointVisibilityGraph(
            IEnumerable <Polyline> listOfHoles,
            VisibilityGraph visibilityGraph,
            Point point,
            VisibilityKind visibilityKind)
        {
            //maybe there is nothing to do
            var qv = visibilityGraph.FindVertex(point);

            if (qv != null)
            {
                return(qv);
            }

            var calculator = new PointVisibilityCalculator(listOfHoles, visibilityGraph, point, visibilityKind);

            calculator.FillGraph();
            return(calculator.QVertex);
        }
        internal static void CalculatePointVisibilityGraph(IEnumerable <Polyline> listOfHoles,
                                                           VisibilityGraph visibilityGraph, Point point,
                                                           VisibilityKind visibilityKind, out VisibilityVertex qVertex)
        {
            //maybe there is nothing to do
            var qv = visibilityGraph.FindVertex(point);

            if (qv != null)
            {
                qVertex = qv;
                return;
            }

            var calculator = new PointVisibilityCalculator(listOfHoles, visibilityGraph, point, visibilityKind);

            calculator.FillGraph();
            qVertex = calculator.QVertex;
            Debug.Assert(qVertex != null);
        }
 PointVisibilityCalculator(IEnumerable<Polyline> holes, VisibilityGraph visibilityGraph, Point point,
                           VisibilityKind visibilityKind) {
     this.holes = holes;
     //this.graphOfHoleBoundaries = holeBoundariesGraph;
     this.visibilityGraph = visibilityGraph;
     q = point;
     qPolylinePoint = new PolylinePoint(q);
     QVertex = this.visibilityGraph.AddVertex(qPolylinePoint);
     this.visibilityKind = visibilityKind;
     heapForSorting = new BinaryHeapWithComparer<Stem>(new StemStartPointComparer(q));
 }
Ejemplo n.º 9
0
 static VisibilityKind()
 {
     VALUES_ARRAY    = new VisibilityKind[4];
     NONE            = new VisibilityKind(0, "none", "none");
     VALUES_ARRAY[0] = NONE;
 }